@lobehub/editor 4.24.1 → 4.25.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 (148) hide show
  1. package/es/codemirror/style.js +42 -0
  2. package/es/editor-kernel/kernel.d.ts +9 -0
  3. package/es/editor-kernel/kernel.js +74 -11
  4. package/es/editor-kernel/react/useDecorators.js +2 -4
  5. package/es/headless/collapsible-plugin.js +74 -0
  6. package/es/headless/index.js +2 -0
  7. package/es/headless.d.ts +30 -0
  8. package/es/headless.js +2618 -139
  9. package/es/index.d.ts +26 -3
  10. package/es/index.js +17 -2
  11. package/es/locale/index.d.ts +14 -0
  12. package/es/locale/index.js +14 -0
  13. package/es/plugins/block/command/index.js +24 -0
  14. package/es/plugins/block/plugin/index.js +7 -5
  15. package/es/plugins/block/react/ReactBlockPlugin.js +43 -1
  16. package/es/plugins/block/react/core/menu-position.js +20 -0
  17. package/es/plugins/block/react/drag/drag-session.js +3 -2
  18. package/es/plugins/block/react/drag/drag-utils.js +13 -1
  19. package/es/plugins/codemirror-block/index.d.ts +2 -1
  20. package/es/plugins/codemirror-block/plugin/index.js +2 -0
  21. package/es/plugins/codemirror-block/react/CodemirrorNode.js +95 -5
  22. package/es/plugins/codemirror-block/react/useCodemirrorEditLock.js +33 -0
  23. package/es/plugins/codemirror-block/service/index.d.ts +40 -0
  24. package/es/plugins/codemirror-block/service/index.js +59 -0
  25. package/es/plugins/collapsible/command/index.d.ts +17 -0
  26. package/es/plugins/collapsible/command/index.js +72 -0
  27. package/es/plugins/collapsible/index.d.ts +7 -0
  28. package/es/plugins/collapsible/node/CollapsibleNode.d.ts +30 -0
  29. package/es/plugins/collapsible/node/CollapsibleNode.js +138 -0
  30. package/es/plugins/collapsible/plugin/index.d.ts +11 -0
  31. package/es/plugins/collapsible/plugin/index.js +535 -0
  32. package/es/plugins/collapsible/react/ReactCollapsiblePlugin.d.ts +6 -0
  33. package/es/plugins/collapsible/react/ReactCollapsiblePlugin.js +19 -0
  34. package/es/plugins/collapsible/react/index.d.ts +3 -0
  35. package/es/plugins/collapsible/react/style.js +67 -0
  36. package/es/plugins/collapsible/react/type.d.ts +6 -0
  37. package/es/plugins/common/plugin/index.js +14 -4
  38. package/es/plugins/common/plugin/progressive-select-all.js +81 -0
  39. package/es/plugins/common/plugin/register.js +73 -4
  40. package/es/plugins/common/react/ReactPlainText.js +27 -9
  41. package/es/plugins/link/command/index.js +26 -3
  42. package/es/plugins/link/conversion/index.js +237 -0
  43. package/es/plugins/link/index.d.ts +5 -3
  44. package/es/plugins/link/node/LinkBlockCardNode.d.ts +16 -0
  45. package/es/plugins/link/node/LinkBlockCardNode.js +66 -0
  46. package/es/plugins/link/node/LinkCardNode.d.ts +42 -0
  47. package/es/plugins/link/node/LinkCardNode.js +161 -0
  48. package/es/plugins/link/node/LinkIframeNode.d.ts +33 -0
  49. package/es/plugins/link/node/LinkIframeNode.js +131 -0
  50. package/es/plugins/link/node/LinkNode.d.ts +48 -2
  51. package/es/plugins/link/node/LinkNode.js +14 -6
  52. package/es/plugins/link/node/SchemaNode.d.ts +36 -0
  53. package/es/plugins/link/node/SchemaNode.js +149 -0
  54. package/es/plugins/link/normalization/index.d.ts +7 -0
  55. package/es/plugins/link/normalization/index.js +38 -0
  56. package/es/plugins/link/plugin/index.d.ts +26 -1
  57. package/es/plugins/link/plugin/index.js +124 -4
  58. package/es/plugins/link/react/ReactLinkPlugin.js +165 -7
  59. package/es/plugins/link/react/components/LinkCard.js +235 -0
  60. package/es/plugins/link/react/components/LinkEdit.js +93 -14
  61. package/es/plugins/link/react/components/LinkIframe.js +128 -0
  62. package/es/plugins/link/react/components/LinkToolbar.js +440 -111
  63. package/es/plugins/link/react/components/SchemaLink.js +49 -0
  64. package/es/plugins/link/react/index.d.ts +2 -2
  65. package/es/plugins/link/react/renderer-registry.d.ts +81 -0
  66. package/es/plugins/link/react/renderer-registry.js +80 -0
  67. package/es/plugins/link/react/style.js +63 -1
  68. package/es/plugins/link/react/type.d.ts +24 -1
  69. package/es/plugins/link/service/i-link-service.d.ts +156 -1
  70. package/es/plugins/link/service/i-link-service.js +258 -5
  71. package/es/plugins/list/plugin/index.js +9 -2
  72. package/es/plugins/litexml/command/diffCommand.js +94 -14
  73. package/es/plugins/litexml/command/index.js +187 -6
  74. package/es/plugins/litexml/diff-validation.js +237 -0
  75. package/es/plugins/litexml/node/DiffContentNode.js +67 -0
  76. package/es/plugins/litexml/node/DiffNode.d.ts +1 -1
  77. package/es/plugins/litexml/node/DiffNode.js +5 -2
  78. package/es/plugins/litexml/node/TableCellDiffNode.js +77 -0
  79. package/es/plugins/litexml/node/TableRowDiffNode.js +73 -0
  80. package/es/plugins/litexml/plugin/index.d.ts +2 -0
  81. package/es/plugins/litexml/plugin/index.js +62 -9
  82. package/es/plugins/litexml/react/DiffNodeToolbar/index.js +10 -12
  83. package/es/plugins/litexml/react/TableRowDiffToolbar.js +123 -0
  84. package/es/plugins/litexml/react/hooks/useHasDiffNode.js +5 -2
  85. package/es/plugins/litexml/react/index.js +6 -2
  86. package/es/plugins/litexml/react/style.js +18 -5
  87. package/es/plugins/litexml/table-cell-diff.js +153 -0
  88. package/es/plugins/litexml/table-row-diff.js +82 -0
  89. package/es/plugins/markdown/data-source/markdown/parse.js +25 -1
  90. package/es/plugins/markdown/plugin/index.js +5 -3
  91. package/es/plugins/slash/react/ReactSlashPlugin.js +22 -43
  92. package/es/plugins/slash/react/components/DefaultSlashMenu.js +76 -16
  93. package/es/plugins/slash/react/menu-utils.js +84 -0
  94. package/es/plugins/slash/service/i-slash-service.d.ts +3 -0
  95. package/es/plugins/table/plugin/index.js +4 -1
  96. package/es/plugins/table/plugin/single-cell-paste.js +79 -0
  97. package/es/plugins/table/react/TableController/hooks.js +7 -4
  98. package/es/plugins/table/react/hooks.js +2 -2
  99. package/es/plugins/table/react/index.js +2 -0
  100. package/es/plugins/table/react/style.js +15 -5
  101. package/es/plugins/table/react/useScrollFocusedTableCellIntoView.js +46 -0
  102. package/es/plugins/toc/index.d.ts +10 -0
  103. package/es/plugins/toc/plugin/index.d.ts +8 -0
  104. package/es/plugins/toc/plugin/index.js +56 -0
  105. package/es/plugins/toc/react/ReactTocPlugin.d.ts +6 -0
  106. package/es/plugins/toc/react/ReactTocPlugin.js +36 -0
  107. package/es/plugins/toc/react/getNearestScrollContainer.d.ts +6 -0
  108. package/es/plugins/toc/react/getNearestScrollContainer.js +18 -0
  109. package/es/plugins/toc/react/hooks/useActiveHeading.js +59 -0
  110. package/es/plugins/toc/react/hooks/useTocItems.js +50 -0
  111. package/es/plugins/toc/react/index.d.ts +5 -0
  112. package/es/plugins/toc/react/type.d.ts +30 -0
  113. package/es/plugins/toc/react/useToc.d.ts +5 -0
  114. package/es/plugins/toc/react/useToc.js +41 -0
  115. package/es/plugins/toc/service/i-toc-service.d.ts +39 -0
  116. package/es/plugins/toc/service/i-toc-service.js +125 -0
  117. package/es/plugins/toc/service/index.d.ts +3 -0
  118. package/es/plugins/toc/types.d.ts +23 -0
  119. package/es/plugins/toc/utils/index.d.ts +6 -0
  120. package/es/plugins/toc/utils/index.js +30 -0
  121. package/es/plugins/toolbar/react/index.js +26 -12
  122. package/es/plugins/toolbar/react/style.js +3 -2
  123. package/es/plugins/virtual-block/plugin/register.js +34 -12
  124. package/es/plugins/yjs/index.d.ts +6 -0
  125. package/es/plugins/yjs/plugin/index.d.ts +7 -0
  126. package/es/plugins/yjs/plugin/index.js +191 -0
  127. package/es/plugins/yjs/plugin/types.d.ts +16 -0
  128. package/es/plugins/yjs/plugin/utils/awareness.js +9 -0
  129. package/es/plugins/yjs/plugin/utils/editor-state.js +47 -0
  130. package/es/plugins/yjs/plugin/utils/history.js +31 -0
  131. package/es/plugins/yjs/plugin/utils/node-properties.js +39 -0
  132. package/es/plugins/yjs/plugin/utils/sync.js +24 -0
  133. package/es/plugins/yjs/react/codemirrorEditLockProvider.js +59 -0
  134. package/es/plugins/yjs/react/index.d.ts +23 -0
  135. package/es/plugins/yjs/react/index.js +200 -0
  136. package/es/plugins/yjs/service/index.d.ts +47 -0
  137. package/es/plugins/yjs/service/index.js +84 -0
  138. package/es/plugins/yjs/websocket-provider.d.ts +78 -0
  139. package/es/plugins/yjs/websocket-provider.js +263 -0
  140. package/es/react/hooks/useEditor.d.ts +24 -2
  141. package/es/react/hooks/useEditor.js +13 -3
  142. package/es/react.d.ts +2 -2
  143. package/es/renderer/LexicalRenderer.js +9 -2
  144. package/es/types/kernel.d.ts +16 -0
  145. package/es/utils/updatePosition.js +5 -2
  146. package/package.json +3 -1
  147. package/patches/@lexical__yjs@0.42.0.patch +42 -0
  148. package/scripts/postinstall-lexical-patch.cjs +62 -36
