mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
fix: text 是空的时候会报错
This commit is contained in:
@@ -164,7 +164,10 @@ function createTextNode() {
|
||||
let lineHeight = this.getStyle('lineHeight', false)
|
||||
// 文本超长自动换行
|
||||
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 isMultiLine = false
|
||||
textArr.forEach((item, index) => {
|
||||
|
||||
@@ -237,7 +237,14 @@ class 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>`
|
||||
this.textEditNode.innerHTML = this.cacheEditingText || html
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user