mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Fix:修复大纲里点击文字编辑时输入框焦点丢失的问题
This commit is contained in:
@@ -12,6 +12,8 @@ export default class TextEdit {
|
||||
this.textEditNode = null
|
||||
// 隐藏的文本输入框
|
||||
this.hiddenInputEl = null
|
||||
// 节点激活时默认聚焦到隐藏输入框
|
||||
this.enableFocus = true
|
||||
// 文本编辑框是否显示
|
||||
this.showTextEdit = false
|
||||
// 如果编辑过程中缩放画布了,那么缓存当前编辑的内容
|
||||
@@ -97,7 +99,17 @@ export default class TextEdit {
|
||||
|
||||
// 让隐藏的文本输入框聚焦
|
||||
focusHiddenInput() {
|
||||
if (this.hiddenInputEl) this.hiddenInputEl.focus()
|
||||
if (this.hiddenInputEl && this.enableFocus) this.hiddenInputEl.focus()
|
||||
}
|
||||
|
||||
// 关闭默认聚焦
|
||||
stopFocusOnNodeActive() {
|
||||
this.enableFocus = false
|
||||
}
|
||||
|
||||
// 开启默认聚焦
|
||||
openFocusOnNodeActive() {
|
||||
this.enableFocus = true
|
||||
}
|
||||
|
||||
// 注册临时快捷键
|
||||
|
||||
@@ -117,7 +117,10 @@ export default {
|
||||
this.notHandleDataChange = true
|
||||
let targetNode = node.data._node
|
||||
if (targetNode && targetNode.nodeData.data.isActive) return
|
||||
this.mindMap.execCommand('GO_TARGET_NODE', node.data.data.uid)
|
||||
this.mindMap.renderer.textEdit.stopFocusOnNodeActive()
|
||||
this.mindMap.execCommand('GO_TARGET_NODE', node.data.data.uid, () => {
|
||||
this.mindMap.renderer.textEdit.openFocusOnNodeActive()
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user