package/es/index.d.ts CHANGED
@@ -39,11 +39,18 @@ import { bundledLanguagesInfo } from "./plugins/codeblock/index.js";
39
39
  import { INSERT_CODEMIRROR_COMMAND, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND } from "./plugins/codemirror-block/command/index.js";
40
40
  import { CodemirrorPlugin, CodemirrorPluginOptions } from "./plugins/codemirror-block/plugin/index.js";
41
41
  import ReactCodemirrorPlugin from "./plugins/codemirror-block/react/ReactCodemirrorNode.js";
42
+ import { CodemirrorEditLock, CodemirrorEditLockOwner, CodemirrorEditLockProvider, CodemirrorEditLockService, ICodemirrorEditLockService } from "./plugins/codemirror-block/service/index.js";
42
43
  import "./plugins/codemirror-block/index.js";
43
44
  import { CollaborationUser } from "./plugins/collaboration/utils.js";
44
45
  import { CollaborationProviderFactory, EditorCollaborationConfig, ReactCollaborationPluginProps } from "./plugins/collaboration/react/type.js";
45
46
  import { ReactCollaborationPlugin } from "./plugins/collaboration/react/ReactCollaborationPlugin.js";
46
47
  import "./plugins/collaboration/index.js";
48
+ import { $createCollapsibleNode, $isCollapsibleNode, CollapsibleNode, SerializedCollapsibleNode } from "./plugins/collapsible/node/CollapsibleNode.js";
49
+ import { INSERT_COLLAPSIBLE_COMMAND, UPDATE_COLLAPSIBLE_COMMAND } from "./plugins/collapsible/command/index.js";
50
+ import { CollapsiblePlugin, CollapsiblePluginOptions } from "./plugins/collapsible/plugin/index.js";
51
+ import { ReactCollapsiblePluginProps } from "./plugins/collapsible/react/type.js";
52
+ import ReactCollapsiblePlugin from "./plugins/collapsible/react/ReactCollapsiblePlugin.js";
53
+ import "./plugins/collapsible/index.js";
47
54
  import { INSERT_HEADING_COMMAND, INSERT_QUOTE_COMMAND } from "./plugins/common/command/index.js";
48
55
  import { $createCursorNode, $isCardLikeElementNode, $isCursorNode, CardLikeElementNode, cursorNodeSerialized } from "./plugins/common/node/cursor.js";
49
56
  import { CommonPlugin, CommonPluginOptions } from "./plugins/common/plugin/index.js";
@@ -78,10 +85,12 @@ import { ReactNodePlugin } from "./plugins/inode/react/index.js";
78
85
  import { INodeService } from "./plugins/inode/service/index.js";
79
86
  import "./plugins/inode/index.js";
80
87
  import { INSERT_LINK_COMMAND } from "./plugins/link/command/index.js";
88
+ import { ILinkService, LinkEmbedRule, LinkLabels, LinkToolbarAction, LinkToolbarItem, LinkToolbarItemIcon, LinkToolbarRenderContext, ParsedSchemaUrl, SchemaRule, getNodeTitle, getNodeUrl, normalizeProtocol } from "./plugins/link/service/i-link-service.js";
89
+ import { normalizeSchemaLinkNode } from "./plugins/link/normalization/index.js";
81
90
  import { LinkPlugin, LinkPluginOptions } from "./plugins/link/plugin/index.js";
82
- import { ReactLinkPluginProps } from "./plugins/link/react/type.js";
91
+ import { LinkCardRenderer, LinkCardRendererProps, LinkIframeRenderer, LinkIframeRendererProps, ReactSchemaRule, SchemaLinkRenderer, SchemaLinkRendererConfig, SchemaLinkRendererProps, SchemaRenderer, SchemaRendererProps } from "./plugins/link/react/renderer-registry.js";
92
+ import { ReactLinkDefaultToolbarItemKey, ReactLinkDefaultToolbarItems, ReactLinkPluginProps } from "./plugins/link/react/type.js";
83
93
  import { ReactLinkPlugin } from "./plugins/link/react/ReactLinkPlugin.js";
84
- import { ILinkService } from "./plugins/link/service/i-link-service.js";
85
94
  import "./plugins/link/index.js";
86
95
  import { INSERT_LINK_HIGHLIGHT_COMMAND, registerLinkHighlightCommand } from "./plugins/link-highlight/command/index.js";
87
96
  import { LinkHighlightPlugin, LinkHighlightPluginOptions } from "./plugins/link-highlight/plugin/index.js";
@@ -126,6 +135,14 @@ import { TablePlugin, TablePluginOptions } from "./plugins/table/plugin/index.js
126
135
  import { ReactTablePlugin } from "./plugins/table/react/index.js";
