1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-02-19 20:55:55 +01:00

app: use F1 for opening command palette on Firefox. fixes #385

This commit is contained in:
Kushagra Gour 2019-06-06 00:24:58 +05:30
parent a31de0f94a
commit f53177f7d2

View File

@ -569,6 +569,10 @@ export default class App extends Component {
// we don't want this to trigger which in turn focuses back the last editor.
this.closeSavedItemsPane();
} else if ((event.ctrlKey || event.metaKey) && event.keyCode === 80) {
// cmd+shift+P and this is Firefox, do nothing
if (event.shiftKey && navigator.userAgent.match(/Firefox/)) {
return true;
}
this.setState({
isCommandPaletteOpen: true,
isCommandPaletteInCommandMode: !!event.shiftKey
@ -579,6 +583,15 @@ export default class App extends Component {
!!event.shiftKey ? 'command' : 'files'
);
event.preventDefault();
} else if (event.key === 'F1' && navigator.userAgent.match(/Firefox/)) {
// On firefox, open command palette with F1 because Cmd+Shift+P
// is for opening private window
this.setState({
isCommandPaletteOpen: true,
isCommandPaletteInCommandMode: true
});
trackEvent('ui', 'openCommandPaletteKeyboardShortcut', 'command');
event.preventDefault();
}
});