UndoService
Defined in: src/shell.ts:409
Multi-level undo/redo. Records are kept in memory only, are bounded by count and by size, and are dropped when the table or view they belong to is closed.
Example
const before = column.get(0);
column.set(0, 42);
DG.UndoService.push('Set value', () => column.set(0, before), {
redo: () => column.set(0, 42),
context: column.dataFrame
});
Constructors
Constructor
new UndoService():
UndoService
Returns
UndoService
Accessors
redoName
Get Signature
get
staticredoName():string|null
Defined in: src/shell.ts:424
Returns
string | null
undoName
Get Signature
get
staticundoName():string|null
Defined in: src/shell.ts:423
Returns
string | null
Methods
clear()
staticclear():void
Defined in: src/shell.ts:427
Drops both stacks.
Returns
void
ownScope()
staticownScope(element):void
Defined in: src/shell.ts:432
Claims Ctrl+Z for [element]: while focus is inside it, the platform does not undo. Use it for embedded editors (sketchers, graph editors, notebooks) that keep their own history, instead of installing a document-level key handler.
Parameters
| Parameter | Type |
|---|---|
element | HTMLElement |
Returns
void
push()
staticpush(name,undo,options?):void
Defined in: src/shell.ts:412
Registers an undoable operation that has already been performed. Without [options.redo] the operation can be undone but not redone.
Parameters
| Parameter | Type |
|---|---|
name | string |
undo | () => void |
options? | { context?: any; redo?: () => void; } |
options.context? | any |
options.redo? | () => void |
Returns
void
releaseScope()
staticreleaseScope(element):void
Defined in: src/shell.ts:435
Returns Ctrl+Z to the platform. See ownScope.
Parameters
| Parameter | Type |
|---|---|
element | HTMLElement |
Returns
void
run()
staticrun<T>(name,action,undo,options?):T
Defined in: src/shell.ts:417
Performs [action] and registers [undo] as its inverse.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
name | string |
action | () => T |
undo | () => void |
options? | { context?: any; redo?: () => void; } |
options.context? | any |
options.redo? | () => void |
Returns
T