127
136
  import { ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, TableControllerMenuAxis, TableControllerMenuService } from "./plugins/table/service/i-table-controller-menu-service.js";
128
137
  import "./plugins/table/index.js";
138
+ import { TocHeadingTag, TocItem, TocJumpOptions, TocPluginOptions, TocScrollBehavior, TocScrollLogicalPosition } from "./plugins/toc/types.js";
139
+ import { ITocService, TocService } from "./plugins/toc/service/i-toc-service.js";
140
+ import { TocPlugin } from "./plugins/toc/plugin/index.js";
141
+ import { ReactTocPluginProps, UseTocOptions, UseTocResult } from "./plugins/toc/react/type.js";
142
+ import ReactTocPlugin from "./plugins/toc/react/ReactTocPlugin.js";
143
+ import { useToc } from "./plugins/toc/react/useToc.js";
144
+ import { buildTocTree, flattenTocTree } from "./plugins/toc/utils/index.js";
145
+ import "./plugins/toc/index.js";
129
146
  import { HIDE_TOOLBAR_COMMAND, SHOW_TOOLBAR_COMMAND, ToolbarCommandOptions, registerToolbarCommand } from "./plugins/toolbar/command/index.js";
130
147
  import { ReactToolbarPlugin } from "./plugins/toolbar/react/index.js";
131
148
  import "./plugins/toolbar/index.js";
@@ -135,6 +152,12 @@ import "./plugins/upload/index.js";
135
152
  import { VirtualBlockPlugin, VirtualBlockPluginOptions } from "./plugins/virtual-block/plugin/index.js";
136
153
  import ReactVirtualBlockPlugin from "./plugins/virtual-block/react/ReactVirtualBlock.js";
137
154
  import "./plugins/virtual-block/index.js";
155
+ import { YjsInitialEditorState, YjsPluginOptions, YjsProviderFactory } from "./plugins/yjs/plugin/types.js";
156
+ import { YjsPlugin } from "./plugins/yjs/plugin/index.js";
157
+ import { Doc, ReactYjsPlugin, ReactYjsPluginProps } from "./plugins/yjs/react/index.js";
158
+ import { IYjsService, YjsAwarenessUser, YjsPluginState, YjsService } from "./plugins/yjs/service/index.js";
159
+ import { CreateWebSocketYjsProviderOptions, WebSocketYjsProvider, WebSocketYjsProviderStatus, createWebSocketYjsProvider, fetchWebSocketDemoDocument, saveWebSocketDemoDocument, snapshotWebSocketDemoDocument } from "./plugins/yjs/websocket-provider.js";
160
+ import "./plugins/yjs/index.js";
138
161
  import { browserDebug, createDebugLogger, debugLogger, debugLoggers, devConsole, prodSafeLogger } from "./utils/debug.js";
139
162
  import { Kernel } from "./editor-kernel/kernel.js";
140
163
  import { scrollIntoView } from "./utils/scrollIntoView.js";
@@ -149,4 +172,4 @@ declare function enableHotReload(): void;
149
172
  */
150
173
  declare function disableHotReload(): void;
151
174
  //#endregion
