fix: list rendering error (#297)

This commit is contained in:
YangFong 2024-05-12 18:38:15 +08:00 committed by GitHub
parent ed951d293b
commit 7ade99b9b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -365,10 +365,29 @@ export default {
copy() {
this.$emit(`startCopy`)
setTimeout(() => {
function modifyHtmlStructure(htmlString) {
// div HTML
const tempDiv = document.createElement(`div`)
tempDiv.innerHTML = htmlString
const originalItems = tempDiv.querySelectorAll(`li > ul, li > ol`)
originalItems.forEach((originalItem) => {
originalItem.parentElement.insertAdjacentElement(
`afterend`,
originalItem
)
})
// HTML
return tempDiv.innerHTML
}
solveWeChatImage()
const clipboardDiv = document.getElementById(`output`)
clipboardDiv.innerHTML = mergeCss(clipboardDiv.innerHTML)
clipboardDiv.innerHTML = modifyHtmlStructure(clipboardDiv.innerHTML)
// katex
clipboardDiv.innerHTML = clipboardDiv.innerHTML