From 4d610853487fcd2a464f43c2da8a6faf1b2a95f7 Mon Sep 17 00:00:00 2001 From: Lucas Perais Date: Tue, 27 Jun 2023 09:11:32 +0000 Subject: [PATCH] [FIX] web_editor: wysiwyg coherent API Before this commit the function getContentEditableAreas passed in options was not correctly called. The OdooEditor which receives it too passes itself to it. This commit corrects the call in Wysiwyg to that function and passes the odooEditor instance Part-of: odoo/odoo#126963 --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 19c6852d6b4..c5f0c8861db 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -342,7 +342,7 @@ const Wysiwyg = Widget.extend({ window.addEventListener('beforeunload', this._onBeforeUnload); } if (this.options.getContentEditableAreas) { - $(this.options.getContentEditableAreas()).find('*').off('mousedown mouseup click'); + $(this.options.getContentEditableAreas(this.odooEditor)).find('*').off('mousedown mouseup click'); } // The toolbar must be configured after the snippetMenu is loaded @@ -735,7 +735,7 @@ const Wysiwyg = Widget.extend({ $body.off('mousemove', this.resizerMousemove); $body.off('mouseup', this.resizerMouseup); const $wrapwrap = $('#wrapwrap'); - if ($wrapwrap.length) { + if ($wrapwrap.length && this.odooEditor) { $('#wrapwrap')[0].removeEventListener('scroll', this.odooEditor.multiselectionRefresh, { passive: true }); } $(this.$root).off('click'); @@ -901,7 +901,7 @@ const Wysiwyg = Widget.extend({ this.savingContent = true; await this.cleanForSave(); - const editables = this.options.getContentEditableAreas(); + const editables = "getContentEditableAreas" in this.options ? this.options.getContentEditableAreas(this.odooEditor) : []; await this.savePendingImages(editables.length ? $(editables) : this.$editable); await this._saveViewBlocks(); this.savingContent = false;