1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-05-09 11:56:31 +02:00

add keyboard sh0rtcuts command

This commit is contained in:
Kushagra Gour 2018-10-30 01:05:08 +05:30
parent ae85bfb474
commit 23a1df7dfd
2 changed files with 17 additions and 4 deletions

View File

@ -3,6 +3,7 @@ export const NEW_CREATION_EVENT = 'newCreationEvent';
export const OPEN_SAVED_CREATIONS_EVENT = 'openSavedCreationsEvent';
export const SAVE_EVENT = 'saveEvent';
export const OPEN_SETTINGS_EVENT = 'openSettingsEvent';
export const SHOW_KEYBOARD_SHORTCUTS_EVENT = 'showKeyboardShortcutsEvent';
export const commands = [
{
@ -24,5 +25,10 @@ export const commands = [
name: 'Open Settings',
event: OPEN_SETTINGS_EVENT,
keyboardShortcut: ''
},
{
name: 'Show Keyboard Shortcuts',
event: SHOW_KEYBOARD_SHORTCUTS_EVENT,
keyboardShortcut: ''
}
];

View File

@ -60,7 +60,8 @@ import {
OPEN_SAVED_CREATIONS_EVENT,
SAVE_EVENT,
OPEN_SETTINGS_EVENT,
NEW_CREATION_EVENT
NEW_CREATION_EVENT,
SHOW_KEYBOARD_SHORTCUTS_EVENT
} from '../commands';
import { commandPaletteService } from '../commandPaletteService';
@ -503,6 +504,9 @@ export default class App extends Component {
openSettings() {
this.setState({ isSettingsModalOpen: true });
}
openKeyboardShortcuts() {
this.setState({ isKeyboardShortcutsModalOpen: true });
}
componentDidMount() {
function setBodySize() {
@ -584,6 +588,9 @@ export default class App extends Component {
},
[OPEN_SETTINGS_EVENT]: () => {
this.openSettings();
},
[SHOW_KEYBOARD_SHORTCUTS_EVENT]: () => {
this.openKeyboardShortcuts();
}
};
for (let eventName in commandPalleteHooks) {
@ -1455,9 +1462,9 @@ export default class App extends Component {
)}
codepenBtnClickHandler={this.codepenBtnClickHandler.bind(this)}
saveHtmlBtnClickHandler={this.saveHtmlBtnClickHandler.bind(this)}
keyboardShortcutsBtnClickHandler={() =>
this.setState({ isKeyboardShortcutsModalOpen: true })
}
keyboardShortcutsBtnClickHandler={this.openKeyboardShortcuts.bind(
this
)}
screenshotBtnClickHandler={this.screenshotBtnClickHandler.bind(
this
)}