152
- export { $closest, $closestNodeType, $createCursorNode, $getNearestNodeFromDOMNode, $getNodeFromDOMNode, $isCardLikeElementNode, $isCursorNode, ANCHOR_PADDING_CSS_VAR, AutoCompletePlugin, type BlockDragTarget, BlockMenuService, BlockMovePayload, BlockPlugin, BlockPluginOptions, CONTENT_BLOCKS_DATA_TYPE, CardLikeElementNode, CodePlugin, CodeblockPlugin, CodeblockPluginOptions, CodemirrorPlugin, CodemirrorPluginOptions, type CollaborationProviderFactory, type CollaborationUser, CommonPlugin, CommonPluginOptions, type ContentBlock, ContentBlocksDataSource, ContentBlocksPlugin, type ContentBlocksPluginOptions, DEFAULT_BLOCK_ANCHOR_PADDING, DEFAULT_HEADLESS_EDITOR_PLUGINS, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, DiffAction, EDITOR_THEME_KEY, type EditorCollaborationConfig, type ExtractContentBlocksOptions, type FileContentBlock, type FileListItem, 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, IBlockActionButton, IBlockActionButtonIcon, IBlockMenuItem, IBlockMenuRenderContext, IBlockMenuService, IBlockSelectHandler, 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_COLUMN_COMMAND, INSERT_TABLE_COMMAND, INSERT_TABLE_ROW_COMMAND, INSERT_UNORDERED_LIST_COMMAND, INodePlugin, INodePluginOptions, INodeService, type ISlashDividerOption, type ISlashMenuOption, type ISlashOption, type ISlashSectionOption, type ISlashService, ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, ITriggerContext, IUploadService, type ImageContentBlock, type ImageListItem, 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, MOVE_BLOCK_COMMAND, MarkdownPlugin, MathPlugin, type MediaLists, MentionPlugin, MentionPluginOptions, type MenuRenderProps, ModifierCombination, REMOVE_LIST_COMMAND, ReactAutoCompletePlugin, ReactBlockPlugin, type ReactBlockPluginProps, ReactCodePlugin, ReactCodeblockPlugin, type ReactCodeblockPluginProps, ReactCodemirrorPlugin, ReactCollaborationPlugin, type ReactCollaborationPluginProps, ReactEditor, ReactEditorContent, ReactEditorContentProps, ReactFilePlugin, type ReactFilePluginProps, ReactHRPlugin, type ReactHRPluginProps, ReactImagePlugin, type ReactImagePluginProps, ReactLinkHighlightPlugin, ReactLinkPlugin, type ReactLinkPluginProps, ReactListPlugin, type ReactListPluginProps, ReactLiteXmlPlugin, ReactMarkdownPlugin, ReactMathPlugin, ReactMentionPlugin, type ReactMentionPluginProps, ReactNodePlugin, ReactPlainText, ReactPlainTextProps, ReactSlashOption, type ReactSlashOptionProps, ReactSlashPlugin, type ReactSlashPluginProps, ReactTablePlugin, ReactToolbarPlugin, ReactVirtualBlockPlugin, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND, SELECT_TABLE_COMMAND, SHOW_TOOLBAR_COMMAND, type SerializedMentionNode, SlashMenu, type SlashMenuProps, type SlashOptions, SlashPlugin, SlashPluginOptions, TableControllerMenuAxis, TableControllerMenuService, TablePlugin, TablePluginOptions, type TextContentBlock, 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, extractContentBlocks, extractMediaFromEditorState, extractMediaLists, flattenSlashOptions, genServiceId, generateEditorId, getHotkeyById, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, isDOMNode, isDocumentFragment, isPunctuationChar, isPureUrl, isSlashDividerOption, isSlashMenuOption, isSlashSectionOption, isValidUrl, moment, noop, prodSafeLogger, reconcileDecorator, registerBlockMoveCommand, registerEditorKernel, registerLinkHighlightCommand, registerToolbarCommand, resetRandomKey, scrollIntoView, unregisterEditorKernel, useHasDiffNode, useLexicalComposerContext, useLexicalEditor };
175
+ export { $closest, $closestNodeType, $createCollapsibleNode, $createCursorNode, $getNearestNodeFromDOMNode, $getNodeFromDOMNode, $isCardLikeElementNode, $isCollapsibleNode, $isCursorNode, ANCHOR_PADDING_CSS_VAR, AutoCompletePlugin, type BlockDragTarget, BlockMenuService, BlockMovePayload, BlockPlugin, BlockPluginOptions, CONTENT_BLOCKS_DATA_TYPE, CardLikeElementNode, CodePlugin, CodeblockPlugin, CodeblockPluginOptions, CodemirrorEditLock, CodemirrorEditLockOwner, CodemirrorEditLockProvider, CodemirrorEditLockService, CodemirrorPlugin, CodemirrorPluginOptions, type CollaborationProviderFactory, type CollaborationUser, CollapsibleNode, CollapsiblePlugin, CollapsiblePluginOptions, CommonPlugin, CommonPluginOptions, type ContentBlock, ContentBlocksDataSource, ContentBlocksPlugin, type ContentBlocksPluginOptions, CreateWebSocketYjsProviderOptions, DEFAULT_BLOCK_ANCHOR_PADDING, DEFAULT_HEADLESS_EDITOR_PLUGINS, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, DiffAction, type Doc, EDITOR_THEME_KEY, type EditorCollaborationConfig, type ExtractContentBlocksOptions, type FileContentBlock, type FileListItem, 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, IBlockActionButton, IBlockActionButtonIcon, IBlockMenuItem, IBlockMenuRenderContext, IBlockMenuService, IBlockSelectHandler, ICodemirrorEditLockService, type IEditor, ILinkService, ILitexmlService, IMarkdownShortCutService, INSERT_CHECK_LIST_COMMAND, INSERT_CODEINLINE_COMMAND, INSERT_CODEMIRROR_COMMAND, INSERT_COLLAPSIBLE_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_COLUMN_COMMAND, INSERT_TABLE_COMMAND, INSERT_TABLE_ROW_COMMAND, INSERT_UNORDERED_LIST_COMMAND, INodePlugin, INodePluginOptions, INodeService, type ISlashDividerOption, type ISlashMenuOption, type ISlashOption, type ISlashSectionOption, type ISlashService, ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, ITocService, ITriggerContext, IUploadService, IYjsService, type ImageContentBlock, type ImageListItem, 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, type LinkCardRenderer, type LinkCardRendererProps, type LinkEmbedRule, LinkHighlightPlugin, LinkHighlightPluginOptions, type LinkIframeRenderer, type LinkIframeRendererProps, type LinkLabels, LinkPlugin, LinkPluginOptions, type LinkToolbarAction, type LinkToolbarItem, type LinkToolbarItemIcon, type LinkToolbarRenderContext, ListPlugin, ListPluginOptions, LitexmlDataSource, LitexmlPlugin, type LitexmlPluginOptions, LitexmlService, type MARKDOWN_READER_LEVEL, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX, MOVE_BLOCK_COMMAND, MarkdownPlugin, MathPlugin, type MediaLists, MentionPlugin, MentionPluginOptions, type MenuRenderProps, ModifierCombination, type ParsedSchemaUrl, REMOVE_LIST_COMMAND, ReactAutoCompletePlugin, ReactBlockPlugin, type ReactBlockPluginProps, ReactCodePlugin, ReactCodeblockPlugin, type ReactCodeblockPluginProps, ReactCodemirrorPlugin, ReactCollaborationPlugin, type ReactCollaborationPluginProps, ReactCollapsiblePlugin, type ReactCollapsiblePluginProps, ReactEditor, ReactEditorContent, ReactEditorContentProps, ReactFilePlugin, type ReactFilePluginProps, ReactHRPlugin, type ReactHRPluginProps, ReactImagePlugin, type ReactImagePluginProps, type ReactLinkDefaultToolbarItemKey, type ReactLinkDefaultToolbarItems, ReactLinkHighlightPlugin, ReactLinkPlugin, type ReactLinkPluginProps, ReactListPlugin, type ReactListPluginProps, ReactLiteXmlPlugin, ReactMarkdownPlugin, ReactMathPlugin, ReactMentionPlugin, type ReactMentionPluginProps, ReactNodePlugin, ReactPlainText, ReactPlainTextProps, type ReactSchemaRule, ReactSlashOption, type ReactSlashOptionProps, ReactSlashPlugin, type ReactSlashPluginProps, ReactTablePlugin, ReactTocPlugin, type ReactTocPluginProps, ReactToolbarPlugin, ReactVirtualBlockPlugin, ReactYjsPlugin, ReactYjsPluginProps, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND, SELECT_TABLE_COMMAND, SHOW_TOOLBAR_COMMAND, type SchemaLinkRenderer, type SchemaLinkRendererConfig, type SchemaLinkRendererProps, type SchemaRenderer, type SchemaRendererProps, type SchemaRule, SerializedCollapsibleNode, type SerializedMentionNode, SlashMenu, type SlashMenuProps, type SlashOptions, SlashPlugin, SlashPluginOptions, TableControllerMenuAxis, TableControllerMenuService, TablePlugin, TablePluginOptions, type TextContentBlock, TocHeadingTag, TocItem, TocJumpOptions, TocPlugin, TocPluginOptions, TocScrollBehavior, TocScrollLogicalPosition, TocService, ToolbarCommandOptions, UPDATE_CODEBLOCK_LANG, UPDATE_COLLAPSIBLE_COMMAND, UPDATE_LIST_START_COMMAND, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM, UploadPlugin, UploadPluginOptions, type UseTocOptions, type UseTocResult, VirtualBlockPlugin, VirtualBlockPluginOptions, WebSocketYjsProvider, WebSocketYjsProviderStatus, type XMLReaderFunc, type XMLReaderRecord, type XMLWriterFunc, type XMLWriterRecord, YjsAwarenessUser, type YjsInitialEditorState, YjsPlugin, type YjsPluginOptions, YjsPluginState, type YjsProviderFactory, YjsService, assert, browserDebug, buildTocTree, bundledLanguagesInfo, compareNodeOrder, createDebugLogger, createEmptyEditorState, createHeadlessEditor, createWebSocketYjsProvider, cursorNodeSerialized, debugLogger, debugLoggers, detectCodeLanguage, detectLanguage, devConsole, disableHotReload, enableHotReload, extractContentBlocks, extractMediaFromEditorState, extractMediaLists, fetchWebSocketDemoDocument, flattenSlashOptions, flattenTocTree, genServiceId, generateEditorId, getHotkeyById, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getNodeTitle, getNodeUrl, getParentElement, isDOMNode, isDocumentFragment, isPunctuationChar, isPureUrl, isSlashDividerOption, isSlashMenuOption, isSlashSectionOption, isValidUrl, moment, noop, normalizeProtocol, normalizeSchemaLinkNode, prodSafeLogger, reconcileDecorator, registerBlockMoveCommand, registerEditorKernel, registerLinkHighlightCommand, registerToolbarCommand, resetRandomKey, saveWebSocketDemoDocument, scrollIntoView, snapshotWebSocketDemoDocument, unregisterEditorKernel, useHasDiffNode, useLexicalComposerContext, useLexicalEditor, useToc };
package/es/index.js CHANGED
@@ -37,6 +37,7 @@ import { INSERT_CODEINLINE_COMMAND } from "./plugins/code/command/index.js";
37
37
  import { CodePlugin } from "./plugins/code/plugin/index.js";
38
38
  import { UPDATE_CODEBLOCK_LANG } from "./plugins/codeblock/command/symbols.js";
39
39
  import { INSERT_CODEMIRROR_COMMAND, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND } from "./plugins/codemirror-block/command/index.js";
40
+ import { CodemirrorEditLockService, ICodemirrorEditLockService } from "./plugins/codemirror-block/service/index.js";
40
41
  import { CodemirrorPlugin } from "./plugins/codemirror-block/plugin/index.js";
41
42
  import { IUploadService, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM } from "./plugins/upload/service/i-upload-service.js";
42
43
  import { UploadPlugin } from "./plugins/upload/plugin/index.js";
@@ -46,8 +47,9 @@ import { INSERT_HORIZONTAL_RULE_COMMAND } from "./plugins/hr/command/index.js";
46
47
  import { HRPlugin } from "./plugins/hr/plugin/index.js";
47
48
  import { INSERT_IMAGE_COMMAND } from "./plugins/image/command/index.js";
