fix: support multi-step redo by refactoring undo/redo recording (#1192)

Multi-step redo was broken because `getUndoHistoryItem()` cleared the
redo stack whenever the last undo item was sealed — even during redo
operations. After the first redo, the 50ms debounce timer would seal
the item, causing the next redo to wipe the remaining redo history.

Refactored the undo/redo system with:
- `TransactionSource` enum (userEdit, undo, redo, none) replacing
  boolean flag combinations in ApplyOptions
- `UndoManager.record()` with symmetric paths for each source:
  - userEdit: groups into unsealed items, clears redo on branch
  - undo: pushes directly to redo stack
  - redo: pushes directly to undo stack (sealed), no redo clear
- Deprecated `getUndoHistoryItem()` and legacy boolean flags
This commit is contained in:
Lucas 2026-03-25 15:25:00 +08:00 • committed by GitHub
commit 37521c205f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,8 @@ export 'src/editor/l10n/appflowy_editor_l10n.dart';
export 'src/editor/selection_menu/selection_menu.dart';
// editor state
export 'src/editor_state.dart';
// history
export 'src/history/undo_manager.dart' show TransactionSource;
// extension
export 'src/extensions/extensions.dart';
export 'src/infra/clipboard.dart';