Demo:修复大纲修改一个节点的文本后再点击其他节点时不聚焦的问题
This commit is contained in:
parent
680320ba76
commit
fbd061e8b3
@ -75,6 +75,7 @@ export default {
|
|||||||
window.addEventListener('keydown', this.onKeyDown)
|
window.addEventListener('keydown', this.onKeyDown)
|
||||||
this.$bus.$on('data_change', this.handleDataChange)
|
this.$bus.$on('data_change', this.handleDataChange)
|
||||||
this.$bus.$on('node_tree_render_end', this.handleNodeTreeRenderEnd)
|
this.$bus.$on('node_tree_render_end', this.handleNodeTreeRenderEnd)
|
||||||
|
this.$bus.$on('hide_text_edit', this.handleHideTextEdit)
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
@ -83,8 +84,16 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKeyDown)
|
window.removeEventListener('keydown', this.onKeyDown)
|
||||||
this.$bus.$off('data_change', this.handleDataChange)
|
this.$bus.$off('data_change', this.handleDataChange)
|
||||||
this.$bus.$off('node_tree_render_end', this.handleNodeTreeRenderEnd)
|
this.$bus.$off('node_tree_render_end', this.handleNodeTreeRenderEnd)
|
||||||
|
this.$bus.$off('hide_text_edit', this.handleHideTextEdit)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleHideTextEdit() {
|
||||||
|
if (this.notHandleDataChange) {
|
||||||
|
this.notHandleDataChange = false
|
||||||
|
this.refresh()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
handleDataChange() {
|
handleDataChange() {
|
||||||
// 在大纲里操作节点时不要响应该事件,否则会重新刷新树
|
// 在大纲里操作节点时不要响应该事件,否则会重新刷新树
|
||||||
if (this.notHandleDataChange) {
|
if (this.notHandleDataChange) {
|
||||||
@ -191,6 +200,7 @@ export default {
|
|||||||
const text = richText ? e.target.innerHTML : e.target.innerText
|
const text = richText ? e.target.innerHTML : e.target.innerText
|
||||||
const targetNode = this.mindMap.renderer.findNodeByUid(node.data.uid)
|
const targetNode = this.mindMap.renderer.findNodeByUid(node.data.uid)
|
||||||
if (!targetNode) return
|
if (!targetNode) return
|
||||||
|
this.notHandleDataChange = true
|
||||||
if (richText) {
|
if (richText) {
|
||||||
targetNode.setText(textToNodeRichTextWithWrap(text), true, true)
|
targetNode.setText(textToNodeRichTextWithWrap(text), true, true)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user