From 7e996cb91c9d6af8bfffd1782b51c6bff75075da Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 11 Apr 2020 18:57:59 +0100 Subject: [PATCH] Add riot-desktop shortcuts for forward/back matching browsers&slack Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/BasePlatform.js | 4 ++++ src/Keyboard.ts | 2 ++ src/components/structures/LoggedInView.js | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/src/BasePlatform.js b/src/BasePlatform.js index 5d809eb28f..7214031586 100644 --- a/src/BasePlatform.js +++ b/src/BasePlatform.js @@ -188,4 +188,8 @@ export default class BasePlatform { const callbackUrl = this.getSSOCallbackUrl(mxClient.getHomeserverUrl(), mxClient.getIdentityServerUrl()); window.location.href = mxClient.getSsoLoginUrl(callbackUrl.toString(), loginType); // redirect to SSO } + + onKeyDown(ev: KeyboardEvent): boolean { + return false; // no shortcuts implemented + } } diff --git a/src/Keyboard.ts b/src/Keyboard.ts index 23e2bbf0d6..7040898872 100644 --- a/src/Keyboard.ts +++ b/src/Keyboard.ts @@ -43,6 +43,8 @@ export const Key = { BACKTICK: "`", SPACE: " ", SLASH: "/", + SQUARE_BRACKET_LEFT: "[", + SQUARE_BRACKET_RIGHT: "]", A: "a", B: "b", C: "c", diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index d9980aeca6..fe59a6a8f1 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -40,6 +40,7 @@ import {Resizer, CollapseDistributor} from '../../resizer'; import MatrixClientContext from "../../contexts/MatrixClientContext"; import * as KeyboardShortcuts from "../../accessibility/KeyboardShortcuts"; import HomePage from "./HomePage"; +import PlatformPeg from "../../PlatformPeg"; // We need to fetch each pinned message individually (if we don't already have it) // so each pinned message may trigger a request. Limit the number per room for sanity. // NB. this is just for server notices rather than pinned messages in general. @@ -407,6 +408,11 @@ const LoggedInView = createReactClass({ }); handled = true; } + break; + + default: + // if we do not have a handler for it, pass it to the platform which might + handled = PlatformPeg.get().onKeyDown(ev); } if (handled) {