textEdit类增加isShowTextEdit方法判断当前是否处在节点编辑状态

This commit is contained in:
街角小林 2023-12-18 09:12:04 +08:00
parent 4a2816fc75
commit b950c2bfe9
3 changed files with 11 additions and 9 deletions

View File

@ -44,13 +44,10 @@ export default class KeyCommand {
this.isInSvg = true
})
this.mindMap.on('svg_mouseleave', () => {
if (this.mindMap.richText && this.mindMap.richText.showTextEdit) {
return
}
if (this.mindMap.renderer.textEdit.isShowTextEdit()) return
if (
this.mindMap.renderer.textEdit.showTextEdit ||
(this.mindMap.associativeLine &&
this.mindMap.associativeLine.showTextEdit)
this.mindMap.associativeLine &&
this.mindMap.associativeLine.showTextEdit
) {
return
}

View File

@ -276,9 +276,6 @@ class Render {
})
// 插入同级节点
this.mindMap.keyCommand.addShortcut('Enter', () => {
if (this.textEdit.showTextEdit) {
return
}
this.mindMap.execCommand('INSERT_NODE')
})
// 插入父节点

View File

@ -126,6 +126,14 @@ export default class TextEdit {
})
}
// 获取当前文本编辑框是否处于显示状态,也就是是否处在文本编辑状态
isShowTextEdit() {
if (this.mindMap.richText) {
return this.mindMap.richText.showTextEdit
}
return this.showTextEdit
}
// 显示文本编辑框
// isInserting是否是刚创建的节点
// isFromKeyDown是否是在按键事件进入的编辑