From 171ae90cd04df2d000cf521f7f3cd67aff38530e Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Thu, 20 Jan 2022 09:35:31 +0000 Subject: [PATCH] [FIX] web_editor, mass_mailing: speed up opening of field html inline On opening field html with the inline styles option we were parsing all the css in the page. This should only be needed when we save. This commit moves the call to `getCSSRules`back to `commitChanges`. closes odoo/odoo#83131 X-original-commit: 0d4342317d456ed37f0bf24f00538ef54f847e60 Signed-off-by: David Monjoie (dmo) --- addons/mass_mailing/static/src/js/mass_mailing_widget.js | 4 ---- addons/web_editor/static/src/js/backend/convert_inline.js | 8 -------- 2 files changed, 12 deletions(-) diff --git a/addons/mass_mailing/static/src/js/mass_mailing_widget.js b/addons/mass_mailing/static/src/js/mass_mailing_widget.js index 818d08d2970..789f15a8fda 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_widget.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_widget.js @@ -115,10 +115,6 @@ var MassMailingFieldHtml = FieldHtml.extend({ this.$content.find('.o_layout').addBack().data('name', 'Mailing'); // We don't want to drop snippets directly within the wysiwyg. this.$content.removeClass('o_editable'); - // Force compute CSS rules even without the style-inline node option. - if (this.mode === 'edit' && !this.cssRules) { - this.cssRules = convertInline.getCSSRules(this.wysiwyg.getEditable()[0].ownerDocument); - } }, /** * Returns true if the editable area is empty. diff --git a/addons/web_editor/static/src/js/backend/convert_inline.js b/addons/web_editor/static/src/js/backend/convert_inline.js index 8416e43316b..707a673b97a 100644 --- a/addons/web_editor/static/src/js/backend/convert_inline.js +++ b/addons/web_editor/static/src/js/backend/convert_inline.js @@ -955,14 +955,6 @@ FieldHtml.include({ // Public //-------------------------------------------------------------------------- - _createWysiwygIntance: function () { - return this._super(...arguments).then(() => { - if (this.nodeOptions['style-inline'] && this.mode === "edit") { - this.cssRules = getCSSRules(this.wysiwyg.getEditable()[0].ownerDocument); - } - }); - }, - /** * @override */