48
49
  import { ImagePlugin } from "./plugins/image/plugin/index.js";
50
+ import { ILinkService, getNodeTitle, getNodeUrl, normalizeProtocol } from "./plugins/link/service/i-link-service.js";
49
51
  import { INSERT_LINK_COMMAND } from "./plugins/link/command/index.js";
50
- import { ILinkService } from "./plugins/link/service/i-link-service.js";
52
+ import { normalizeSchemaLinkNode } from "./plugins/link/normalization/index.js";
51
53
  import { LinkPlugin } from "./plugins/link/plugin/index.js";
52
54
  import { INSERT_CHECK_LIST_COMMAND } from "./plugins/list/plugin/checkList.js";
53
55
  import { ListPlugin } from "./plugins/list/plugin/index.js";
@@ -59,6 +61,7 @@ import { BlockMenuService, IBlockMenuService } from "./plugins/block/service/i-b
59
61
  import { INSERT_TABLE_COLUMN_COMMAND, INSERT_TABLE_COMMAND, INSERT_TABLE_ROW_COMMAND, SELECT_TABLE_COMMAND } from "./plugins/table/command/index.js";
60
62
  import { ITableControllerMenuService, TableControllerMenuService } from "./plugins/table/service/i-table-controller-menu-service.js";
61
63
  import { TablePlugin } from "./plugins/table/plugin/index.js";
64
+ import { $createCollapsibleNode, $isCollapsibleNode, CollapsibleNode } from "./plugins/collapsible/node/CollapsibleNode.js";
62
65
  import { extractMediaFromEditorState } from "./headless/extract-media-from-editor-state.js";
63
66
  import { DEFAULT_HEADLESS_EDITOR_PLUGINS, HeadlessEditor, createHeadlessEditor } from "./headless/index.js";
64
67
  import { AutoCompletePlugin } from "./plugins/auto-complete/plugin/index.js";
@@ -73,6 +76,10 @@ import { ReactCodeblockPlugin } from "./plugins/codeblock/react/ReactCodeblockPl
73
76
  import { bundledLanguagesInfo } from "./plugins/codeblock/index.js";
74
77
  import ReactCodemirrorPlugin from "./plugins/codemirror-block/react/ReactCodemirrorNode.js";
75
78
  import { ReactCollaborationPlugin } from "./plugins/collaboration/react/ReactCollaborationPlugin.js";
79
+ import { INSERT_COLLAPSIBLE_COMMAND, UPDATE_COLLAPSIBLE_COMMAND } from "./plugins/collapsible/command/index.js";
80
+ import { IYjsService, YjsService } from "./plugins/yjs/service/index.js";
81
+ import { CollapsiblePlugin } from "./plugins/collapsible/plugin/index.js";
82
+ import ReactCollapsiblePlugin from "./plugins/collapsible/react/ReactCollapsiblePlugin.js";
76
83
  import { CONTENT_BLOCKS_DATA_TYPE } from "./plugins/content-blocks/types.js";
77
84
  import { extractContentBlocks } from "./plugins/content-blocks/utils/extract.js";
78
85
  import { ContentBlocksDataSource } from "./plugins/content-blocks/data-source/content-blocks-data-source.js";
@@ -95,10 +102,18 @@ import SlashMenu from "./plugins/slash/react/components/SlashMenu.js";
95
102
  import ReactSlashOption from "./plugins/slash/react/ReactSlashOption.js";
96
103
  import ReactSlashPlugin from "./plugins/slash/react/ReactSlashPlugin.js";
97
104
  import { ReactTablePlugin } from "./plugins/table/react/index.js";
105
+ import { buildTocTree, flattenTocTree } from "./plugins/toc/utils/index.js";
106
+ import { ITocService, TocService } from "./plugins/toc/service/i-toc-service.js";
107
+ import { TocPlugin } from "./plugins/toc/plugin/index.js";
108
+ import ReactTocPlugin from "./plugins/toc/react/ReactTocPlugin.js";
109
+ import { useToc } from "./plugins/toc/react/useToc.js";
98
110
  import { HIDE_TOOLBAR_COMMAND, SHOW_TOOLBAR_COMMAND, registerToolbarCommand } from "./plugins/toolbar/command/index.js";
99
111
  import { ReactToolbarPlugin } from "./plugins/toolbar/react/index.js";
100
112
  import { VirtualBlockPlugin } from "./plugins/virtual-block/plugin/index.js";
101
113
  import ReactVirtualBlockPlugin from "./plugins/virtual-block/react/ReactVirtualBlock.js";
114
+ import { YjsPlugin } from "./plugins/yjs/plugin/index.js";
115
+ import { ReactYjsPlugin } from "./plugins/yjs/react/index.js";
116
+ import { WebSocketYjsProvider, createWebSocketYjsProvider, fetchWebSocketDemoDocument, saveWebSocketDemoDocument, snapshotWebSocketDemoDocument } from "./plugins/yjs/websocket-provider.js";
102
117
  import { scrollIntoView } from "./utils/scrollIntoView.js";
103
118
  //#region src/index.ts
104
119
  init_hotkey();
@@ -132,4 +147,4 @@ function disableHotReload() {
132
147
  }
133
148
  }
134
149
  //#endregion
