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