From 9397d5896d24dd8f65eca9d35d7c9d5fb044badf Mon Sep 17 00:00:00 2001 From: nd0ut Date: Mon, 29 May 2023 15:14:11 +0300 Subject: [PATCH] fix(cloud-editor): double init --- blocks/CloudImageEditor/src/CloudEditor.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/blocks/CloudImageEditor/src/CloudEditor.js b/blocks/CloudImageEditor/src/CloudEditor.js index e2e5723f4..791f6c7dc 100644 --- a/blocks/CloudImageEditor/src/CloudEditor.js +++ b/blocks/CloudImageEditor/src/CloudEditor.js @@ -62,11 +62,18 @@ export class CloudEditor extends ShadowWrapper { }; shadowReadyCallback() { - this.initEditor(); + if (this.renderShadow) { + this.initEditor(); + } } initCallback() { super.initCallback(); + + this.$['*faderEl'] = this.ref['fader-el']; + this.$['*cropperEl'] = this.ref['cropper-el']; + this.$['*imgContainerEl'] = this.ref['img-container-el']; + if (!this.renderShadow) { this.initEditor(); } @@ -82,10 +89,6 @@ export class CloudEditor extends ShadowWrapper { return; } - this.$['*faderEl'] = this.ref['fader-el']; - this.$['*cropperEl'] = this.ref['cropper-el']; - this.$['*imgContainerEl'] = this.ref['img-container-el']; - this.ref['img-el'].addEventListener('load', (e) => { this._imgLoading = false; this._debouncedShowLoader(false); @@ -116,10 +119,6 @@ export class CloudEditor extends ShadowWrapper { image_hidden_effects: tabId !== TabId.CROP, }); }); - } - - initCallback() { - super.initCallback(); if (this.$.cdnUrl) { let uuid = extractUuid(this.$.cdnUrl);