mirror of
https://github.com/chinchang/web-maker.git
synced 2025-02-22 06:03:22 +01:00
app: use F1 for opening command palette on Firefox. fixes #385
This commit is contained in:
parent
a31de0f94a
commit
f53177f7d2
@ -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.
|
// we don't want this to trigger which in turn focuses back the last editor.
|
||||||
this.closeSavedItemsPane();
|
this.closeSavedItemsPane();
|
||||||
} else if ((event.ctrlKey || event.metaKey) && event.keyCode === 80) {
|
} 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({
|
this.setState({
|
||||||
isCommandPaletteOpen: true,
|
isCommandPaletteOpen: true,
|
||||||
isCommandPaletteInCommandMode: !!event.shiftKey
|
isCommandPaletteInCommandMode: !!event.shiftKey
|
||||||
@ -579,6 +583,15 @@ export default class App extends Component {
|
|||||||
!!event.shiftKey ? 'command' : 'files'
|
!!event.shiftKey ? 'command' : 'files'
|
||||||
);
|
);
|
||||||
event.preventDefault();
|
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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user