[FIX] web_editor: fix css rules computing everywhere

X-original-commit: bf9928d28818324c85318968a235d238398bca68
Part-of: odoo/odoo#81540
This commit is contained in:
David Monjoie
2021-12-16 15:58:24 +00:00
committed by Antoine Guenet
parent 096c3ab82f
commit 8b1012a79d
2 changed files with 7 additions and 1 deletions
@@ -115,6 +115,10 @@ 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.
@@ -955,7 +955,9 @@ FieldHtml.include({
_createWysiwygIntance: function () {
return this._super(...arguments).then(() => {
this.cssRules = getCSSRules(this.wysiwyg.getEditable()[0].ownerDocument);
if (this.nodeOptions['style-inline'] && this.mode === "edit") {
this.cssRules = getCSSRules(this.wysiwyg.getEditable()[0].ownerDocument);
}
});
},