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

  • add(name: string, icon: string, movePointer?: boolean): void
  • Parameters

    • name: string
    • icon: string
    • Default value movePointer: boolean = true

    Returns void

addFromJson

  • addFromJson(json: string): void
  • Add new history from json and load it.

    Parameters

    • json: string

    Returns void

canRedo

  • canRedo(): boolean
  • Check if redo operation is possible.

    Returns boolean

canUndo

  • canUndo(): boolean
  • 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

  • getPointer(): number
  • Get history stack pointer.

    Returns number

load

  • Parameters

    Returns Promise<any>

redo

  • redo(): void
  • Redo last operation.

    Returns void

reload

  • reload(): void
  • Reload current history state.

    Returns void

replaceCurrent

  • replaceCurrent(): void
  • Replace current history item with current canvas state.

    Returns void

undo

  • undo(): void
  • Undo last operation.

    Returns void