mobx-keystone

    Interface UndoMiddlewareOptions<S>

    Undo middleware options.

    interface UndoMiddlewareOptions<S> {
        attachedState?: { restore(s: S): void; save(): S };
        maxRedoLevels?: number;
        maxUndoLevels?: number;
    }

    Type Parameters

    • S
    Index

    Properties

    attachedState?: { restore(s: S): void; save(): S }

    Attached states are states that are saved/restored when undoing/redoing. Usually used to restore state that is not part of the document model such as focus, selection, scroll position, etc.

    Type declaration

    • restore: function
      • Restores a certain state previously saved.

        Parameters

        • s: S

          State to restore.

        Returns void

    • save: function
      • Saves a certain state and associates it with the undo step. This state can be restored when undoing/redoing.

        Returns S

    maxRedoLevels?: number

    Max number of redo levels to keep, or undefined for infinite.

    maxUndoLevels?: number

    Max number of undo levels to keep, or undefined for infinite.

    MMNEPVFCICPMFPCPTTAAATR