@lobehub/editor 4.29.1 → 5.0.0-beta.1

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 (149) hide show
  1. package/README.md +86 -0
  2. package/es/codemirror/components/CopyButton.js +1 -1
  3. package/es/codemirror/components/LanguageSelect.js +1 -3
  4. package/es/codemirror/components/MoreOptions.js +1 -2
  5. package/es/codemirror/components/Toolbar.js +1 -2
  6. package/es/codemirror/components/style.js +1 -1
  7. package/es/codemirror/style.js +1 -1
  8. package/es/codemirror/theme.js +1 -1
  9. package/es/editor-kernel/index.d.ts +2 -2
  10. package/es/editor-kernel/index.js +2 -2
  11. package/es/editor-kernel/react/useAnchor.js +1 -1
  12. package/es/headless/index.d.ts +5 -2
  13. package/es/headless/index.js +20 -22
  14. package/es/headless.d.ts +6 -507
  15. package/es/headless.js +903 -408
  16. package/es/i-node-identity-service-BBC_bg97.d.ts +522 -0
  17. package/es/index.d.ts +4 -2
  18. package/es/index.js +5 -2
  19. package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.js +1 -1
  20. package/es/plugins/auto-complete/react/style.js +1 -1
  21. package/es/plugins/block/react/ReactBlockPlugin.js +2 -7
  22. package/es/plugins/block/react/style.js +1 -1
  23. package/es/plugins/code/react/CodeReactPlugin.js +1 -1
  24. package/es/plugins/code/react/style.js +1 -1
  25. package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +1 -1
  26. package/es/plugins/codeblock/react/style.js +1 -1
  27. package/es/plugins/codemirror-block/react/CodemirrorNode.js +1 -3
  28. package/es/plugins/codemirror-block/react/MermaidPreview.js +1 -2
  29. package/es/plugins/collapsible/react/ReactCollapsiblePlugin.js +1 -1
  30. package/es/plugins/collapsible/react/style.js +74 -64
  31. package/es/plugins/common/data-source/json-data-source.js +33 -25
  32. package/es/plugins/common/data-source/text-data-source.js +6 -1
  33. package/es/plugins/common/index.d.ts +3 -1
  34. package/es/plugins/common/node/node-id.d.ts +7 -0
  35. package/es/plugins/common/node/node-id.js +484 -0
  36. package/es/plugins/common/node/node-identity-policy.d.ts +26 -0
  37. package/es/plugins/common/node/node-identity-policy.js +68 -0
  38. package/es/plugins/common/plugin/index.js +28 -2
  39. package/es/plugins/common/react/Placeholder/style.js +1 -1
  40. package/es/plugins/common/react/ReactPlainText.js +1 -1
  41. package/es/plugins/common/react/style.js +1 -1
  42. package/es/plugins/common/service/i-node-identity-service.d.ts +19 -0
  43. package/es/plugins/common/service/i-node-identity-service.js +4 -0
  44. package/es/plugins/common/service/node-identity-service.js +87 -0
  45. package/es/plugins/common/utils/index.js +3 -1
  46. package/es/plugins/file/react/components/ReactFile.js +1 -1
  47. package/es/plugins/file/react/style.js +1 -1
  48. package/es/plugins/hr/react/components/HRNode.js +1 -1
  49. package/es/plugins/hr/react/style.js +1 -1
  50. package/es/plugins/image/react/components/Image.js +1 -3
  51. package/es/plugins/image/react/components/ImageEditPopover.js +1 -3
  52. package/es/plugins/image/react/components/LazyImage.js +1 -1
  53. package/es/plugins/image/react/components/ResizeHandle.js +1 -1
  54. package/es/plugins/image/react/components/style.js +1 -1
  55. package/es/plugins/image/react/style.js +1 -1
  56. package/es/plugins/link/react/ReactLinkPlugin.js +1 -1
  57. package/es/plugins/link/react/components/LinkEdit.js +1 -3
  58. package/es/plugins/link/react/components/LinkToolbar.js +1 -1
  59. package/es/plugins/link/react/style.js +1 -1
  60. package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.js +1 -1
  61. package/es/plugins/link-highlight/react/style.js +1 -1
  62. package/es/plugins/list/plugin/index.js +7 -1
  63. package/es/plugins/list/react/style.js +1 -1
  64. package/es/plugins/litexml/command/index.d.ts +2 -2
  65. package/es/plugins/litexml/command/index.js +464 -292
  66. package/es/plugins/litexml/command/symbols.d.ts +18 -7
  67. package/es/plugins/litexml/command/symbols.js +2 -1
  68. package/es/plugins/litexml/data-source/litexml-data-source.js +34 -31
  69. package/es/plugins/litexml/diff-validation.js +68 -14
  70. package/es/plugins/litexml/index.d.ts +2 -2
  71. package/es/plugins/litexml/node/identity-policy.js +91 -0
  72. package/es/plugins/litexml/plugin/index.js +6 -0
  73. package/es/plugins/litexml/react/DiffNodeToolbar/index.js +1 -3
  74. package/es/plugins/litexml/react/DiffNodeToolbar/style.js +1 -1
  75. package/es/plugins/litexml/react/TableRowDiffToolbar.js +1 -3
  76. package/es/plugins/litexml/react/style.js +1 -1
  77. package/es/plugins/litexml/table-cell-diff.js +4 -0
  78. package/es/plugins/litexml/table-row-diff.js +4 -0
  79. package/es/plugins/litexml/utils/index.js +10 -23
  80. package/es/plugins/markdown/command/index.js +77 -4
  81. package/es/plugins/markdown/data-source/markdown-data-source.js +6 -1
  82. package/es/plugins/markdown/react/index.js +1 -1
  83. package/es/plugins/math/react/components/MathEditorContainer.js +1 -1
  84. package/es/plugins/math/react/components/MathEditorContent.js +1 -2
  85. package/es/plugins/math/react/components/Placeholder.js +1 -3
  86. package/es/plugins/math/react/style.js +1 -1
  87. package/es/plugins/mention/react/components/Mention.js +1 -1
  88. package/es/plugins/mention/react/style.js +1 -1
  89. package/es/plugins/slash/react/components/DefaultSlashMenu.js +1 -2
  90. package/es/plugins/slash/service/i-slash-service.d.ts +2 -2
  91. package/es/plugins/table/react/TableActionMenu/ActionMenu.js +1 -1
  92. package/es/plugins/table/react/TableActionMenu/index.js +1 -1
  93. package/es/plugins/table/react/TableActionMenu/style.js +1 -1
  94. package/es/plugins/table/react/TableColController.js +1 -1
  95. package/es/plugins/table/react/TableController/style.js +1 -1
  96. package/es/plugins/table/react/TableControllerButton.js +2 -2
  97. package/es/plugins/table/react/TableControllerMenu.js +2 -2
  98. package/es/plugins/table/react/TableHoverActions/index.js +1 -2
  99. package/es/plugins/table/react/TableHoverActions/style.js +1 -1
  100. package/es/plugins/table/react/TableResize/index.js +2 -2
  101. package/es/plugins/table/react/TableResize/style.js +1 -1
  102. package/es/plugins/table/react/TableRowController.js +1 -1
  103. package/es/plugins/table/react/index.js +1 -1
  104. package/es/plugins/table/react/style.js +1 -1
  105. package/es/plugins/toolbar/react/index.js +1 -2
  106. package/es/plugins/toolbar/react/style.js +1 -1
  107. package/es/plugins/yjs/plugin/index.js +5 -3
  108. package/es/plugins/yjs/plugin/utils/editor-state.js +8 -1
  109. package/es/plugins/yjs/plugin/utils/node-identity.js +106 -0
  110. package/es/plugins/yjs/service/index.js +38 -4
  111. package/es/react/ChatInput/ChatInput.js +1 -2
  112. package/es/react/ChatInput/style.js +1 -1
  113. package/es/react/ChatInput/type.d.ts +1 -1
  114. package/es/react/ChatInputActionBar/ChatInputActionBar.js +1 -2
  115. package/es/react/ChatInputActionBar/style.js +1 -1
  116. package/es/react/ChatInputActionBar/type.d.ts +1 -1
  117. package/es/react/ChatInputActions/ChatInputActions.js +1 -2
  118. package/es/react/ChatInputActions/components/ActionItem.js +1 -1
  119. package/es/react/ChatInputActions/components/ActionRender.js +1 -1
  120. package/es/react/ChatInputActions/components/CollapsedActions.js +1 -2
  121. package/es/react/ChatInputActions/style.js +1 -1
  122. package/es/react/ChatInputActions/type.d.ts +4 -4
  123. package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +1 -3
  124. package/es/react/CodeLanguageSelect/style.js +1 -1
  125. package/es/react/CodeLanguageSelect/type.d.ts +1 -1
  126. package/es/react/FloatActions/FloatActions.js +1 -2
  127. package/es/react/FloatActions/components/ActionItem.js +1 -1
  128. package/es/react/FloatActions/components/ActionRender.js +1 -1
  129. package/es/react/FloatActions/components/CollapsedActions.js +1 -2
  130. package/es/react/FloatActions/style.js +1 -1
  131. package/es/react/FloatActions/type.d.ts +4 -4
  132. package/es/react/SendButton/SendButton.js +1 -2
  133. package/es/react/SendButton/components/SendIcon.js +1 -1
  134. package/es/react/SendButton/components/StopIcon.js +1 -1
  135. package/es/react/SendButton/style.js +1 -1
  136. package/es/react/SendButton/type.d.ts +1 -1
  137. package/es/renderer/LexicalDiff.js +1 -1
  138. package/es/renderer/LexicalRenderer.js +1 -1
  139. package/es/renderer/diff/compute.js +2 -2
  140. package/es/renderer/diff/style.js +1 -1
  141. package/es/renderer/engine/render-builtin-node.js +2 -2
  142. package/es/renderer/renderers/codeblock.js +1 -1
  143. package/es/renderer/renderers/horizontalrule.js +1 -1
  144. package/es/renderer/renderers/mermaid.js +1 -1
  145. package/es/renderer/style.js +1 -1
  146. package/es/{symbols-Do7jD4Tt.d.ts → symbols-Dyr9yyS0.d.ts} +18 -7
  147. package/package.json +6 -8
  148. package/scripts/postinstall-lexical-patch.cjs +0 -21
  149. package/patches/lexical@0.42.0.patch +0 -82
