Feat:修复处于文本编辑中切换为只读模式时文本未保存的问题
This commit is contained in:
parent
b5b8c2be60
commit
f33c886d6a
@ -479,15 +479,16 @@ class MindMap {
|
|||||||
}
|
}
|
||||||
const isReadonly = mode === CONSTANTS.MODE.READONLY
|
const isReadonly = mode === CONSTANTS.MODE.READONLY
|
||||||
if (isReadonly === this.opt.readonly) return
|
if (isReadonly === this.opt.readonly) return
|
||||||
this.opt.readonly = isReadonly
|
if (isReadonly) {
|
||||||
if (this.opt.readonly) {
|
|
||||||
// 取消当前激活的元素
|
|
||||||
this.execCommand('CLEAR_ACTIVE_NODE')
|
|
||||||
// 如果处于编辑态,要隐藏所有的编辑框
|
// 如果处于编辑态,要隐藏所有的编辑框
|
||||||
if (this.renderer.textEdit.isShowTextEdit()) {
|
if (this.renderer.textEdit.isShowTextEdit()) {
|
||||||
this.renderer.textEdit.hideEditTextBox()
|
this.renderer.textEdit.hideEditTextBox()
|
||||||
|
this.command.originAddHistory()
|
||||||
}
|
}
|
||||||
|
// 取消当前激活的元素
|
||||||
|
this.execCommand('CLEAR_ACTIVE_NODE')
|
||||||
}
|
}
|
||||||
|
this.opt.readonly = isReadonly
|
||||||
this.emit('mode_change', mode)
|
this.emit('mode_change', mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class Command {
|
|||||||
this.activeHistoryIndex = 0
|
this.activeHistoryIndex = 0
|
||||||
// 注册快捷键
|
// 注册快捷键
|
||||||
this.registerShortcutKeys()
|
this.registerShortcutKeys()
|
||||||
|
this.originAddHistory = this.addHistory.bind(this)
|
||||||
this.addHistory = throttle(
|
this.addHistory = throttle(
|
||||||
this.addHistory,
|
this.addHistory,
|
||||||
this.mindMap.opt.addHistoryTime,
|
this.mindMap.opt.addHistoryTime,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user