Skip to content

Commit

Permalink
fix: donot empty text when only has title elem (#3248)
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector authored Feb 16, 2023
1 parent 979b255 commit 9ccda3e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/x6-common/src/dom/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,14 @@ export function text(
const autoLineHeight = defaultLineHeight === 'auto'
const lineHeight = autoLineHeight ? '1.5em' : defaultLineHeight || '1em'

empty(elem)
let needEmptyElem = true
const childs = elem.children
if (childs.length === 1 && childs[0].tagName.toUpperCase() === 'TITLE') {
needEmptyElem = false
}
if (needEmptyElem) {
empty(elem)
}

attr(elem, {
// Preserve spaces, do not consecutive spaces to get collapsed to one.
Expand Down

0 comments on commit 9ccda3e

Please sign in to comment.