From 9826d59cbeae031d78b85b0ec76ec13686b66197 Mon Sep 17 00:00:00 2001 From: Mathieu Walravens Date: Fri, 28 Jul 2023 15:54:25 +0000 Subject: [PATCH] [FIX] web_editor: getScrollOptions not initialized in translations Steps to reproduce: 1. Go to a blog post 2. Add a header 3. Hide the element on desktop and save 4. Click the button to translate the page When translating a page, `getScrollOptions` is not initialized, which throws an error when updating invisible DOM, as it could require the function to be loaded. This is because `_updateInvisibleDOM` needs this property to be set. Similar fix: https://github.com/odoo/odoo/commit/62cc16dae74729a805a08f17db8ba75d9c51d096 opw-3430581 closes odoo/odoo#133100 X-original-commit: 233cc3439799d2ecc7342c5f02176cef394e08a7 Signed-off-by: Romain Derie (rde) Signed-off-by: Walravens Mathieu (wama) --- addons/web_editor/static/src/js/editor/snippets.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 9af38adb04d..de5845ad45c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1815,6 +1815,7 @@ var SnippetsMenu = Widget.extend({ id: 'oe_manipulators', }); this.$body.prepend(this.$snippetEditorArea); + this.options.getScrollOptions = this._getScrollOptions.bind(this); // Add tooltips on we-title elements whose text overflows and on all // elements with available tooltip text. Note that the tooltips of the @@ -1863,7 +1864,6 @@ var SnippetsMenu = Widget.extend({ this.emptyOptionsTabContent = document.createElement('div'); this.emptyOptionsTabContent.classList.add('text-center', 'pt-5'); this.emptyOptionsTabContent.append(_t("Select a block on your page to style it.")); - this.options.getScrollOptions = this._getScrollOptions.bind(this); // Fetch snippet templates and compute it defs.push((async () => {