mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-22 02:47:46 +08:00
只读模式下禁止添加历史记录、禁止响应前进后退操作
This commit is contained in:
parent
1e5dfd97e1
commit
b40da53aef
@ -72,6 +72,9 @@ class Command {
|
||||
|
||||
// 添加回退数据
|
||||
addHistory() {
|
||||
if (this.mindMap.opt.readonly) {
|
||||
return
|
||||
}
|
||||
let data = this.getCopyData()
|
||||
this.history.push(simpleDeepClone(data))
|
||||
this.activeHistoryIndex = this.history.length - 1
|
||||
@ -85,6 +88,9 @@ class Command {
|
||||
|
||||
// 回退
|
||||
back(step = 1) {
|
||||
if (this.mindMap.opt.readonly) {
|
||||
return
|
||||
}
|
||||
if (this.activeHistoryIndex - step >= 0) {
|
||||
this.activeHistoryIndex -= step
|
||||
this.mindMap.emit(
|
||||
@ -98,6 +104,9 @@ class Command {
|
||||
|
||||
// 前进
|
||||
forward(step = 1) {
|
||||
if (this.mindMap.opt.readonly) {
|
||||
return
|
||||
}
|
||||
let len = this.history.length
|
||||
if (this.activeHistoryIndex + step <= len - 1) {
|
||||
this.activeHistoryIndex += step
|
||||
|
||||
@ -16,15 +16,15 @@ let APIList = [
|
||||
'node',
|
||||
'render',
|
||||
'view',
|
||||
'miniMap',
|
||||
'doExport',
|
||||
'watermark',
|
||||
'keyCommand',
|
||||
'keyboardNavigation',
|
||||
'command',
|
||||
'batchExecution',
|
||||
'select',
|
||||
'drag',
|
||||
'batchExecution',
|
||||
'keyboardNavigation',
|
||||
'doExport',
|
||||
'miniMap',
|
||||
'watermark',
|
||||
'xmind',
|
||||
'utils'
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user