@lobehub/editor 3.3.2 → 3.4.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.
Files changed (55) hide show
  1. package/es/editor-kernel/index.d.ts +1 -0
  2. package/es/editor-kernel/index.js +3 -1
  3. package/es/editor-kernel/kernel.js +1 -0
  4. package/es/editor-kernel/lexical/Lexical.dev.js +3052 -0
  5. package/es/editor-kernel/lexical/Lexical.dev.mjs +15365 -0
  6. package/es/editor-kernel/lexical/Lexical.js +7634 -0
  7. package/es/editor-kernel/lexical/Lexical.mjs +7258 -0
  8. package/es/editor-kernel/lexical/LexicalCommands.d.ts +175 -0
  9. package/es/editor-kernel/lexical/LexicalConstants.d.ts +54 -0
  10. package/es/editor-kernel/lexical/LexicalEditor.d.ts +672 -0
  11. package/es/editor-kernel/lexical/LexicalEditorState.d.ts +39 -0
  12. package/es/editor-kernel/lexical/LexicalEvents.d.ts +22 -0
  13. package/es/editor-kernel/lexical/LexicalGC.d.ts +23 -0
  14. package/es/editor-kernel/lexical/LexicalMutations.d.ts +12 -0
  15. package/es/editor-kernel/lexical/LexicalNode.d.ts +689 -0
  16. package/es/editor-kernel/lexical/LexicalNodeState.d.ts +569 -0
  17. package/es/editor-kernel/lexical/LexicalNormalization.d.ts +11 -0
  18. package/es/editor-kernel/lexical/LexicalReconciler.d.ts +28 -0
  19. package/es/editor-kernel/lexical/LexicalSelection.d.ts +368 -0
  20. package/es/editor-kernel/lexical/LexicalUpdateTags.d.ts +67 -0
  21. package/es/editor-kernel/lexical/LexicalUpdates.d.ts +72 -0
  22. package/es/editor-kernel/lexical/LexicalUtils.d.ts +492 -0
  23. package/es/editor-kernel/lexical/caret/LexicalCaret.d.ts +635 -0
  24. package/es/editor-kernel/lexical/caret/LexicalCaretUtils.d.ts +224 -0
  25. package/es/editor-kernel/lexical/extension-core/defineExtension.d.ts +126 -0
  26. package/es/editor-kernel/lexical/extension-core/index.d.ts +38 -0
  27. package/es/editor-kernel/lexical/extension-core/internal.d.ts +32 -0
  28. package/es/editor-kernel/lexical/extension-core/safeCast.d.ts +15 -0
  29. package/es/editor-kernel/lexical/extension-core/shallowMergeConfig.d.ts +20 -0
  30. package/es/editor-kernel/lexical/extension-core/types.d.ts +371 -0
  31. package/es/editor-kernel/lexical/index.d.ts +368 -0
  32. package/es/editor-kernel/lexical/nodes/ArtificialNode.d.ts +16 -0
  33. package/es/editor-kernel/lexical/nodes/LexicalDecoratorNode.d.ts +32 -0
  34. package/es/editor-kernel/lexical/nodes/LexicalElementNode.d.ts +235 -0
  35. package/es/editor-kernel/lexical/nodes/LexicalLineBreakNode.d.ts +30 -0
  36. package/es/editor-kernel/lexical/nodes/LexicalParagraphNode.d.ts +39 -0
  37. package/es/editor-kernel/lexical/nodes/LexicalRootNode.d.ts +35 -0
  38. package/es/editor-kernel/lexical/nodes/LexicalTabNode.d.ts +30 -0
  39. package/es/editor-kernel/lexical/nodes/LexicalTextNode.d.ts +311 -0
  40. package/es/plugins/common/data-source/json-data-source.js +29 -3
  41. package/es/plugins/common/react/ReactPlainText.js +9 -0
  42. package/es/plugins/common/utils/index.d.ts +2 -1
  43. package/es/plugins/common/utils/index.js +33 -0
  44. package/es/plugins/litexml/command/index.js +9 -1
  45. package/es/plugins/litexml/data-source/litexml-data-source.js +12 -2
  46. package/es/plugins/litexml/plugin/index.js +41 -3
  47. package/es/plugins/litexml/utils/index.d.ts +2 -1
  48. package/es/plugins/litexml/utils/index.js +7 -1
  49. package/es/plugins/markdown/data-source/markdown-data-source.js +6 -25
  50. package/es/plugins/markdown/data-source/markdown-writer-context.d.ts +5 -1
  51. package/es/plugins/markdown/data-source/markdown-writer-context.js +27 -2
  52. package/es/plugins/markdown/service/shortcut.d.ts +7 -0
  53. package/es/types/kernel.d.ts +4 -0
  54. package/package.json +8 -2
  55. package/scripts/patch-lexical.js +39 -0
