fix: text 是空的时候会报错
This commit is contained in:
parent
ba44f69f9f
commit
e1172c8d0d
@ -164,7 +164,10 @@ function createTextNode() {
|
|||||||
let lineHeight = this.getStyle('lineHeight', false)
|
let lineHeight = this.getStyle('lineHeight', false)
|
||||||
// 文本超长自动换行
|
// 文本超长自动换行
|
||||||
let textStyle = this.style.getTextFontStyle()
|
let textStyle = this.style.getTextFontStyle()
|
||||||
let textArr = this.nodeData.data.text.split(/\n/gim)
|
let textArr = []
|
||||||
|
if (this.nodeData.data.text && typeof this.nodeData.data.text === 'string') {
|
||||||
|
textArr = this.nodeData.data.text.split(/\n/gim)
|
||||||
|
}
|
||||||
let maxWidth = this.mindMap.opt.textAutoWrapWidth
|
let maxWidth = this.mindMap.opt.textAutoWrapWidth
|
||||||
let isMultiLine = false
|
let isMultiLine = false
|
||||||
textArr.forEach((item, index) => {
|
textArr.forEach((item, index) => {
|
||||||
|
|||||||
@ -237,7 +237,14 @@ class RichText {
|
|||||||
}
|
}
|
||||||
if (!node.nodeData.data.richText) {
|
if (!node.nodeData.data.richText) {
|
||||||
// 还不是富文本的情况
|
// 还不是富文本的情况
|
||||||
let text = node.nodeData.data.text.split(/\n/gim).join('<br>')
|
let text = ''
|
||||||
|
if (
|
||||||
|
node.nodeData.data.text &&
|
||||||
|
typeof node.nodeData.data.text === 'string'
|
||||||
|
) {
|
||||||
|
text = node.nodeData.data.text.split(/\n/gim).join('<br>')
|
||||||
|
}
|
||||||
|
|
||||||
let html = `<p>${text}</p>`
|
let html = `<p>${text}</p>`
|
||||||
this.textEditNode.innerHTML = this.cacheEditingText || html
|
this.textEditNode.innerHTML = this.cacheEditingText || html
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user