undoDepth function

int undoDepth(
  1. EditorState state
)

Get the depth of undoable events.

Implementation

int undoDepth(EditorState state) {
  final histState = state.field(historyField);
  if (histState == null) return 0;
  final branch = histState.done;
  return branch.length - (branch.isNotEmpty && branch.first.changes == null ? 1 : 0);
}