@@ -0,0 +1,368 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { TextNode } from '.';
9
+ import type { LexicalEditor } from './LexicalEditor';
10
+ import type { EditorState } from './LexicalEditorState';
11
+ import type { NodeKey } from './LexicalNode';
12
+ import { LexicalNode } from './LexicalNode';
13
+ import type { ElementNode } from './nodes/LexicalElementNode';
14
+ import type { TextFormatType } from './nodes/LexicalTextNode';
15
+
16
+ export type TextPointType = {
17
+ _selection: BaseSelection;
18
+ getNode: () => TextNode;
19
+ is: (point: PointType) => boolean;
20
+ isBefore: (point: PointType) => boolean;
21
+ key: NodeKey;
22
+ offset: number;
23
+ set: (key: NodeKey, offset: number, type: 'text' | 'element', onlyIfChanged?: boolean) => void;
24
+ type: 'text';
25
+ };
26
+ export type ElementPointType = {
27
+ _selection: BaseSelection;
28
+ getNode: () => ElementNode;
29
+ is: (point: PointType) => boolean;
30
+ isBefore: (point: PointType) => boolean;
31
+ key: NodeKey;
32
+ offset: number;
33
+ set: (key: NodeKey, offset: number, type: 'text' | 'element', onlyIfChanged?: boolean) => void;
34
+ type: 'element';
35
+ };
36
+ export type PointType = TextPointType | ElementPointType;
37
+ export declare class Point {
38
+ key: NodeKey;
39
+ offset: number;
40
+ type: 'text' | 'element';
41
+ _selection: BaseSelection | null;
42
+ constructor(key: NodeKey, offset: number, type: 'text' | 'element');
43
+ is(point: PointType): boolean;
44
+ isBefore(b: PointType): boolean;
45
+ getNode(): LexicalNode;
46
+ set(key: NodeKey, offset: number, type: 'text' | 'element', onlyIfChanged?: boolean): void;
47
+ }
48
+ export declare function $createPoint(
49
+ key: NodeKey,
50
+ offset: number,
51
+ type: 'text' | 'element',
52
+ ): PointType;
53
+ export declare function $moveSelectionPointToEnd(point: PointType, node: LexicalNode): void;
54
+ export interface BaseSelection {
55
+ _cachedNodes: Array<LexicalNode> | null;
56
+ dirty: boolean;
57
+ clone(): BaseSelection;
58
+ extract(): Array<LexicalNode>;
59
+ getNodes(): Array<LexicalNode>;
60
+ getTextContent(): string;
61
+ insertText(text: string): void;
62
+ insertRawText(text: string): void;
63
+ is(selection: null | BaseSelection): boolean;
64
+ insertNodes(nodes: Array<LexicalNode>): void;
65
+ getStartEndPoints(): null | [PointType, PointType];
66
+ isCollapsed(): boolean;
67
+ isBackward(): boolean;
68
+ getCachedNodes(): LexicalNode[] | null;
69
+ setCachedNodes(nodes: LexicalNode[] | null): void;
70
+ }
71
+ export declare class NodeSelection implements BaseSelection {
72
+ _nodes: Set<NodeKey>;
73
+ _cachedNodes: Array<LexicalNode> | null;
74
+ dirty: boolean;
75
+ constructor(objects: Set<NodeKey>);
76
+ getCachedNodes(): LexicalNode[] | null;
77
+ setCachedNodes(nodes: LexicalNode[] | null): void;
78
+ is(selection: null | BaseSelection): boolean;
79
+ isCollapsed(): boolean;
80
+ isBackward(): boolean;
81
+ getStartEndPoints(): null;
82
+ add(key: NodeKey): void;
83
+ delete(key: NodeKey): void;
84
+ clear(): void;
85
+ has(key: NodeKey): boolean;
86
+ clone(): NodeSelection;
87
+ extract(): Array<LexicalNode>;
88
+ insertRawText(text: string): void;
89
+ insertText(): void;
90
+ insertNodes(nodes: Array<LexicalNode>): void;
91
+ getNodes(): Array<LexicalNode>;
92
+ getTextContent(): string;
93
+ /**
94
+ * Remove all nodes in the NodeSelection. If there were any nodes,
95
+ * replace the selection with a new RangeSelection at the previous
96
+ * location of the first node.
97
+ */
98
+ deleteNodes(): void;
99
+ }
100
+ export declare function $isRangeSelection(x: unknown): x is RangeSelection;
101
+ export declare class RangeSelection implements BaseSelection {
102
+ format: number;
103
+ style: string;
104
+ anchor: PointType;
105
+ focus: PointType;
106
+ _cachedNodes: Array<LexicalNode> | null;
107
+ dirty: boolean;
108
+ constructor(anchor: PointType, focus: PointType, format: number, style: string);
109
+ getCachedNodes(): LexicalNode[] | null;
110
+ setCachedNodes(nodes: LexicalNode[] | null): void;
111
+ /**
112
+ * Used to check if the provided selections is equal to this one by value,
113
+ * including anchor, focus, format, and style properties.
114
+ * @param selection - the Selection to compare this one to.
115
+ * @returns true if the Selections are equal, false otherwise.
116
+ */
117
+ is(selection: null | BaseSelection): boolean;
118
+ /**
119
+ * Returns whether the Selection is "collapsed", meaning the anchor and focus are
120
+ * the same node and have the same offset.
121
+ *
122
+ * @returns true if the Selection is collapsed, false otherwise.
123
+ */
124
+ isCollapsed(): boolean;
125
+ /**
126
+ * Gets all the nodes in the Selection. Uses caching to make it generally suitable
127
+ * for use in hot paths.
128
+ *
129
+ * See also the {@link CaretRange} APIs (starting with
130
+ * {@link $caretRangeFromSelection}), which are likely to provide a better
131
+ * foundation for any operation where partial selection is relevant
132
+ * (e.g. the anchor or focus are inside an ElementNode and TextNode)
133
+ *
134
+ * @returns an Array containing all the nodes in the Selection
135
+ */
136
+ getNodes(): Array<LexicalNode>;
137
+ /**
138
+ * Sets this Selection to be of type "text" at the provided anchor and focus values.
139
+ *
140
+ * @param anchorNode - the anchor node to set on the Selection
141
+ * @param anchorOffset - the offset to set on the Selection
142
+ * @param focusNode - the focus node to set on the Selection
143
+ * @param focusOffset - the focus offset to set on the Selection
144
+ */
145
+ setTextNodeRange(
146
+ anchorNode: TextNode,
147
+ anchorOffset: number,
148
+ focusNode: TextNode,
149
+ focusOffset: number,
150
+ ): void;
151
+ /**
152
+ * Gets the (plain) text content of all the nodes in the selection.
153
+ *
154
+ * @returns a string representing the text content of all the nodes in the Selection
155
+ */
156
+ getTextContent(): string;
157
+ /**
158
+ * Attempts to map a DOM selection range onto this Lexical Selection,
159
+ * setting the anchor, focus, and type accordingly
160
+ *
161
+ * @param range a DOM Selection range conforming to the StaticRange interface.
162
+ */
163
+ applyDOMRange(range: StaticRange): void;
164
+ /**
165
+ * Creates a new RangeSelection, copying over all the property values from this one.
166
+ *
167
+ * @returns a new RangeSelection with the same property values as this one.
168
+ */
169
+ clone(): RangeSelection;
170
+ /**
171
+ * Toggles the provided format on all the TextNodes in the Selection.
172
+ *
173
+ * @param format a string TextFormatType to toggle on the TextNodes in the selection
174
+ */
175
+ toggleFormat(format: TextFormatType): void;
176
+ /**
177
+ * Sets the value of the format property on the Selection
178
+ *
179
+ * @param format - the format to set at the value of the format property.
180
+ */
181
+ setFormat(format: number): void;
182
+ /**
183
+ * Sets the value of the style property on the Selection
184
+ *
185
+ * @param style - the style to set at the value of the style property.
186
+ */
187
+ setStyle(style: string): void;
188
+ /**
189
+ * Returns whether the provided TextFormatType is present on the Selection. This will be true if any node in the Selection
190
+ * has the specified format.
191
+ *
192
+ * @param type the TextFormatType to check for.
193
+ * @returns true if the provided format is currently toggled on on the Selection, false otherwise.
194
+ */
195
+ hasFormat(type: TextFormatType): boolean;
196
+ /**
197
+ * Attempts to insert the provided text into the EditorState at the current Selection.
198
+ * converts tabs, newlines, and carriage returns into LexicalNodes.
199
+ *
200
+ * @param text the text to insert into the Selection
201
+ */
202
+ insertRawText(text: string): void;
203
+ /**
204
+ * Insert the provided text into the EditorState at the current Selection.
205
+ *
206
+ * @param text the text to insert into the Selection
207
+ */
208
+ insertText(text: string): void;
209
+ /**
210
+ * Removes the text in the Selection, adjusting the EditorState accordingly.
211
+ */
212
+ removeText(): void;
213
+ /**
214
+ * Applies the provided format to the TextNodes in the Selection, splitting or
215
+ * merging nodes as necessary.
216
+ *
217
+ * @param formatType the format type to apply to the nodes in the Selection.
218
+ * @param alignWithFormat a 32-bit integer representing formatting flags to align with.
219
+ */
220
+ formatText(formatType: TextFormatType, alignWithFormat?: number | null): void;
221
+ /**
222
+ * Attempts to "intelligently" insert an arbitrary list of Lexical nodes into the EditorState at the
223
+ * current Selection according to a set of heuristics that determine how surrounding nodes
224
+ * should be changed, replaced, or moved to accommodate the incoming ones.
225
+ *
226
+ * @param nodes - the nodes to insert
227
+ */
228
+ insertNodes(nodes: Array<LexicalNode>): void;
229
+ /**
230
+ * Inserts a new ParagraphNode into the EditorState at the current Selection
231
+ *
232
+ * @returns the newly inserted node.
233
+ */
234
+ insertParagraph(): ElementNode | null;
235
+ /**
236
+ * Inserts a logical linebreak, which may be a new LineBreakNode or a new ParagraphNode, into the EditorState at the
237
+ * current Selection.
238
+ */
239
+ insertLineBreak(selectStart?: boolean): void;
240
+ /**
241
+ * Extracts the nodes in the Selection, splitting nodes where necessary
242
+ * to get offset-level precision.
243
+ *
244
+ * @returns The nodes in the Selection
245
+ */
246
+ extract(): Array<LexicalNode>;
247
+ /**
248
+ * Modifies the Selection according to the parameters and a set of heuristics that account for
249
+ * various node types. Can be used to safely move or extend selection by one logical "unit" without
250
+ * dealing explicitly with all the possible node types.
251
+ *
252
+ * @param alter the type of modification to perform
253
+ * @param isBackward whether or not selection is backwards
254
+ * @param granularity the granularity at which to apply the modification
255
+ */
256
+ modify(
257
+ alter: 'move' | 'extend',
258
+ isBackward: boolean,
259
+ granularity: 'character' | 'word' | 'lineboundary',
260
+ ): void;
261
+ /**
262
+ * Helper for handling forward character and word deletion that prevents element nodes
263
+ * like a table, columns layout being destroyed
264
+ *
265
+ * @param anchor the anchor
266
+ * @param anchorNode the anchor node in the selection
267
+ * @param isBackward whether or not selection is backwards
268
+ */
269
+ forwardDeletion(
270
+ anchor: PointType,
271
+ anchorNode: TextNode | ElementNode,
272
+ isBackward: boolean,
273
+ ): boolean;
274
+ /**
275
+ * Performs one logical character deletion operation on the EditorState based on the current Selection.
276
+ * Handles different node types.
277
+ *
278
+ * @param isBackward whether or not the selection is backwards.
279
+ */
280
+ deleteCharacter(isBackward: boolean): void;
281
+ /**
282
+ * Performs one logical line deletion operation on the EditorState based on the current Selection.
283
+ * Handles different node types.
284
+ *
285
+ * @param isBackward whether or not the selection is backwards.
286
+ */
287
+ deleteLine(isBackward: boolean): void;
288
+ /**
289
+ * Performs one logical word deletion operation on the EditorState based on the current Selection.
290
+ * Handles different node types.
291
+ *
292
+ * @param isBackward whether or not the selection is backwards.
293
+ */
294
+ deleteWord(isBackward: boolean): void;
295
+ /**
296
+ * Returns whether the Selection is "backwards", meaning the focus
297
+ * logically precedes the anchor in the EditorState.
298
+ * @returns true if the Selection is backwards, false otherwise.
299
+ */
300
+ isBackward(): boolean;
301
+ getStartEndPoints(): null | [PointType, PointType];
302
+ }
303
+ export declare function $isNodeSelection(x: unknown): x is NodeSelection;
304
+ export declare function $getCharacterOffsets(selection: BaseSelection): [number, number];
305
+ export declare function $isBlockElementNode(
306
+ node: LexicalNode | null | undefined,
307
+ ): node is ElementNode;
308
+ export declare function $internalMakeRangeSelection(
309
+ anchorKey: NodeKey,
310
+ anchorOffset: number,
311
+ focusKey: NodeKey,
312
+ focusOffset: number,
313
+ anchorType: 'text' | 'element',
314
+ focusType: 'text' | 'element',
315
+ ): RangeSelection;
316
+ export declare function $createRangeSelection(): RangeSelection;
317
+ export declare function $createNodeSelection(): NodeSelection;
318
+ export declare function $internalCreateSelection(
319
+ editor: LexicalEditor,
320
+ event: UIEvent | Event | null,
321
+ ): null | BaseSelection;
322
+ export declare function $createRangeSelectionFromDom(
323
+ domSelection: Selection | null,
324
+ editor: LexicalEditor,
325
+ ): null | RangeSelection;
326
+ export declare function $internalCreateRangeSelection(
327
+ lastSelection: null | BaseSelection,
328
+ domSelection: Selection | null,
329
+ editor: LexicalEditor,
330
+ event: UIEvent | Event | null,
331
+ ): null | RangeSelection;
332
+ export declare function $getSelection(): null | BaseSelection;
333
+ export declare function $getPreviousSelection(): null | BaseSelection;
334
+ export declare function $updateElementSelectionOnCreateDeleteNode(
335
+ selection: RangeSelection,
336
+ parentNode: LexicalNode,
337
+ nodeOffset: number,
338
+ times?: number,
339
+ ): void;
340
+ export declare function applySelectionTransforms(
341
+ nextEditorState: EditorState,
342
+ editor: LexicalEditor,
343
+ ): void;
344
+ export declare function moveSelectionPointToSibling(
345
+ point: PointType,
346
+ node: LexicalNode,
347
+ parent: ElementNode,
348
+ prevSibling: LexicalNode | null,
349
+ nextSibling: LexicalNode | null,
350
+ ): void;
351
+ export declare function adjustPointOffsetForMergedSibling(
352
+ point: PointType,
353
+ isBefore: boolean,
354
+ key: NodeKey,
355
+ target: TextNode,
356
+ textLength: number,
357
+ ): void;
358
+ export declare function updateDOMSelection(
359
+ prevSelection: BaseSelection | null,
360
+ nextSelection: BaseSelection | null,
361
+ editor: LexicalEditor,
362
+ domSelection: Selection,
363
+ tags: Set<string>,
364
+ rootElement: HTMLElement,
365
+ nodeCount: number,
366
+ ): void;
367
+ export declare function $insertNodes(nodes: Array<LexicalNode>): void;
368
+ export declare function $getTextContent(): string;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * Common update tags used in Lexical. These tags can be used with editor.update() or $addUpdateTag()
10
+ * to indicate the type/purpose of an update. Multiple tags can be used in a single update.
11
+ */
12
+ /**
13
+ * Indicates that the update is related to history operations (undo/redo)
14
+ */
15
+ export declare const HISTORIC_TAG = 'historic';
16
+ /**
17
+ * Indicates that a new history entry should be pushed to the history stack
18
+ */
19
+ export declare const HISTORY_PUSH_TAG = 'history-push';
20
+ /**
21
+ * Indicates that the current update should be merged with the previous history entry
22
+ */
23
+ export declare const HISTORY_MERGE_TAG = 'history-merge';
24
+ /**
25
+ * Indicates that the update is related to a paste operation
26
+ */
27
+ export declare const PASTE_TAG = 'paste';
28
+ /**
29
+ * Indicates that the update is related to collaborative editing
30
+ */
31
+ export declare const COLLABORATION_TAG = 'collaboration';
32
+ /**
33
+ * Indicates that the update should skip collaborative sync
34
+ */
35
+ export declare const SKIP_COLLAB_TAG = 'skip-collab';
36
+ /**
37
+ * Indicates that the update should skip scrolling the selection into view
38
+ */
39
+ export declare const SKIP_SCROLL_INTO_VIEW_TAG = 'skip-scroll-into-view';
40
+ /**
41
+ * Indicates that the update should skip updating the DOM selection
42
+ * This is useful when you want to make updates without changing the selection or focus
43
+ */
44
+ export declare const SKIP_DOM_SELECTION_TAG = 'skip-dom-selection';
45
+ /**
46
+ * Indicates that after changing the selection, the editor should not focus itself
47
+ * This tag is ignored if {@link SKIP_DOM_SELECTION_TAG} is used
48
+ */
49
+ export declare const SKIP_SELECTION_FOCUS_TAG = 'skip-selection-focus';
50
+ /**
51
+ * The update was triggered by editor.focus()
52
+ */
53
+ export declare const FOCUS_TAG = 'focus';
54
+ /**
55
+ * The set of known update tags to help with TypeScript suggestions.
56
+ */
57
+ export type UpdateTag =
58
+ | typeof COLLABORATION_TAG
59
+ | typeof FOCUS_TAG
60
+ | typeof HISTORIC_TAG
61
+ | typeof HISTORY_MERGE_TAG
62
+ | typeof HISTORY_PUSH_TAG
63
+ | typeof PASTE_TAG
64
+ | typeof SKIP_COLLAB_TAG
65
+ | typeof SKIP_DOM_SELECTION_TAG
66
+ | typeof SKIP_SCROLL_INTO_VIEW_TAG
67
+ | (string & {});
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import {
9
+ CommandPayloadType,
10
+ EditorUpdateOptions,
11
+ LexicalCommand,
12
+ LexicalEditor,
13
+ SetListeners,
14
+ Transform,
15
+ } from './LexicalEditor';
16
+ import type { SerializedEditorState } from './LexicalEditorState';
17
+ import { EditorState } from './LexicalEditorState';
18
+ import type { LexicalNode, SerializedLexicalNode } from './LexicalNode';
19
+
20
+ export declare function isCurrentlyReadOnlyMode(): boolean;
21
+ export declare function errorOnReadOnly(): void;
22
+ export declare function errorOnInfiniteTransforms(): void;
23
+ export declare function getActiveEditorState(): EditorState;
24
+ export declare function getActiveEditor(): LexicalEditor;
25
+ export declare function internalGetActiveEditor(): LexicalEditor | null;
26
+ export declare function internalGetActiveEditorState(): EditorState | null;
27
+ export declare function $applyTransforms(
28
+ editor: LexicalEditor,
29
+ node: LexicalNode,
30
+ transformsCache: Map<string, Array<Transform<LexicalNode>>>,
31
+ ): void;
32
+ export declare function $parseSerializedNode(serializedNode: SerializedLexicalNode): LexicalNode;
33
+ export declare function parseEditorState(
34
+ serializedEditorState: SerializedEditorState,
35
+ editor: LexicalEditor,
36
+ updateFn: void | ((editorState: EditorState) => void),
37
+ ): EditorState;
38
+ export declare function readEditorState<V>(
39
+ editor: LexicalEditor | null,
40
+ editorState: EditorState,
41
+ callbackFn: () => V,
42
+ ): V;
43
+ export declare function $commitPendingUpdates(
44
+ editor: LexicalEditor,
45
+ recoveryEditorState?: EditorState,
46
+ ): void;
47
+ export declare function triggerListeners<T extends keyof SetListeners>(
48
+ type: T,
49
+ editor: LexicalEditor,
50
+ isCurrentlyEnqueuingUpdates: boolean,
51
+ ...payload: SetListeners[T]
52
+ ): void;
53
+ export declare function triggerCommandListeners<TCommand extends LexicalCommand<unknown>>(
54
+ editor: LexicalEditor,
55
+ type: TCommand,
56
+ payload: CommandPayloadType<TCommand>,
57
+ ): boolean;
58
+ /**
59
+ * A variant of updateEditor that will not defer if it is nested in an update
60
+ * to the same editor, much like if it was an editor.dispatchCommand issued
61
+ * within an update
62
+ */
63
+ export declare function updateEditorSync(
64
+ editor: LexicalEditor,
65
+ updateFn: () => void,
66
+ options?: EditorUpdateOptions,
67
+ ): void;
68
+ export declare function updateEditor(
69
+ editor: LexicalEditor,
70
+ updateFn: () => void,
71
+ options?: EditorUpdateOptions,
72
+ ): void;