Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parse): 当复制富文本到编辑器时,如果span内部分内容加粗,则整个span都会被加粗 #5812

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/core/src/parse-html/parse-elem-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ function parseElemHtml($elem: Dom7Array, editor: IDomEditor): Descendant | Desce
if ($elem.attr('data-w-e-type')) {
return parseCommonElemHtml($elem, editor)
} else {
if ($elem[0].childNodes.length > 1) {
const childNodes = $elem[0].childNodes
return Array.from(childNodes).map(child => {
$($elem[0]).empty()
$($elem[0]).append($(child))
return parseTextElemHtml($($elem[0]), editor)
})
}
return parseTextElemHtml($elem, editor)
}
}
Expand Down