Skip to main content

history

Documentation / editor/modules/history

HistoryModule​

Defined in: editor/modules/history.ts:24

Properties​

PropertyTypeDefined in

clearHistory

() => void

editor/modules/history.ts:31

cutoffHistory

() => void

editor/modules/history.ts:30

getStack

() => UndoStack

editor/modules/history.ts:33

hasRedo

() => boolean

editor/modules/history.ts:27

hasUndo

() => boolean

editor/modules/history.ts:26

options

Options

editor/modules/history.ts:25

redo

() => void

editor/modules/history.ts:29

setStack

(value: UndoStack) => void

editor/modules/history.ts:32

undo

() => void

editor/modules/history.ts:28

Methods​

destroy()​

destroy(): void;

Defined in: editor/modules/history.ts:34

Returns​

void


Options​

Defined in: editor/modules/history.ts:15

Properties​

PropertyTypeDefined in

delay

number

editor/modules/history.ts:16

maxStack

number

editor/modules/history.ts:17

unrecordedSources

Set<string>

editor/modules/history.ts:18


StackEntry​

Defined in: editor/modules/history.ts:5

Properties​

PropertyTypeDefined in

redo

default

editor/modules/history.ts:6

undo

default

editor/modules/history.ts:7


UndoStack​

Defined in: editor/modules/history.ts:10

Properties​

PropertyTypeDefined in

redo

StackEntry[]

editor/modules/history.ts:12

undo

StackEntry[]

editor/modules/history.ts:11


history()​

const history: (editor: Editor) => object;

Defined in: editor/modules/history.ts:22

Parameters​

ParameterType

editor

Editor

Returns​

object

NameTypeDefined in

clearHistory()

() => void

editor/modules/history.ts:161

commands

{ redo: () => void; undo: () => void; }

editor/modules/history.ts:167

cutoffHistory()

() => void

editor/modules/history.ts:160

getStack()

() => UndoStack

editor/modules/history.ts:163

hasRedo()

() => boolean

editor/modules/history.ts:157

hasUndo()

() => boolean

editor/modules/history.ts:156

options

Options

editor/modules/history.ts:155

redo()

() => void

editor/modules/history.ts:159

setStack()

(value: UndoStack) => void

editor/modules/history.ts:162

shortcuts

{ mac:Cmd+Shift+Z: string; mac:Cmd+Z: string; win:Ctrl+Y: string; win:Ctrl+Z: string; }

editor/modules/history.ts:171

undo()

() => void

editor/modules/history.ts:158

destroy()

() =>

editor/modules/history.ts:181

getActive()

() =>

editor/modules/history.ts:164

init()

() =>

editor/modules/history.ts:177


initHistory()​

function initHistory(initOptions: Partial<Options>): (editor: Editor) => object;

Defined in: editor/modules/history.ts:53

History is a view module for storing user changes and undoing/redoing those changes.

Stores history for all user-generated changes. Like-changes will be combined until a selection or a delay timeout cuts off the combining. E.g. if a user types "Hello" the 5 changes will be combined into one history entry. If the user moves the cursor somewhere and then back to the end and types " World" the next 6 changes are combined separately from the first 5 because selection changes add a cutoff history entries.

The default options can be overridden by passing alternatives to history. To add a timeout to force a cutoff after so many milliseconds set a delay like this:

const modules = {
history: history({ delay: 4000 })
};

Parameters​

ParameterType

initOptions

Partial<Options>

Returns​

(editor: Editor): object;

Parameters​

ParameterType

editor

Editor

Returns​

object

NameTypeDefined in

clearHistory()

() => void

editor/modules/history.ts:161

commands

{ redo: () => void; undo: () => void; }

editor/modules/history.ts:167

cutoffHistory()

() => void

editor/modules/history.ts:160

getStack()

() => UndoStack

editor/modules/history.ts:163

hasRedo()

() => boolean

editor/modules/history.ts:157

hasUndo()

() => boolean

editor/modules/history.ts:156

options

Options

editor/modules/history.ts:155

redo()

() => void

editor/modules/history.ts:159

setStack()

(value: UndoStack) => void

editor/modules/history.ts:162

shortcuts

{ mac:Cmd+Shift+Z: string; mac:Cmd+Z: string; win:Ctrl+Y: string; win:Ctrl+Z: string; }

editor/modules/history.ts:171

undo()

() => void

editor/modules/history.ts:158

destroy()

() =>

editor/modules/history.ts:181

getActive()

() =>

editor/modules/history.ts:164

init()

() =>

editor/modules/history.ts:177


transformHistoryStack()​

function transformHistoryStack(stack: UndoStack, delta: 
| default
| default): void;

Defined in: editor/modules/history.ts:196

Parameters​

ParameterType

stack

UndoStack

delta

| default | default

Returns​

void


undoStack()​

function undoStack(): UndoStack;

Defined in: editor/modules/history.ts:189

Returns​

UndoStack