package/es/headless.d.ts CHANGED
@@ -1,509 +1,7 @@
1
- import { o as LITEXML_MODIFY_COMMAND } from "./symbols-Do7jD4Tt.js";
2
- import { HistoryState, HistoryStateEntry } from "@lexical/history";
3
- import { CommandListener, CommandListenerPriority, CommandPayloadType, EditorState, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, LexicalNodeConfig, SerializedEditorState, SerializedLexicalNode } from "lexical";
4
- //#region src/editor-kernel/data-source.d.ts
5
- interface IWriteOptions {
6
- selection?: boolean;
7
- }
8
- declare class DataSource {
9
- protected dataType: string;
10
- constructor(dataType: string);
11
- get type(): string;
12
- read(editor: LexicalEditor, data: any, options?: Record<string, unknown>): void;
13
- write(editor: LexicalEditor, options?: IWriteOptions): any;
14
- }
15
- //#endregion
16
- //#region src/types/hotkey.d.ts
17
- declare const HotkeyEnum: {
18
- readonly Bold: "bold";
19
- readonly BulletList: "bulletList";
20
- readonly CodeInline: "codeInline";
21
- readonly Italic: "italic";
22
- readonly Link: "link";
23
- readonly Mention: "mention";
24
- readonly NumberList: "numberList";
25
- readonly PasteAsPlainText: "pasteAsPlainText";
26
- readonly Redo: "redo";
27
- readonly Slash: "slash";
28
- readonly Strikethrough: "strikethrough";
29
- readonly Underline: "underline";
30
- readonly Undo: "undo";
31
- };
32
- type HotkeyId = (typeof HotkeyEnum)[keyof typeof HotkeyEnum];
33
- type ModifierCombination = {
34
- altKey?: boolean;
35
- ctrlKey?: boolean;
36
- metaKey?: boolean;
37
- shiftKey?: boolean;
38
- } | Record<string, never>;
39
- //#endregion
40
- //#region src/utils/hotkey/registerHotkey.d.ts
41
- type HotkeysEvent = {
42
- key?: string;
43
- keys: string;
44
- modifiers: ModifierCombination;
45
- scopes?: string[];
46
- };
47
- type HotkeyOptions = {
48
- enabled?: boolean;
49
- preventDefault?: boolean;
50
- stopImmediatePropagation?: boolean;
51
- stopPropagation?: boolean;
52
- };
53
- //#endregion
54
- //#region src/locale/index.d.ts
55
- declare const _default: {
56
- block: {
57
- copy: string;
58
- delete: string;
59
- select: string;
60
- };
61
- cancel: string;
62
- codemirror: {
63
- copySuccess: string;
64
- preview: string;
65
- selectLanguage: string;
66
- selectTheme: string;
67
- showLineNumbers: string;
68
- tabSize: string;
69
- theme: string;
70
- useTabs: string;
71
- };
72
- confirm: string;
73
- file: {
74
- error: string;
75
- uploading: string;
76
- };
77
- image: {
78
- broken: string;
79
- preview: string;
80
- replace: string;
81
- };
82
- link: {
83
- copy: string;
84
- copySuccess: string;
85
- convertToCard: string;
86
- convertToIframe: string;
87
- convertToLink: string;
88
- convertToSchema: string;
89
- edit: string;
90
- editLinkTitle: string;
91
- editTextTitle: string;
92
- open: string;
93
- placeholder: string;
94
- unlink: string;
95
- };
96
- markdown: {
97
- autoFormatMessage: string;
98
- autoFormatTitle: string;
99
- cancel: string;
100
- confirm: string;
101
- parseMessage: string;
102
- parseTitle: string;
103
- };
104
- math: {
105
- placeholder: string;
106
- };
107
- modifier: {
108
- accept: string;
109
- acceptAll: string;
110
- reject: string;
111
- rejectedAll: string;
112
- };
113
- table: {
114
- delete: string;
115
- deleteColumn: string;
116
- deleteRow: string;
117
- insertColumnLeft: string;
118
- insertColumnRight: string;
119
- insertRowAbove: string;
120
- insertRowBelow: string;
121
- };
122
- toc: {
123
- ariaLabel: string;
124
- empty: string;
125
- expand: string;
126
- pin: string;
127
- title: string;
128
- unpin: string;
129
- };
130
- };
131
- //#endregion
132
- //#region src/types/locale.d.ts
133
- /**
134
- * Internationalization key type declaration, plugins can extend through declaration merging
135
- */
136
- type LocaleType = typeof _default;
137
- type FlattenKeys<T, Prefix extends string = ''> = { [K in keyof T & string]: T[K] extends string ? Prefix extends '' ? K : `${Prefix}.${K}` : T[K] extends Record<string, any> ? FlattenKeys<T[K], Prefix extends '' ? K : `${Prefix}.${K}`> : never; }[keyof T & string];
138
- type ILocaleKeys = Record<FlattenKeys<LocaleType>, string>;
139
- //#endregion
140
- //#region src/types/kernel.d.ts
141
- type IDecoratorFunc = (_node: LexicalNode, _editor: LexicalEditor) => any;
142
- type INodeRegistrationTransform = (node: LexicalNodeConfig, index: number) => LexicalNodeConfig | null | undefined;
143
- type IBeforeEditorInitLifecycle = () => void;
144
- type IDecorator = {
145
- queryDOM: (_element: HTMLElement) => HTMLElement;
146
- render: IDecoratorFunc;
147
- } | IDecoratorFunc;
148
- /**
149
- * Service ID type
150
- */
151
- type IServiceID<Service> = {
152
- readonly __serviceId: string;
153
- __serviceType?: Service;
154
- };
155
- interface ISelectionObject {
156
- endNodeId: string;
157
- endOffset: number;
158
- startNodeId: string;
159
- startOffset: number;
160
- type: 'range' | 'node' | 'table';
161
- }
162
- interface IDocumentOptions {
163
- [key: string]: unknown;
164
- keepHistory?: boolean;
165
- /** only work for json datasource */
166
- keepId?: boolean;
167
- }
168
- interface IKernelEventMap {
169
- /**
170
- * Document change event
171
- */
172
- documentChange: (type: string, content: any) => void;
173
- /**
174
- * Editor editable state change event
175
- */
176
- editableChange: (editable: boolean) => void;
177
- /**
178
- * Editor error event
179
- */
180
- error: (error: Error) => void;
181
- /**
182
- * Initialization event
183
- * @param editor Lexical editor instance
184
- * @returns
185
- */
186
- initialized: (editor: LexicalEditor) => void;
187
- /**
188
- * handle markdown parse event
189
- */
190
- markdownParse: (params: {
191
- cacheState: EditorState;
192
- historyState: HistoryStateEntry | null;
193
- markdown: string;
194
- matchedPatterns: string[];
195
- score: number;
196
- }) => void;
197
- /**
198
- * handle paste event
199
- */
200
- onPaste: (event: ClipboardEvent) => void;
201
- }
202
- /**
203
- * External API
204
- */
205
- interface IEditor {
206
- /**
207
- * Lose focus
208
- */
209
- blur(): void;
210
- /**
211
- * Clean editor content (clear all content)
212
- */
213
- cleanDocument(): void;
214
- /**
215
- * Destroy editor instance
216
- */
217
- destroy(): void;
218
- /**
219
- * Execute editor commands to manipulate editor content
220
- * @param type
221
- * @param payload
222
- */
223
- dispatchCommand<TCommand extends LexicalCommand<unknown>>(type: TCommand, payload: CommandPayloadType<TCommand>): boolean;
224
- /**
225
- * Focus editor
226
- */
227
- focus(): void;
228
- /**
229
- * Get editor content of specified type
230
- */
231
- getDocument(type: string): DataSource | undefined;
232
- /**
233
- * Lexical history state (undo stack metadata)
234
- */
235
- getHistoryState(): HistoryState;
236
- /**
237
- * Get Lexical editor instance
238
- */
239
- getLexicalEditor(): LexicalEditor | null;
240
- /**
241
- * Get document editor root node
242
- */
243
- getRootElement(): HTMLElement | null;
244
- /**
245
- * Get editor selection information
246
- */
247
- getSelection(): ISelectionObject | null;
248
- /**
249
- * Get document editor selection content of specified type
250
- * @param type
251
- */
252
- getSelectionDocument(type: string): unknown | null;
253
- /**
254
- * Get editor theme
255
- */
256
- getTheme(): Record<string, string | Record<string, string>>;
257
- /**
258
- * Get headless editor instance
259
- */
260
- initHeadlessEditor(): LexicalEditor | null;
261
- /**
262
- * Get node editor instance
263
- */
264
- initNodeEditor(): LexicalEditor | null;
265
- /**
266
- * Check if editor is editable
267
- */
268
- isEditable(): boolean;
269
- /**
270
- * Check if editor content is empty
271
- * @returns true if editor content is empty, false otherwise
272
- */
273
- get isEmpty(): boolean;
274
- /**
275
- * Check if editor has active selection
276
- * @returns true if editor has selection, false otherwise
277
- */
278
- get isSelected(): boolean;
279
- /**
280
- * Remove editor event listener
281
- * @param event
282
- * @param listener
283
- */
284
- off<T extends keyof IKernelEventMap>(event: T, listener: IKernelEventMap[T]): this;
285
- /**
286
- * Add editor event listener
287
- * @param event
288
- * @param listener
289
- */
290
- on<T extends keyof IKernelEventMap>(event: T, listener: IKernelEventMap[T]): this;
291
- /**
292
- * Listen to event once, automatically remove listener after trigger
293
- * @param event
294
- * @param listener
295
- */
296
- once<T extends keyof IKernelEventMap>(event: T, listener: IKernelEventMap[T]): this;
297
- /**
298
- * Extends the priority level of Lexical commands.
299
- * Registers a listener that triggers when the provided command is dispatched
300
- * via {@link LexicalEditor.dispatch}. The listener is triggered based on its priority.
301
- * Listeners with higher priority can "intercept" commands and prevent them
302
- * from propagating to other handlers by returning true.
303
- *
304
- * Listeners are always invoked within {@link LexicalEditor.update} and can call dollar functions.
305
- *
306
- * Listeners registered at the same priority level will deterministically run
307
- * in the order of registration.
308
- *
309
- * @param command - The command that triggers the callback.
310
- * @param listener - The function executed when the command is dispatched.
311
- * @param priority - The relative priority of the listener. 0 | 1 | 2 | 3 | 4
312
- * (or {@link COMMAND_PRIORITY_EDITOR} |
313
- * {@link COMMAND_PRIORITY_LOW} |
314
- * {@link COMMAND_PRIORITY_NORMAL} |
315
- * {@link COMMAND_PRIORITY_HIGH} |
316
- * {@link COMMAND_PRIORITY_CRITICAL})
317
- * @returns A teardown function to clean up the listener.
318
- */
319
- registerHighCommand<P>(command: LexicalCommand<P>, listener: CommandListener<P>, priority: CommandListenerPriority): () => void;
320
- /**
321
- * Register keyboard shortcut
322
- * @param hotkey
323
- * @param callback
324
- * @param options
325
- */
326
- registerHotkey(hotkey: HotkeyId, callback: (event: KeyboardEvent, handler: HotkeysEvent) => void, options?: HotkeyOptions): () => void;
327
- /**
328
- * Register internationalization text
329
- * @param locale Internationalization text object
330
- */
331
- registerLocale(locale: Partial<Record<keyof ILocaleKeys, string>>): void;
332
- /**
333
- * Register editor plugin
334
- */
335
- registerPlugin<T>(plugin: IEditorPluginConstructor<T>, config?: T): IEditor;
336
- /**
337
- * Register multiple editor plugins
338
- */
339
- registerPlugins(plugins: Array<IPlugin>): IEditor;
340
- /**
341
- * Get editor Service, usually provided by plugins to extend certain functionalities
342
- * @param serviceId
343
- */
344
- requireService<T>(serviceId: IServiceID<T>): T | null;
345
- /**
346
- * Set editor content, type is content type, content is content data
347
- * @param type
348
- * @param content
349
- */
350
- setDocument(type: string, content: any, options?: IDocumentOptions): void;
351
- /**
352
- * Enable or disable editor editing capability
353
- * @param editable
354
- */
355
- setEditable(editable: boolean): void;
356
- /**
357
- * Set document editor root node
358
- * @param dom
359
- */
360
- setRootElement(dom: HTMLElement, editable?: boolean): LexicalEditor;
361
- setRootElement(dom: null, editable?: boolean): LexicalEditor | null;
362
- /**
363
- * set editor selection
364
- * @param selection
365
- */
366
- setSelection(selection: ISelectionObject, opt?: {
367
- collapseToEnd?: boolean;
368
- collapseToStart?: boolean;
369
- }): Promise<boolean>;
370
- /**
371
- * Get translation text
372
- * @param key Translation key
373
- * @param params Parameter replacement
374
- */
375
- t<K extends keyof ILocaleKeys>(key: K, params?: Record<string, any>): string;
376
- /**
377
- * Update editor theme
378
- * @param key
379
- * @param value
380
- */
381
- updateTheme(key: string, value: string | Record<string, string>): void;
382
- }
383
- /**
384
- * API provided to plugins
385
- */
386
- interface IEditorKernel extends IEditor {
387
- /**
388
- * Clone the current editor kernel instance
389
- */
390
- cloneNodeEditor(): IEditorKernel;
391
- emit<T extends keyof IKernelEventMap>(event: T, params: Parameters<IKernelEventMap[T]>[0]): void;
392
- /**
393
- * Get editor Node decorator for specific Node rendering
394
- * @param name
395
- */
396
- getDecorator(name: string): IDecorator | undefined;
397
- /**
398
- * Get all registered decorator names
399
- */
400
- getRegisteredDecorators(): string[];
401
- /**
402
- * Check if hot reload mode is enabled
403
- */
404
- isHotReloadMode(): boolean;
405
- /**
406
- * Register a lifecycle hook that runs right before editor initialization.
407
- * @param hook
408
- * @returns unregister function
409
- */
410
- registerBeforeEditorInit(hook: IBeforeEditorInitLifecycle): () => void;
411
- /**
412
- * Register data source for multi-format data conversion
413
- * @param dataSource
414
- */
415
- registerDataSource(dataSource: DataSource): void;
416
- /**
417
- * Register editor node decorator
418
- * @param name
419
- * @param decorator
420
- */
421
- registerDecorator(name: string, decorator: IDecorator): void;
422
- /**
423
- * Register a transform hook that runs before editor initialization
424
- * to rewrite registered nodes before createEditor/createHeadlessEditor is called.
425
- * @param transform
426
- * @returns unregister function
427
- */
428
- registerNodeTransform(transform: INodeRegistrationTransform): () => void;
429
- /**
430
- * Register Lexical Node
431
- * @param nodes
432
- */
433
- registerNodes(nodes: Array<LexicalNodeConfig>): void;
434
- /**
435
- * Register className(s) to the contenteditable root element.
436
- * @param className One or more class names separated by spaces
437
- * @returns unregister function
438
- */
439
- registerRootClassName(className: string): () => void;
440
- /**
441
- * Register a callback for root attach/detach events.
442
- *
443
- * Call this after the kernel's Lexical editor has been initialized (usually
444
- * from plugin onInit). Lexical immediately invokes a newly registered root
445
- * listener with the current root, so listeners registered after the initial
446
- * setRootElement still receive the first root attach. Headless kernels
447
- * return a no-op cleanup because headless Lexical editors do not support
448
- * root listeners.
449
- */
450
- registerRootListener(listener: (rootElement: HTMLElement | null) => void): () => void;
451
- /**
452
- * Register service
453
- * @param serviceId
454
- * @param service
455
- */
456
- registerService<T>(serviceId: IServiceID<T>, service: T): void;
457
- /**
458
- * Register service with hot reload support - allows overriding existing services
459
- * @param serviceId Service identifier
460
- * @param service Service instance
461
- */
462
- registerServiceHotReload<T>(serviceId: IServiceID<T>, service: T): void;
463
- /**
464
- * Register theme
465
- * @param themes
466
- */
467
- registerThemes(themes: Record<string, any>): void;
468
- /**
469
- * Enable or disable hot reload mode
470
- * @param enabled Whether to enable hot reload mode
471
- */
472
- setHotReloadMode(enabled: boolean): void;
473
- /**
474
- * Unregister editor node decorator
475
- * @param name Decorator name
476
- */
477
- unregisterDecorator(name: string): boolean;
478
- }
479
- /**
480
- * Plugin interface
481
- */
482
- interface IEditorPlugin<IConfig> {
483
- config?: IConfig;
484
- /**
485
- * Editor destruction
486
- */
487
- destroy(): void;
488
- /**
489
- * After editor document content is written by setDocument
490
- */
491
- onDocumentChange?(type: string, content: any, options?: IDocumentOptions): void;
492
- /**
493
- * After Lexical editor instantiation
494
- * @param editor Lexical editor instance
495
- */
496
- onInit?(editor: LexicalEditor): void;
497
- }
498
- /**
499
- * Plugin class interface
500
- */
501
- interface IEditorPluginConstructor<IConfig> {
502
- readonly pluginName: string;
503
- new (kernel: IEditorKernel, config?: IConfig): IEditorPlugin<IConfig>;
504
- }
505
- type IPlugin<T = any> = IEditorPluginConstructor<T> | [IEditorPluginConstructor<T>, T?];
506
- //#endregion
1
+ import { a as IPlugin, i as IEditor, n as NodeIdentitySnapshot, r as IDocumentOptions, t as INodeIdentityService } from "./i-node-identity-service-BBC_bg97.js";
2
+ import { o as LITEXML_MODIFY_COMMAND, u as LiteXmlOperationResult } from "./symbols-Dyr9yyS0.js";
3
+ import { $getNodeById, $getNodeId } from "./plugins/common/node/node-id.js";
4
+ import { CommandPayloadType, ElementNode, LexicalEditor, LexicalNode, SerializedEditorState, SerializedLexicalNode } from "lexical";
507
5
  //#region src/headless/extract-media-from-editor-state.d.ts
