History tool can be used to undo/redo, get/load editor state, add current editor state to history and more.
var pixie = new Pixie({
onLoad: function() {
pixie.getTool('history').add('my history item', 'some icon');
}
});
History tool methods
add
-
Parameters
-
name: string
-
icon: string
-
Default value movePointer: boolean = true
Returns void
-
addFromJson
-
Parameters
-
json: string
Returns void
-
canRedo
-
Check if redo operation is possible.
Returns boolean
canUndo
-
Check if undo operation is possible.
Returns boolean
get
-
Get history item by name.
Parameters
-
name: string
Returns HistoryItem
-
getAllItems
-
Get all history items.
Returns HistoryItem[]
getCurrentCanvasState
-
Get serialized canvas and editor state.
Returns SerializedCanvas
getPointer
-
Get history stack pointer.
Returns number
load
-
Parameters
-
item: HistoryItem | string
Returns Promise<any>
-
redo
-
Redo last operation.
Returns void
reload
-
Reload current history state.
Returns void
replaceCurrent
-
Replace current history item with current canvas state.
Returns void
undo
-
Undo last operation.
Returns void
Add new history from json and load it.