undo - Methods - Question Editor API

Question Editor API Methods

undo()

Revert Question Editor state to a previously captured state.

Conditions that may prevent operation to be performed:

  • A previous Undo/Redo operation is still running.
  • There are no previous snapshots to revert to.
  • A snapshot is currently being saved.
  • The page has not yet completely loaded.

To know when the undo operation has completed, listen to the revisionHistoryState:change (refer to event types) and watch for when either canUndo or canRedo is true.

Examples

// event to listen - after modifying any input field
questionEditorApp.on("revisionHistoryState:change", function (data) {
    console.log(data); //{canUndo: true, canRedo: false}
});

questionEditorApp.undo(); //{canUndo: false, canRedo: true}

Arguments

None.

Return value

Type boolean

If the operation can not be performed, then false is returned

Type null

If the operation can be performed, then null is returned
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.