@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,492 @@
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 { DecoratorNode, ElementNode, LineBreakNode, UpdateTag } from '.';
9
+ import type {
10
+ CommandPayloadType,
11
+ EditorThemeClasses,
12
+ Klass,
13
+ LexicalCommand,
14
+ MutatedNodes,
15
+ MutationListeners,
16
+ NodeMutation,
17
+ RegisteredNode,
18
+ RegisteredNodes,
19
+ Spread,
20
+ } from './LexicalEditor';
21
+ import { LexicalEditor } from './LexicalEditor';
22
+ import type { EditorState } from './LexicalEditorState';
23
+ import { LexicalNode, type NodeKey, type NodeMap, type StaticNodeConfigValue } from './LexicalNode';
24
+ import type { BaseSelection, PointType, RangeSelection } from './LexicalSelection';
25
+ import type { RootNode } from './nodes/LexicalRootNode';
26
+ import { type TextFormatType, TextNode } from './nodes/LexicalTextNode';
27
+
28
+ export declare const emptyFunction: () => void;
29
+ export declare function setPendingNodeToClone(pendingNode: null | LexicalNode): void;
30
+ export declare function getPendingNodeToClone(): null | LexicalNode;
31
+ export declare function resetRandomKey(): void;
32
+ export declare function generateRandomKey(): string;
33
+ /**
34
+ * @internal
35
+ */
36
+ export declare function getRegisteredNodeOrThrow(
37
+ editor: LexicalEditor,
38
+ nodeType: string,
39
+ ): RegisteredNode;
40
+ /**
41
+ * @internal
42
+ */
43
+ export declare function getRegisteredNode(
44
+ editor: LexicalEditor,
45
+ nodeType: string,
46
+ ): undefined | RegisteredNode;
47
+ export declare const isArray: (arg: any) => arg is any[];
48
+ /** @internal */
49
+ export declare const scheduleMicroTask: (fn: () => void) => void;
50
+ export declare function $isSelectionCapturedInDecorator(node: Node): boolean;
51
+ export declare function isSelectionCapturedInDecoratorInput(anchorDOM: Node): boolean;
52
+ export declare function isSelectionWithinEditor(
53
+ editor: LexicalEditor,
54
+ anchorDOM: null | Node,
55
+ focusDOM: null | Node,
56
+ ): boolean;
57
+ /**
58
+ * @returns true if the given argument is a LexicalEditor instance from this build of Lexical
59
+ */
60
+ export declare function isLexicalEditor(editor: unknown): editor is LexicalEditor;
61
+ export declare function getNearestEditorFromDOMNode(node: Node | null): LexicalEditor | null;
62
+ /** @internal */
63
+ export declare function getEditorPropertyFromDOMNode(node: Node | null): unknown;
64
+ export declare function getTextDirection(text: string): 'ltr' | 'rtl' | null;
65
+ /**
66
+ * Return true if the TextNode is a TabNode or is in token mode.
67
+ */
68
+ export declare function $isTokenOrTab(node: TextNode): boolean;
69
+ /**
70
+ * Return true if the TextNode is a TabNode, or is in token or segmented mode.
71
+ */
72
+ export declare function $isTokenOrSegmented(node: TextNode): boolean;
73
+ /**
74
+ * @param node - The element being tested
75
+ * @returns Returns true if node is an DOM Text node, false otherwise.
76
+ */
77
+ export declare function isDOMTextNode(node: unknown): node is Text;
78
+ /**
79
+ * @param node - The element being tested
80
+ * @returns Returns true if node is an DOM Document node, false otherwise.
81
+ */
82
+ export declare function isDOMDocumentNode(node: unknown): node is Document;
83
+ export declare function getDOMTextNode(element: Node | null): Text | null;
84
+ export declare function toggleTextFormatType(
85
+ format: number,
86
+ type: TextFormatType,
87
+ alignWithFormat: null | number,
88
+ ): number;
89
+ export declare function $isLeafNode(
90
+ node: LexicalNode | null | undefined,
91
+ ): node is TextNode | LineBreakNode | DecoratorNode<unknown>;
92
+ export declare function $setNodeKey(
93
+ node: LexicalNode,
94
+ existingKey: NodeKey | null | undefined,
95
+ ): void;
96
+ /**
97
+ * Removes a node from its parent, updating all necessary pointers and links.
98
+ * @internal
99
+ *
100
+ * This function is for internal use of the library.
101
+ * Please do not use it as it may change in the future.
102
+ */
103
+ export declare function removeFromParent(node: LexicalNode): void;
104
+ export declare function internalMarkNodeAsDirty(node: LexicalNode): void;
105
+ export declare function internalMarkSiblingsAsDirty(node: LexicalNode): void;
106
+ export declare function $setCompositionKey(compositionKey: null | NodeKey): void;
107
+ export declare function $getCompositionKey(): null | NodeKey;
108
+ export declare function $getNodeByKey<T extends LexicalNode>(
109
+ key: NodeKey,
110
+ _editorState?: EditorState,
111
+ ): T | null;
112
+ export declare function $getNodeFromDOMNode(
113
+ dom: Node,
114
+ editorState?: EditorState,
115
+ ): LexicalNode | null;
116
+ export declare function setNodeKeyOnDOMNode(dom: Node, editor: LexicalEditor, key: NodeKey): void;
117
+ export declare function getNodeKeyFromDOMNode(
118
+ dom: Node,
119
+ editor: LexicalEditor,
120
+ ): NodeKey | undefined;
121
+ export declare function $getNearestNodeFromDOMNode(
122
+ startingDOM: Node,
123
+ editorState?: EditorState,
124
+ ): LexicalNode | null;
125
+ export declare function cloneDecorators(editor: LexicalEditor): Record<NodeKey, unknown>;
126
+ export declare function getEditorStateTextContent(editorState: EditorState): string;
127
+ export declare function markNodesWithTypesAsDirty(editor: LexicalEditor, types: string[]): void;
128
+ export declare function $getRoot(): RootNode;
129
+ export declare function internalGetRoot(editorState: EditorState): RootNode;
130
+ export declare function $setSelection(selection: null | BaseSelection): void;
131
+ export declare function $flushMutations(): void;
132
+ export declare function $getNodeFromDOM(dom: Node): null | LexicalNode;
133
+ /**
134
+ * Return true if `str` contains any valid surrogate pair.
135
+ *
136
+ * See also $updateCaretSelectionForUnicodeCharacter for
137
+ * a discussion on when and why this is useful.
138
+ */
139
+ export declare function doesContainSurrogatePair(str: string): boolean;
140
+ export declare function getEditorsToPropagate(editor: LexicalEditor): Array<LexicalEditor>;
141
+ export declare function createUID(): string;
142
+ export declare function getAnchorTextFromDOM(anchorNode: Node): null | string;
143
+ export declare function $updateSelectedTextFromDOM(
144
+ isCompositionEnd: boolean,
145
+ editor: LexicalEditor,
146
+ data?: string,
147
+ ): void;
148
+ export declare function $updateTextNodeFromDOMContent(
149
+ textNode: TextNode,
150
+ textContent: string,
151
+ anchorOffset: null | number,
152
+ focusOffset: null | number,
153
+ compositionEnd: boolean,
154
+ ): void;
155
+ export declare function $shouldInsertTextAfterOrBeforeTextNode(
156
+ selection: RangeSelection,
157
+ node: TextNode,
158
+ ): boolean;
159
+ /**
160
+ * A KeyboardEvent or structurally similar object with a string `key` as well
161
+ * as `altKey`, `ctrlKey`, `metaKey`, and `shiftKey` boolean properties.
162
+ */
163
+ export type KeyboardEventModifiers = Pick<
164
+ KeyboardEvent,
165
+ 'key' | 'metaKey' | 'ctrlKey' | 'shiftKey' | 'altKey'
166
+ >;
167
+ /**
168
+ * A record of keyboard modifiers that must be enabled.
169
+ * If the value is `'any'` then the modifier key's state is ignored.
170
+ * If the value is `true` then the modifier key must be pressed.
171
+ * If the value is `false` or the property is omitted then the modifier key must
172
+ * not be pressed.
173
+ */
174
+ export type KeyboardEventModifierMask = {
175
+ [K in Exclude<keyof KeyboardEventModifiers, 'key'>]?: boolean | undefined | 'any';
176
+ };
177
+ /**
178
+ * Match a KeyboardEvent with its expected modifier state
179
+ *
180
+ * @param event A KeyboardEvent, or structurally similar object
181
+ * @param mask An object specifying the expected state of the modifiers
182
+ * @returns true if the event matches
183
+ */
184
+ export declare function isModifierMatch(
185
+ event: KeyboardEventModifiers,
186
+ mask: KeyboardEventModifierMask,
187
+ ): boolean;
188
+ /**
189
+ * Match a KeyboardEvent with its expected state
190
+ *
191
+ * @param event A KeyboardEvent, or structurally similar object
192
+ * @param expectedKey The string to compare with event.key (case insensitive)
193
+ * @param mask An object specifying the expected state of the modifiers
194
+ * @returns true if the event matches
195
+ */
196
+ export declare function isExactShortcutMatch(
197
+ event: KeyboardEventModifiers,
198
+ expectedKey: string,
199
+ mask: KeyboardEventModifierMask,
200
+ ): boolean;
201
+ export declare function isTab(event: KeyboardEventModifiers): boolean;
202
+ export declare function isBold(event: KeyboardEventModifiers): boolean;
203
+ export declare function isItalic(event: KeyboardEventModifiers): boolean;
204
+ export declare function isUnderline(event: KeyboardEventModifiers): boolean;
205
+ export declare function isParagraph(event: KeyboardEventModifiers): boolean;
206
+ export declare function isLineBreak(event: KeyboardEventModifiers): boolean;
207
+ export declare function isOpenLineBreak(event: KeyboardEventModifiers): boolean;
208
+ export declare function isDeleteWordBackward(event: KeyboardEventModifiers): boolean;
209
+ export declare function isDeleteWordForward(event: KeyboardEventModifiers): boolean;
210
+ export declare function isDeleteLineBackward(event: KeyboardEventModifiers): boolean;
211
+ export declare function isDeleteLineForward(event: KeyboardEventModifiers): boolean;
212
+ export declare function isDeleteBackward(event: KeyboardEventModifiers): boolean;
213
+ export declare function isDeleteForward(event: KeyboardEventModifiers): boolean;
214
+ export declare function isUndo(event: KeyboardEventModifiers): boolean;
215
+ export declare function isRedo(event: KeyboardEventModifiers): boolean;
216
+ export declare function isCopy(event: KeyboardEventModifiers): boolean;
217
+ export declare function isCut(event: KeyboardEventModifiers): boolean;
218
+ export declare function isMoveBackward(event: KeyboardEventModifiers): boolean;
219
+ export declare function isMoveToStart(event: KeyboardEventModifiers): boolean;
220
+ export declare function isMoveForward(event: KeyboardEventModifiers): boolean;
221
+ export declare function isMoveToEnd(event: KeyboardEventModifiers): boolean;
222
+ export declare function isMoveUp(event: KeyboardEventModifiers): boolean;
223
+ export declare function isMoveDown(event: KeyboardEventModifiers): boolean;
224
+ export declare function isModifier(event: KeyboardEventModifiers): boolean;
225
+ export declare function isSpace(event: KeyboardEventModifiers): boolean;
226
+ export declare function controlOrMeta(metaKey: boolean, ctrlKey: boolean): boolean;
227
+ export declare function isBackspace(event: KeyboardEventModifiers): boolean;
228
+ export declare function isEscape(event: KeyboardEventModifiers): boolean;
229
+ export declare function isDelete(event: KeyboardEventModifiers): boolean;
230
+ export declare function isSelectAll(event: KeyboardEventModifiers): boolean;
231
+ export declare function $selectAll(selection?: RangeSelection | null): RangeSelection;
232
+ export declare function getCachedClassNameArray(
233
+ classNamesTheme: EditorThemeClasses,
234
+ classNameThemeType: string,
235
+ ): Array<string>;
236
+ export declare function setMutatedNode(
237
+ mutatedNodes: MutatedNodes,
238
+ registeredNodes: RegisteredNodes,
239
+ mutationListeners: MutationListeners,
240
+ node: LexicalNode,
241
+ mutation: NodeMutation,
242
+ ): void;
243
+ /**
244
+ * @deprecated Use {@link LexicalEditor.registerMutationListener} with `skipInitialization: false` instead.
245
+ */
246
+ export declare function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<T>;
247
+ export declare function $getAdjacentNode(focus: PointType, isBackward: boolean): null | LexicalNode;
248
+ export declare function isFirefoxClipboardEvents(editor: LexicalEditor): boolean;
249
+ export declare function dispatchCommand<TCommand extends LexicalCommand<unknown>>(
250
+ editor: LexicalEditor,
251
+ command: TCommand,
252
+ payload: CommandPayloadType<TCommand>,
253
+ ): boolean;
254
+ export declare function $textContentRequiresDoubleLinebreakAtEnd(node: ElementNode): boolean;
255
+ export declare function getElementByKeyOrThrow(editor: LexicalEditor, key: NodeKey): HTMLElement;
256
+ export declare function getParentElement(node: Node): HTMLElement | null;
257
+ export declare function getDOMOwnerDocument(target: EventTarget | null): Document | null;
258
+ export declare function scrollIntoViewIfNeeded(
259
+ editor: LexicalEditor,
260
+ selectionRect: DOMRect,
261
+ rootElement: HTMLElement,
262
+ ): void;
263
+ export declare function $hasUpdateTag(tag: UpdateTag): boolean;
264
+ export declare function $addUpdateTag(tag: UpdateTag): void;
265
+ /**
266
+ * Add a function to run after the current update. This will run after any
267
+ * `onUpdate` function already supplied to `editor.update()`, as well as any
268
+ * functions added with previous calls to `$onUpdate`.
269
+ *
270
+ * @param updateFn The function to run after the current update.
271
+ */
272
+ export declare function $onUpdate(updateFn: () => void): void;
273
+ export declare function $maybeMoveChildrenSelectionToParent(
274
+ parentNode: LexicalNode,
275
+ ): BaseSelection | null;
276
+ export declare function $hasAncestor(child: LexicalNode, targetNode: LexicalNode): boolean;
277
+ export declare function getDefaultView(domElem: EventTarget | null): Window | null;
278
+ export declare function getWindow(editor: LexicalEditor): Window;
279
+ export declare function $isInlineElementOrDecoratorNode(node: LexicalNode): boolean;
280
+ export declare function $getNearestRootOrShadowRoot(node: LexicalNode): RootNode | ElementNode;
281
+ declare const ShadowRootNodeBrand: unique symbol;
282
+ type ShadowRootNode = Spread<
283
+ {
284
+ isShadowRoot(): true;
285
+ [ShadowRootNodeBrand]: never;
286
+ },
287
+ ElementNode
288
+ >;
289
+ export declare function $isRootOrShadowRoot(
290
+ node: null | LexicalNode,
291
+ ): node is RootNode | ShadowRootNode;
292
+ /**
293
+ * Returns a shallow clone of node with a new key. All properties of the node
294
+ * will be copied to the new node (by `clone` and then `afterCloneFrom`),
295
+ * except those related to parent/sibling/child
296
+ * relationships in the `EditorState`. This means that the copy must be
297
+ * separately added to the document, and it will not have any children.
298
+ *
299
+ * @param node - The node to be copied.
300
+ * @returns The copy of the node.
301
+ */
302
+ export declare function $copyNode<T extends LexicalNode>(node: T): T;
303
+ export declare function $applyNodeReplacement<N extends LexicalNode>(node: N): N;
304
+ export declare function errorOnInsertTextNodeOnRoot(
305
+ node: LexicalNode,
306
+ insertNode: LexicalNode,
307
+ ): void;
308
+ export declare function $getNodeByKeyOrThrow<N extends LexicalNode>(key: NodeKey): N;
309
+ export declare function removeDOMBlockCursorElement(
310
+ blockCursorElement: HTMLElement,
311
+ editor: LexicalEditor,
312
+ rootElement: HTMLElement,
313
+ ): void;
314
+ export declare function updateDOMBlockCursorElement(
315
+ editor: LexicalEditor,
316
+ rootElement: HTMLElement,
317
+ nextSelection: null | BaseSelection,
318
+ ): void;
319
+ /**
320
+ * Returns the selection for the given window, or the global window if null.
321
+ * Will return null if {@link CAN_USE_DOM} is false.
322
+ *
323
+ * @param targetWindow The window to get the selection from
324
+ * @returns a Selection or null
325
+ */
326
+ export declare function getDOMSelection(targetWindow: null | Window): null | Selection;
327
+ /**
328
+ * Returns the selection for the defaultView of the ownerDocument of given EventTarget.
329
+ *
330
+ * @param eventTarget The node to get the selection from
331
+ * @returns a Selection or null
332
+ */
333
+ export declare function getDOMSelectionFromTarget(
334
+ eventTarget: null | EventTarget,
335
+ ): null | Selection;
336
+ export declare function $splitNode(
337
+ node: ElementNode,
338
+ offset: number,
339
+ ): [ElementNode | null, ElementNode];
340
+ /**
341
+ * @param x - The element being tested
342
+ * @returns Returns true if x is an HTML anchor tag, false otherwise
343
+ */
344
+ export declare function isHTMLAnchorElement(x: unknown): x is HTMLAnchorElement;
345
+ /**
346
+ * @param x - The element being tested
347
+ * @returns Returns true if x is an HTML element, false otherwise.
348
+ */
349
+ export declare function isHTMLElement(x: unknown): x is HTMLElement;
350
+ /**
351
+ * @param x - The element being tested
352
+ * @returns Returns true if x is a DOM Node, false otherwise.
353
+ */
354
+ export declare function isDOMNode(x: unknown): x is Node;
355
+ /**
356
+ * @param x - The element being testing
357
+ * @returns Returns true if x is a document fragment, false otherwise.
358
+ */
359
+ export declare function isDocumentFragment(x: unknown): x is DocumentFragment;
360
+ /**
361
+ *
362
+ * @param node - the Dom Node to check
363
+ * @returns if the Dom Node is an inline node
364
+ */
365
+ export declare function isInlineDomNode(node: Node): boolean;
366
+ /**
367
+ *
368
+ * @param node - the Dom Node to check
369
+ * @returns if the Dom Node is a block node
370
+ */
371
+ export declare function isBlockDomNode(node: Node): boolean;
372
+ /**
373
+ * @internal
374
+ *
375
+ * This function is for internal use of the library.
376
+ * Please do not use it as it may change in the future.
377
+ *
378
+ * This function returns true for a DecoratorNode that is not inline OR
379
+ * an ElementNode that is:
380
+ * - not a root or shadow root
381
+ * - not inline
382
+ * - can't be empty
383
+ * - has no children or an inline first child
384
+ */
385
+ export declare function INTERNAL_$isBlock(
386
+ node: LexicalNode,
387
+ ): node is ElementNode | DecoratorNode<unknown>;
388
+ /**
389
+ * Utility function for accessing current active editor instance.
390
+ * @returns Current active editor
391
+ */
392
+ export declare function $getEditor(): LexicalEditor;
393
+ /** @internal */
394
+ export type TypeToNodeMap = Map<string, NodeMap>;
395
+ export declare function getCachedTypeToNodeMap(editorState: EditorState): TypeToNodeMap;
396
+ /**
397
+ * Returns a clone of a node using `node.constructor.clone()` followed by
398
+ * `clone.afterCloneFrom(node)`. The resulting clone must have the same key,
399
+ * parent/next/prev pointers, and other properties that are not set by
400
+ * `node.constructor.clone` (format, style, etc.). This is primarily used by
401
+ * {@link LexicalNode.getWritable} to create a writable version of an
402
+ * existing node. The clone is the same logical node as the original node,
403
+ * do not try and use this function to duplicate or copy an existing node.
404
+ *
405
+ * Does not mutate the EditorState.
406
+ * @param latestNode - The node to be cloned.
407
+ * @returns The clone of the node.
408
+ */
409
+ export declare function $cloneWithProperties<T extends LexicalNode>(latestNode: T): T;
410
+ /**
411
+ * Returns a clone with {@link $cloneWithProperties} and then "detaches"
412
+ * it from the state by overriding its getLatest and getWritable to always
413
+ * return this. This node can not be added to an EditorState or become the
414
+ * parent, child, or sibling of another node. It is primarily only useful
415
+ * for making in-place temporary modifications to a TextNode when
416
+ * serializing a partial slice.
417
+ *
418
+ * Does not mutate the EditorState.
419
+ * @param latestNode - The node to be cloned.
420
+ * @returns The clone of the node.
421
+ */
422
+ export declare function $cloneWithPropertiesEphemeral<T extends LexicalNode>(latestNode: T): T;
423
+ export declare function setNodeIndentFromDOM(
424
+ elementDom: HTMLElement,
425
+ elementNode: ElementNode,
426
+ ): void;
427
+ /**
428
+ * @internal
429
+ *
430
+ * Mark this node as unmanaged by lexical's mutation observer like
431
+ * decorator nodes
432
+ */
433
+ export declare function setDOMUnmanaged(elementDom: HTMLElement): void;
434
+ /**
435
+ * @internal
436
+ *
437
+ * True if this DOM node was marked with {@link setDOMUnmanaged}
438
+ */
439
+ export declare function isDOMUnmanaged(elementDom: Node): boolean;
440
+ /**
441
+ * @internal
442
+ */
443
+ export declare function hasOwnStaticMethod(
444
+ klass: Klass<LexicalNode>,
445
+ k: keyof Klass<LexicalNode>,
446
+ ): boolean;
447
+ /**
448
+ * @internal
449
+ */
450
+ export declare function hasOwnExportDOM(klass: Klass<LexicalNode>): boolean;
451
+ /** @internal */
452
+ export declare function getStaticNodeConfig(klass: Klass<LexicalNode>): {
453
+ ownNodeType: undefined | string;
454
+ ownNodeConfig: undefined | StaticNodeConfigValue<LexicalNode, string>;
455
+ };
456
+ /**
457
+ * Create an node from its class.
458
+ *
459
+ * Note that this will directly construct the final `withKlass` node type,
460
+ * and will ignore the deprecated `with` functions. This allows `$create` to
461
+ * skip any intermediate steps where the replaced node would be created and
462
+ * then immediately discarded (once per configured replacement of that node).
463
+ *
464
+ * This does not support any arguments to the constructor.
465
+ * Setters can be used to initialize your node, and they can
466
+ * be chained. You can of course write your own mutliple-argument functions
467
+ * to wrap that.
468
+ *
469
+ * @example
470
+ * ```ts
471
+ * function $createTokenText(text: string): TextNode {
472
+ * return $create(TextNode).setTextContent(text).setMode('token');
473
+ * }
474
+ * ```
475
+ */
476
+ export declare function $create<T extends LexicalNode>(klass: Klass<T>): T;
477
+ /**
478
+ * Starts with a node and moves up the tree (toward the root node) to find a matching node based on
479
+ * the search parameters of the findFn. (Consider JavaScripts' .find() function where a testing function must be
480
+ * passed as an argument. eg. if( (node) => node.__type === 'div') ) return true; otherwise return false
481
+ * @param startingNode - The node where the search starts.
482
+ * @param findFn - A testing function that returns true if the current node satisfies the testing parameters.
483
+ * @returns `startingNode` or one of its ancestors that matches the `findFn` predicate and is not the `RootNode`, or `null` if no match was found.
484
+ */
485
+ export declare const $findMatchingParent: {
486
+ <T extends LexicalNode>(
487
+ startingNode: LexicalNode,
488
+ findFn: (node: LexicalNode) => node is T,
489
+ ): T | null;
490
+ (startingNode: LexicalNode, findFn: (node: LexicalNode) => boolean): LexicalNode | null;
491
+ };
492
+ export {};