2.4 KiB
History
Editor's edit history
Type: HistoryInterface
Constructor
new (engine: EngineInterface): HistoryInterface
Method
reset
Reset history, it will clear all history
reset(): void;
hasUndo
Is there an undo operation
hasUndo(): boolean;
hasRedo
Is there a redo operation
hasRedo(): boolean;
undo
Perform undo operation
undo(): void;
redo
Perform redo operation
redo(): void;
hold
The action in the next milliseconds remains as a historical segment
/**
* How many milliseconds the action remains as a historical segment
* @param time milliseconds
*/
hold(time?: number): void;
releaseHold
Reset hold
/**
* Reset hold
*/
releaseHold(): void;
onFilter
Monitor and filter ops stored in history
/**
* Monitoring and filtering are stored in the history stack
* @param filter true to filter and exclude, false to record in the history stack
*/
onFilter(filter: (op: Op) => boolean): void
onSelf
Monitor the current change ops and decide whether to write to the history record
/**
*
* @param collect method undefined The default delay save, true save immediately, false immediately discard. Promise<boolean> blocks all subsequent ops until it returns false or true
*/
onSelf(collect: (ops: Op[]) => Promise<boolean> | boolean | undefined): void
clear
Delay to clear all history records
clear(): void;
saveOp
Save the currently unmaintained operations to the stack
saveOp(): void;
handleSelfOps
Collect local editing operations
/**
* @param ops operation set
* */
handleSelfOps(ops: Op[]): void;
handleRemoteOps
Collect remote operations (operations from other coordinators)
/**
* @param ops operation set
* */
handleRemoteOps(ops: Op[]): void;
getUndoOp
Get the undo operation of the current top position
getUndoOp(): Operation | undefined;
getRedoOp
Get the redo operation of the current top position
getRedoOp(): Operation | undefined;
getCurrentRangePath
Get the converted path of the current cursor
getCurrentRangePath(): Path[];
getRangePathBeforeCommand
Get the converted path of the cursor recorded before executing the command
getRangePathBeforeCommand(): Path[];