From 7b95f5c8a7ec8dfd68c102e998a2324e3974d1aa Mon Sep 17 00:00:00 2001 From: Deependra Solanki Date: Fri, 10 Nov 2023 12:04:02 +0530 Subject: [PATCH] [FIX] web_editor: remove redundant code from setTagName Commit [1] implemented an approach for changing style of a list item to normal. It no longer wrapped the content in a

to remove extra spacing to next list item. Later commit [2] was introduced which did the same thing but in sanatize. Hence the code added in commit [1] is no longer needed. This commit removes the redundant code from `setTagName`. [1]: 03a134c [2]: 324e138 closes odoo/odoo#141812 X-original-commit: bd1e432dc29be0dec6e52b142d9fb712335209b6 Signed-off-by: Antoine Guenet (age) --- .../static/src/js/editor/odoo-editor/src/utils/utils.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index 8a0bcdf24f7..0df11e86dea 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -2084,11 +2084,8 @@ export function setTagName(el, newTagName) { while (el.firstChild) { n.append(el.firstChild); } - const closestLi = el.closest('li'); - if (el.tagName === 'LI' && newTagName !== 'p') { + if (el.tagName === 'LI') { el.append(n); - } else if (closestLi && newTagName === 'p') { - closestLi.replaceChildren(...n.childNodes); } else { el.parentNode.replaceChild(n, el); }