@lexical/history 0.9.1 → 0.10.0

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.
@@ -266,6 +266,16 @@ function clearHistory(historyState) {
266
266
  historyState.redoStack = [];
267
267
  historyState.current = null;
268
268
  }
269
+ /**
270
+ * Registers necessary listeners to manage undo/redo history stack and related editor commands.
271
+ * It returns `unregister` callback that cleans up all listeners and should be called on editor unmount.
272
+ * @param editor - The lexical editor.
273
+ * @param historyState - The history state, containing the current state and the undo/redo stack.
274
+ * @param delay - The time (in milliseconds) the editor should delay generating a new history stack,
275
+ * instead of merging the current changes with the current stack.
276
+ * @returns The listeners cleanup callback function.
277
+ */
278
+
269
279
 
270
280
  function registerHistory(editor, historyState, delay) {
271
281
  const getMergeAction = createMergeActionGetter(editor, delay);
@@ -332,6 +342,11 @@ function registerHistory(editor, historyState, delay) {
332
342
  unregisterUpdateListener();
333
343
  };
334
344
  }
345
+ /**
346
+ * Creates an empty history state.
347
+ * @returns - The empty history state, as an object.
348
+ */
349
+
335
350
  function createEmptyHistoryState() {
336
351
  return {
337
352
  current: null,
package/index.d.ts CHANGED
@@ -17,5 +17,18 @@ export declare type HistoryState = {
17
17
  redoStack: Array<HistoryStateEntry>;
18
18
  undoStack: Array<HistoryStateEntry>;
19
19
  };
20
+ /**
21
+ * Registers necessary listeners to manage undo/redo history stack and related editor commands.
22
+ * It returns `unregister` callback that cleans up all listeners and should be called on editor unmount.
23
+ * @param editor - The lexical editor.
24
+ * @param historyState - The history state, containing the current state and the undo/redo stack.
25
+ * @param delay - The time (in milliseconds) the editor should delay generating a new history stack,
26
+ * instead of merging the current changes with the current stack.
27
+ * @returns The listeners cleanup callback function.
28
+ */
20
29
  export declare function registerHistory(editor: LexicalEditor, historyState: HistoryState, delay: number): () => void;
30
+ /**
31
+ * Creates an empty history state.
32
+ * @returns - The empty history state, as an object.
33
+ */
21
34
  export declare function createEmptyHistoryState(): HistoryState;
package/package.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "history"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.9.1",
11
+ "version": "0.10.0",
12
12
  "main": "LexicalHistory.js",
13
13
  "peerDependencies": {
14
- "lexical": "0.9.1"
14
+ "lexical": "0.10.0"
15
15
  },
16
16
  "dependencies": {
17
- "@lexical/utils": "0.9.1"
17
+ "@lexical/utils": "0.10.0"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",