From d3d4443e1335e78bcab344a38087cc147b62d0b2 Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Mon, 22 Aug 2022 14:58:28 +0000 Subject: [PATCH] [FIX] web_editor: always apply checklist class on convert p to checklist When converting a paragraph to a checklist, we first apply the checklist class and then take the paragraph's attributes and apply it to the new list. If said attributes included the "class" attribute, it wrote over the checklist class. Part-of: odoo/odoo#92200 --- .../src/js/editor/odoo-editor/src/commands/toggleList.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/toggleList.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/toggleList.js index 63cbbea2752..a82ed5b9607 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/toggleList.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/toggleList.js @@ -40,9 +40,13 @@ HTMLElement.prototype.oToggleList = function (offset, mode = 'UL') { HTMLParagraphElement.prototype.oToggleList = function (offset, mode = 'UL') { const restoreCursor = preserveCursor(this.ownerDocument); const list = insertListAfter(this, mode, [[...this.childNodes]]); + const classList = [...list.classList]; for (const attribute of this.attributes) { list.setAttribute(attribute.name, attribute.value); } + for (const className of classList) { + list.classList.toggle(className, true); // restore list classes + } this.remove(); restoreCursor(new Map([[this, list.firstChild]]));