AlexZ 发表于 2021-3-2 16:17:29

【V14 Update1 新功能预览】API 获取 Undo/Redo 栈

SpreadJS 通过命令管理器提供了 Undo/Redo 功能,但有些用户想一次 Undo 多个步骤,或者 Undo 到指定的操作步骤,基于此, 新版本中讲通过几个 API 接口返回当前操作的 Undo/Redo 栈(数组),便于用户根据实际需求,自行控制,如下图:


API:getRedoStack
///* function getRedoStack()
/**
* Get the redo stack.
* @returns {Command[]} ICommand is an object. It include sheetName and cmd. the type of sheetName and cmd both is string.
*/

API:getUndoStack
///* function getUndoStack()
/**
* Get the undo stack.
* @returns {Command[]} ICommand is an object. It include sheetName and cmd. the type of sheetName and cmd both is string.
*/

API:maxSize
///* function maxSize(value?: number):any
/**
* Gets or sets the the undo/redo stack max size.
* @param {number} value this value should be greater or equal to 0.
* @returns {number | UndoManager} If no value is set. return the max size of undo/redo stack. otherwise return UndoManager.
*/



页: [1]
查看完整版本: 【V14 Update1 新功能预览】API 获取 Undo/Redo 栈