revisionHistoryState:change
Triggered when current state of Undo/Redo changes. State changes are triggered by the following actions:
- Clicking the Undo or Redo buttons.
- Calling
undo()
orredo()
public methods. - Changing any UI field (on blur).
This event gets fired twice per state change:
- The first event fires with both booleans set to false, to indicate both buttons should be disabled (see right).
- The second event fires with updated states once the first has completed. E.g. after changing a field,
canUndo
will be true andcanRedo
will be false (see right).
New snapshots are typically very fast so both events will trigger rapidly, but undo/redo operations can take some time. It is important to listen to these events and prevent or ignore further undo/redo commands until the current operation completes.
Note
if you call the public method off()
with the argument revisionHistoryState:change
, it will disable the default undo and redo buttons.
Callback arguments
-
undo_state objectAn object that contains:
-
canUndo
: boolean, indicates whether there is a previous state that QE can be reverted to via theundo()
public method. -
canRedo
: boolean, indicates whether there is a newer state that QE can be restored to viaredo()
public method.
(first event):{canUndo: false, canRedo: false}
Sample data (second event):{canUndo: true, canRedo: false}
-