[FIX] web_editor: restore rules cache

This commit restores the cache on the document that was lost with the
new parsing system [1]. It allows for faster convertion to inline styles
after the first time on the same document.

[1] https://github.com/odoo/odoo/commit/10e749537186dfb80aee1f2537f3b5804f66cfe5#diff-5922d38ff6520249ff5b3a3240eebc350c6f9f4d9f486d512128c23261c45841L19

closes odoo/odoo#83139

X-original-commit: 0ee96727793cfa64c9cdb9f3ef3b7e6b1ef1f631
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2022-01-24 07:41:52 +00:00
parent ad368da483
commit f02b15dcc2
@@ -336,8 +336,11 @@ function classToStyle($editable, cssRules) {
* specificity: number;}>
*/
function toInline($editable, cssRules) {
const doc = $editable[0].ownerDocument;
cssRules = cssRules || doc._rulesCache;
if (!cssRules) {
cssRules = getCSSRules($editable[0].ownerDocument);
cssRules = getCSSRules(doc);
doc._rulesCache = cssRules;
}
// Fix outlook image rendering bug (this change will be kept in both