refactor(editor): move history from doc to store (#12131)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Undo/redo history management is now centralized in the workspace, providing more consistent and robust undo/redo behavior.
  - History update events are emitted at the workspace level, enabling better tracking of changes.

- **Bug Fixes**
  - Improved reliability of undo/redo actions by shifting history management from documents to the workspace.

- **Documentation**
  - Updated and clarified documentation for history-related APIs, including improved examples and clearer descriptions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Saul-Mirone
2025-05-05 09:24:09 +00:00
parent 61af6fd24e
commit d859c4252b
12 changed files with 145 additions and 337 deletions
@@ -310,7 +310,7 @@ const builtinSurfaceToolbarConfig = {
note.props.displayMode !== NoteDisplayMode.EdgelessOnly
);
ctx.doc.captureSync();
ctx.store.captureSync();
ctx.chain
.pipe(duplicateSelectedModelsCommand, {
selectedModels: [model],
@@ -350,7 +350,7 @@ const builtinSurfaceToolbarConfig = {
}
if (contentModels.length === 0) return;
ctx.doc.captureSync();
ctx.store.captureSync();
ctx.chain
.pipe(draftSelectedModelsCommand, {
selectedModels: contentModels,