diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js index 836212b85b4..ef0957787c8 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js @@ -588,13 +588,15 @@ export const editorCommands = { return font; }); // Color the selected s and remove uncolored fonts. - for (const font of new Set(fonts)) { + const fontsSet = new Set(fonts); + for (const font of fontsSet) { colorElement(font, color, mode); if (!hasColor(font, mode) && !font.hasAttribute('style')) { for (const child of [...font.childNodes]) { font.parentNode.insertBefore(child, font); } font.parentNode.removeChild(font); + fontsSet.delete(font); } } restoreCursor(); @@ -606,7 +608,7 @@ export const editorCommands = { newSelection.removeAllRanges(); newSelection.addRange(range); } - return [...fonts, ...coloredTds]; + return [...fontsSet, ...coloredTds]; }, // Table insertTable: (editor, { rowNumber = 2, colNumber = 2 } = {}) => {