135
- export { $closest, $closestNodeType, $createCursorNode, $getNearestNodeFromDOMNode, $getNodeFromDOMNode, $isCardLikeElementNode, $isCursorNode, ANCHOR_PADDING_CSS_VAR, AutoCompletePlugin, BlockMenuService, BlockPlugin, CONTENT_BLOCKS_DATA_TYPE, CardLikeElementNode, CodePlugin, CodeblockPlugin, CodemirrorPlugin, CommonPlugin, ContentBlocksDataSource, ContentBlocksPlugin, DEFAULT_BLOCK_ANCHOR_PADDING, DEFAULT_HEADLESS_EDITOR_PLUGINS, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, DiffAction, EDITOR_THEME_KEY, FilePlugin, GET_MARKDOWN_SELECTION_COMMAND, HIDE_TOOLBAR_COMMAND, HOVER_COMMAND, HRPlugin, HeadlessEditor, HotkeyEnum, HotkeyScopeEnum, IBlockMenuService, 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_COLUMN_COMMAND, INSERT_TABLE_COMMAND, INSERT_TABLE_ROW_COMMAND, INSERT_UNORDERED_LIST_COMMAND, INodePlugin, INodeService, ITableControllerMenuService, IUploadService, ImagePlugin, Kernel, KeyEnum, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND, LexicalErrorBoundary, LexicalPortalContainer, LinkHighlightPlugin, LinkPlugin, ListPlugin, LitexmlDataSource, LitexmlPlugin, LitexmlService, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX, MOVE_BLOCK_COMMAND, MarkdownPlugin, MathPlugin, MentionPlugin, REMOVE_LIST_COMMAND, ReactAutoCompletePlugin, ReactBlockPlugin, ReactCodePlugin, ReactCodeblockPlugin, ReactCodemirrorPlugin, ReactCollaborationPlugin, ReactEditor, ReactEditorContent, ReactFilePlugin, ReactHRPlugin, ReactImagePlugin, ReactLinkHighlightPlugin, ReactLinkPlugin, ReactListPlugin, ReactLiteXmlPlugin, ReactMarkdownPlugin, ReactMathPlugin, ReactMentionPlugin, ReactNodePlugin, ReactPlainText, ReactSlashOption, ReactSlashPlugin, ReactTablePlugin, ReactToolbarPlugin, ReactVirtualBlockPlugin, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND, SELECT_TABLE_COMMAND, SHOW_TOOLBAR_COMMAND, SlashMenu, SlashPlugin, TableControllerMenuService, TablePlugin, UPDATE_CODEBLOCK_LANG, UPDATE_LIST_START_COMMAND, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM, UploadPlugin, VirtualBlockPlugin, assert, browserDebug, bundledLanguagesInfo, compareNodeOrder, createDebugLogger, createEmptyEditorState, createHeadlessEditor, cursorNodeSerialized, debugLogger, debugLoggers, detectCodeLanguage, detectLanguage, devConsole, disableHotReload, enableHotReload, extractContentBlocks, extractMediaFromEditorState, extractMediaLists, flattenSlashOptions, genServiceId, generateEditorId, getHotkeyById, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, isDOMNode, isDocumentFragment, isPunctuationChar, isPureUrl, isSlashDividerOption, isSlashMenuOption, isSlashSectionOption, isValidUrl, moment, noop, prodSafeLogger, reconcileDecorator, registerBlockMoveCommand, registerEditorKernel, registerLinkHighlightCommand, registerToolbarCommand, resetRandomKey, scrollIntoView, unregisterEditorKernel, useHasDiffNode, useLexicalComposerContext, useLexicalEditor };
150
+ export { $closest, $closestNodeType, $createCollapsibleNode, $createCursorNode, $getNearestNodeFromDOMNode, $getNodeFromDOMNode, $isCardLikeElementNode, $isCollapsibleNode, $isCursorNode, ANCHOR_PADDING_CSS_VAR, AutoCompletePlugin, BlockMenuService, BlockPlugin, CONTENT_BLOCKS_DATA_TYPE, CardLikeElementNode, CodePlugin, CodeblockPlugin, CodemirrorEditLockService, CodemirrorPlugin, CollapsibleNode, CollapsiblePlugin, CommonPlugin, ContentBlocksDataSource, ContentBlocksPlugin, DEFAULT_BLOCK_ANCHOR_PADDING, DEFAULT_HEADLESS_EDITOR_PLUGINS, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, DiffAction, EDITOR_THEME_KEY, FilePlugin, GET_MARKDOWN_SELECTION_COMMAND, HIDE_TOOLBAR_COMMAND, HOVER_COMMAND, HRPlugin, HeadlessEditor, HotkeyEnum, HotkeyScopeEnum, IBlockMenuService, ICodemirrorEditLockService, ILinkService, ILitexmlService, IMarkdownShortCutService, INSERT_CHECK_LIST_COMMAND, INSERT_CODEINLINE_COMMAND, INSERT_CODEMIRROR_COMMAND, INSERT_COLLAPSIBLE_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_COLUMN_COMMAND, INSERT_TABLE_COMMAND, INSERT_TABLE_ROW_COMMAND, INSERT_UNORDERED_LIST_COMMAND, INodePlugin, INodeService, ITableControllerMenuService, ITocService, IUploadService, IYjsService, ImagePlugin, Kernel, KeyEnum, LITEXML_APPLY_COMMAND, LITEXML_DIFFNODE_ALL_COMMAND, LITEXML_DIFFNODE_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND, LexicalErrorBoundary, LexicalPortalContainer, LinkHighlightPlugin, LinkPlugin, ListPlugin, LitexmlDataSource, LitexmlPlugin, LitexmlService, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX, MOVE_BLOCK_COMMAND, MarkdownPlugin, MathPlugin, MentionPlugin, REMOVE_LIST_COMMAND, ReactAutoCompletePlugin, ReactBlockPlugin, ReactCodePlugin, ReactCodeblockPlugin, ReactCodemirrorPlugin, ReactCollaborationPlugin, ReactCollapsiblePlugin, ReactEditor, ReactEditorContent, ReactFilePlugin, ReactHRPlugin, ReactImagePlugin, ReactLinkHighlightPlugin, ReactLinkPlugin, ReactListPlugin, ReactLiteXmlPlugin, ReactMarkdownPlugin, ReactMathPlugin, ReactMentionPlugin, ReactNodePlugin, ReactPlainText, ReactSlashOption, ReactSlashPlugin, ReactTablePlugin, ReactTocPlugin, ReactToolbarPlugin, ReactVirtualBlockPlugin, ReactYjsPlugin, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND, SELECT_TABLE_COMMAND, SHOW_TOOLBAR_COMMAND, SlashMenu, SlashPlugin, TableControllerMenuService, TablePlugin, TocPlugin, TocService, UPDATE_CODEBLOCK_LANG, UPDATE_COLLAPSIBLE_COMMAND, UPDATE_LIST_START_COMMAND, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM, UploadPlugin, VirtualBlockPlugin, WebSocketYjsProvider, YjsPlugin, YjsService, assert, browserDebug, buildTocTree, bundledLanguagesInfo, compareNodeOrder, createDebugLogger, createEmptyEditorState, createHeadlessEditor, createWebSocketYjsProvider, cursorNodeSerialized, debugLogger, debugLoggers, detectCodeLanguage, detectLanguage, devConsole, disableHotReload, enableHotReload, extractContentBlocks, extractMediaFromEditorState, extractMediaLists, fetchWebSocketDemoDocument, flattenSlashOptions, flattenTocTree, genServiceId, generateEditorId, getHotkeyById, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getNodeTitle, getNodeUrl, getParentElement, isDOMNode, isDocumentFragment, isPunctuationChar, isPureUrl, isSlashDividerOption, isSlashMenuOption, isSlashSectionOption, isValidUrl, moment, noop, normalizeProtocol, normalizeSchemaLinkNode, prodSafeLogger, reconcileDecorator, registerBlockMoveCommand, registerEditorKernel, registerLinkHighlightCommand, registerToolbarCommand, resetRandomKey, saveWebSocketDemoDocument, scrollIntoView, snapshotWebSocketDemoDocument, unregisterEditorKernel, useHasDiffNode, useLexicalComposerContext, useLexicalEditor, useToc };
@@ -26,6 +26,12 @@ declare const _default: {
26
26
  replace: string;
27
27
  };
28
28
  link: {
29
+ copy: string;
30
+ copySuccess: string;
31
+ convertToCard: string;
32
+ convertToIframe: string;
33
+ convertToLink: string;
34
+ convertToSchema: string;
29
35
  edit: string;
30
36
  editLinkTitle: string;
31
37
  editTextTitle: string;
@@ -59,6 +65,14 @@ declare const _default: {
59
65
  insertRowAbove: string;
60
66
  insertRowBelow: string;
61
67
  };
68
+ toc: {
69
+ ariaLabel: string;
70
+ empty: string;
71
+ expand: string;
72
+ pin: string;
73
+ title: string;
74
+ unpin: string;
75
+ };
62
76
  };
63
77
  //#endregion
64
78
  export { _default as default };
