fix: optimize organizeHTMLContent

This commit is contained in:
Michael Yang 2025-01-07 12:24:22 +08:00
parent 86021ac357
commit 54703fe95b
1 changed files with 5 additions and 1 deletions

View File

@ -173,7 +173,11 @@ export const organizeHTMLContent = (originalHtml: string) => {
const liOrP = ul.firstElementChild;
if (liOrP?.tagName === "P") {
liOrP.replaceWith(liOrP.innerHTML)
const fragment = document.createDocumentFragment();
liOrP.childNodes.forEach(node => {
fragment.append(node.cloneNode(true))
})
liOrP.replaceWith(fragment)
}
const liList = ul.querySelectorAll("li");