mirror of https://github.com/vector-im/riot-web
Better handling space shortcuts
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/17780/head
parent
76d9f26a16
commit
f8da8254ce
|
@ -575,9 +575,9 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
onKeyDown(ev: KeyboardEvent): boolean {
|
onKeyDown(ev: KeyboardEvent): boolean {
|
||||||
let handled = false;
|
let handled = false;
|
||||||
|
|
||||||
switch (ev.code) {
|
switch (ev.key) {
|
||||||
case "BracketLeft":
|
case Key.SQUARE_BRACKET_LEFT:
|
||||||
case "BracketRight":
|
case Key.SQUARE_BRACKET_RIGHT:
|
||||||
if (isMac && ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey) {
|
if (isMac && ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey) {
|
||||||
this.navigateForwardBack(ev.key === Key.SQUARE_BRACKET_LEFT);
|
this.navigateForwardBack(ev.key === Key.SQUARE_BRACKET_LEFT);
|
||||||
handled = true;
|
handled = true;
|
||||||
|
@ -591,23 +591,17 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "Digit1":
|
if (
|
||||||
case "Digit2":
|
!handled &&
|
||||||
case "Digit3":
|
SettingsStore.getValue("feature_spaces") &&
|
||||||
case "Digit4":
|
ev.code.startsWith("Digit") &&
|
||||||
case "Digit5":
|
isOnlyCtrlOrCmdKeyEvent(ev)
|
||||||
case "Digit6":
|
) {
|
||||||
case "Digit7":
|
const spaceNumber = ev.code.slice(5); // Cut off the first 5 characters - "Digit"
|
||||||
case "Digit8":
|
this.navigateToSpace(parseInt(spaceNumber, 10));
|
||||||
case "Digit9":
|
handled = true;
|
||||||
case "Digit0":
|
|
||||||
if (SettingsStore.getValue("feature_spaces") && isOnlyCtrlOrCmdKeyEvent(ev)) {
|
|
||||||
const spaceNumber = ev.code.slice(5); // Cut off the first 5 characters - "Digit"
|
|
||||||
this.navigateToSpace(parseInt(spaceNumber, 10));
|
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
|
|
Loading…
Reference in New Issue