@lobehub/editor 4.16.0 → 4.16.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/headless/index.d.ts +1 -1
- package/es/headless/index.js +1 -1
- package/es/headless.d.ts +1 -18
- package/es/headless.js +1 -6
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -2
- package/es/plugins/litexml/command/diffCommand.d.ts +2 -17
- package/es/plugins/litexml/command/diffCommand.js +3 -9
- package/es/plugins/litexml/command/index.d.ts +2 -38
- package/es/plugins/litexml/command/index.js +3 -6
- package/es/plugins/litexml/command/symbols.d.ts +67 -0
- package/es/plugins/litexml/command/symbols.js +34 -0
- package/es/plugins/litexml/index.d.ts +1 -2
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +1 -1
- package/es/symbols-DEEvsKq4.d.ts +67 -0
- package/package.json +5 -1
package/es/headless/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDocumentOptions, IEditor, IPlugin } from "../types/kernel.js";
|
|
2
|
-
import { LITEXML_MODIFY_COMMAND } from "../plugins/litexml/command/
|
|
2
|
+
import { LITEXML_MODIFY_COMMAND } from "../plugins/litexml/command/symbols.js";
|
|
3
3
|
import { FileListItem, ImageListItem, MediaLists, extractMediaFromEditorState } from "./extract-media-from-editor-state.js";
|
|
4
4
|
import { CommandPayloadType, SerializedEditorState, SerializedLexicalNode } from "lexical";
|
|
5
5
|
|
package/es/headless/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { moment } from "../editor-kernel/utils.js";
|
|
2
2
|
import Editor from "../editor-kernel/index.js";
|
|
3
|
-
import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "../plugins/litexml/command/
|
|
3
|
+
import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "../plugins/litexml/command/symbols.js";
|
|
4
4
|
import { MarkdownPlugin } from "../plugins/markdown/plugin/index.js";
|
|
5
5
|
import { LitexmlPlugin } from "../plugins/litexml/plugin/index.js";
|
|
6
6
|
import { CommonPlugin } from "../plugins/common/plugin/index.js";
|
package/es/headless.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { o as LITEXML_MODIFY_COMMAND } from "./symbols-DEEvsKq4.js";
|
|
1
2
|
import { HistoryState, HistoryStateEntry } from "@lexical/history";
|
|
2
|
-
import * as _$lexical from "lexical";
|
|
3
3
|
import { CommandListener, CommandListenerPriority, CommandPayloadType, EditorState, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, LexicalNodeConfig, SerializedEditorState, SerializedLexicalNode } from "lexical";
|
|
4
4
|
|
|
5
5
|
//#region src/editor-kernel/data-source.d.ts
|
|
@@ -473,23 +473,6 @@ interface IEditorPluginConstructor<IConfig> {
|
|
|
473
473
|
}
|
|
474
474
|
type IPlugin<T = any> = IEditorPluginConstructor<T> | [IEditorPluginConstructor<T>, T?];
|
|
475
475
|
//#endregion
|
|
476
|
-
//#region src/plugins/litexml/command/index.d.ts
|
|
477
|
-
declare const LITEXML_MODIFY_COMMAND: _$lexical.LexicalCommand<({
|
|
478
|
-
action: "insert";
|
|
479
|
-
beforeId: string;
|
|
480
|
-
litexml: string;
|
|
481
|
-
} | {
|
|
482
|
-
action: "insert";
|
|
483
|
-
afterId: string;
|
|
484
|
-
litexml: string;
|
|
485
|
-
} | {
|
|
486
|
-
action: "remove";
|
|
487
|
-
id: string;
|
|
488
|
-
} | {
|
|
489
|
-
action: "modify";
|
|
490
|
-
litexml: string | string[];
|
|
491
|
-
})[]>;
|
|
492
|
-
//#endregion
|
|
493
476
|
//#region src/headless/extract-media-from-editor-state.d.ts
|
|
494
477
|
interface ImageListItem {
|
|
495
478
|
alt: string;
|
package/es/headless.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./plugins/litexml/command/symbols.js";
|
|
1
2
|
import { createHeadlessEditor as createHeadlessEditor$1 } from "@lexical/headless";
|
|
2
3
|
import { createEmptyHistoryState, registerHistory } from "@lexical/history";
|
|
3
4
|
import { $computeTableMapSkipCellCheck, $createTableNodeWithDimensions, $createTableSelection, $deleteTableColumnAtSelection, $deleteTableRowAtSelection, $findTableNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isSimpleTable, $isTableCellNode, $isTableNode, $isTableRowNode, $isTableSelection, TableCellNode, TableNode, TableNode as TableNode$1, TableRowNode, registerTableCellUnmergeTransform, registerTablePlugin, registerTableSelectionObserver, setScrollableTablesActive } from "@lexical/table";
|
|
@@ -1847,10 +1848,6 @@ function wrapBlockModify(oldBlock, editor, changeFn) {
|
|
|
1847
1848
|
diffNode.append($cloneNode(newBlock, editor));
|
|
1848
1849
|
newBlock.replace(diffNode, false);
|
|
1849
1850
|
}
|
|
1850
|
-
const LITEXML_MODIFY_COMMAND = createCommand("LITEXML_MODIFY_COMMAND");
|
|
1851
|
-
const LITEXML_APPLY_COMMAND = createCommand("LITEXML_APPLY_COMMAND");
|
|
1852
|
-
const LITEXML_REMOVE_COMMAND = createCommand("LITEXML_REMOVE_COMMAND");
|
|
1853
|
-
const LITEXML_INSERT_COMMAND = createCommand("LITEXML_INSERT_COMMAND");
|
|
1854
1851
|
function registerLiteXMLCommand(editor, dataSource) {
|
|
1855
1852
|
return mergeRegister(editor.registerCommand(LITEXML_MODIFY_COMMAND, (payload) => {
|
|
1856
1853
|
const resultPayload = payload.reduce((acc, cur) => {
|
|
@@ -2077,8 +2074,6 @@ function handleInsert(editor, payload, dataSource) {
|
|
|
2077
2074
|
}
|
|
2078
2075
|
//#endregion
|
|
2079
2076
|
//#region src/plugins/litexml/command/diffCommand.ts
|
|
2080
|
-
const LITEXML_DIFFNODE_COMMAND = createCommand("LITEXML_DIFFNODE_COMMAND");
|
|
2081
|
-
const LITEXML_DIFFNODE_ALL_COMMAND = createCommand("LITEXML_DIFFNODE_ALL_COMMAND");
|
|
2082
2077
|
function doAction(node, action) {
|
|
2083
2078
|
if (node.diffType === "modify") {
|
|
2084
2079
|
const children = node.getChildren();
|
package/es/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { ReactEditor } from "./editor-kernel/react/react-editor.js";
|
|
|
12
12
|
import { useLexicalEditor } from "./editor-kernel/react/useLexicalEditor.js";
|
|
13
13
|
import { ILitexmlService, LitexmlService, XMLReaderFunc, XMLReaderRecord, XMLWriterFunc, XMLWriterRecord } from "./plugins/litexml/service/litexml-service.js";
|
|
14
14
|
import { LitexmlDataSource } from "./plugins/litexml/data-source/litexml-data-source.js";
|
|
15
|
-
import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./plugins/litexml/command/
|
|
15
|
+
import { DiffAction, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./plugins/litexml/command/symbols.js";
|
|
16
16
|
import { FileListItem, ImageListItem, MediaLists, extractMediaFromEditorState } from "./headless/extract-media-from-editor-state.js";
|
|
17
17
|
import { DEFAULT_HEADLESS_EDITOR_PLUGINS, HeadlessDocumentType, HeadlessEditor, HeadlessEditorExport, HeadlessEditorExportOptions, HeadlessEditorHydrationInput, HeadlessEditorOptions, HeadlessLiteXMLBatchOperation, HeadlessLiteXMLInsertOperation, HeadlessLiteXMLOperation, HeadlessLiteXMLRemoveOperation, HeadlessLiteXMLReplaceOperation, createHeadlessEditor } from "./headless/index.js";
|
|
18
18
|
import { AutoCompletePlugin } from "./plugins/auto-complete/plugin/index.js";
|
|
@@ -73,7 +73,6 @@ import { INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST
|
|
|
73
73
|
import { ListPlugin, ListPluginOptions } from "./plugins/list/plugin/index.js";
|
|
74
74
|
import { ReactListPluginProps } from "./plugins/list/react/type.js";
|
|
75
75
|
import { ReactListPlugin } from "./plugins/list/react/ReactListPlugin.js";
|
|
76
|
-
import { DiffAction, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND } from "./plugins/litexml/command/diffCommand.js";
|
|
77
76
|
import { LitexmlPlugin, LitexmlPluginOptions } from "./plugins/litexml/plugin/index.js";
|
|
78
77
|
import { ReactLiteXmlPlugin } from "./plugins/litexml/react/index.js";
|
|
79
78
|
import { useHasDiffNode } from "./plugins/litexml/react/hooks/useHasDiffNode.js";
|
package/es/index.js
CHANGED
|
@@ -14,8 +14,7 @@ import { ReactEditor } from "./editor-kernel/react/react-editor.js";
|
|
|
14
14
|
import { useLexicalEditor } from "./editor-kernel/react/useLexicalEditor.js";
|
|
15
15
|
import { INSERT_HEADING_COMMAND, INSERT_QUOTE_COMMAND } from "./plugins/common/command/index.js";
|
|
16
16
|
import { $createCursorNode, $isCardLikeElementNode, $isCursorNode, CardLikeElementNode, cursorNodeSerialized } from "./plugins/common/node/cursor.js";
|
|
17
|
-
import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./plugins/litexml/command/
|
|
18
|
-
import { DiffAction, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND } from "./plugins/litexml/command/diffCommand.js";
|
|
17
|
+
import { DiffAction, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./plugins/litexml/command/symbols.js";
|
|
19
18
|
import { INodeService } from "./plugins/inode/service/index.js";
|
|
20
19
|
import { INodePlugin } from "./plugins/inode/plugin/index.js";
|
|
21
20
|
import ReactNodePlugin from "./plugins/inode/react/index.js";
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LexicalEditor } from "lexical";
|
|
3
|
-
|
|
4
|
-
//#region src/plugins/litexml/command/diffCommand.d.ts
|
|
5
|
-
declare enum DiffAction {
|
|
6
|
-
Reject = 0,
|
|
7
|
-
Accept = 1
|
|
8
|
-
}
|
|
9
|
-
declare const LITEXML_DIFFNODE_COMMAND: _$lexical.LexicalCommand<{
|
|
10
|
-
action: DiffAction;
|
|
11
|
-
nodeKey: string;
|
|
12
|
-
}>;
|
|
13
|
-
declare const LITEXML_DIFFNODE_ALL_COMMAND: _$lexical.LexicalCommand<{
|
|
14
|
-
action: DiffAction;
|
|
15
|
-
}>;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { DiffAction, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND };
|
|
1
|
+
import { DiffAction, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND } from "./symbols.js";
|
|
2
|
+
import { LexicalEditor } from "lexical";
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { DiffNode } from "../node/DiffNode.js";
|
|
2
|
-
import {
|
|
2
|
+
import { LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND } from "./symbols.js";
|
|
3
|
+
import { $getNodeByKey, $isElementNode, COMMAND_PRIORITY_EDITOR } from "lexical";
|
|
3
4
|
import { mergeRegister } from "@lexical/utils";
|
|
4
5
|
//#region src/plugins/litexml/command/diffCommand.ts
|
|
5
|
-
let DiffAction = /* @__PURE__ */ function(DiffAction) {
|
|
6
|
-
DiffAction[DiffAction["Reject"] = 0] = "Reject";
|
|
7
|
-
DiffAction[DiffAction["Accept"] = 1] = "Accept";
|
|
8
|
-
return DiffAction;
|
|
9
|
-
}({});
|
|
10
|
-
const LITEXML_DIFFNODE_COMMAND = createCommand("LITEXML_DIFFNODE_COMMAND");
|
|
11
|
-
const LITEXML_DIFFNODE_ALL_COMMAND = createCommand("LITEXML_DIFFNODE_ALL_COMMAND");
|
|
12
6
|
function doAction(node, action) {
|
|
13
7
|
if (node.diffType === "modify") {
|
|
14
8
|
const children = node.getChildren();
|
|
@@ -94,4 +88,4 @@ function registerLiteXMLDiffCommand(editor) {
|
|
|
94
88
|
}, COMMAND_PRIORITY_EDITOR));
|
|
95
89
|
}
|
|
96
90
|
//#endregion
|
|
97
|
-
export {
|
|
91
|
+
export { registerLiteXMLDiffCommand };
|
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LexicalEditor } from "lexical";
|
|
3
|
-
|
|
4
|
-
//#region src/plugins/litexml/command/index.d.ts
|
|
5
|
-
declare const LITEXML_MODIFY_COMMAND: _$lexical.LexicalCommand<({
|
|
6
|
-
action: "insert";
|
|
7
|
-
beforeId: string;
|
|
8
|
-
litexml: string;
|
|
9
|
-
} | {
|
|
10
|
-
action: "insert";
|
|
11
|
-
afterId: string;
|
|
12
|
-
litexml: string;
|
|
13
|
-
} | {
|
|
14
|
-
action: "remove";
|
|
15
|
-
id: string;
|
|
16
|
-
} | {
|
|
17
|
-
action: "modify";
|
|
18
|
-
litexml: string | string[];
|
|
19
|
-
})[]>;
|
|
20
|
-
declare const LITEXML_APPLY_COMMAND: _$lexical.LexicalCommand<{
|
|
21
|
-
delay?: boolean;
|
|
22
|
-
litexml: string | string[];
|
|
23
|
-
}>;
|
|
24
|
-
declare const LITEXML_REMOVE_COMMAND: _$lexical.LexicalCommand<{
|
|
25
|
-
delay?: boolean;
|
|
26
|
-
id: string;
|
|
27
|
-
}>;
|
|
28
|
-
declare const LITEXML_INSERT_COMMAND: _$lexical.LexicalCommand<{
|
|
29
|
-
beforeId: string;
|
|
30
|
-
delay?: boolean;
|
|
31
|
-
litexml: string;
|
|
32
|
-
} | {
|
|
33
|
-
afterId: string;
|
|
34
|
-
delay?: boolean;
|
|
35
|
-
litexml: string;
|
|
36
|
-
}>;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND };
|
|
1
|
+
import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./symbols.js";
|
|
2
|
+
import { LexicalEditor } from "lexical";
|
|
@@ -2,7 +2,8 @@ import { createDebugLogger, init_debug } from "../../../utils/debug.js";
|
|
|
2
2
|
import { $closest } from "../../../editor-kernel/utils.js";
|
|
3
3
|
import { $createDiffNode, DiffNode } from "../node/DiffNode.js";
|
|
4
4
|
import { $cloneNode, $parseSerializedNodeImpl, charToId } from "../utils/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./symbols.js";
|
|
6
|
+
import { $createParagraphNode, $getNodeByKey, $getRoot, $insertNodes, $isElementNode, COMMAND_PRIORITY_EDITOR } from "lexical";
|
|
6
7
|
import { mergeRegister } from "@lexical/utils";
|
|
7
8
|
import { $isListItemNode } from "@lexical/list";
|
|
8
9
|
//#region src/plugins/litexml/command/index.ts
|
|
@@ -101,10 +102,6 @@ function wrapBlockModify(oldBlock, editor, changeFn) {
|
|
|
101
102
|
diffNode.append($cloneNode(newBlock, editor));
|
|
102
103
|
newBlock.replace(diffNode, false);
|
|
103
104
|
}
|
|
104
|
-
const LITEXML_MODIFY_COMMAND = createCommand("LITEXML_MODIFY_COMMAND");
|
|
105
|
-
const LITEXML_APPLY_COMMAND = createCommand("LITEXML_APPLY_COMMAND");
|
|
106
|
-
const LITEXML_REMOVE_COMMAND = createCommand("LITEXML_REMOVE_COMMAND");
|
|
107
|
-
const LITEXML_INSERT_COMMAND = createCommand("LITEXML_INSERT_COMMAND");
|
|
108
105
|
function registerLiteXMLCommand(editor, dataSource) {
|
|
109
106
|
return mergeRegister(editor.registerCommand(LITEXML_MODIFY_COMMAND, (payload) => {
|
|
110
107
|
const resultPayload = payload.reduce((acc, cur) => {
|
|
@@ -330,4 +327,4 @@ function handleInsert(editor, payload, dataSource) {
|
|
|
330
327
|
});
|
|
331
328
|
}
|
|
332
329
|
//#endregion
|
|
333
|
-
export {
|
|
330
|
+
export { registerLiteXMLCommand };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as _$lexical from "lexical";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/litexml/command/symbols.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* LiteXML command identities.
|
|
6
|
+
*
|
|
7
|
+
* These symbols are intentionally isolated in a side-effect-free module so they
|
|
8
|
+
* keep a SINGLE runtime identity across every entry of this package.
|
|
9
|
+
*
|
|
10
|
+
* Lexical's `dispatchCommand` matches command listeners by object reference, not
|
|
11
|
+
* by the string label. The package ships two independently-bundled entries — the
|
|
12
|
+
* browser build (`index` / `react` / `renderer`) and the node build (`headless`)
|
|
13
|
+
* — and if each entry inlined its own `createCommand(...)` call, dispatching a
|
|
14
|
+
* command obtained from one entry onto an editor registered by the other would
|
|
15
|
+
* silently no-op (different object identities, same label).
|
|
16
|
+
*
|
|
17
|
+
* By keeping every command in this one module — exposed verbatim through
|
|
18
|
+
* `@lobehub/editor/litexml-commands` and emitted as a shared chunk by both
|
|
19
|
+
* builds — a single object backs the command in any runtime, and the module is
|
|
20
|
+
* pure enough to be imported on the server without pulling in the DOM-dependent
|
|
21
|
+
* editor bundle.
|
|
22
|
+
*/
|
|
23
|
+
declare enum DiffAction {
|
|
24
|
+
Reject = 0,
|
|
25
|
+
Accept = 1
|
|
26
|
+
}
|
|
27
|
+
declare const LITEXML_MODIFY_COMMAND: _$lexical.LexicalCommand<({
|
|
28
|
+
action: "insert";
|
|
29
|
+
beforeId: string;
|
|
30
|
+
litexml: string;
|
|
31
|
+
} | {
|
|
32
|
+
action: "insert";
|
|
33
|
+
afterId: string;
|
|
34
|
+
litexml: string;
|
|
35
|
+
} | {
|
|
36
|
+
action: "remove";
|
|
37
|
+
id: string;
|
|
38
|
+
} | {
|
|
39
|
+
action: "modify";
|
|
40
|
+
litexml: string | string[];
|
|
41
|
+
})[]>;
|
|
42
|
+
declare const LITEXML_APPLY_COMMAND: _$lexical.LexicalCommand<{
|
|
43
|
+
delay?: boolean;
|
|
44
|
+
litexml: string | string[];
|
|
45
|
+
}>;
|
|
46
|
+
declare const LITEXML_REMOVE_COMMAND: _$lexical.LexicalCommand<{
|
|
47
|
+
delay?: boolean;
|
|
48
|
+
id: string;
|
|
49
|
+
}>;
|
|
50
|
+
declare const LITEXML_INSERT_COMMAND: _$lexical.LexicalCommand<{
|
|
51
|
+
beforeId: string;
|
|
52
|
+
delay?: boolean;
|
|
53
|
+
litexml: string;
|
|
54
|
+
} | {
|
|
55
|
+
afterId: string;
|
|
56
|
+
delay?: boolean;
|
|
57
|
+
litexml: string;
|
|
58
|
+
}>;
|
|
59
|
+
declare const LITEXML_DIFFNODE_COMMAND: _$lexical.LexicalCommand<{
|
|
60
|
+
action: DiffAction;
|
|
61
|
+
nodeKey: string;
|
|
62
|
+
}>;
|
|
63
|
+
declare const LITEXML_DIFFNODE_ALL_COMMAND: _$lexical.LexicalCommand<{
|
|
64
|
+
action: DiffAction;
|
|
65
|
+
}>;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { DiffAction, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createCommand } from "lexical";
|
|
2
|
+
//#region src/plugins/litexml/command/symbols.ts
|
|
3
|
+
/**
|
|
4
|
+
* LiteXML command identities.
|
|
5
|
+
*
|
|
6
|
+
* These symbols are intentionally isolated in a side-effect-free module so they
|
|
7
|
+
* keep a SINGLE runtime identity across every entry of this package.
|
|
8
|
+
*
|
|
9
|
+
* Lexical's `dispatchCommand` matches command listeners by object reference, not
|
|
10
|
+
* by the string label. The package ships two independently-bundled entries — the
|
|
11
|
+
* browser build (`index` / `react` / `renderer`) and the node build (`headless`)
|
|
12
|
+
* — and if each entry inlined its own `createCommand(...)` call, dispatching a
|
|
13
|
+
* command obtained from one entry onto an editor registered by the other would
|
|
14
|
+
* silently no-op (different object identities, same label).
|
|
15
|
+
*
|
|
16
|
+
* By keeping every command in this one module — exposed verbatim through
|
|
17
|
+
* `@lobehub/editor/litexml-commands` and emitted as a shared chunk by both
|
|
18
|
+
* builds — a single object backs the command in any runtime, and the module is
|
|
19
|
+
* pure enough to be imported on the server without pulling in the DOM-dependent
|
|
20
|
+
* editor bundle.
|
|
21
|
+
*/
|
|
22
|
+
let DiffAction = /* @__PURE__ */ function(DiffAction) {
|
|
23
|
+
DiffAction[DiffAction["Reject"] = 0] = "Reject";
|
|
24
|
+
DiffAction[DiffAction["Accept"] = 1] = "Accept";
|
|
25
|
+
return DiffAction;
|
|
26
|
+
}({});
|
|
27
|
+
const LITEXML_MODIFY_COMMAND = createCommand("LITEXML_MODIFY_COMMAND");
|
|
28
|
+
const LITEXML_APPLY_COMMAND = createCommand("LITEXML_APPLY_COMMAND");
|
|
29
|
+
const LITEXML_REMOVE_COMMAND = createCommand("LITEXML_REMOVE_COMMAND");
|
|
30
|
+
const LITEXML_INSERT_COMMAND = createCommand("LITEXML_INSERT_COMMAND");
|
|
31
|
+
const LITEXML_DIFFNODE_COMMAND = createCommand("LITEXML_DIFFNODE_COMMAND");
|
|
32
|
+
const LITEXML_DIFFNODE_ALL_COMMAND = createCommand("LITEXML_DIFFNODE_ALL_COMMAND");
|
|
33
|
+
//#endregion
|
|
34
|
+
export { DiffAction, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ILitexmlService, LitexmlService, XMLReaderFunc, XMLReaderRecord, XMLWriterFunc, XMLWriterRecord } from "./service/litexml-service.js";
|
|
2
2
|
import { LitexmlDataSource } from "./data-source/litexml-data-source.js";
|
|
3
|
-
import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./command/
|
|
4
|
-
import { DiffAction, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND } from "./command/diffCommand.js";
|
|
3
|
+
import { DiffAction, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "./command/symbols.js";
|
|
5
4
|
import { LitexmlPlugin, LitexmlPluginOptions } from "./plugin/index.js";
|
|
6
5
|
import { ReactLiteXmlPlugin } from "./react/index.js";
|
|
7
6
|
import { useHasDiffNode } from "./react/hooks/useHasDiffNode.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import LexicalPortalContainer from "../../../../editor-kernel/react/PortalContainer.js";
|
|
2
|
-
import { LITEXML_DIFFNODE_COMMAND } from "../../command/
|
|
2
|
+
import { LITEXML_DIFFNODE_COMMAND } from "../../command/symbols.js";
|
|
3
3
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
|
|
4
4
|
import { styles } from "./style.js";
|
|
5
5
|
import { ActionIcon, Block } from "@lobehub/ui";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as _$lexical from "lexical";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/litexml/command/symbols.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* LiteXML command identities.
|
|
6
|
+
*
|
|
7
|
+
* These symbols are intentionally isolated in a side-effect-free module so they
|
|
8
|
+
* keep a SINGLE runtime identity across every entry of this package.
|
|
9
|
+
*
|
|
10
|
+
* Lexical's `dispatchCommand` matches command listeners by object reference, not
|
|
11
|
+
* by the string label. The package ships two independently-bundled entries — the
|
|
12
|
+
* browser build (`index` / `react` / `renderer`) and the node build (`headless`)
|
|
13
|
+
* — and if each entry inlined its own `createCommand(...)` call, dispatching a
|
|
14
|
+
* command obtained from one entry onto an editor registered by the other would
|
|
15
|
+
* silently no-op (different object identities, same label).
|
|
16
|
+
*
|
|
17
|
+
* By keeping every command in this one module — exposed verbatim through
|
|
18
|
+
* `@lobehub/editor/litexml-commands` and emitted as a shared chunk by both
|
|
19
|
+
* builds — a single object backs the command in any runtime, and the module is
|
|
20
|
+
* pure enough to be imported on the server without pulling in the DOM-dependent
|
|
21
|
+
* editor bundle.
|
|
22
|
+
*/
|
|
23
|
+
declare enum DiffAction {
|
|
24
|
+
Reject = 0,
|
|
25
|
+
Accept = 1
|
|
26
|
+
}
|
|
27
|
+
declare const LITEXML_MODIFY_COMMAND: _$lexical.LexicalCommand<({
|
|
28
|
+
action: "insert";
|
|
29
|
+
beforeId: string;
|
|
30
|
+
litexml: string;
|
|
31
|
+
} | {
|
|
32
|
+
action: "insert";
|
|
33
|
+
afterId: string;
|
|
34
|
+
litexml: string;
|
|
35
|
+
} | {
|
|
36
|
+
action: "remove";
|
|
37
|
+
id: string;
|
|
38
|
+
} | {
|
|
39
|
+
action: "modify";
|
|
40
|
+
litexml: string | string[];
|
|
41
|
+
})[]>;
|
|
42
|
+
declare const LITEXML_APPLY_COMMAND: _$lexical.LexicalCommand<{
|
|
43
|
+
delay?: boolean;
|
|
44
|
+
litexml: string | string[];
|
|
45
|
+
}>;
|
|
46
|
+
declare const LITEXML_REMOVE_COMMAND: _$lexical.LexicalCommand<{
|
|
47
|
+
delay?: boolean;
|
|
48
|
+
id: string;
|
|
49
|
+
}>;
|
|
50
|
+
declare const LITEXML_INSERT_COMMAND: _$lexical.LexicalCommand<{
|
|
51
|
+
beforeId: string;
|
|
52
|
+
delay?: boolean;
|
|
53
|
+
litexml: string;
|
|
54
|
+
} | {
|
|
55
|
+
afterId: string;
|
|
56
|
+
delay?: boolean;
|
|
57
|
+
litexml: string;
|
|
58
|
+
}>;
|
|
59
|
+
declare const LITEXML_DIFFNODE_COMMAND: _$lexical.LexicalCommand<{
|
|
60
|
+
action: DiffAction;
|
|
61
|
+
nodeKey: string;
|
|
62
|
+
}>;
|
|
63
|
+
declare const LITEXML_DIFFNODE_ALL_COMMAND: _$lexical.LexicalCommand<{
|
|
64
|
+
action: DiffAction;
|
|
65
|
+
}>;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { LITEXML_INSERT_COMMAND as a, LITEXML_DIFFNODE_COMMAND as i, LITEXML_APPLY_COMMAND as n, LITEXML_MODIFY_COMMAND as o, LITEXML_DIFFNODE_ALL_COMMAND as r, LITEXML_REMOVE_COMMAND as s, DiffAction as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/editor",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.1",
|
|
4
4
|
"description": "A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"types": "./es/headless.d.ts",
|
|
35
35
|
"import": "./es/headless.js"
|
|
36
36
|
},
|
|
37
|
+
"./litexml-commands": {
|
|
38
|
+
"types": "./es/plugins/litexml/command/symbols.d.ts",
|
|
39
|
+
"import": "./es/plugins/litexml/command/symbols.js"
|
|
40
|
+
},
|
|
37
41
|
"./react": {
|
|
38
42
|
"types": "./es/react.d.ts",
|
|
39
43
|
"import": "./es/react.js"
|