mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 01:48:18 +00:00
Merge branch 'fix/hotkey' into 'release/0.9.1'
fix: 增加try catch See merge request !911457
This commit is contained in:
commit
8a701c0c0d
@ -328,23 +328,27 @@ function getKeyInfo(combination: string, action?: string): KeyInfo {
|
|||||||
* convention - prevent default and stop propogation on the event
|
* convention - prevent default and stop propogation on the event
|
||||||
*/
|
*/
|
||||||
function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
|
function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
|
||||||
const editor = globalContext.get(Editor);
|
try {
|
||||||
const designer = editor.get('designer');
|
const editor = globalContext.get(Editor);
|
||||||
const node = designer?.currentSelection?.getNodes()?.[0];
|
const designer = editor.get('designer');
|
||||||
const npm = node?.componentMeta?.npm;
|
const node = designer?.currentSelection?.getNodes()?.[0];
|
||||||
const selected =
|
const npm = node?.componentMeta?.npm;
|
||||||
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || '';
|
const selected =
|
||||||
if (callback(e, combo) === false) {
|
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || '';
|
||||||
e.preventDefault();
|
if (callback(e, combo) === false) {
|
||||||
e.stopPropagation();
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
editor?.emit('hotkey.callback.call', {
|
||||||
|
callback,
|
||||||
|
e,
|
||||||
|
combo,
|
||||||
|
sequence,
|
||||||
|
selected,
|
||||||
|
});
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err.message);
|
||||||
}
|
}
|
||||||
editor?.emit('hotkey.callback.call', {
|
|
||||||
callback,
|
|
||||||
e,
|
|
||||||
combo,
|
|
||||||
sequence,
|
|
||||||
selected,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Hotkey {
|
export class Hotkey {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user