@lobehub/editor 4.8.5 → 4.9.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.
- package/es/{ReactSlashPlugin-BZvB0g1k.js → ReactSlashPlugin-Dn5VWUzS.js} +352 -339
- package/es/headless.d.ts +531 -0
- package/es/headless.js +26178 -0
- package/es/{index-BfKEHYDe.d.ts → index-BXj6uAM3.d.ts} +4 -0
- package/es/index.d.ts +250 -185
- package/es/index.js +2077 -1849
- package/es/react.d.ts +1 -1
- package/es/react.js +5 -5
- package/es/renderer.js +6 -6
- package/es/{style-B7Vfm0cE.js → style-CcDKrOoJ.js} +143 -143
- package/es/{style-Tlcvrhqp.js → style-DAKdXzC4.js} +42 -1
- package/package.json +5 -1
- package/scripts/postinstall-lexical-patch.cjs +46 -7
|
@@ -288,6 +288,10 @@ interface IEditor {
|
|
|
288
288
|
* Get editor theme
|
|
289
289
|
*/
|
|
290
290
|
getTheme(): Record<string, string | Record<string, string>>;
|
|
291
|
+
/**
|
|
292
|
+
* Get headless editor instance
|
|
293
|
+
*/
|
|
294
|
+
initHeadlessEditor(): LexicalEditor | null;
|
|
291
295
|
/**
|
|
292
296
|
* Get node editor instance
|
|
293
297
|
*/
|
package/es/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as IWriteOptions, A as INSERT_HEADING_COMMAND, B as ILocaleKeys, C as CommonPlugin, D as $isCursorNode, E as $isCardLikeElementNode, F as IEditorKernel, G as HotkeyEnum, H as HotkeyOptions, I as IEditorPluginConstructor, J as HotkeyScopeEnum, K as HotkeyId, L as IPlugin, M as IDecorator, N as IDocumentOptions, O as CardLikeElementNode, P as IEditor, Q as DataSource, R as ISelectionObject, S as ReactPlainTextProps, T as $createCursorNode, U as HotkeysEvent, W as getHotkeyById, X as KeyEnum, Y as HotkeyScopeId, Z as ModifierCombination, _ as MentionNode, a as ReactSlashOptionProps, b as ReactEditorContent, c as ITriggerContext, d as ISlashMenuOption, f as ISlashOption, g as ReactMentionPluginProps, h as ReactMentionPlugin, i as MenuRenderProps, j as INSERT_QUOTE_COMMAND, k as cursorNodeSerialized, l as SlashPlugin, m as SlashOptions, n as ReactSlashOption, o as ReactSlashPluginProps, p as ISlashService, q as HotkeyItem, r as SlashMenu, s as SlashMenuProps, t as ReactSlashPlugin, u as SlashPluginOptions, v as SerializedMentionNode, w as CommonPluginOptions, x as ReactEditorContentProps, y as ReactPlainText, z as IServiceID } from "./index-
|
|
1
|
+
import { $ as IWriteOptions, A as INSERT_HEADING_COMMAND, B as ILocaleKeys, C as CommonPlugin, D as $isCursorNode, E as $isCardLikeElementNode, F as IEditorKernel, G as HotkeyEnum, H as HotkeyOptions, I as IEditorPluginConstructor, J as HotkeyScopeEnum, K as HotkeyId, L as IPlugin, M as IDecorator, N as IDocumentOptions, O as CardLikeElementNode, P as IEditor, Q as DataSource, R as ISelectionObject, S as ReactPlainTextProps, T as $createCursorNode, U as HotkeysEvent, W as getHotkeyById, X as KeyEnum, Y as HotkeyScopeId, Z as ModifierCombination, _ as MentionNode, a as ReactSlashOptionProps, b as ReactEditorContent, c as ITriggerContext, d as ISlashMenuOption, f as ISlashOption, g as ReactMentionPluginProps, h as ReactMentionPlugin, i as MenuRenderProps, j as INSERT_QUOTE_COMMAND, k as cursorNodeSerialized, l as SlashPlugin, m as SlashOptions, n as ReactSlashOption, o as ReactSlashPluginProps, p as ISlashService, q as HotkeyItem, r as SlashMenu, s as SlashMenuProps, t as ReactSlashPlugin, u as SlashPluginOptions, v as SerializedMentionNode, w as CommonPluginOptions, x as ReactEditorContentProps, y as ReactPlainText, z as IServiceID } from "./index-BXj6uAM3.js";
|
|
2
2
|
import { HistoryState, HistoryStateEntry } from "@lexical/history";
|
|
3
3
|
import { InsertTableCommandPayloadHeaders } from "@lexical/table";
|
|
4
4
|
import EventEmitter from "eventemitter3";
|
|
5
5
|
import * as _$lexical from "lexical";
|
|
6
|
-
import { BaseSelection, CommandListener, CommandListenerPriority, CommandPayloadType, DOMConversionMap, DOMExportOutput, DecoratorNode, EditorConfig, EditorThemeClasses, ElementDOMSlot, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, LexicalNodeConfig, LexicalUpdateJSON, NodeKey, RangeSelection, SerializedElementNode, SerializedLexicalNode, SerializedRootNode, SerializedTextNode, Spread, TextFormatType, TextNode, resetRandomKey } from "lexical";
|
|
6
|
+
import { BaseSelection, CommandListener, CommandListenerPriority, CommandPayloadType, DOMConversionMap, DOMExportOutput, DecoratorNode, EditorConfig, EditorThemeClasses, ElementDOMSlot, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, LexicalNodeConfig, LexicalUpdateJSON, NodeKey, RangeSelection, SerializedEditorState, SerializedElementNode, SerializedLexicalNode, SerializedRootNode, SerializedTextNode, Spread, TextFormatType, TextNode, resetRandomKey } from "lexical";
|
|
7
7
|
import createDebug from "debug";
|
|
8
8
|
import React, { FC, JSX, ReactNode } from "react";
|
|
9
9
|
import { INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, UPDATE_LIST_START_COMMAND } from "@lexical/list";
|
|
@@ -95,6 +95,251 @@ declare const ReactEditor: FC<IReactEditorProps>;
|
|
|
95
95
|
//#region src/editor-kernel/react/useLexicalEditor.d.ts
|
|
96
96
|
declare function useLexicalEditor(handleEditor: (lexicalEditor: LexicalEditor) => (() => void) | undefined, deps?: any[]): void;
|
|
97
97
|
//#endregion
|
|
98
|
+
//#region src/plugins/litexml/service/litexml-service.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* XML Reader function type - converts XML element to Lexical node
|
|
101
|
+
*/
|
|
102
|
+
type XMLReaderFunc = (xmlElement: Element, children: any[]) => any | any[] | false;
|
|
103
|
+
/**
|
|
104
|
+
* XML Writer function type - converts Lexical node to XML string
|
|
105
|
+
*/
|
|
106
|
+
type XMLWriterFunc = (node: LexicalNode, ctx: IWriterContext, indent: number, nodeToXML: (node: any, lines: string[], indent?: number) => void) => IXmlNode | HandleChildrenResult | false;
|
|
107
|
+
/**
|
|
108
|
+
* Record of XML readers indexed by tag name
|
|
109
|
+
*/
|
|
110
|
+
type XMLReaderRecord = {
|
|
111
|
+
[tagName: string]: XMLReaderFunc | XMLReaderFunc[];
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Record of XML writers indexed by node type
|
|
115
|
+
*/
|
|
116
|
+
type XMLWriterRecord = {
|
|
117
|
+
[nodeType: string]: XMLWriterFunc | XMLWriterFunc[];
|
|
118
|
+
};
|
|
119
|
+
interface IXmlNode {
|
|
120
|
+
attributes: {
|
|
121
|
+
[key: string]: string;
|
|
122
|
+
};
|
|
123
|
+
children?: IXmlNode[];
|
|
124
|
+
tagName: string;
|
|
125
|
+
textContent?: string;
|
|
126
|
+
}
|
|
127
|
+
interface HandleChildrenResult {
|
|
128
|
+
lines: string[];
|
|
129
|
+
}
|
|
130
|
+
interface IWriterContext {
|
|
131
|
+
createXmlNode(tagName: string, attributes?: {
|
|
132
|
+
[key: string]: string;
|
|
133
|
+
}, textContent?: string): IXmlNode;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* ILitexmlService - Service interface for extending Litexml plugin
|
|
137
|
+
* Allows other plugins to register custom XML readers and writers
|
|
138
|
+
*/
|
|
139
|
+
interface ILitexmlService {
|
|
140
|
+
/**
|
|
141
|
+
* Get all registered XML readers
|
|
142
|
+
*/
|
|
143
|
+
getXMLReaders(): XMLReaderRecord;
|
|
144
|
+
/**
|
|
145
|
+
* Get all registered XML writers
|
|
146
|
+
*/
|
|
147
|
+
getXMLWriters(): XMLWriterRecord;
|
|
148
|
+
/**
|
|
149
|
+
* Check if a reader is registered for a tag
|
|
150
|
+
*/
|
|
151
|
+
hasXMLReader(tagName: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Check if a writer is registered for a node type
|
|
154
|
+
*/
|
|
155
|
+
hasXMLWriter(nodeType: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Register a custom XML reader for a specific tag name
|
|
158
|
+
* @param tagName - XML tag name to handle (case-insensitive)
|
|
159
|
+
* @param reader - Function that converts XML element to Lexical node
|
|
160
|
+
*/
|
|
161
|
+
registerXMLReader(tagName: string, reader: XMLReaderFunc): void;
|
|
162
|
+
/**
|
|
163
|
+
* Register a custom XML writer for a specific Lexical node type
|
|
164
|
+
* @param nodeType - Lexical node type to handle
|
|
165
|
+
* @param writer - Function that converts Lexical node to XML string
|
|
166
|
+
*/
|
|
167
|
+
registerXMLWriter(nodeType: string, writer: XMLWriterFunc): void;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Service ID for Litexml service
|
|
171
|
+
*/
|
|
172
|
+
declare const ILitexmlService: IServiceID<ILitexmlService>;
|
|
173
|
+
/**
|
|
174
|
+
* Default implementation of ILitexmlService
|
|
175
|
+
*/
|
|
176
|
+
declare class LitexmlService implements ILitexmlService {
|
|
177
|
+
private readers;
|
|
178
|
+
private writers;
|
|
179
|
+
registerXMLReader(tagName: string, reader: XMLReaderFunc): void;
|
|
180
|
+
registerXMLWriter(nodeType: string, writer: XMLWriterFunc): void;
|
|
181
|
+
getXMLReaders(): XMLReaderRecord;
|
|
182
|
+
getXMLWriters(): XMLWriterRecord;
|
|
183
|
+
hasXMLReader(tagName: string): boolean;
|
|
184
|
+
hasXMLWriter(nodeType: string): boolean;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/plugins/litexml/data-source/litexml-data-source.d.ts
|
|
188
|
+
/**
|
|
189
|
+
* LitexmlDataSource - Handles conversion between Lexical editor state and XML format
|
|
190
|
+
* Provides read (parse XML to Lexical) and write (export Lexical to XML) capabilities
|
|
191
|
+
*/
|
|
192
|
+
declare class LitexmlDataSource extends DataSource {
|
|
193
|
+
protected dataType: string;
|
|
194
|
+
protected getService?: (<T>(serviceId: IServiceID<T>) => T | null) | undefined;
|
|
195
|
+
private litexmlService;
|
|
196
|
+
private ctx;
|
|
197
|
+
constructor(dataType?: string, getService?: (<T>(serviceId: IServiceID<T>) => T | null) | undefined, service?: ILitexmlService);
|
|
198
|
+
readLiteXMLToInode(litexml: string): any;
|
|
199
|
+
/**
|
|
200
|
+
* Parse XML string and set it to the editor
|
|
201
|
+
* @param editor - The Lexical editor instance
|
|
202
|
+
* @param data - XML string to parse
|
|
203
|
+
*/
|
|
204
|
+
read(editor: LexicalEditor, data: string): void;
|
|
205
|
+
/**
|
|
206
|
+
* Export editor content to XML format
|
|
207
|
+
* @param editor - The Lexical editor instance
|
|
208
|
+
* @param options - Write options (e.g., selection flag)
|
|
209
|
+
* @returns XML string representation of the editor content
|
|
210
|
+
*/
|
|
211
|
+
write(editor: LexicalEditor, options?: IWriteOptions): any;
|
|
212
|
+
/**
|
|
213
|
+
* Parse XML string using browser's built-in parser
|
|
214
|
+
*/
|
|
215
|
+
private parseXMLString;
|
|
216
|
+
/**
|
|
217
|
+
* Convert XML document to Lexical node structure
|
|
218
|
+
*/
|
|
219
|
+
private xmlToLexical;
|
|
220
|
+
/**
|
|
221
|
+
* Recursively process XML elements and convert to Lexical nodes
|
|
222
|
+
*/
|
|
223
|
+
private processXMLElement;
|
|
224
|
+
/**
|
|
225
|
+
* Process XML element's children
|
|
226
|
+
*/
|
|
227
|
+
private processXMLChildren;
|
|
228
|
+
/**
|
|
229
|
+
* Convert Lexical node structure to XML string
|
|
230
|
+
*/
|
|
231
|
+
private lexicalToXML;
|
|
232
|
+
/**
|
|
233
|
+
* Recursively convert Lexical nodes to XML elements
|
|
234
|
+
*/
|
|
235
|
+
private nodesToXML;
|
|
236
|
+
/**
|
|
237
|
+
* Build XML attribute string from attributes object
|
|
238
|
+
*/
|
|
239
|
+
private buildXMLAttributes;
|
|
240
|
+
/**
|
|
241
|
+
* Escape XML special characters
|
|
242
|
+
*/
|
|
243
|
+
private escapeXML;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/plugins/litexml/command/index.d.ts
|
|
247
|
+
declare const LITEXML_MODIFY_COMMAND: _$lexical.LexicalCommand<({
|
|
248
|
+
action: "insert";
|
|
249
|
+
beforeId: string;
|
|
250
|
+
litexml: string;
|
|
251
|
+
} | {
|
|
252
|
+
action: "insert";
|
|
253
|
+
afterId: string;
|
|
254
|
+
litexml: string;
|
|
255
|
+
} | {
|
|
256
|
+
action: "remove";
|
|
257
|
+
id: string;
|
|
258
|
+
} | {
|
|
259
|
+
action: "modify";
|
|
260
|
+
litexml: string | string[];
|
|
261
|
+
})[]>;
|
|
262
|
+
declare const LITEXML_APPLY_COMMAND: _$lexical.LexicalCommand<{
|
|
263
|
+
delay?: boolean;
|
|
264
|
+
litexml: string | string[];
|
|
265
|
+
}>;
|
|
266
|
+
declare const LITEXML_REMOVE_COMMAND: _$lexical.LexicalCommand<{
|
|
267
|
+
delay?: boolean;
|
|
268
|
+
id: string;
|
|
269
|
+
}>;
|
|
270
|
+
declare const LITEXML_INSERT_COMMAND: _$lexical.LexicalCommand<{
|
|
271
|
+
beforeId: string;
|
|
272
|
+
delay?: boolean;
|
|
273
|
+
litexml: string;
|
|
274
|
+
} | {
|
|
275
|
+
afterId: string;
|
|
276
|
+
delay?: boolean;
|
|
277
|
+
litexml: string;
|
|
278
|
+
}>;
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/headless/index.d.ts
|
|
281
|
+
type HeadlessDocumentType = 'json' | 'litexml' | 'markdown' | (string & object);
|
|
282
|
+
interface HeadlessEditorHydrationInput {
|
|
283
|
+
content: unknown;
|
|
284
|
+
options?: IDocumentOptions;
|
|
285
|
+
type: HeadlessDocumentType;
|
|
286
|
+
}
|
|
287
|
+
interface HeadlessEditorExportOptions {
|
|
288
|
+
litexml?: boolean;
|
|
289
|
+
}
|
|
290
|
+
interface HeadlessEditorExport {
|
|
291
|
+
editorData: SerializedEditorState<SerializedLexicalNode>;
|
|
292
|
+
litexml?: string;
|
|
293
|
+
markdown: string;
|
|
294
|
+
}
|
|
295
|
+
interface HeadlessEditorOptions {
|
|
296
|
+
additionalPlugins?: ReadonlyArray<IPlugin>;
|
|
297
|
+
initialValue?: HeadlessEditorHydrationInput;
|
|
298
|
+
plugins?: ReadonlyArray<IPlugin>;
|
|
299
|
+
}
|
|
300
|
+
interface HeadlessLiteXMLReplaceOperation {
|
|
301
|
+
action: 'apply' | 'replace';
|
|
302
|
+
delay?: boolean;
|
|
303
|
+
litexml: string | string[];
|
|
304
|
+
}
|
|
305
|
+
type HeadlessLiteXMLInsertOperation = {
|
|
306
|
+
action: 'insert';
|
|
307
|
+
afterId: string;
|
|
308
|
+
delay?: boolean;
|
|
309
|
+
litexml: string;
|
|
310
|
+
} | {
|
|
311
|
+
action: 'insert';
|
|
312
|
+
beforeId: string;
|
|
313
|
+
delay?: boolean;
|
|
314
|
+
litexml: string;
|
|
315
|
+
};
|
|
316
|
+
interface HeadlessLiteXMLRemoveOperation {
|
|
317
|
+
action: 'remove';
|
|
318
|
+
delay?: boolean;
|
|
319
|
+
id: string;
|
|
320
|
+
}
|
|
321
|
+
interface HeadlessLiteXMLBatchOperation {
|
|
322
|
+
action: 'batch';
|
|
323
|
+
operations: CommandPayloadType<typeof LITEXML_MODIFY_COMMAND>;
|
|
324
|
+
}
|
|
325
|
+
type HeadlessLiteXMLOperation = HeadlessLiteXMLBatchOperation | HeadlessLiteXMLInsertOperation | HeadlessLiteXMLRemoveOperation | HeadlessLiteXMLReplaceOperation;
|
|
326
|
+
declare const DEFAULT_HEADLESS_EDITOR_PLUGINS: ReadonlyArray<IPlugin>;
|
|
327
|
+
declare class HeadlessEditor {
|
|
328
|
+
readonly kernel: IEditor;
|
|
329
|
+
constructor(options?: HeadlessEditorOptions);
|
|
330
|
+
hydrate(input: HeadlessEditorHydrationInput): this;
|
|
331
|
+
hydrateEditorData(editorData: SerializedEditorState<SerializedLexicalNode> | string, options?: IDocumentOptions): this;
|
|
332
|
+
hydrateLiteXML(litexml: string, options?: IDocumentOptions): this;
|
|
333
|
+
hydrateMarkdown(markdown: string, options?: IDocumentOptions): this;
|
|
334
|
+
applyLiteXML(operation: HeadlessLiteXMLOperation | ReadonlyArray<HeadlessLiteXMLOperation>): Promise<this>;
|
|
335
|
+
applyLiteXMLBatch(operations: CommandPayloadType<typeof LITEXML_MODIFY_COMMAND>): Promise<this>;
|
|
336
|
+
export(options?: HeadlessEditorExportOptions): HeadlessEditorExport;
|
|
337
|
+
exportState(options?: HeadlessEditorExportOptions): HeadlessEditorExport;
|
|
338
|
+
destroy(): void;
|
|
339
|
+
private applyLiteXMLOperation;
|
|
340
|
+
}
|
|
341
|
+
declare function createHeadlessEditor(options?: HeadlessEditorOptions): HeadlessEditor;
|
|
342
|
+
//#endregion
|
|
98
343
|
//#region src/plugins/auto-complete/plugin/index.d.ts
|
|
99
344
|
interface AutoCompletePluginOptions {
|
|
100
345
|
/** Delay in milliseconds before triggering auto-complete (default: 1000ms) */
|
|
@@ -657,188 +902,6 @@ interface ReactListPluginProps {
|
|
|
657
902
|
//#region src/plugins/list/react/ReactListPlugin.d.ts
|
|
658
903
|
declare const ReactListPlugin: FC<ReactListPluginProps>;
|
|
659
904
|
//#endregion
|
|
660
|
-
//#region src/plugins/litexml/service/litexml-service.d.ts
|
|
661
|
-
/**
|
|
662
|
-
* XML Reader function type - converts XML element to Lexical node
|
|
663
|
-
*/
|
|
664
|
-
type XMLReaderFunc = (xmlElement: Element, children: any[]) => any | any[] | false;
|
|
665
|
-
/**
|
|
666
|
-
* XML Writer function type - converts Lexical node to XML string
|
|
667
|
-
*/
|
|
668
|
-
type XMLWriterFunc = (node: LexicalNode, ctx: IWriterContext, indent: number, nodeToXML: (node: any, lines: string[], indent?: number) => void) => IXmlNode | HandleChildrenResult | false;
|
|
669
|
-
/**
|
|
670
|
-
* Record of XML readers indexed by tag name
|
|
671
|
-
*/
|
|
672
|
-
type XMLReaderRecord = {
|
|
673
|
-
[tagName: string]: XMLReaderFunc | XMLReaderFunc[];
|
|
674
|
-
};
|
|
675
|
-
/**
|
|
676
|
-
* Record of XML writers indexed by node type
|
|
677
|
-
*/
|
|
678
|
-
type XMLWriterRecord = {
|
|
679
|
-
[nodeType: string]: XMLWriterFunc | XMLWriterFunc[];
|
|
680
|
-
};
|
|
681
|
-
interface IXmlNode {
|
|
682
|
-
attributes: {
|
|
683
|
-
[key: string]: string;
|
|
684
|
-
};
|
|
685
|
-
children?: IXmlNode[];
|
|
686
|
-
tagName: string;
|
|
687
|
-
textContent?: string;
|
|
688
|
-
}
|
|
689
|
-
interface HandleChildrenResult {
|
|
690
|
-
lines: string[];
|
|
691
|
-
}
|
|
692
|
-
interface IWriterContext {
|
|
693
|
-
createXmlNode(tagName: string, attributes?: {
|
|
694
|
-
[key: string]: string;
|
|
695
|
-
}, textContent?: string): IXmlNode;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* ILitexmlService - Service interface for extending Litexml plugin
|
|
699
|
-
* Allows other plugins to register custom XML readers and writers
|
|
700
|
-
*/
|
|
701
|
-
interface ILitexmlService {
|
|
702
|
-
/**
|
|
703
|
-
* Get all registered XML readers
|
|
704
|
-
*/
|
|
705
|
-
getXMLReaders(): XMLReaderRecord;
|
|
706
|
-
/**
|
|
707
|
-
* Get all registered XML writers
|
|
708
|
-
*/
|
|
709
|
-
getXMLWriters(): XMLWriterRecord;
|
|
710
|
-
/**
|
|
711
|
-
* Check if a reader is registered for a tag
|
|
712
|
-
*/
|
|
713
|
-
hasXMLReader(tagName: string): boolean;
|
|
714
|
-
/**
|
|
715
|
-
* Check if a writer is registered for a node type
|
|
716
|
-
*/
|
|
717
|
-
hasXMLWriter(nodeType: string): boolean;
|
|
718
|
-
/**
|
|
719
|
-
* Register a custom XML reader for a specific tag name
|
|
720
|
-
* @param tagName - XML tag name to handle (case-insensitive)
|
|
721
|
-
* @param reader - Function that converts XML element to Lexical node
|
|
722
|
-
*/
|
|
723
|
-
registerXMLReader(tagName: string, reader: XMLReaderFunc): void;
|
|
724
|
-
/**
|
|
725
|
-
* Register a custom XML writer for a specific Lexical node type
|
|
726
|
-
* @param nodeType - Lexical node type to handle
|
|
727
|
-
* @param writer - Function that converts Lexical node to XML string
|
|
728
|
-
*/
|
|
729
|
-
registerXMLWriter(nodeType: string, writer: XMLWriterFunc): void;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Service ID for Litexml service
|
|
733
|
-
*/
|
|
734
|
-
declare const ILitexmlService: IServiceID<ILitexmlService>;
|
|
735
|
-
/**
|
|
736
|
-
* Default implementation of ILitexmlService
|
|
737
|
-
*/
|
|
738
|
-
declare class LitexmlService implements ILitexmlService {
|
|
739
|
-
private readers;
|
|
740
|
-
private writers;
|
|
741
|
-
registerXMLReader(tagName: string, reader: XMLReaderFunc): void;
|
|
742
|
-
registerXMLWriter(nodeType: string, writer: XMLWriterFunc): void;
|
|
743
|
-
getXMLReaders(): XMLReaderRecord;
|
|
744
|
-
getXMLWriters(): XMLWriterRecord;
|
|
745
|
-
hasXMLReader(tagName: string): boolean;
|
|
746
|
-
hasXMLWriter(nodeType: string): boolean;
|
|
747
|
-
}
|
|
748
|
-
//#endregion
|
|
749
|
-
//#region src/plugins/litexml/data-source/litexml-data-source.d.ts
|
|
750
|
-
/**
|
|
751
|
-
* LitexmlDataSource - Handles conversion between Lexical editor state and XML format
|
|
752
|
-
* Provides read (parse XML to Lexical) and write (export Lexical to XML) capabilities
|
|
753
|
-
*/
|
|
754
|
-
declare class LitexmlDataSource extends DataSource {
|
|
755
|
-
protected dataType: string;
|
|
756
|
-
protected getService?: (<T>(serviceId: IServiceID<T>) => T | null) | undefined;
|
|
757
|
-
private litexmlService;
|
|
758
|
-
private ctx;
|
|
759
|
-
constructor(dataType?: string, getService?: (<T>(serviceId: IServiceID<T>) => T | null) | undefined, service?: ILitexmlService);
|
|
760
|
-
readLiteXMLToInode(litexml: string): any;
|
|
761
|
-
/**
|
|
762
|
-
* Parse XML string and set it to the editor
|
|
763
|
-
* @param editor - The Lexical editor instance
|
|
764
|
-
* @param data - XML string to parse
|
|
765
|
-
*/
|
|
766
|
-
read(editor: LexicalEditor, data: string): void;
|
|
767
|
-
/**
|
|
768
|
-
* Export editor content to XML format
|
|
769
|
-
* @param editor - The Lexical editor instance
|
|
770
|
-
* @param options - Write options (e.g., selection flag)
|
|
771
|
-
* @returns XML string representation of the editor content
|
|
772
|
-
*/
|
|
773
|
-
write(editor: LexicalEditor, options?: IWriteOptions): any;
|
|
774
|
-
/**
|
|
775
|
-
* Parse XML string using browser's built-in parser
|
|
776
|
-
*/
|
|
777
|
-
private parseXMLString;
|
|
778
|
-
/**
|
|
779
|
-
* Convert XML document to Lexical node structure
|
|
780
|
-
*/
|
|
781
|
-
private xmlToLexical;
|
|
782
|
-
/**
|
|
783
|
-
* Recursively process XML elements and convert to Lexical nodes
|
|
784
|
-
*/
|
|
785
|
-
private processXMLElement;
|
|
786
|
-
/**
|
|
787
|
-
* Process XML element's children
|
|
788
|
-
*/
|
|
789
|
-
private processXMLChildren;
|
|
790
|
-
/**
|
|
791
|
-
* Convert Lexical node structure to XML string
|
|
792
|
-
*/
|
|
793
|
-
private lexicalToXML;
|
|
794
|
-
/**
|
|
795
|
-
* Recursively convert Lexical nodes to XML elements
|
|
796
|
-
*/
|
|
797
|
-
private nodesToXML;
|
|
798
|
-
/**
|
|
799
|
-
* Build XML attribute string from attributes object
|
|
800
|
-
*/
|
|
801
|
-
private buildXMLAttributes;
|
|
802
|
-
/**
|
|
803
|
-
* Escape XML special characters
|
|
804
|
-
*/
|
|
805
|
-
private escapeXML;
|
|
806
|
-
}
|
|
807
|
-
//#endregion
|
|
808
|
-
//#region src/plugins/litexml/command/index.d.ts
|
|
809
|
-
declare const LITEXML_MODIFY_COMMAND: _$lexical.LexicalCommand<({
|
|
810
|
-
action: "insert";
|
|
811
|
-
beforeId: string;
|
|
812
|
-
litexml: string;
|
|
813
|
-
} | {
|
|
814
|
-
action: "insert";
|
|
815
|
-
afterId: string;
|
|
816
|
-
litexml: string;
|
|
817
|
-
} | {
|
|
818
|
-
action: "remove";
|
|
819
|
-
id: string;
|
|
820
|
-
} | {
|
|
821
|
-
action: "modify";
|
|
822
|
-
litexml: string | string[];
|
|
823
|
-
})[]>;
|
|
824
|
-
declare const LITEXML_APPLY_COMMAND: _$lexical.LexicalCommand<{
|
|
825
|
-
delay?: boolean;
|
|
826
|
-
litexml: string | string[];
|
|
827
|
-
}>;
|
|
828
|
-
declare const LITEXML_REMOVE_COMMAND: _$lexical.LexicalCommand<{
|
|
829
|
-
delay?: boolean;
|
|
830
|
-
id: string;
|
|
831
|
-
}>;
|
|
832
|
-
declare const LITEXML_INSERT_COMMAND: _$lexical.LexicalCommand<{
|
|
833
|
-
beforeId: string;
|
|
834
|
-
delay?: boolean;
|
|
835
|
-
litexml: string;
|
|
836
|
-
} | {
|
|
837
|
-
afterId: string;
|
|
838
|
-
delay?: boolean;
|
|
839
|
-
litexml: string;
|
|
840
|
-
}>;
|
|
841
|
-
//#endregion
|
|
842
905
|
//#region src/plugins/litexml/command/diffCommand.d.ts
|
|
843
906
|
declare enum DiffAction {
|
|
844
907
|
Reject = 0,
|
|
@@ -2727,6 +2790,7 @@ declare class Kernel extends EventEmitter implements IEditorKernel {
|
|
|
2727
2790
|
private logger;
|
|
2728
2791
|
private historyState;
|
|
2729
2792
|
private editor?;
|
|
2793
|
+
private headlessEditor;
|
|
2730
2794
|
constructor();
|
|
2731
2795
|
cloneNodeEditor(): IEditorKernel;
|
|
2732
2796
|
getHistoryState(): HistoryState;
|
|
@@ -2747,6 +2811,7 @@ declare class Kernel extends EventEmitter implements IEditorKernel {
|
|
|
2747
2811
|
setRootElement(dom: HTMLElement, editable?: boolean): LexicalEditor;
|
|
2748
2812
|
setEditable(editable: boolean): void;
|
|
2749
2813
|
initNodeEditor(): LexicalEditor;
|
|
2814
|
+
initHeadlessEditor(): LexicalEditor;
|
|
2750
2815
|
setDocument(type: string, content: any, options?: IDocumentOptions): void;
|
|
2751
2816
|
setSelection(selection: ISelectionObject, opt?: {
|
|
2752
2817
|
collapseToEnd?: boolean;
|
|
@@ -2830,4 +2895,4 @@ declare function enableHotReload(): void;
|
|
|
2830
2895
|
*/
|
|
2831
2896
|
declare function disableHotReload(): void;
|
|
2832
2897
|
//#endregion
|
|
2833
|
-
export { $closest, $closestNodeType, $createCursorNode, $getNearestNodeFromDOMNode, $getNodeFromDOMNode, $isCardLikeElementNode, $isCursorNode, AutoCompletePlugin, CardLikeElementNode, CodePlugin, CodeblockPlugin, CodeblockPluginOptions, CodemirrorPlugin, CodemirrorPluginOptions, CommonPlugin, CommonPluginOptions, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, DiffAction, EDITOR_THEME_KEY, FilePlugin, FilePluginOptions, GET_MARKDOWN_SELECTION_COMMAND, HIDE_TOOLBAR_COMMAND, HOVER_COMMAND, HRPlugin, HRPluginOptions, HotkeyEnum, HotkeyId, HotkeyItem, HotkeyScopeEnum, HotkeyScopeId, type IEditor, ILinkService, ILitexmlService, IMarkdownShortCutService, INSERT_CHECK_LIST_COMMAND, INSERT_CODEINLINE_COMMAND, INSERT_CODEMIRROR_COMMAND, INSERT_FILE_COMMAND, INSERT_HEADING_COMMAND, INSERT_HORIZONTAL_RULE_COMMAND, INSERT_IMAGE_COMMAND, INSERT_LINK_COMMAND, INSERT_LINK_HIGHLIGHT_COMMAND, INSERT_MARKDOWN_COMMAND, INSERT_MATH_COMMAND, INSERT_MENTION_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_QUOTE_COMMAND, INSERT_TABLE_COMMAND, INSERT_UNORDERED_LIST_COMMAND, INodePlugin, INodePluginOptions, INodeService, ISlashMenuOption, ISlashOption, ISlashService, ITriggerContext, IUploadService, ImagePlugin, ImagePluginOptions, Kernel, KeyEnum, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND, LexicalErrorBoundary, LexicalPortalContainer, LinkHighlightPlugin, LinkHighlightPluginOptions, LinkPlugin, LinkPluginOptions, ListPlugin, ListPluginOptions, LitexmlDataSource, LitexmlPlugin, type LitexmlPluginOptions, LitexmlService, type MARKDOWN_READER_LEVEL, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX, MarkdownPlugin, MathPlugin, MentionPlugin, MentionPluginOptions, MenuRenderProps, ModifierCombination, REMOVE_LIST_COMMAND, ReactAutoCompletePlugin, ReactCodePlugin, ReactCodeblockPlugin, ReactCodeblockPluginProps, ReactCodemirrorPlugin, ReactEditor, ReactEditorContent, ReactEditorContentProps, ReactFilePlugin, ReactFilePluginProps, ReactHRPlugin, ReactHRPluginProps, ReactImagePlugin, ReactImagePluginProps, ReactLinkHighlightPlugin, ReactLinkPlugin, ReactLinkPluginProps, ReactListPlugin, ReactListPluginProps, ReactLiteXmlPlugin, ReactMarkdownPlugin, ReactMathPlugin, ReactMentionPlugin, ReactMentionPluginProps, ReactNodePlugin, ReactPlainText, ReactPlainTextProps, ReactSlashOption, ReactSlashOptionProps, ReactSlashPlugin, ReactSlashPluginProps, ReactTablePlugin, ReactToolbarPlugin, ReactVirtualBlockPlugin, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND, SELECT_TABLE_COMMAND, SHOW_TOOLBAR_COMMAND, type SerializedMentionNode, SlashMenu, SlashMenuProps, SlashOptions, SlashPlugin, SlashPluginOptions, TablePlugin, TablePluginOptions, ToolbarCommandOptions, UPDATE_CODEBLOCK_LANG, UPDATE_LIST_START_COMMAND, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM, UploadPlugin, UploadPluginOptions, VirtualBlockPlugin, VirtualBlockPluginOptions, type XMLReaderFunc, type XMLReaderRecord, type XMLWriterFunc, type XMLWriterRecord, assert, browserDebug, bundledLanguagesInfo, compareNodeOrder, createDebugLogger, createEmptyEditorState, cursorNodeSerialized, debugLogger, debugLoggers, detectCodeLanguage, detectLanguage, devConsole, disableHotReload, enableHotReload, genServiceId, generateEditorId, getHotkeyById, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, isDOMNode, isDocumentFragment, isPunctuationChar, isPureUrl, isValidUrl, moment, noop, prodSafeLogger, reconcileDecorator, registerEditorKernel, registerLinkHighlightCommand, registerToolbarCommand, resetRandomKey, scrollIntoView, unregisterEditorKernel, useHasDiffNode, useLexicalComposerContext, useLexicalEditor };
|
|
2898
|
+
export { $closest, $closestNodeType, $createCursorNode, $getNearestNodeFromDOMNode, $getNodeFromDOMNode, $isCardLikeElementNode, $isCursorNode, AutoCompletePlugin, CardLikeElementNode, CodePlugin, CodeblockPlugin, CodeblockPluginOptions, CodemirrorPlugin, CodemirrorPluginOptions, CommonPlugin, CommonPluginOptions, DEFAULT_HEADLESS_EDITOR_PLUGINS, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, DiffAction, EDITOR_THEME_KEY, FilePlugin, FilePluginOptions, GET_MARKDOWN_SELECTION_COMMAND, HIDE_TOOLBAR_COMMAND, HOVER_COMMAND, HRPlugin, HRPluginOptions, HeadlessDocumentType, HeadlessEditor, HeadlessEditorExport, HeadlessEditorExportOptions, HeadlessEditorHydrationInput, HeadlessEditorOptions, HeadlessLiteXMLBatchOperation, HeadlessLiteXMLInsertOperation, HeadlessLiteXMLOperation, HeadlessLiteXMLRemoveOperation, HeadlessLiteXMLReplaceOperation, HotkeyEnum, HotkeyId, HotkeyItem, HotkeyScopeEnum, HotkeyScopeId, type IEditor, ILinkService, ILitexmlService, IMarkdownShortCutService, INSERT_CHECK_LIST_COMMAND, INSERT_CODEINLINE_COMMAND, INSERT_CODEMIRROR_COMMAND, INSERT_FILE_COMMAND, INSERT_HEADING_COMMAND, INSERT_HORIZONTAL_RULE_COMMAND, INSERT_IMAGE_COMMAND, INSERT_LINK_COMMAND, INSERT_LINK_HIGHLIGHT_COMMAND, INSERT_MARKDOWN_COMMAND, INSERT_MATH_COMMAND, INSERT_MENTION_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_QUOTE_COMMAND, INSERT_TABLE_COMMAND, INSERT_UNORDERED_LIST_COMMAND, INodePlugin, INodePluginOptions, INodeService, ISlashMenuOption, ISlashOption, ISlashService, ITriggerContext, IUploadService, ImagePlugin, ImagePluginOptions, Kernel, KeyEnum, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND, LexicalErrorBoundary, LexicalPortalContainer, LinkHighlightPlugin, LinkHighlightPluginOptions, LinkPlugin, LinkPluginOptions, ListPlugin, ListPluginOptions, LitexmlDataSource, LitexmlPlugin, type LitexmlPluginOptions, LitexmlService, type MARKDOWN_READER_LEVEL, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX, MarkdownPlugin, MathPlugin, MentionPlugin, MentionPluginOptions, MenuRenderProps, ModifierCombination, REMOVE_LIST_COMMAND, ReactAutoCompletePlugin, ReactCodePlugin, ReactCodeblockPlugin, ReactCodeblockPluginProps, ReactCodemirrorPlugin, ReactEditor, ReactEditorContent, ReactEditorContentProps, ReactFilePlugin, ReactFilePluginProps, ReactHRPlugin, ReactHRPluginProps, ReactImagePlugin, ReactImagePluginProps, ReactLinkHighlightPlugin, ReactLinkPlugin, ReactLinkPluginProps, ReactListPlugin, ReactListPluginProps, ReactLiteXmlPlugin, ReactMarkdownPlugin, ReactMathPlugin, ReactMentionPlugin, ReactMentionPluginProps, ReactNodePlugin, ReactPlainText, ReactPlainTextProps, ReactSlashOption, ReactSlashOptionProps, ReactSlashPlugin, ReactSlashPluginProps, ReactTablePlugin, ReactToolbarPlugin, ReactVirtualBlockPlugin, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND, SELECT_TABLE_COMMAND, SHOW_TOOLBAR_COMMAND, type SerializedMentionNode, SlashMenu, SlashMenuProps, SlashOptions, SlashPlugin, SlashPluginOptions, TablePlugin, TablePluginOptions, ToolbarCommandOptions, UPDATE_CODEBLOCK_LANG, UPDATE_LIST_START_COMMAND, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM, UploadPlugin, UploadPluginOptions, VirtualBlockPlugin, VirtualBlockPluginOptions, type XMLReaderFunc, type XMLReaderRecord, type XMLWriterFunc, type XMLWriterRecord, assert, browserDebug, bundledLanguagesInfo, compareNodeOrder, createDebugLogger, createEmptyEditorState, createHeadlessEditor, cursorNodeSerialized, debugLogger, debugLoggers, detectCodeLanguage, detectLanguage, devConsole, disableHotReload, enableHotReload, genServiceId, generateEditorId, getHotkeyById, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, isDOMNode, isDocumentFragment, isPunctuationChar, isPureUrl, isValidUrl, moment, noop, prodSafeLogger, reconcileDecorator, registerEditorKernel, registerLinkHighlightCommand, registerToolbarCommand, resetRandomKey, scrollIntoView, unregisterEditorKernel, useHasDiffNode, useLexicalComposerContext, useLexicalEditor };
|