@@ -29,6 +29,12 @@ var init_locale = __esmMin((() => {
29
29
  replace: "Replace"
30
30
  },
31
31
  link: {
32
+ copy: "Copy Link",
33
+ copySuccess: "Link copied",
34
+ convertToCard: "Convert to Card",
35
+ convertToIframe: "Convert to Iframe",
36
+ convertToLink: "Convert to Link",
37
+ convertToSchema: "Convert to Schema",
32
38
  edit: "Edit Link",
33
39
  editLinkTitle: "Link",
34
40
  editTextTitle: "Text",
@@ -59,6 +65,14 @@ var init_locale = __esmMin((() => {
59
65
  insertColumnRight: "Insert {{count}} column(s) to the right",
60
66
  insertRowAbove: "Insert {{count}} row(s) above",
61
67
  insertRowBelow: "Insert {{count}} row(s) below"
68
+ },
69
+ toc: {
70
+ ariaLabel: "Table of contents",
71
+ empty: "No headings",
72
+ expand: "Expand table of contents",
73
+ pin: "Pin table of contents",
74
+ title: "TOC",
75
+ unpin: "Unpin table of contents"
62
76
  }
63
77
  };
64
78
  }));
@@ -43,6 +43,22 @@ const cleanupEmptyListForItem = (listItem) => {
43
43
  const parentList = getListParent(listItem);
44
44
  if (parentList && parentList.getChildrenSize() === 0) parentList.remove();
45
45
  };
46
+ const hasAncestorOfType = (node, type) => {
47
+ let parent = node.getParent();
48
+ while (parent) {
49
+ if (parent.getType() === type) return true;
50
+ parent = parent.getParent();
51
+ }
52
+ return false;
53
+ };
54
+ const isDescendantOf = (node, ancestor) => {
55
+ let parent = node.getParent();
56
+ while (parent) {
57
+ if (parent === ancestor) return true;
58
+ parent = parent.getParent();
59
+ }
60
+ return false;
61
+ };
46
62
  const moveBlockNode = (payload) => {
47
63
  logger.debug("start", payload);
48
64
  const sourceNode = $getNodeByKey(payload.sourceBlockId);
@@ -58,6 +74,14 @@ const moveBlockNode = (payload) => {
58
74
  logger.debug("abort: source-equals-target");
59
75
  return;
60
76
  }
77
+ if (isDescendantOf(targetNode, sourceNode)) {
78
+ logger.debug("abort: target-inside-source");
79
+ return;
80
+ }
81
+ if (sourceNode.getType() === "collapsible" && hasAncestorOfType(targetNode, "collapsible")) {
82
+ logger.debug("abort: collapsible-inside-collapsible");
83
+ return;
84
+ }
61
85
  if (!$isListItemNode(targetNode)) {
62
86
  const sourceIsListItem = $isListItemNode(sourceNode);
63
87
  let movingNode = sourceNode;
@@ -56,13 +56,14 @@ const patchBlockNodeCreateDOM = (nodeClass, attributeName) => {
56
56
  nodeClass.prototype.createDOM = function patchedCreateDOM(config, editor) {
57
57
  const dom = originCreateDOM.call(this, config, editor);
58
58
  const latestNode = typeof this.getLatest === "function" ? this.getLatest() : this;
59
- const isRootOrListChainToRoot = (() => {
60
- let current = typeof latestNode.getParent === "function" ? latestNode.getParent() : null;
59
+ const parentNode = typeof latestNode.getParent === "function" ? latestNode.getParent() : null;
60
+ const isBlockChainToEditableRoot = (() => {
61
+ let current = parentNode;
61
62
  if (!current || typeof current.getType !== "function") return false;
62
- if (current.getType() === "root") return true;
63
+ if (current.getType() === "root" || current.isShadowRoot?.()) return true;
63
64
  while (current && typeof current.getType === "function") {
64
65
  const parentType = current.getType();
65
- if (parentType === "root") return true;
66
+ if (parentType === "root" || current.isShadowRoot?.()) return true;
66
67
  if (parentType !== "list" && parentType !== "listitem") return false;
67
68
  current = typeof current.getParent === "function" ? current.getParent() : null;
68
69
  }
@@ -70,7 +71,8 @@ const patchBlockNodeCreateDOM = (nodeClass, attributeName) => {
70
71
  })();
71
72
  const nodeKey = typeof latestNode.getKey === "function" ? latestNode.getKey() : this.getKey();
72
73
  const nodeType = typeof latestNode.getType === "function" ? latestNode.getType() : "";
73
- if (dom && typeof latestNode.isInline === "function" && !latestNode.isInline() && nodeType !== "list" && isRootOrListChainToRoot) {
74
+ const isCollapsibleTitleChild = parentNode?.getType?.() === "collapsible" && typeof latestNode.getIndexWithinParent === "function" && latestNode.getIndexWithinParent() === 0;
75
+ if (dom && typeof latestNode.isInline === "function" && !latestNode.isInline() && nodeType !== "list" && isBlockChainToEditableRoot && !isCollapsibleTitleChild) {
74
76
  dom.dataset.blockId = nodeKey;
75
77
  if (attributeName !== "data-block-id") dom.setAttribute(attributeName, nodeKey);
76
78
  }
@@ -5,6 +5,7 @@ import { useLexicalEditor } from "../../../editor-kernel/react/useLexicalEditor.
5
5
  import { IBlockMenuService } from "../service/i-block-menu-service.js";
6
6
  import { BlockPlugin } from "../plugin/index.js";
7
7
  import { useEditable } from "../../../editor-kernel/react/useEditable.js";
8
+ import { resolveBlockMenuTop } from "./core/menu-position.js";
8
9
  import { createRuntimeContext } from "./core/runtime-context.js";
9
10
  import { collectDragBlocks, getBlockMeasureRect, getTableBlockRect, isTableBlockElement } from "./drag/drag-utils.js";
10
11
  import { startBlockDragSession } from "./drag/drag-session.js";
@@ -31,6 +32,18 @@ const getTableMenuAnchorRect = (element) => {
31
32
  top: rect.top
32
33
  };
33
34
  };
35
+ const isBlockInsideElement = (block, container) => {
36
+ return block !== container && container.contains(block);
37
+ };
38
+ const getElementDepth = (element, stopAt) => {
39
+ let depth = 0;
40
+ let current = element;
41
+ while (current && current !== stopAt) {
42
+ depth += 1;
43
+ current = current.parentElement;
44
+ }
45
+ return depth;
46
+ };
34
47
  const ReactBlockPlugin = (props) => {
35
48
  const { token } = theme.useToken();
36
49
  const [editor] = useLexicalComposerContext();
@@ -181,6 +194,16 @@ const ReactBlockPlugin = (props) => {
181
194
  if (!prev) return next || null;
182
195
  return Math.min(Math.abs(y - next.rect.top), Math.abs(y - next.rect.bottom)) < Math.min(Math.abs(y - prev.rect.top), Math.abs(y - prev.rect.bottom)) ? next : prev;
183
196
  };
197
+ const resolveNestedBlockByY = (rects, container, y) => {
198
+ const candidates = rects.filter((entry) => isBlockInsideElement(entry.block, container) && y >= entry.rect.top && y <= entry.rect.bottom);
199
+ if (candidates.length === 0) return null;
200
+ return candidates.sort((a, b) => {
201
+ const depthA = getElementDepth(a.block, container);
202
+ const depthB = getElementDepth(b.block, container);
203
+ if (depthA !== depthB) return depthB - depthA;
204
+ return a.rect.height - b.rect.height;
205
+ })[0];
206
+ };
184
207
  const isInRootLeftPaddingArea = (root, clientX, clientY) => {
185
208
  const rootRect = root.getBoundingClientRect();
186
209
  if (!(clientX >= rootRect.left && clientX <= rootRect.right && clientY >= rootRect.top && clientY <= rootRect.bottom)) return false;
@@ -207,6 +230,17 @@ const ReactBlockPlugin = (props) => {
207
230
  } : null;
208
231
  const blockElement = targetElement.closest("[data-block-id]");
209
232
  if (blockElement instanceof HTMLElement && root.contains(blockElement)) {
233
+ if (blockElement.dataset.collapsible === "true") {
234
+ const nestedEntry = resolveNestedBlockByY(getBlockRects(root), blockElement, clientY);
235
+ if (nestedEntry) {
236
+ const nestedBlockElement = resolveCurrentBlockElement(root, nestedEntry.blockId);
237
+ if (nestedBlockElement) return {
238
+ blockElement: nestedBlockElement,
239
+ blockId: nestedEntry.blockId,
240
+ source: "direct"
241
+ };
242
+ }
243
+ }
210
244
  const blockId = blockElement.dataset.blockId;
211
245
  if (!blockId) return null;
212
246
  return {
@@ -437,6 +471,7 @@ const ReactBlockPlugin = (props) => {
437
471
  return;
438
472
  }
439
473
  const menuWidth = menuRef.current?.offsetWidth || 32;
474
+ const menuHeight = menuRef.current?.offsetHeight || 32;
440
475
  const gap = 8;
441
476
  const listItemOffset = menuContext.blockElement.tagName === "LI" ? 16 : 0;
442
477
  const isTableBlock = isTableBlockElement(menuContext.blockElement);
@@ -449,9 +484,16 @@ const ReactBlockPlugin = (props) => {
449
484
  const anchorLeft = isTableBlock && tableAnchorRect ? Math.max(tableAnchorRect.left, minTableLeft) : blockRect.left;
450
485
  const rawAnchorTop = tableAnchorRect?.top ?? blockRect.top;
451
486
  const anchorTop = rawAnchorTop >= blockRect.top - 1 && rawAnchorTop <= blockRect.bottom + 1 ? rawAnchorTop : blockRect.top;
487
+ const lineHeight = window.getComputedStyle(menuContext.blockElement).lineHeight;
452
488
  const position = {
453
489
  left: Math.max(gap, anchorLeft - menuWidth - gap - listItemOffset - tableMenuOffset),
454
- top: anchorTop
490
+ top: resolveBlockMenuTop({
491
+ anchorTop,
492
+ blockHeight: blockRect.height,
493
+ blockTagName: menuContext.blockElement.tagName,
494
+ lineHeight,
495
+ menuHeight
496
+ })
455
497
  };
456
498
  setMenuPosition(position);
457
499
  };
@@ -0,0 +1,20 @@
1
+ //#region src/plugins/block/react/core/menu-position.ts
2
+ const TEXT_LINE_BLOCK_TAGS = /* @__PURE__ */ new Set([
3
+ "BLOCKQUOTE",
4
+ "H1",
5
+ "H2",
6
+ "H3",
7
+ "H4",
8
+ "H5",
9
+ "H6",
10
+ "LI",
11
+ "P"
12
+ ]);
13
+ const resolveBlockMenuTop = ({ anchorTop, blockHeight, blockTagName, lineHeight, menuHeight }) => {
14
+ if (!TEXT_LINE_BLOCK_TAGS.has(blockTagName.toUpperCase())) return anchorTop + -2;
15
+ const parsedLineHeight = Number.parseFloat(lineHeight);
16
+ if (!Number.isFinite(parsedLineHeight) || parsedLineHeight <= 0) return anchorTop + -2;
17
+ return anchorTop + (Math.min(parsedLineHeight, blockHeight) - menuHeight) / 2;
18
+ };
19
+ //#endregion
20
+ export { resolveBlockMenuTop };
@@ -1,6 +1,6 @@
1
1
  import { createDebugLogger, init_debug } from "../../../../utils/debug.js";
2
2
  import { MOVE_BLOCK_COMMAND } from "../../command/index.js";
3
- import { collectDragBlocks, getAutoScrollDelta, resolveNearestInsertionSlot, resolveScrollContainers } from "./drag-utils.js";
3
+ import { collectDragBlocks, filterDragBlocksForSource, getAutoScrollDelta, resolveNearestInsertionSlot, resolveScrollContainers } from "./drag-utils.js";
4
4
  //#region src/plugins/block/react/drag/drag-session.ts
5
5
  init_debug();
6
6
  const logger = createDebugLogger("plugin", "block-react");
@@ -96,7 +96,8 @@ const startBlockDragSession = ({ clientX, clientY, clearDragPreview, contextRef,
96
96
  clearDragPreview();
97
97
  return;
98
98
  }
99
- const bestSlot = resolveNearestInsertionSlot(source.blockId, blocks, y);
99
+ const validBlocks = filterDragBlocksForSource(source.blockId, blocks);
100
+ const bestSlot = resolveNearestInsertionSlot(source.blockId, validBlocks, y);
100
101
  if (!bestSlot) {
101
102
  clearDragPreview();
102
103
  return;
@@ -47,6 +47,18 @@ const collectDragBlocks = (root) => {
47
47
  return acc;
48
48
  }, []).sort((a, b) => a.rect.top - b.rect.top);
49
49
  };
50
+ const isCollapsibleBlockElement = (element) => {
51
+ return element.dataset.collapsible === "true";
52
+ };
53
+ const isBlockInsideCollapsibleElement = (element) => {
54
+ const closestCollapsible = element.closest("[data-collapsible=\"true\"]");
55
+ return Boolean(closestCollapsible && closestCollapsible !== element);
56
+ };
57
+ const filterDragBlocksForSource = (sourceBlockId, blocks) => {
58
+ const source = blocks.find((block) => block.blockId === sourceBlockId);
59
+ if (!source || !isCollapsibleBlockElement(source.block)) return blocks;
60
+ return blocks.filter((block) => !isBlockInsideCollapsibleElement(block.block));
61
+ };
50
62
  const resolveScrollContainers = (root) => {
51
63
  if (!root) return [];
52
64
  let element = root;
@@ -119,4 +131,4 @@ const resolveNearestInsertionSlot = (sourceBlockId, blocks, y) => {
119
131
  return bestSlot;
120
132
  };
121
133
  //#endregion
122
- export { collectDragBlocks, getAutoScrollDelta, getBlockMeasureRect, getTableBlockRect, isTableBlockElement, resolveNearestInsertionSlot, resolveScrollContainers };
134
+ export { collectDragBlocks, filterDragBlocksForSource, getAutoScrollDelta, getBlockMeasureRect, getTableBlockRect, isTableBlockElement, resolveNearestInsertionSlot, resolveScrollContainers };
@@ -2,4 +2,5 @@ import { INSERT_CODEMIRROR_COMMAND, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFO
2
2
  import { CodemirrorPlugin, CodemirrorPluginOptions } from "./plugin/index.js";
3
3
  import ReactCodemirrorPlugin from "./react/ReactCodemirrorNode.js";
4
4
  import "./react/index.js";
5
- export { CodemirrorPlugin, CodemirrorPluginOptions, INSERT_CODEMIRROR_COMMAND, ReactCodemirrorPlugin, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND };
5
+ import { CodemirrorEditLock, CodemirrorEditLockOwner, CodemirrorEditLockProvider, CodemirrorEditLockService, ICodemirrorEditLockService } from "./service/index.js";
6
+ export { CodemirrorEditLock, CodemirrorEditLockOwner, CodemirrorEditLockProvider, CodemirrorEditLockService, CodemirrorPlugin, CodemirrorPluginOptions, ICodemirrorEditLockService, INSERT_CODEMIRROR_COMMAND, ReactCodemirrorPlugin, SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND };
@@ -5,6 +5,7 @@ import { IMarkdownShortCutService } from "../../markdown/service/shortcut.js";
5
5
  import { $createCodeMirrorNode, CodeMirrorNode } from "../node/CodeMirrorNode.js";
6
6
  import { registerCodeMirrorCommand } from "../command/index.js";
7
7
  import { modeMatch } from "../lib/mode.js";
8
+ import { CodemirrorEditLockService, ICodemirrorEditLockService } from "../service/index.js";
8
9
  import { $createNodeSelection, $setSelection } from "lexical";
9
10
  //#region src/plugins/codemirror-block/plugin/index.ts
10
11
  init_helper();
@@ -18,6 +19,7 @@ const CodemirrorPlugin = class extends KernelPlugin {
18
19
  this.kernel = kernel;
19
20
  kernel.registerNodes([CodeMirrorNode]);
20
21
  kernel.registerThemes({ hr: config?.theme || "" });
22
+ kernel.registerServiceHotReload(ICodemirrorEditLockService, new CodemirrorEditLockService());
21
23
  this.registerDecorator(kernel, "codemirror", (node, editor) => {
22
24
  return config?.decorator ? config.decorator(node, editor) : null;
23
25
  });