diff options
-rw-r--r-- | app/features/settings/components/SettingsButton.js | 26 | ||||
-rw-r--r-- | package-lock.json | 5 | ||||
-rw-r--r-- | package.json | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/app/features/settings/components/SettingsButton.js b/app/features/settings/components/SettingsButton.js index 6d030cc..aee13c2 100644 --- a/app/features/settings/components/SettingsButton.js +++ b/app/features/settings/components/SettingsButton.js @@ -2,6 +2,9 @@ import SettingsIcon from '@atlaskit/icon/glyph/settings'; +import * as Mousetrap from 'mousetrap'; +import 'mousetrap/plugins/global-bind/mousetrap-global-bind'; + import React, { Component } from 'react'; import { connect } from 'react-redux'; import type { Dispatch } from 'redux'; @@ -19,6 +22,11 @@ type Props = { }; /** + * Shortcut keys by which the drawer will open. + */ +const drawerShortcut = [ 'command+,', 'ctrl+shift+s' ]; + +/** * Setttings button for Navigation Bar. */ class SettingButton extends Component<Props, *> { @@ -34,6 +42,24 @@ class SettingButton extends Component<Props, *> { } /** + * Bind shortcut when the component did mount. + * + * @returns {void} + */ + componentDidMount() { + Mousetrap.bindGlobal(drawerShortcut, this._onIconClick); + } + + /** + * Bind shortcut when the component before unmount. + * + * @returns {void} + */ + componentWillUnmount() { + Mousetrap.unbind(drawerShortcut); + } + + /** * Render function of component. * * @returns {ReactElement} diff --git a/package-lock.json b/package-lock.json index 85d5142..5718f48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8461,6 +8461,11 @@ } } }, + "mousetrap": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/mousetrap/-/mousetrap-1.6.2.tgz", + "integrity": "sha512-jDjhi7wlHwdO6q6DS7YRmSHcuI+RVxadBkLt3KHrhd3C2b+w5pKefg3oj5beTcHZyVFA9Aksf+yEE1y5jxUjVA==" + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", diff --git a/package.json b/package.json index c05a5b0..fad0d00 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "history": "4.7.2", "jitsi-meet-electron-utils": "github:jitsi/jitsi-meet-electron-utils#1972c3bf0884ace68eb496894dabae593d6dbf49", "js-md5": "0.7.3", + "mousetrap": "1.6.2", "react": "16.3.2", "react-dom": "16.3.2", "react-redux": "5.0.7", |