diff options
| author | Samuel Degueldre <sad@odoo.com> | 2021-01-11 11:12:48 +0000 |
|---|---|---|
| committer | Samuel Degueldre <sad@odoo.com> | 2021-01-12 12:52:33 +0000 |
| commit | 9dd7e037239ff7b124d36f176fe4c66091e2cc4e (patch) | |
| tree | 173422d81d32d4dc4b0386e52e447be62c3fb099 | |
| parent | ddd10ad9bbef0005c2c518884c4b753c9042382e (diff) | |
[FIX] web_editor: fix steps snippet line removed when change icon bg-col
Previously, when changing the background-color of an icon in the
s_process_steps snippet, the line that goes through the snippet would
disappear from that block. This was caused by our font-application code
attempting to remove extraneous DOM nodes when changing a font color or
backrgound-color, but not considering elements with a ::before or
::after pseudoelement has having content, and subsequently removing
them.
opw-2423785
closes odoo/odoo#64404
X-original-commit: 6b363d202d9c35e8249f7bb2b0730b995fdf4a7d
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
| -rw-r--r-- | addons/web_editor/static/src/js/editor/summernote.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js index 290918a9563..3b49d1d8b4b 100644 --- a/addons/web_editor/static/src/js/editor/summernote.js +++ b/addons/web_editor/static/src/js/editor/summernote.js @@ -2261,7 +2261,8 @@ $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color } // remove node without attributes (move content), and merge the same nodes - var className2, style, style2; + var className2, style, style2, hasBefore, hasAfter; + var noContent = ['none', null, undefined]; for (i=0; i<nodes.length; i++) { node = nodes[i]; @@ -2280,8 +2281,10 @@ $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color $font = $(node); className = dom.orderClass(node); style = dom.orderStyle(node); + hasBefore = noContent.indexOf(window.getComputedStyle(node, '::before').content) === -1; + hasAfter = noContent.indexOf(window.getComputedStyle(node, '::after').content) === -1; - if (!className && !style) { + if (!className && !style && !hasBefore && !hasAfter) { remove(node, node.parentNode); continue; } |
