History
MMO.editor · 1 symbol · generated 30 Sep 2026
History
History.js:18The undo/redo stack of one editable region.
- Namespace
MMO.editor
Index
| constructor(root, max) | ||
| reset() | Forget every step: the current content becomes the first one. | |
| snapshot() | ||
| commit() | Record the current content as a new step, if it changed. | |
| touch(delay) | Record the current content after a pause: what is typed in one go is undone in one go. | |
| cancelTimer() | [internal] | |
| canUndo() | ||
| canRedo() | ||
| undo() | Go back one step | |
| redo() | Go forward one step | |
| restore(step, fallbackRange) | [internal] Put a step back in the region |
Methods11
constructor(root, max)
History.js:23| root | Element | the editable region |
| max = 200 | number | how many steps are kept |
reset()
History.js:35Forget every step: the current content becomes the first one.
snapshot()
History.js:44| returns | html: string, range: ?Object | } the region as it is now |
commit()
History.js:56Record the current content as a new step, if it changed.
| returns | boolean | true when a step was added |
touch(delay)
History.js:78Record the current content after a pause: what is typed in one go is undone in one go.
| delay = 600 | number | in ms |
cancelTimer()
History.js:86[internal]
canUndo()
History.js:96| returns | boolean |
canRedo()
History.js:103| returns | boolean |
undo()
History.js:111Go back one step
| returns | boolean | false when there was nothing to undo |
redo()
History.js:124Go forward one step
| returns | boolean | false when there was nothing to redo |
restore(step, fallbackRange)
History.js:136[internal] Put a step back in the region
| step | ||
| fallbackRange = null | ?Object | where the selection goes when the step has none |