From 6a35f242a7d2e9da7a5746e69fc547a1dca1449a Mon Sep 17 00:00:00 2001 From: dhba-odoo Date: Wed, 12 Jul 2023 09:29:26 +0000 Subject: [PATCH] [FIX] web_editor: color pallete flicker Before this commit: After applying formatting styles to text that already has some color applied to it, we encountered an issue where the color pallete would flicker when attempting to change the color. After this commit: Now, the color palette will no longer flicker when trying to change the color of text that has formatting styles applied to it. task-3417998 closes odoo/odoo#132561 X-original-commit: 7a9977882b0e9222beba7de23f026de937a60a4d Signed-off-by: David Monjoie (dmo) --- .../static/src/js/editor/odoo-editor/src/utils/utils.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index adac7549470..1d131757570 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -1292,11 +1292,9 @@ export function isFontSize(node, props) { * @returns {boolean} */ export function isSelectionFormat(editable, format) { - const selectedNodes = getSelectedNodes(editable) + const selectedNodes = getTraversedNodes(editable) .filter(n => n.nodeType === Node.TEXT_NODE && n.nodeValue.trim().length); const isFormatted = formatsSpecs[format].isFormatted; - selectedNodes.push(closestElement(editable.ownerDocument.getSelection().anchorNode)); - selectedNodes.push(closestElement(editable.ownerDocument.getSelection().focusNode)); return selectedNodes.every(n => isFormatted(n, editable)); }