mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 01:37:17 +00:00
fix: 修复兼容报错
This commit is contained in:
parent
080102db5b
commit
c88dfda955
@ -368,10 +368,16 @@ export class Hotkey {
|
|||||||
|
|
||||||
private nextExpectedAction: boolean | string = false;
|
private nextExpectedAction: boolean | string = false;
|
||||||
|
|
||||||
|
private isActivate = true;
|
||||||
|
|
||||||
constructor(readonly name: string = 'unknown') {
|
constructor(readonly name: string = 'unknown') {
|
||||||
this.mount(window);
|
this.mount(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activate(activate: boolean): void {
|
||||||
|
this.isActivate = activate;
|
||||||
|
}
|
||||||
|
|
||||||
mount(window: Window) {
|
mount(window: Window) {
|
||||||
const { document } = window;
|
const { document } = window;
|
||||||
const handleKeyEvent = this.handleKeyEvent.bind(this);
|
const handleKeyEvent = this.handleKeyEvent.bind(this);
|
||||||
@ -546,6 +552,9 @@ export class Hotkey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleKeyEvent(e: KeyboardEvent): void {
|
private handleKeyEvent(e: KeyboardEvent): void {
|
||||||
|
if (!this.isActivate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const character = characterFromEvent(e);
|
const character = characterFromEvent(e);
|
||||||
|
|
||||||
// no character found then stop
|
// no character found then stop
|
||||||
|
|||||||
@ -80,7 +80,6 @@ export class BasicContext {
|
|||||||
editor.set('material', material);
|
editor.set('material', material);
|
||||||
editor.set('hotkey', hotkey);
|
editor.set('hotkey', hotkey);
|
||||||
editor.set('innerHotkey', innerHotkey);
|
editor.set('innerHotkey', innerHotkey);
|
||||||
innerHotkey.mount(window);
|
|
||||||
this.innerSetters = innerSetters;
|
this.innerSetters = innerSetters;
|
||||||
this.innerSkeleton = innerSkeleton;
|
this.innerSkeleton = innerSkeleton;
|
||||||
this.skeleton = skeleton;
|
this.skeleton = skeleton;
|
||||||
|
|||||||
@ -16,6 +16,7 @@ export class Context extends BasicContext {
|
|||||||
|
|
||||||
setActivate = (_activate: boolean) => {
|
setActivate = (_activate: boolean) => {
|
||||||
this._activate = _activate;
|
this._activate = _activate;
|
||||||
|
this.innerHotkey.activate(this._activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
get active() {
|
get active() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user