mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 18:37:43 +08:00
Demo:修复节点内容为html标签时大纲无法显示和编辑的问题
This commit is contained in:
parent
217f5ee95d
commit
0d4cbc7344
@ -629,7 +629,7 @@ export const textToNodeRichTextWithWrap = html => {
|
||||
}
|
||||
return list
|
||||
.map(item => {
|
||||
return `<p><span>${item}</span></p>`
|
||||
return `<p><span>${htmlEscape(item)}</span></p>`
|
||||
})
|
||||
.join('')
|
||||
}
|
||||
|
||||
@ -42,7 +42,8 @@ import {
|
||||
nodeRichTextToTextWithWrap,
|
||||
textToNodeRichTextWithWrap,
|
||||
getTextFromHtml,
|
||||
createUid
|
||||
createUid,
|
||||
htmlEscape
|
||||
} from 'simple-mind-map/src/utils'
|
||||
|
||||
// 大纲树
|
||||
@ -129,10 +130,11 @@ export default {
|
||||
let data = this.mindMap.getData()
|
||||
data.root = true // 标记根节点
|
||||
let walk = root => {
|
||||
const text = (root.data.richText
|
||||
let text = (root.data.richText
|
||||
? nodeRichTextToTextWithWrap(root.data.text)
|
||||
: root.data.text
|
||||
).replaceAll(/\n/g, '<br>')
|
||||
text = htmlEscape(text)
|
||||
root.textCache = text // 保存一份修改前的数据,用于对比是否修改了
|
||||
root.label = text
|
||||
root.uid = root.data.uid
|
||||
|
||||
@ -54,7 +54,8 @@ import {
|
||||
textToNodeRichTextWithWrap,
|
||||
getTextFromHtml,
|
||||
createUid,
|
||||
simpleDeepClone
|
||||
simpleDeepClone,
|
||||
htmlEscape
|
||||
} from 'simple-mind-map/src/utils'
|
||||
import { storeData } from '@/api'
|
||||
|
||||
@ -102,10 +103,11 @@ export default {
|
||||
let data = this.mindMap.getData()
|
||||
data.root = true // 标记根节点
|
||||
let walk = root => {
|
||||
const text = (root.data.richText
|
||||
let text = (root.data.richText
|
||||
? nodeRichTextToTextWithWrap(root.data.text)
|
||||
: root.data.text
|
||||
).replaceAll(/\n/g, '<br>')
|
||||
text = htmlEscape(text)
|
||||
root.textCache = text // 保存一份修改前的数据,用于对比是否修改了
|
||||
root.label = text
|
||||
root.uid = root.data.uid
|
||||
|
||||
Loading…
Reference in New Issue
Block a user