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