[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) <dmo@odoo.com>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user