@volter/editor-sdk 0.5.57 → 0.5.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/host.ts +12 -2
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@volter/editor-sdk",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.5.57",
5
+ "version": "0.5.58",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -70,7 +70,7 @@
70
70
  "typescript": "^5.6.0",
71
71
  "undici": "^7.28.0",
72
72
  "zod": "^4.3.6",
73
- "@volter/editor-project": "0.5.57",
73
+ "@volter/editor-project": "0.5.58",
74
74
  "@types/node": "^22.0.0"
75
75
  },
76
76
  "peerDependencies": {
package/src/host.ts CHANGED
@@ -894,13 +894,18 @@ export interface EditorHostHistoryElement {
894
894
  */
895
895
  /** The frame's own undo, for every editor affordance that is not a chord. */
896
896
  export interface EditorHostHistoryDelegate {
897
- undo(): void;
898
- redo(): void;
897
+ undo(): void | boolean | Promise<void | boolean>;
898
+ redo(): void | boolean | Promise<void | boolean>;
899
899
  canUndo(): boolean;
900
900
  canRedo(): boolean;
901
+ undoLabel?(): string | null;
902
+ redoLabel?(): string | null;
901
903
  }
902
904
 
903
905
  export interface EditorHostHistory {
906
+ /** Record a native document edit in the workbench's existing history.
907
+ * The document owns restoration; the frame owns ordering and shortcuts. */
908
+ record(element: EditorHostHistoryElement): void;
904
909
  /**
905
910
  * Install the frame's own undo as the one stack. Called once its service
906
911
  * exists, which is AFTER the editor mounts.
@@ -919,6 +924,11 @@ export interface EditorHostHistory {
919
924
  * already possible, so it pushes what it missed first, in order.
920
925
  */
921
926
  onElement(listener: (element: EditorHostHistoryElement) => void): () => void;
927
+ /** Discard history for replaced/closed native documents, never ordinary edits. */
928
+ invalidate(resources: readonly string[]): void;
929
+ onInvalidated(listener: (resources: readonly string[]) => void): () => void;
930
+ /** The workbench finished moving its own stack (including keyboard commands). */
931
+ changed(): void;
922
932
  /** Everything recorded so far, oldest first. */
923
933
  elements(): readonly EditorHostHistoryElement[];
924
934
  /**