diff --git a/addons/web_editor/static/lib/odoo-editor/src/commands/shiftTab.js b/addons/web_editor/static/lib/odoo-editor/src/commands/shiftTab.js index 9d0e6d33ead..1a9f9408643 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/commands/shiftTab.js +++ b/addons/web_editor/static/lib/odoo-editor/src/commands/shiftTab.js @@ -49,6 +49,7 @@ HTMLLIElement.prototype.oShiftTab = function () { return li; } else { const ul = li.parentNode; + const dir = ul.getAttribute('dir'); let p; while (li.firstChild) { if (isBlock(li.firstChild)) { @@ -56,6 +57,10 @@ HTMLLIElement.prototype.oShiftTab = function () { ul.after(li.firstChild); } else { p = p || document.createElement('P'); + if (dir) { + p.setAttribute('dir', dir); + p.style.setProperty('text-align', ul.style.getPropertyValue('text-align')); + } p.append(li.firstChild); } } diff --git a/addons/web_editor/static/lib/odoo-editor/src/commands/toggleList.js b/addons/web_editor/static/lib/odoo-editor/src/commands/toggleList.js index c1417ccb5c1..63cbbea2752 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/commands/toggleList.js +++ b/addons/web_editor/static/lib/odoo-editor/src/commands/toggleList.js @@ -30,6 +30,9 @@ HTMLElement.prototype.oToggleList = function (offset, mode = 'UL') { restoreCursor(); } else { const list = insertListAfter(this, mode, [this]); + for (const attribute of this.attributes) { + list.setAttribute(attribute.name, attribute.value); + } restoreCursor(new Map([[this, list.firstElementChild]])); } }; @@ -37,6 +40,9 @@ 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]]); + for (const attribute of this.attributes) { + list.setAttribute(attribute.name, attribute.value); + } this.remove(); restoreCursor(new Map([[this, list.firstChild]]));