[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) <rde@odoo.com>
Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com>
This commit is contained in:
Mathieu Walravens
2023-08-24 23:40:12 +02:00
parent 1bc197b380
commit 9826d59cbe
@@ -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 () => {