From 9b05ac61772f17b4027e0994a3fadc3f1c3ddd6e Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 17 Sep 2021 15:39:35 +0200 Subject: [PATCH] Prevent custom trigger without container --- docs/modules/Assets.md | 2 +- src/asset_manager/index.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/modules/Assets.md b/docs/modules/Assets.md index 6e07f6d20..fa3f36e8f 100644 --- a/docs/modules/Assets.md +++ b/docs/modules/Assets.md @@ -337,7 +337,7 @@ editor.on('asset:custom', props => { // props.close (Function) - A callback to close the Asset Manager // props.remove (Function) - A callback to remove an asset // props.select (Function) - A callback to select an asset - // props.container (HTMLElement) - The element where you can append your UI + // props.container (HTMLElement) - The element where you should append your UI // Here you would put the logic to render/update your UI. }); diff --git a/src/asset_manager/index.js b/src/asset_manager/index.js index a943f38d0..f22d763df 100644 --- a/src/asset_manager/index.js +++ b/src/asset_manager/index.js @@ -119,6 +119,9 @@ export default () => { __trgCustom: debounce(function() { const bhv = this.__getBehaviour(); + if (!bhv.container && !this.getConfig('custom').open) { + return; + } this.em.trigger(this.events.custom, { am: this, open: this.isOpen(),