mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(core): 公共点击事件在非浏览器环境不执行
This commit is contained in:
parent
46a26af5d6
commit
ec94eed787
@ -76,15 +76,19 @@ export default class EventHelper extends EventEmitter {
|
|||||||
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
|
if (app.jsEngine === 'browser') {
|
||||||
globalThis.document.body.addEventListener('click', this.commonClickEventHandler);
|
globalThis.document.body.addEventListener('click', this.commonClickEventHandler);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public destroy() {
|
public destroy() {
|
||||||
this.removeNodeEvents();
|
this.removeNodeEvents();
|
||||||
this.removeAllListeners();
|
this.removeAllListeners();
|
||||||
|
|
||||||
|
if (this.app.jsEngine === 'browser') {
|
||||||
globalThis.document.body.removeEventListener('click', this.commonClickEventHandler);
|
globalThis.document.body.removeEventListener('click', this.commonClickEventHandler);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bindNodeEvents(node: TMagicNode) {
|
public bindNodeEvents(node: TMagicNode) {
|
||||||
node.events?.forEach((event, index) => {
|
node.events?.forEach((event, index) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user