[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 <p> 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) <age@odoo.com>
This commit is contained in:
Deependra Solanki
2023-11-13 14:38:38 +00:00
parent 3d8fb4d699
commit 7b95f5c8a7
@@ -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);
}