Fix:1.修复一键去除所有节点自定义样式命令不支持不为数组的概要的问题;2.修复富文本模式下创建的概要节点不是富文本的问题;Feat:插入概要时支持默认聚焦和进入编辑状态
This commit is contained in:
parent
2b8d4ae225
commit
7f0202e16e
@ -989,12 +989,18 @@ class Render {
|
|||||||
const _hasCustomStyles = this._handleRemoveCustomStyles(node.data)
|
const _hasCustomStyles = this._handleRemoveCustomStyles(node.data)
|
||||||
if (_hasCustomStyles) hasCustomStyles = true
|
if (_hasCustomStyles) hasCustomStyles = true
|
||||||
// 不要忘记概要节点
|
// 不要忘记概要节点
|
||||||
if (node.data.generalization && node.data.generalization.length > 0) {
|
let generalization = node.data.generalization
|
||||||
node.data.generalization.forEach(generalizationData => {
|
if (generalization) {
|
||||||
const _hasCustomStyles =
|
generalization = Array.isArray(generalization)
|
||||||
this._handleRemoveCustomStyles(generalizationData)
|
? generalization
|
||||||
if (_hasCustomStyles) hasCustomStyles = true
|
: [generalization]
|
||||||
})
|
if (generalization.length > 0) {
|
||||||
|
generalization.forEach(generalizationData => {
|
||||||
|
const _hasCustomStyles =
|
||||||
|
this._handleRemoveCustomStyles(generalizationData)
|
||||||
|
if (_hasCustomStyles) hasCustomStyles = true
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1632,7 +1638,7 @@ class Render {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 添加节点概要
|
// 添加节点概要
|
||||||
addGeneralization(data) {
|
addGeneralization(data, openEdit = true) {
|
||||||
if (this.activeNodeList.length <= 0) {
|
if (this.activeNodeList.length <= 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1644,13 +1650,22 @@ class Render {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
const list = parseAddGeneralizationNodeList(nodeList)
|
const list = parseAddGeneralizationNodeList(nodeList)
|
||||||
|
const isRichText = !!this.mindMap.richText
|
||||||
|
const { focusNewNode, inserting } = this.getNewNodeBehavior(
|
||||||
|
openEdit,
|
||||||
|
list.length > 1
|
||||||
|
)
|
||||||
list.forEach(item => {
|
list.forEach(item => {
|
||||||
const newData = {
|
const newData = {
|
||||||
|
inserting,
|
||||||
...(data || {
|
...(data || {
|
||||||
text: this.mindMap.opt.defaultGeneralizationText
|
text: this.mindMap.opt.defaultGeneralizationText
|
||||||
}),
|
}),
|
||||||
range: item.range || null,
|
range: item.range || null,
|
||||||
uid: createUid()
|
uid: createUid(),
|
||||||
|
richText: isRichText,
|
||||||
|
resetRichText: isRichText,
|
||||||
|
isActive: focusNewNode
|
||||||
}
|
}
|
||||||
let generalization = item.node.getData('generalization')
|
let generalization = item.node.getData('generalization')
|
||||||
if (generalization) {
|
if (generalization) {
|
||||||
@ -1670,6 +1685,10 @@ class Render {
|
|||||||
expand: true
|
expand: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// 需要清除原来激活的节点
|
||||||
|
if (focusNewNode) {
|
||||||
|
this.clearActiveNodeList()
|
||||||
|
}
|
||||||
this.mindMap.render(() => {
|
this.mindMap.render(() => {
|
||||||
// 修复祖先节点存在概要时位置未更新的问题
|
// 修复祖先节点存在概要时位置未更新的问题
|
||||||
// 修复同时给存在上下级关系的节点添加概要时重叠的问题
|
// 修复同时给存在上下级关系的节点添加概要时重叠的问题
|
||||||
|
|||||||
@ -51,6 +51,7 @@ function createGeneralizationNode() {
|
|||||||
if (!cur.generalizationNode) {
|
if (!cur.generalizationNode) {
|
||||||
cur.generalizationNode = new Node({
|
cur.generalizationNode = new Node({
|
||||||
data: {
|
data: {
|
||||||
|
inserting: item.inserting,
|
||||||
data: item
|
data: item
|
||||||
},
|
},
|
||||||
uid: createUid(),
|
uid: createUid(),
|
||||||
@ -59,6 +60,7 @@ function createGeneralizationNode() {
|
|||||||
isGeneralization: true
|
isGeneralization: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
delete item.inserting
|
||||||
// 关联所属节点
|
// 关联所属节点
|
||||||
cur.generalizationNode.generalizationBelongNode = this
|
cur.generalizationNode.generalizationBelongNode = this
|
||||||
// 大小
|
// 大小
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user