508
6
  interface ImageListItem {
509
7
  alt: string;
@@ -579,6 +77,7 @@ declare class HeadlessEditor {
579
77
  hydrateMarkdown(markdown: string, options?: IDocumentOptions): this;
580
78
  applyLiteXML(operation: HeadlessLiteXMLOperation | ReadonlyArray<HeadlessLiteXMLOperation>): Promise<this>;
581
79
  applyLiteXMLBatch(operations: CommandPayloadType<typeof LITEXML_MODIFY_COMMAND>): Promise<this>;
80
+ applyLiteXMLBatchWithResults(operations: CommandPayloadType<typeof LITEXML_MODIFY_COMMAND>): Promise<LiteXmlOperationResult[]>;
582
81
  export(options?: HeadlessEditorExportOptions): HeadlessEditorExport;
583
82
  exportState(options?: HeadlessEditorExportOptions): HeadlessEditorExport;
584
83
  destroy(): void;
@@ -586,4 +85,4 @@ declare class HeadlessEditor {
586
85
  }
587
86
  declare function createHeadlessEditor(options?: HeadlessEditorOptions): HeadlessEditor;
588
87
  //#endregion
589
- export { DEFAULT_HEADLESS_EDITOR_PLUGINS, type FileListItem, HeadlessDocumentType, HeadlessEditor, HeadlessEditorExport, HeadlessEditorExportOptions, HeadlessEditorHydrationInput, HeadlessEditorOptions, HeadlessLiteXMLBatchOperation, HeadlessLiteXMLInsertOperation, HeadlessLiteXMLOperation, HeadlessLiteXMLRemoveOperation, HeadlessLiteXMLReplaceOperation, type ImageListItem, type MediaLists, createHeadlessEditor, extractMediaFromEditorState };
88
+ export { $getNodeById, $getNodeId, DEFAULT_HEADLESS_EDITOR_PLUGINS, type FileListItem, HeadlessDocumentType, HeadlessEditor, HeadlessEditorExport, HeadlessEditorExportOptions, HeadlessEditorHydrationInput, HeadlessEditorOptions, HeadlessLiteXMLBatchOperation, HeadlessLiteXMLInsertOperation, HeadlessLiteXMLOperation, HeadlessLiteXMLRemoveOperation, HeadlessLiteXMLReplaceOperation, INodeIdentityService, type ImageListItem, type LiteXmlOperationResult, type MediaLists, type NodeIdentitySnapshot, createHeadlessEditor, extractMediaFromEditorState };