fix: 增加try catch

This commit is contained in:
wuyue.xht 2020-07-28 20:24:05 +08:00
parent 26c307ec7b
commit 6f5d11cf77

View File

@ -328,6 +328,7 @@ function getKeyInfo(combination: string, action?: string): KeyInfo {
* convention - prevent default and stop propogation on the event
*/
function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
try {
const editor = globalContext.get(Editor);
const designer = editor.get('designer');
const node = designer?.currentSelection?.getNodes()?.[0];
@ -345,6 +346,9 @@ function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string
sequence,
selected,
});
} catch(err) {
console.error(err.message);
}
}
export class Hotkey {