@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
@@ -1,4 +1,4 @@
1
- import { createStaticStyles } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/plugins/block/react/style.ts
3
3
  const ANCHOR_PADDING_CSS_VAR = "--lobe-block-anchor-padding";
4
4
  /**
@@ -3,8 +3,8 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
3
3
  import { MarkdownPlugin } from "../../markdown/plugin/index.js";
4
4
  import { CodePlugin } from "../plugin/index.js";
5
5
  import { styles } from "./style.js";
6
+ import { cx } from "@lobehub/ui";
6
7
  import { useLayoutEffect } from "react";
7
- import { cx } from "antd-style";
8
8
  //#region src/plugins/code/react/CodeReactPlugin.tsx
9
9
  const ReactCodePlugin = ({ className, enableHotkey = true }) => {
10
10
  const [editor] = useLexicalComposerContext();
@@ -1,4 +1,4 @@
1
- import { createStaticStyles } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/plugins/code/react/style.ts
3
3
  const styles = createStaticStyles(({ css, cssVar }) => ({ codeInline: css`
4
4
  display: inline;
@@ -3,8 +3,8 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
3
3
  import { MarkdownPlugin } from "../../markdown/plugin/index.js";
4
4
  import { CodeblockPlugin } from "../plugin/index.js";
5
5
  import { styles } from "./style.js";
6
+ import { cx } from "@lobehub/ui";
6
7
  import { useLayoutEffect } from "react";
7
- import { cx } from "antd-style";
8
8
  //#region src/plugins/codeblock/react/ReactCodeblockPlugin.tsx
9
9
  const ReactCodeblockPlugin = ({ theme, shikiTheme }) => {
10
10
  const [editor] = useLexicalComposerContext();
@@ -1,4 +1,4 @@
1
- import { createStaticStyles } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/plugins/codeblock/react/style.ts
3
3
  const styles = createStaticStyles(({ css, cssVar }) => ({
4
4
  code: css`
@@ -8,12 +8,10 @@ import { SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND } fro
8
8
  import { useLexicalNodeSelection } from "../../../editor-kernel/react/useLexicalNodeSelection.js";
9
9
  import MermaidPreview from "./MermaidPreview.js";
10
10
  import { useCodemirrorEditLock } from "./useCodemirrorEditLock.js";
11
- import { ActionIcon } from "@lobehub/ui/base-ui";
11
+ import { ActionIcon, Block, cx } from "@lobehub/ui";
12
12
  import { CodeXml, Eye } from "lucide-react";
13
13
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
- import { Block } from "@lobehub/ui";
16
- import { cx } from "antd-style";
17
15
  import { debounce } from "es-toolkit/compat";
18
16
  import { $getSelection, $setSelection, COMMAND_PRIORITY_CRITICAL, KEY_DOWN_COMMAND } from "lexical";
19
17
  import { mergeRegister } from "@lexical/utils";
@@ -1,8 +1,7 @@
1
1
  "use client";
2
+ import { Mermaid, cssVar } from "@lobehub/ui";
2
3
  import { useEffect, useState } from "react";
3
4
  import { jsx } from "react/jsx-runtime";
4
- import { Mermaid } from "@lobehub/ui";
5
- import { cssVar } from "antd-style";
6
5
  //#region src/plugins/codemirror-block/react/MermaidPreview.tsx
7
6
  const MermaidPreview = ({ code }) => {
8
7
  const [error, setError] = useState(null);
@@ -3,8 +3,8 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
3
3
  import { MarkdownPlugin } from "../../markdown/plugin/index.js";
4
4
  import { CollapsiblePlugin } from "../plugin/index.js";
5
5
  import { styles } from "./style.js";
6
+ import { cx } from "@lobehub/ui";
6
7
  import { useLayoutEffect } from "react";
7
- import { cx } from "antd-style";
8
8
  //#region src/plugins/collapsible/react/ReactCollapsiblePlugin.tsx
9
9
  const ReactCollapsiblePlugin = ({ className }) => {
10
10
  const [editor] = useLexicalComposerContext();
@@ -1,67 +1,77 @@
1
- import { css } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/plugins/collapsible/react/style.ts
3
- const styles = css`
4
- position: relative;
5
- margin: 12px 0;
6
- padding: 14px 16px 14px 42px;
7
- border: 1px solid rgba(51, 103, 153, 0.72);
8
- border-radius: 8px;
9
-
10
- &[data-collapsible-collapsed='true'] {
11
- padding-block: 10px;
12
- }
13
-
14
- [data-collapsible-toggle='true'] {
15
- cursor: pointer;
16
- position: absolute;
17
- inset-block-start: 20px;
18
- inset-inline-start: 16px;
19
- width: 14px;
20
- height: 14px;
21
- padding: 0;
22
- border: 0;
23
- color: currentColor;
24
- background: transparent;
25
- }
26
-
27
- &[data-collapsible-collapsed='true'] > [data-collapsible-toggle='true'] {
28
- inset-block-start: 15px;
29
- }
30
-
31
- [data-collapsible-toggle='true']::before {
32
- content: '';
33
- display: block;
34
- width: 0;
35
- height: 0;
36
- margin: 3px 0 0 2px;
37
- border-style: solid;
38
- }
39
-
40
- &[data-collapsible-collapsed='false'] > [data-collapsible-toggle='true']::before {
41
- border-width: 7px 5px 0 5px;
42
- border-color: currentColor transparent transparent transparent;
43
- }
44
-
45
- &[data-collapsible-collapsed='true'] > [data-collapsible-toggle='true']::before {
46
- border-width: 5px 0 5px 7px;
47
- border-color: transparent transparent transparent currentColor;
48
- }
49
-
50
- [data-collapsible-content='true'] > *:first-child {
51
- margin-block-start: 0;
52
- }
53
-
54
- [data-collapsible-content='true'] > *:last-child {
55
- margin-block-end: 0;
56
- }
57
-
58
- &[data-collapsible-collapsed='true'] > [data-collapsible-content='true'] > *:first-child {
59
- margin-block-end: 0;
60
- }
61
-
62
- &[data-collapsible-collapsed='true'] > [data-collapsible-content='true'] > *:not(:first-child) {
63
- display: none !important;
64
- }
65
- `;
3
+ const styles = createStaticStyles(({ css }) => css`
4
+ position: relative;
5
+
6
+ margin-block: 12px;
7
+ margin-inline: 0;
8
+ padding-block: 14px;
9
+ padding-inline: 42px 16px;
10
+ border: 1px solid rgb(51 103 153 / 72%);
11
+ border-radius: 8px;
12
+
13
+ &[data-collapsible-collapsed='true'] {
14
+ padding-block: 10px;
15
+ }
16
+
17
+ [data-collapsible-toggle='true'] {
18
+ cursor: pointer;
19
+
20
+ position: absolute;
21
+ inset-block-start: 20px;
22
+ inset-inline-start: 16px;
23
+
24
+ width: 14px;
25
+ height: 14px;
26
+ padding: 0;
27
+ border: 0;
28
+
29
+ color: currentcolor;
30
+
31
+ background: transparent;
32
+ }
33
+
34
+ &[data-collapsible-collapsed='true'] > [data-collapsible-toggle='true'] {
35
+ inset-block-start: 15px;
36
+ }
37
+
38
+ [data-collapsible-toggle='true']::before {
39
+ content: '';
40
+
41
+ display: block;
42
+
43
+ width: 0;
44
+ height: 0;
45
+ margin-block: 3px 0;
46
+ margin-inline: 2px 0;
47
+ border-style: solid;
48
+ }
49
+
50
+ &[data-collapsible-collapsed='false'] > [data-collapsible-toggle='true']::before {
51
+ border-color: currentcolor transparent transparent;
52
+ border-width: 7px 5px 0;
53
+ }
54
+
55
+ &[data-collapsible-collapsed='true'] > [data-collapsible-toggle='true']::before {
56
+ border-color: transparent transparent transparent currentcolor;
57
+ border-width: 5px 0 5px 7px;
58
+ }
59
+
60
+ [data-collapsible-content='true'] > *:first-child {
61
+ margin-block-start: 0;
62
+ }
63
+
64
+ [data-collapsible-content='true'] > *:last-child {
65
+ margin-block-end: 0;
66
+ }
67
+
68
+ &[data-collapsible-collapsed='true'] > [data-collapsible-content='true'] > *:first-child {
69
+ margin-block-end: 0;
70
+ }
71
+
72
+ &[data-collapsible-collapsed='true'] > [data-collapsible-content='true'] > *:not(:first-child) {
73
+ display: none !important;
74
+ }
75
+ `);
66
76
  //#endregion
67
77
  export { styles };
@@ -1,18 +1,40 @@
1
- import { INodeHelper, init_helper } from "../../../editor-kernel/inode/helper.js";
1
+ import { $normalizeNodeIds, init_node_id, migrateSerializedNodeIds } from "../node/node-id.js";
2
2
  import { exportNodeToJSON, init_utils } from "../utils/index.js";
3
3
  import DataSource from "../../../editor-kernel/data-source.js";
4
4
  import { cursorNodeSerialized } from "../node/cursor.js";
5
- import { $parseSerializedNodeImpl } from "../../litexml/utils/index.js";
6
5
  import { $isTableSelection } from "@lexical/table";
7
- import { $getCharacterOffsets, $getNodeByKey, $getRoot, $getSelection, $isElementNode, $isRangeSelection, $isTextNode, IS_CODE, resetRandomKey } from "lexical";
6
+ import { $getCharacterOffsets, $getNodeByKey, $getRoot, $getSelection, $isElementNode, $isRangeSelection, $isTextNode, IS_CODE } from "lexical";
8
7
  //#region src/plugins/common/data-source/json-data-source.ts
9
- init_helper();
8
+ init_node_id();
10
9
  init_utils();
11
10
  var JSONDataSource = class extends DataSource {
12
11
  read(editor, data, options = {}) {
13
- let dataObj;
14
- if (typeof data === "string") dataObj = JSON.parse(data);
15
- else dataObj = data;
12
+ let inputData;
13
+ if (typeof data === "string") inputData = JSON.parse(data);
14
+ else inputData = data;
15
+ const dataObj = structuredClone(inputData);
16
+ if (!(options.keepId ?? dataObj.keepId ?? false)) {
17
+ const stripNodeIds = (node) => {
18
+ delete node.id;
19
+ const state = node.$;
20
+ if (state && typeof state === "object" && state.properties) {
21
+ const properties = { ...state.properties };
22
+ delete properties.nodeId;
23
+ if (Object.keys(properties).length > 0) node.$ = {
24
+ ...state,
25
+ properties
26
+ };
27
+ else {
28
+ const nextState = { ...state };
29
+ delete nextState.properties;
30
+ if (Object.keys(nextState).length > 0) node.$ = nextState;
31
+ else delete node.$;
32
+ }
33
+ }
34
+ if (Array.isArray(node.children)) node.children.forEach((child) => stripNodeIds(child));
35
+ };
36
+ stripNodeIds(dataObj.root);
37
+ } else migrateSerializedNodeIds(dataObj.root);
16
38
  const process = (node) => {
17
39
  for (let i = 0; i < node.children.length; i++) {
18
40
  const child = node.children[i];
@@ -34,24 +56,10 @@ var JSONDataSource = class extends DataSource {
34
56
  }
35
57
  };
36
58
  process(dataObj.root);
37
- if (dataObj.keepId || options.keepId) {
38
- const state = editor.parseEditorState({ root: INodeHelper.createRootNode() }, (state) => {
39
- try {
40
- const root = $parseSerializedNodeImpl(dataObj.root, editor, true, state);
41
- let maxId = -1;
42
- Array.from(state._nodeMap.keys()).forEach((key) => {
43
- if (key === "root") return;
44
- const numericKey = Number(key);
45
- if (Number.isInteger(numericKey) && numericKey >= 0) maxId = Math.max(maxId, numericKey);
46
- });
47
- resetRandomKey(maxId + 1);
48
- state._nodeMap.set(root.getKey(), root);
49
- } catch (error) {
50
- console.error(error);
51
- }
52
- });
53
- editor.setEditorState(state);
54
- } else editor.setEditorState(editor.parseEditorState({ root: dataObj.root }));
59
+ const editorState = editor.parseEditorState({ root: dataObj.root }, () => {
60
+ $normalizeNodeIds($getRoot());
61
+ });
62
+ editor.setEditorState(editorState);
55
63
  }
56
64
  write(editor, options) {
57
65
  if (options?.selection) return editor.getEditorState().read(() => {
@@ -1,8 +1,10 @@
1
1
  import { INodeHelper, init_helper } from "../../../editor-kernel/inode/helper.js";
2
+ import { $normalizeNodeIds, init_node_id } from "../node/node-id.js";
2
3
  import DataSource from "../../../editor-kernel/data-source.js";
3
4
  import { $getRoot, $getSelection } from "lexical";
4
5
  //#region src/plugins/common/data-source/text-data-source.ts
5
6
  init_helper();
7
+ init_node_id();
6
8
  var TextDataSource = class extends DataSource {
7
9
  read(editor, data) {
8
10
  if (typeof data !== "string") throw new Error("Invalid data type " + typeof data);
@@ -16,7 +18,10 @@ var TextDataSource = class extends DataSource {
16
18
  }
17
19
  INodeHelper.appendChild(rootNode, paragraph);
18
20
  });
19
- editor.setEditorState(editor.parseEditorState({ root: rootNode }));
21
+ const editorState = editor.parseEditorState({ root: rootNode }, () => {
22
+ $normalizeNodeIds($getRoot());
23
+ });
24
+ editor.setEditorState(editorState);
20
25
  }
21
26
  write(editor, options) {
22
27
  if (options?.selection) return editor.getEditorState().read(() => {
@@ -1,3 +1,5 @@
1
+ import { $getNodeById, $getNodeId } from "./node/node-id.js";
2
+ import { INodeIdentityService, NodeIdentitySnapshot } from "./service/i-node-identity-service.js";
1
3
  import { INSERT_HEADING_COMMAND, INSERT_QUOTE_COMMAND } from "./command/index.js";
2
4
  import { $createCursorNode, $isCardLikeElementNode, $isCursorNode, CardLikeElementNode, cursorNodeSerialized } from "./node/cursor.js";
3
5
  import { CommonPlugin, CommonPluginOptions } from "./plugin/index.js";
@@ -5,4 +7,4 @@ import { ReactEditorContentProps, ReactPlainTextProps } from "./react/type.js";
5
7
  import ReactEditorContent from "./react/ReactEditorContent.js";
6
8
  import ReactPlainText from "./react/ReactPlainText.js";
7
9
  import "./react/index.js";
8
- export { $createCursorNode, $isCardLikeElementNode, $isCursorNode, CardLikeElementNode, CommonPlugin, CommonPluginOptions, INSERT_HEADING_COMMAND, INSERT_QUOTE_COMMAND, ReactEditorContent, ReactEditorContentProps, ReactPlainText, ReactPlainTextProps, cursorNodeSerialized };
10
+ export { $createCursorNode, $getNodeById, $getNodeId, $isCardLikeElementNode, $isCursorNode, CardLikeElementNode, CommonPlugin, CommonPluginOptions, INSERT_HEADING_COMMAND, INSERT_QUOTE_COMMAND, INodeIdentityService, type NodeIdentitySnapshot, ReactEditorContent, ReactEditorContentProps, ReactPlainText, ReactPlainTextProps, cursorNodeSerialized };
@@ -0,0 +1,7 @@
1
+ import { EditorState, LexicalEditor, LexicalNode } from "lexical";
2
+ //#region src/plugins/common/node/node-id.d.ts
3
+ declare function $getNodeId(node: LexicalNode): string | undefined;
4
+ /** Find the active representation of a logical ID in a Lexical read/update context. */
5
+ declare function $getNodeById(nodeId: string, root?: LexicalNode): LexicalNode | null;
6
+ //#endregion
7
+ export { $getNodeById, $getNodeId };