@lobehub/editor 4.21.0 → 4.23.0

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 (303) hide show
  1. package/README.md +16 -15
  2. package/es/_virtual/_rolldown/runtime.js +8 -1
  3. package/es/codemirror/components/CopyButton.d.ts +0 -1
  4. package/es/codemirror/components/LanguageSelect.d.ts +0 -1
  5. package/es/codemirror/components/MoreOptions.d.ts +0 -1
  6. package/es/codemirror/components/Toolbar.d.ts +0 -1
  7. package/es/codemirror/constants.d.ts +0 -1
  8. package/es/codemirror/types.d.ts +0 -1
  9. package/es/common/sys.js +1 -1
  10. package/es/editor-kernel/data-source.d.ts +1 -2
  11. package/es/editor-kernel/event.d.ts +1 -3
  12. package/es/editor-kernel/index.d.ts +3 -2
  13. package/es/editor-kernel/index.js +4 -4
  14. package/es/editor-kernel/inode/i-element-node.d.ts +0 -1
  15. package/es/editor-kernel/inode/i-node.d.ts +0 -1
  16. package/es/editor-kernel/inode/index.d.ts +3 -1
  17. package/es/editor-kernel/inode/paragraph-node.d.ts +1 -1
  18. package/es/editor-kernel/inode/root-node.d.ts +0 -1
  19. package/es/editor-kernel/inode/text-node.d.ts +0 -1
  20. package/es/editor-kernel/kernel.d.ts +1 -2
  21. package/es/editor-kernel/react/LexicalErrorBoundary.d.ts +2 -6
  22. package/es/editor-kernel/react/PortalContainer.d.ts +7 -3
  23. package/es/editor-kernel/react/PortalContainer.js +4 -4
  24. package/es/editor-kernel/react/index.d.ts +2 -1
  25. package/es/editor-kernel/react/react-context.d.ts +3 -2
  26. package/es/editor-kernel/react/react-editor.d.ts +2 -2
  27. package/es/editor-kernel/react/useDecorators.js +3 -2
  28. package/es/editor-kernel/react/useLexicalEditor.d.ts +0 -1
  29. package/es/editor-kernel/react/useLexicalEditor.js +1 -1
  30. package/es/editor-kernel/utils.d.ts +2 -3
  31. package/es/headless/extract-media-from-editor-state.d.ts +0 -1
  32. package/es/headless/extract-media-from-editor-state.js +1 -1
  33. package/es/headless/index.d.ts +3 -2
  34. package/es/headless/index.js +4 -3
  35. package/es/headless.d.ts +2 -3
  36. package/es/headless.js +20 -41
  37. package/es/index.d.ts +45 -21
  38. package/es/index.js +6 -6
  39. package/es/locale/index.d.ts +1 -1
  40. package/es/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +1 -2
  41. package/es/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +1 -1
  42. package/es/plugins/auto-complete/index.d.ts +3 -1
  43. package/es/plugins/auto-complete/node/placeholderNode.js +1 -1
  44. package/es/plugins/auto-complete/plugin/index.d.ts +2 -1
  45. package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.d.ts +1 -2
  46. package/es/plugins/auto-complete/react/index.d.ts +2 -1
  47. package/es/plugins/auto-complete/react/type.d.ts +1 -0
  48. package/es/plugins/block/command/index.d.ts +1 -3
  49. package/es/plugins/block/index.d.ts +5 -2
  50. package/es/plugins/block/plugin/index.d.ts +1 -0
  51. package/es/plugins/block/react/ReactBlockPlugin.d.ts +3 -2
  52. package/es/plugins/block/react/ReactBlockPlugin.js +5 -3
  53. package/es/plugins/block/react/core/types.d.ts +0 -1
  54. package/es/plugins/block/react/index.d.ts +3 -2
  55. package/es/plugins/block/service/i-block-menu-service.d.ts +1 -1
  56. package/es/plugins/block/service/i-block-menu-service.js +2 -1
  57. package/es/plugins/block/service/index.d.ts +2 -1
  58. package/es/plugins/code/command/index.d.ts +1 -3
  59. package/es/plugins/code/index.d.ts +3 -1
  60. package/es/plugins/code/plugin/index.d.ts +2 -1
  61. package/es/plugins/code/react/CodeReactPlugin.d.ts +1 -2
  62. package/es/plugins/code/react/index.d.ts +2 -1
  63. package/es/plugins/codeblock/command/index.d.ts +3 -1
  64. package/es/plugins/codeblock/command/index.js +1 -1
  65. package/es/plugins/codeblock/command/symbols.d.ts +1 -3
  66. package/es/plugins/codeblock/index.d.ts +3 -1
  67. package/es/plugins/codeblock/index.js +4 -4
  68. package/es/plugins/codeblock/plugin/index.d.ts +1 -0
  69. package/es/plugins/codeblock/react/ReactCodeblockPlugin.d.ts +1 -2
  70. package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +1 -1
  71. package/es/plugins/codeblock/react/index.d.ts +2 -1
  72. package/es/plugins/codeblock/react/style.js +0 -1
  73. package/es/plugins/codeblock/react/type.d.ts +1 -0
  74. package/es/plugins/codemirror-block/command/index.d.ts +3 -5
  75. package/es/plugins/codemirror-block/index.d.ts +3 -1
  76. package/es/plugins/codemirror-block/node/CodeMirrorNode.d.ts +1 -2
  77. package/es/plugins/codemirror-block/plugin/index.d.ts +1 -1
  78. package/es/plugins/codemirror-block/react/ReactCodemirrorNode.d.ts +1 -2
  79. package/es/plugins/codemirror-block/react/index.d.ts +2 -1
  80. package/es/plugins/collaboration/index.d.ts +3 -1
  81. package/es/plugins/collaboration/react/ReactCollaborationPlugin.d.ts +1 -2
  82. package/es/plugins/collaboration/react/ReactCollaborationPlugin.js +1 -1
  83. package/es/plugins/collaboration/react/index.d.ts +2 -1
  84. package/es/plugins/collaboration/react/type.d.ts +0 -1
  85. package/es/plugins/collaboration/utils.d.ts +0 -1
  86. package/es/plugins/collaboration/utils.js +1 -1
  87. package/es/plugins/common/command/index.d.ts +2 -4
  88. package/es/plugins/common/data-source/json-data-source.js +1 -1
  89. package/es/plugins/common/index.d.ts +4 -2
  90. package/es/plugins/common/node/cursor.d.ts +1 -2
  91. package/es/plugins/common/plugin/index.d.ts +1 -1
  92. package/es/plugins/common/plugin/index.js +2 -1
  93. package/es/plugins/common/plugin/paste-handler.d.ts +0 -1
  94. package/es/plugins/common/plugin/register.js +4 -3
  95. package/es/plugins/common/react/Placeholder/index.js +2 -1
  96. package/es/plugins/common/react/ReactEditorContent.d.ts +1 -2
  97. package/es/plugins/common/react/ReactPlainText.d.ts +2 -4
  98. package/es/plugins/common/react/index.d.ts +3 -2
  99. package/es/plugins/common/react/type.d.ts +2 -1
  100. package/es/plugins/common/utils/index.js +1 -1
  101. package/es/plugins/content-blocks/data-source/content-blocks-data-source.d.ts +2 -2
  102. package/es/plugins/content-blocks/index.d.ts +2 -1
  103. package/es/plugins/content-blocks/plugin/index.d.ts +1 -1
  104. package/es/plugins/content-blocks/types.d.ts +1 -2
  105. package/es/plugins/content-blocks/utils/extract-media-lists.d.ts +0 -1
  106. package/es/plugins/content-blocks/utils/extract.d.ts +0 -1
  107. package/es/plugins/content-blocks/utils/extract.js +2 -2
  108. package/es/plugins/file/command/index.d.ts +1 -3
  109. package/es/plugins/file/index.d.ts +3 -1
  110. package/es/plugins/file/node/FileNode.d.ts +1 -2
  111. package/es/plugins/file/plugin/index.d.ts +1 -1
  112. package/es/plugins/file/react/ReactFilePlugin.d.ts +1 -2
  113. package/es/plugins/file/react/index.d.ts +2 -1
  114. package/es/plugins/file/react/type.d.ts +1 -1
  115. package/es/plugins/hr/command/index.d.ts +1 -3
  116. package/es/plugins/hr/index.d.ts +3 -1
  117. package/es/plugins/hr/node/HorizontalRuleNode.d.ts +1 -2
  118. package/es/plugins/hr/plugin/index.d.ts +1 -1
  119. package/es/plugins/hr/react/ReactHRPlugin.d.ts +1 -2
  120. package/es/plugins/hr/react/index.d.ts +2 -1
  121. package/es/plugins/image/command/index.d.ts +1 -3
  122. package/es/plugins/image/index.d.ts +3 -1
  123. package/es/plugins/image/node/basie-image-node.d.ts +0 -1
  124. package/es/plugins/image/node/block-image-node.d.ts +0 -1
  125. package/es/plugins/image/node/image-node.d.ts +0 -1
  126. package/es/plugins/image/plugin/index.d.ts +1 -1
  127. package/es/plugins/image/react/ReactImagePlugin.d.ts +1 -2
  128. package/es/plugins/image/react/components/Image.js +4 -2
  129. package/es/plugins/image/react/components/style.js +3 -3
  130. package/es/plugins/image/react/components/useSupenseImage.js +1 -1
  131. package/es/plugins/image/react/index.d.ts +2 -1
  132. package/es/plugins/inode/index.d.ts +2 -1
  133. package/es/plugins/inode/plugin/index.d.ts +1 -0
  134. package/es/plugins/inode/react/index.d.ts +1 -2
  135. package/es/plugins/inode/react/index.js +1 -1
  136. package/es/plugins/inode/service/index.d.ts +2 -0
  137. package/es/plugins/inode/service/index.js +2 -1
  138. package/es/plugins/link/command/index.d.ts +1 -3
  139. package/es/plugins/link/index.d.ts +3 -1
  140. package/es/plugins/link/node/LinkNode.d.ts +0 -1
  141. package/es/plugins/link/node/LinkNode.js +2 -2
  142. package/es/plugins/link/plugin/index.d.ts +1 -1
  143. package/es/plugins/link/plugin/registry.js +2 -1
  144. package/es/plugins/link/react/ReactLinkPlugin.d.ts +1 -2
  145. package/es/plugins/link/react/ReactLinkPlugin.js +1 -1
  146. package/es/plugins/link/react/index.d.ts +2 -1
  147. package/es/plugins/link/react/type.d.ts +0 -1
  148. package/es/plugins/link/service/i-link-service.d.ts +1 -1
  149. package/es/plugins/link/service/i-link-service.js +2 -1
  150. package/es/plugins/link/utils/index.js +1 -1
  151. package/es/plugins/link-highlight/command/index.d.ts +1 -3
  152. package/es/plugins/link-highlight/index.d.ts +3 -1
  153. package/es/plugins/link-highlight/plugin/index.d.ts +1 -0
  154. package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.d.ts +1 -2
  155. package/es/plugins/link-highlight/react/index.d.ts +2 -1
  156. package/es/plugins/list/command/index.d.ts +1 -1
  157. package/es/plugins/list/command/index.js +2 -2
  158. package/es/plugins/list/index.d.ts +3 -1
  159. package/es/plugins/list/plugin/checkList.d.ts +0 -1
  160. package/es/plugins/list/plugin/checkList.js +0 -7
  161. package/es/plugins/list/plugin/index.d.ts +1 -0
  162. package/es/plugins/list/react/ReactListPlugin.d.ts +1 -2
  163. package/es/plugins/list/react/index.d.ts +2 -1
  164. package/es/plugins/list/react/style.js +1 -1
  165. package/es/plugins/litexml/command/diffCommand.d.ts +2 -1
  166. package/es/plugins/litexml/command/diffCommand.js +2 -2
  167. package/es/plugins/litexml/command/index.d.ts +3 -1
  168. package/es/plugins/litexml/command/index.js +3 -2
  169. package/es/plugins/litexml/command/symbols.d.ts +6 -8
  170. package/es/plugins/litexml/data-source/litexml-data-source.d.ts +4 -3
  171. package/es/plugins/litexml/data-source/litexml-data-source.js +4 -2
  172. package/es/plugins/litexml/index.d.ts +5 -2
  173. package/es/plugins/litexml/node/DiffNode.d.ts +1 -2
  174. package/es/plugins/litexml/plugin/index.d.ts +1 -1
  175. package/es/plugins/litexml/react/DiffNodeToolbar/index.js +1 -1
  176. package/es/plugins/litexml/react/hooks/useHasDiffNode.d.ts +1 -0
  177. package/es/plugins/litexml/react/index.d.ts +1 -2
  178. package/es/plugins/litexml/react/index.js +1 -1
  179. package/es/plugins/litexml/service/litexml-service.d.ts +3 -3
  180. package/es/plugins/litexml/service/litexml-service.js +2 -1
  181. package/es/plugins/markdown/command/index.d.ts +4 -4
  182. package/es/plugins/markdown/data-source/markdown/parse.d.ts +3 -3
  183. package/es/plugins/markdown/data-source/markdown/parse.js +2 -2
  184. package/es/plugins/markdown/data-source/markdown-data-source.js +1 -1
  185. package/es/plugins/markdown/index.d.ts +3 -2
  186. package/es/plugins/markdown/plugin/index.d.ts +2 -1
  187. package/es/plugins/markdown/react/index.d.ts +1 -2
  188. package/es/plugins/markdown/service/shortcut.d.ts +2 -2
  189. package/es/plugins/markdown/service/shortcut.js +2 -1
  190. package/es/plugins/markdown/service/transformers.d.ts +1 -3
  191. package/es/plugins/markdown/utils/index.d.ts +1 -1
  192. package/es/plugins/markdown/utils/index.js +1 -1
  193. package/es/plugins/math/command/index.d.ts +1 -3
  194. package/es/plugins/math/index.d.ts +2 -1
  195. package/es/plugins/math/node/index.d.ts +1 -2
  196. package/es/plugins/math/node/index.js +3 -2
  197. package/es/plugins/math/plugin/index.d.ts +2 -2
  198. package/es/plugins/math/react/components/MathEditorContent.js +2 -1
  199. package/es/plugins/math/react/components/MathInline.js +2 -2
  200. package/es/plugins/math/react/index.d.ts +0 -1
  201. package/es/plugins/math/react/type.d.ts +0 -1
  202. package/es/plugins/mention/command/index.d.ts +1 -3
  203. package/es/plugins/mention/index.d.ts +3 -1
  204. package/es/plugins/mention/node/MentionNode.d.ts +0 -1
  205. package/es/plugins/mention/plugin/index.d.ts +2 -1
  206. package/es/plugins/mention/react/ReactMentionPlugin.d.ts +1 -2
  207. package/es/plugins/mention/react/index.d.ts +2 -1
  208. package/es/plugins/mention/react/type.d.ts +0 -1
  209. package/es/plugins/slash/index.d.ts +5 -3
  210. package/es/plugins/slash/plugin/index.d.ts +1 -1
  211. package/es/plugins/slash/react/ReactSlashOption.d.ts +1 -2
  212. package/es/plugins/slash/react/ReactSlashPlugin.d.ts +1 -2
  213. package/es/plugins/slash/react/ReactSlashPlugin.js +2 -1
  214. package/es/plugins/slash/react/components/SlashMenu.d.ts +1 -2
  215. package/es/plugins/slash/react/index.d.ts +4 -3
  216. package/es/plugins/slash/react/type.d.ts +2 -1
  217. package/es/plugins/slash/service/i-slash-service.d.ts +2 -1
  218. package/es/plugins/slash/service/i-slash-service.js +2 -1
  219. package/es/plugins/slash/utils/utils.js +1 -1
  220. package/es/plugins/table/command/index.d.ts +4 -6
  221. package/es/plugins/table/command/index.js +4 -4
  222. package/es/plugins/table/index.d.ts +3 -1
  223. package/es/plugins/table/node/index.js +2 -1
  224. package/es/plugins/table/plugin/index.d.ts +1 -1
  225. package/es/plugins/table/plugin/index.js +1 -2
  226. package/es/plugins/table/react/TableActionMenu/index.js +0 -7
  227. package/es/plugins/table/react/TableColController.js +2 -2
  228. package/es/plugins/table/react/TableController/hooks.js +3 -2
  229. package/es/plugins/table/react/TableHoverActions/utils.js +1 -1
  230. package/es/plugins/table/react/TableResize/index.js +1 -1
  231. package/es/plugins/table/react/TableRowController.js +1 -1
  232. package/es/plugins/table/react/hooks.js +0 -7
  233. package/es/plugins/table/react/index.d.ts +0 -1
  234. package/es/plugins/table/react/index.js +1 -1
  235. package/es/plugins/table/react/type.d.ts +2 -1
  236. package/es/plugins/table/service/i-table-controller-menu-service.d.ts +1 -1
  237. package/es/plugins/table/service/i-table-controller-menu-service.js +2 -1
  238. package/es/plugins/table/service/index.d.ts +2 -1
  239. package/es/plugins/table/utils/index.js +1 -1
  240. package/es/plugins/toolbar/command/index.d.ts +0 -1
  241. package/es/plugins/toolbar/index.d.ts +2 -1
  242. package/es/plugins/toolbar/react/index.d.ts +0 -1
  243. package/es/plugins/toolbar/react/type.d.ts +0 -1
  244. package/es/plugins/upload/index.d.ts +2 -1
  245. package/es/plugins/upload/plugin/index.d.ts +1 -0
  246. package/es/plugins/upload/service/i-upload-service.d.ts +2 -1
  247. package/es/plugins/upload/service/i-upload-service.js +2 -1
  248. package/es/plugins/virtual-block/index.d.ts +3 -1
  249. package/es/plugins/virtual-block/plugin/index.d.ts +1 -0
  250. package/es/plugins/virtual-block/plugin/register.js +3 -2
  251. package/es/plugins/virtual-block/react/ReactVirtualBlock.d.ts +1 -2
  252. package/es/plugins/virtual-block/react/index.d.ts +2 -1
  253. package/es/react/ChatInput/ChatInput.d.ts +1 -2
  254. package/es/react/ChatInput/ChatInput.js +2 -1
  255. package/es/react/ChatInput/index.d.ts +2 -1
  256. package/es/react/ChatInput/type.d.ts +0 -1
  257. package/es/react/ChatInputActionBar/ChatInputActionBar.d.ts +1 -2
  258. package/es/react/ChatInputActionBar/index.d.ts +2 -1
  259. package/es/react/ChatInputActionBar/type.d.ts +0 -1
  260. package/es/react/ChatInputActions/ChatInputActions.d.ts +2 -4
  261. package/es/react/ChatInputActions/index.d.ts +2 -1
  262. package/es/react/ChatInputActions/type.d.ts +0 -1
  263. package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +1 -2
  264. package/es/react/CodeLanguageSelect/index.d.ts +2 -1
  265. package/es/react/CodeLanguageSelect/type.d.ts +0 -1
  266. package/es/react/Editor/Editor.js +1 -1
  267. package/es/react/Editor/index.d.ts +1 -2
  268. package/es/react/Editor/index.js +1 -1
  269. package/es/react/Editor/type.d.ts +5 -1
  270. package/es/react/Editor/utils.d.ts +0 -1
  271. package/es/react/EditorProvider/index.d.ts +2 -7
  272. package/es/react/EditorProvider/index.js +1 -1
  273. package/es/react/FloatActions/FloatActions.d.ts +1 -2
  274. package/es/react/FloatActions/index.d.ts +2 -1
  275. package/es/react/FloatActions/type.d.ts +0 -1
  276. package/es/react/SendButton/SendButton.d.ts +1 -2
  277. package/es/react/SendButton/index.d.ts +2 -1
  278. package/es/react/SendButton/type.d.ts +0 -1
  279. package/es/react/hooks/useEditor.d.ts +1 -0
  280. package/es/react/hooks/useEditorState/index.d.ts +1 -0
  281. package/es/react/hooks/useEditorState/index.js +8 -4
  282. package/es/react.d.ts +14 -7
  283. package/es/renderer/LexicalDiff.d.ts +1 -16
  284. package/es/renderer/LexicalDiff.js +1 -1
  285. package/es/renderer/LexicalRenderer.d.ts +1 -11
  286. package/es/renderer/diff/style.js +1 -1
  287. package/es/renderer/diff/types.d.ts +0 -1
  288. package/es/renderer/engine/render-builtin-node.js +1 -1
  289. package/es/renderer/nodes/index.d.ts +0 -1
  290. package/es/renderer/renderers/index.d.ts +0 -1
  291. package/es/renderer/renderers/index.js +1 -1
  292. package/es/renderer/renderers/math.js +2 -2
  293. package/es/renderer/types.d.ts +0 -1
  294. package/es/{symbols-DEEvsKq4.d.ts → symbols-Do7jD4Tt.d.ts} +6 -8
  295. package/es/types/hotkey.d.ts +0 -1
  296. package/es/types/index.d.ts +2 -1
  297. package/es/types/kernel.d.ts +1 -2
  298. package/es/types/locale.d.ts +2 -3
  299. package/es/utils/debug.d.ts +1 -2
  300. package/es/utils/debug.js +1 -1
  301. package/es/utils/hotkey/parseHotkeys.js +1 -1
  302. package/es/utils/hotkey/registerHotkey.d.ts +0 -1
  303. package/package.json +19 -19
package/README.md CHANGED
@@ -70,7 +70,7 @@ A modern, extensible rich text editor built on Meta's Lexical framework with dua
70
70
  - 🎨 **Customizable UI** - Antd-styled components with flexible theming
71
71
  - 🔗 **File & Media Support** - Native support for images, files, tables, and more
72
72
  - 🎯 **TypeScript Native** - Built with TypeScript for excellent developer experience
73
- - 📱 **Modern Build System** - Optimized with Vite, Dumi docs, and comprehensive testing
73
+ - 📱 **Modern Build System** - Optimized with Vite, lobedocs, and comprehensive testing
74
74
 
75
75
  ## 📦 Installation
76
76
 
@@ -419,21 +419,22 @@ $ pnpm install
419
419
  $ pnpm run dev
420
420
  ```
421
421
 
422
- This will start the Dumi documentation server with live playground at `http://localhost:8000`.
422
+ This starts the lobedocs development server with the live component playground. The local URL is
423
+ printed in the terminal.
423
424
 
424
425
  ### Available Scripts
425
426
 
426
- | Script | Description |
427
- | -------------------- | --------------------------------------------- |
428
- | `pnpm dev` | Start Dumi development server with playground |
429
- | `pnpm build` | Build library and generate type definitions |
430
- | `pnpm test` | Run tests with Vitest |
431
- | `pnpm test:coverage` | Run tests with coverage report |
432
- | `pnpm lint` | Lint and fix code with ESLint |
433
- | `pnpm type-check` | Type check with TypeScript |
434
- | `pnpm ci` | Run all CI checks (lint, type-check, test) |
435
- | `pnpm docs:build` | Build documentation for production |
436
- | `pnpm release` | Publish new version with semantic-release |
427
+ | Script | Description |
428
+ | -------------------- | -------------------------------------------- |
429
+ | `pnpm dev` | Start lobedocs with the component playground |
430
+ | `pnpm build` | Build library and generate type definitions |
431
+ | `pnpm test` | Run tests with Vitest |
432
+ | `pnpm test:coverage` | Run tests with coverage report |
433
+ | `pnpm lint` | Lint and fix code with ESLint |
434
+ | `pnpm type-check` | Type check with TypeScript |
435
+ | `pnpm ci` | Run all CI checks (lint, type-check, test) |
436
+ | `pnpm docs:build` | Build documentation for production |
437
+ | `pnpm release` | Publish new version with semantic-release |
437
438
 
438
439
  ### Debug Environment Variables
439
440
 
@@ -587,9 +588,9 @@ lobe-editor/
587
588
  │ └── index.ts # Public API exports
588
589
  │
589
590
  ├── docs/ # 📚 Documentation source
591
+ ├── docs.config.ts # lobedocs site configuration
590
592
  ├── tests/ # 🧪 Test files
591
- ├── vitest.config.ts # Test configuration
592
- └── .dumi/ # Dumi doc build cache
593
+ └── vitest.config.ts # Test configuration
593
594
  ```
594
595
 
595
596
  The architecture follows a **dual-layer design**:
@@ -3,7 +3,14 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
6
+ var __esmMin = (fn, res, err) => () => {
7
+ if (err) throw err[0];
8
+ try {
9
+ return fn && (res = fn(fn = 0)), res;
10
+ } catch (e) {
11
+ throw err = [e], e;
12
+ }
13
+ };
7
14
  var __exportAll = (all, no_symbols) => {
8
15
  let target = {};
9
16
  for (var name in all) __defProp(target, name, {
@@ -1,6 +1,5 @@
1
1
  import { CopyButtonProps } from "../types.js";
2
2
  import { FC } from "react";
3
-
4
3
  //#region src/codemirror/components/CopyButton.d.ts
5
4
  declare const CopyButton: FC<CopyButtonProps>;
6
5
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { LanguageSelectProps } from "../types.js";
2
2
  import { FC } from "react";
3
-
4
3
  //#region src/codemirror/components/LanguageSelect.d.ts
5
4
  declare const LanguageSelect: FC<LanguageSelectProps>;
6
5
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { MoreOptionsProps } from "../types.js";
2
2
  import { FC } from "react";
3
-
4
3
  //#region src/codemirror/components/MoreOptions.d.ts
5
4
  declare const MoreOptions: FC<MoreOptionsProps>;
6
5
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { ToolbarProps } from "../types.js";
2
2
  import { FC } from "react";
3
-
4
3
  //#region src/codemirror/components/Toolbar.d.ts
5
4
  declare const Toolbar: FC<ToolbarProps>;
6
5
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { CodeMirrorMode } from "./types.js";
2
-
3
2
  //#region src/codemirror/constants.d.ts
4
3
  declare const LANGUAGES: CodeMirrorMode[];
5
4
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { ReactNode } from "react";
2
-
3
2
  //#region src/codemirror/types.d.ts
4
3
  interface CodeMirrorMode {
5
4
  ext?: string[];
package/es/common/sys.js CHANGED
@@ -24,4 +24,4 @@ var init_sys = __esmMin((() => {
24
24
  }));
25
25
  //#endregion
26
26
  init_sys();
27
- export { CONTROL_OR_META, init_sys, isApple };
27
+ export { CONTROL_OR_META, browserDetect, init_sys, isApple, isBrowser, isNode, macOSDetect, nodeDetect };
@@ -1,5 +1,4 @@
1
1
  import { LexicalEditor } from "lexical";
2
-
3
2
  //#region src/editor-kernel/data-source.d.ts
4
3
  interface IWriteOptions {
5
4
  selection?: boolean;
@@ -12,4 +11,4 @@ declare class DataSource {
12
11
  write(editor: LexicalEditor, options?: IWriteOptions): any;
13
12
  }
14
13
  //#endregion
15
- export { DataSource, IWriteOptions };
14
+ export { IWriteOptions, DataSource as default };
@@ -1,7 +1,5 @@
1
- import * as _$lexical from "lexical";
2
1
  import { LexicalEditor } from "lexical";
3
-
4
2
  //#region src/editor-kernel/event.d.ts
5
- declare const HOVER_COMMAND: _$lexical.LexicalCommand<MouseEvent>;
3
+ declare const HOVER_COMMAND: import("lexical").LexicalCommand<MouseEvent>;
6
4
  //#endregion
7
5
  export { HOVER_COMMAND };
@@ -1,5 +1,6 @@
1
- import { DataSource } from "./data-source.js";
1
+ import DataSource from "./data-source.js";
2
+ import "../types/index.js";
2
3
  import { $closest, $closestNodeType, $getNearestNodeFromDOMNode as $getNearestNodeFromDOMNode$1, $getNodeFromDOMNode, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, EDITOR_THEME_KEY, assert, compareNodeOrder, createEmptyEditorState, genServiceId, generateEditorId, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, isDOMNode, isDocumentFragment, moment, noop, reconcileDecorator, registerEditorKernel, unregisterEditorKernel } from "./utils.js";
3
4
  import { HOVER_COMMAND } from "./event.js";
4
5
  import { resetRandomKey as resetRandomKey$1 } from "lexical";
5
- export { resetRandomKey$1 as resetRandomKey };
6
+ export { $closest, $closestNodeType, $getNearestNodeFromDOMNode$1 as $getNearestNodeFromDOMNode, $getNodeFromDOMNode, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, EDITOR_THEME_KEY, HOVER_COMMAND, assert, compareNodeOrder, createEmptyEditorState, genServiceId, generateEditorId, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, isDOMNode, isDocumentFragment, moment, noop, reconcileDecorator, registerEditorKernel, resetRandomKey$1 as resetRandomKey, unregisterEditorKernel };
@@ -1,7 +1,7 @@
1
- import { init_event } from "./event.js";
2
- import { init_utils } from "./utils.js";
1
+ import { HOVER_COMMAND, init_event } from "./event.js";
2
+ import { $closest, $closestNodeType, $getNearestNodeFromDOMNode as $getNearestNodeFromDOMNode$1, $getNodeFromDOMNode, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, EDITOR_THEME_KEY, assert, compareNodeOrder, createEmptyEditorState, genServiceId, generateEditorId, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, init_utils, isDOMNode, isDocumentFragment, moment, noop, reconcileDecorator, registerEditorKernel, unregisterEditorKernel } from "./utils.js";
3
3
  import { Kernel, init_kernel } from "./kernel.js";
4
- import "./data-source.js";
4
+ import DataSource from "./data-source.js";
5
5
  import { resetRandomKey as resetRandomKey$1 } from "lexical";
6
6
  //#region src/editor-kernel/index.ts
7
7
  init_kernel();
@@ -14,4 +14,4 @@ const Editor = { createEditor() {
14
14
  return new Kernel();
15
15
  } };
16
16
  //#endregion
17
- export { Editor as default, resetRandomKey$1 as resetRandomKey };
17
+ export { $closest, $closestNodeType, $getNearestNodeFromDOMNode$1 as $getNearestNodeFromDOMNode, $getNodeFromDOMNode, DOM_DOCUMENT_FRAGMENT_TYPE, DOM_DOCUMENT_TYPE, DOM_ELEMENT_TYPE, DOM_TEXT_TYPE, DataSource, EDITOR_THEME_KEY, HOVER_COMMAND, assert, compareNodeOrder, createEmptyEditorState, Editor as default, genServiceId, generateEditorId, getKernelFromEditor, getKernelFromEditorConfig, getNodeKeyFromDOMNode, getParentElement, isDOMNode, isDocumentFragment, moment, noop, reconcileDecorator, registerEditorKernel, resetRandomKey$1 as resetRandomKey, unregisterEditorKernel };
@@ -1,5 +1,4 @@
1
1
  import { SerializedElementNode } from "lexical";
2
-
3
2
  //#region src/editor-kernel/inode/i-element-node.d.ts
4
3
  type IElementNode = SerializedElementNode;
5
4
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { SerializedLexicalNode } from "lexical";
2
-
3
2
  //#region src/editor-kernel/inode/i-node.d.ts
4
3
  type INode = SerializedLexicalNode;
5
4
  //#endregion
@@ -1,4 +1,6 @@
1
1
  import { IElementNode } from "./i-element-node.js";
2
2
  import { INode } from "./i-node.js";
3
+ import "./paragraph-node.js";
3
4
  import { IRootNode } from "./root-node.js";
4
- import { ITextNode } from "./text-node.js";
5
+ import { ITextNode } from "./text-node.js";
6
+ export { IElementNode, INode, IRootNode, ITextNode };
@@ -1 +1 @@
1
- export { };
1
+ import "./i-element-node.js";
@@ -1,5 +1,4 @@
1
1
  import { SerializedRootNode } from "lexical";
2
-
3
2
  //#region src/editor-kernel/inode/root-node.d.ts
4
3
  /**
5
4
  * Root node
@@ -1,5 +1,4 @@
1
1
  import { SerializedTextNode } from "lexical";
2
-
3
2
  //#region src/editor-kernel/inode/text-node.d.ts
4
3
  /**
5
4
  * Text node
@@ -1,4 +1,4 @@
1
- import { DataSource } from "./data-source.js";
1
+ import DataSource from "./data-source.js";
2
2
  import { HotkeyId } from "../types/hotkey.js";
3
3
  import { HotkeyOptions, HotkeysEvent } from "../utils/hotkey/registerHotkey.js";
4
4
  import { ILocaleKeys } from "../types/locale.js";
@@ -6,7 +6,6 @@ import { IBeforeEditorInitLifecycle, IDecorator, IDocumentOptions, IEditor, IEdi
6
6
  import { HistoryState } from "@lexical/history";
7
7
  import EventEmitter from "eventemitter3";
8
8
  import { CommandListener, CommandListenerPriority, CommandPayloadType, LexicalCommand, LexicalEditor, LexicalNodeConfig } from "lexical";
9
-
10
9
  //#region src/editor-kernel/kernel.d.ts
11
10
  declare class Kernel extends EventEmitter implements IEditorKernel {
12
11
  private static globalHotReloadMode;
@@ -1,13 +1,9 @@
1
1
  import { JSX } from "react";
2
-
3
2
  //#region src/editor-kernel/react/LexicalErrorBoundary.d.ts
4
3
  type LexicalErrorBoundaryProps = {
5
4
  children: JSX.Element;
6
5
  onError: (error: unknown) => void;
7
6
  };
8
- declare function LexicalErrorBoundary({
9
- children,
10
- onError
11
- }: LexicalErrorBoundaryProps): JSX.Element;
7
+ declare function LexicalErrorBoundary({ children, onError }: LexicalErrorBoundaryProps): JSX.Element;
12
8
  //#endregion
13
- export { LexicalErrorBoundary };
9
+ export { LexicalErrorBoundary, LexicalErrorBoundaryProps };
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import { LexicalEditor, LexicalNode } from "lexical";
3
-
4
3
  //#region src/editor-kernel/react/PortalContainer.d.ts
5
4
  interface PortalContainerProps {
6
5
  children: React.ReactNode;
@@ -9,6 +8,11 @@ interface PortalContainerProps {
9
8
  node: LexicalNode;
10
9
  style?: React.CSSProperties;
11
10
  }
12
- declare const LexicalPortalContainer: React.ForwardRefExoticComponent<PortalContainerProps & React.RefAttributes<HTMLDivElement | null>>;
11
+ declare const LexicalPortalContainer: {
12
+ ({ ref, editor, node, children }: PortalContainerProps & {
13
+ ref?: React.RefObject<HTMLDivElement | null | null>;
14
+ }): React.JSX.Element;
15
+ displayName: string;
16
+ };
13
17
  //#endregion
14
- export { LexicalPortalContainer };
18
+ export { LexicalPortalContainer, LexicalPortalContainer as default, PortalContainerProps };
@@ -1,7 +1,7 @@
1
- import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
1
+ import { useEffect, useImperativeHandle, useRef } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/editor-kernel/react/PortalContainer.tsx
4
- const LexicalPortalContainer = forwardRef(({ editor, node, children }, ref) => {
4
+ const LexicalPortalContainer = ({ ref, editor, node, children }) => {
5
5
  const divRef = useRef(null);
6
6
  useImperativeHandle(ref, () => divRef.current, []);
7
7
  useEffect(() => {
@@ -19,7 +19,7 @@ const LexicalPortalContainer = forwardRef(({ editor, node, children }, ref) => {
19
19
  },
20
20
  children
21
21
  });
22
- });
22
+ };
23
23
  LexicalPortalContainer.displayName = "LexicalPortalContainer";
24
24
  //#endregion
25
- export { LexicalPortalContainer as default };
25
+ export { LexicalPortalContainer, LexicalPortalContainer as default };
@@ -2,4 +2,5 @@ import { LexicalErrorBoundary } from "./LexicalErrorBoundary.js";
2
2
  import { LexicalPortalContainer } from "./PortalContainer.js";
3
3
  import { useLexicalComposerContext } from "./react-context.js";
4
4
  import { ReactEditor } from "./react-editor.js";
5
- import { useLexicalEditor } from "./useLexicalEditor.js";
5
+ import { useLexicalEditor } from "./useLexicalEditor.js";
6
+ export { LexicalErrorBoundary, LexicalPortalContainer, ReactEditor, useLexicalComposerContext, useLexicalEditor };
@@ -1,6 +1,7 @@
1
1
  import { IEditor } from "../../types/kernel.js";
2
+ import "../../types/index.js";
3
+ import "react";
2
4
  import { EditorThemeClasses } from "lexical";
3
-
4
5
  //#region src/editor-kernel/react/react-context.d.ts
5
6
  type LexicalComposerContextType = {
6
7
  getTheme: () => EditorThemeClasses | null | undefined;
@@ -8,4 +9,4 @@ type LexicalComposerContextType = {
8
9
  type LexicalComposerContextWithEditor = [IEditor, LexicalComposerContextType];
9
10
  declare function useLexicalComposerContext(): LexicalComposerContextWithEditor;
10
11
  //#endregion
11
- export { useLexicalComposerContext };
12
+ export { LexicalComposerContextType, LexicalComposerContextWithEditor, useLexicalComposerContext };
@@ -1,6 +1,6 @@
1
1
  import { IEditor } from "../../types/kernel.js";
2
+ import "../../types/index.js";
2
3
  import { FC, ReactNode } from "react";
3
-
4
4
  //#region src/editor-kernel/react/react-editor.d.ts
5
5
  interface IReactEditorProps {
6
6
  children?: ReactNode | undefined;
@@ -13,4 +13,4 @@ interface IReactEditorProps {
13
13
  }
14
14
  declare const ReactEditor: FC<IReactEditorProps>;
15
15
  //#endregion
16
- export { ReactEditor };
16
+ export { IReactEditorProps, ReactEditor };
@@ -7,9 +7,10 @@ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
7
7
  function useDecorators(editor, ErrorBoundary) {
8
8
  const [decorators, setDecorators] = useState(() => editor.getLexicalEditor()?.getDecorators() || {});
9
9
  useLayoutEffectImpl(() => {
10
- let clears = [];
10
+ const clears = [];
11
11
  const handleInit = (editor) => {
12
- setDecorators(editor.getDecorators());
12
+ const initialDecorators = editor.getDecorators();
13
+ setDecorators(initialDecorators);
13
14
  clears.push(editor.registerDecoratorListener((nextDecorators) => {
14
15
  flushSync(() => {
15
16
  setDecorators(nextDecorators);
@@ -1,5 +1,4 @@
1
1
  import { LexicalEditor } from "lexical";
2
-
3
2
  //#region src/editor-kernel/react/useLexicalEditor.d.ts
4
3
  declare function useLexicalEditor(handleEditor: (lexicalEditor: LexicalEditor) => (() => void) | undefined, deps?: any[]): void;
5
4
  //#endregion
@@ -4,7 +4,7 @@ import { useEffect } from "react";
4
4
  function useLexicalEditor(handleEditor, deps = []) {
5
5
  const [editor] = useLexicalComposerContext();
6
6
  useEffect(() => {
7
- let lexicalEditor = editor.getLexicalEditor();
7
+ const lexicalEditor = editor.getLexicalEditor();
8
8
  if (lexicalEditor) return handleEditor(lexicalEditor);
9
9
  else {
10
10
  let remove = void 0;
@@ -1,7 +1,6 @@
1
1
  import { IEditorKernel, IServiceID } from "../types/kernel.js";
2
- import * as _$lexical from "lexical";
2
+ import "../types/index.js";
3
3
  import { EditorConfig, ElementNode, LexicalEditor, LexicalNode, NodeKey } from "lexical";
4
-
5
4
  //#region src/editor-kernel/utils.d.ts
6
5
  declare const DOM_ELEMENT_TYPE = 1;
7
6
  declare const DOM_TEXT_TYPE = 3;
@@ -9,7 +8,7 @@ declare const DOM_DOCUMENT_TYPE = 9;
9
8
  declare const DOM_DOCUMENT_FRAGMENT_TYPE = 11;
10
9
  declare function genServiceId<T>(name: string): IServiceID<T>;
11
10
  declare const noop: () => void;
12
- declare function createEmptyEditorState(): _$lexical.EditorState;
11
+ declare function createEmptyEditorState(): import("lexical").EditorState;
13
12
  declare function assert(cond?: boolean, message?: string): asserts cond;
14
13
  declare function getNodeKeyFromDOMNode(dom: Node, editor: LexicalEditor): NodeKey | undefined;
15
14
  declare function $getNodeFromDOMNode(dom: Node, editor: LexicalEditor, editorState?: ReturnType<LexicalEditor['getEditorState']>): LexicalNode | null;
@@ -1,5 +1,4 @@
1
1
  import { SerializedEditorState } from "lexical";
2
-
3
2
  //#region src/headless/extract-media-from-editor-state.d.ts
4
3
  interface ImageListItem {
5
4
  alt: string;
@@ -1,5 +1,5 @@
1
1
  //#region src/headless/extract-media-from-editor-state.ts
2
- const IMAGE_TYPES = new Set(["image", "block-image"]);
2
+ const IMAGE_TYPES = /* @__PURE__ */ new Set(["image", "block-image"]);
3
3
  const FILE_TYPE = "file";
4
4
  const generateId = () => {
5
5
  if (typeof globalThis.crypto?.randomUUID === "function") return globalThis.crypto.randomUUID();
@@ -1,8 +1,9 @@
1
1
  import { IDocumentOptions, IEditor, IPlugin } from "../types/kernel.js";
2
+ import "../types/index.js";
2
3
  import { LITEXML_MODIFY_COMMAND } from "../plugins/litexml/command/symbols.js";
4
+ import "../plugins/litexml/command/index.js";
3
5
  import { FileListItem, ImageListItem, MediaLists, extractMediaFromEditorState } from "./extract-media-from-editor-state.js";
4
6
  import { CommandPayloadType, SerializedEditorState, SerializedLexicalNode } from "lexical";
5
-
6
7
  //#region src/headless/index.d.ts
7
8
  type HeadlessDocumentType = 'json' | 'litexml' | 'markdown' | (string & object);
8
9
  interface HeadlessEditorHydrationInput {
@@ -66,4 +67,4 @@ declare class HeadlessEditor {
66
67
  }
67
68
  declare function createHeadlessEditor(options?: HeadlessEditorOptions): HeadlessEditor;
68
69
  //#endregion
69
- export { DEFAULT_HEADLESS_EDITOR_PLUGINS, HeadlessDocumentType, HeadlessEditor, HeadlessEditorExport, HeadlessEditorExportOptions, HeadlessEditorHydrationInput, HeadlessEditorOptions, HeadlessLiteXMLBatchOperation, HeadlessLiteXMLInsertOperation, HeadlessLiteXMLOperation, HeadlessLiteXMLRemoveOperation, HeadlessLiteXMLReplaceOperation, createHeadlessEditor };
70
+ export { DEFAULT_HEADLESS_EDITOR_PLUGINS, type FileListItem, HeadlessDocumentType, HeadlessEditor, HeadlessEditorExport, HeadlessEditorExportOptions, HeadlessEditorHydrationInput, HeadlessEditorOptions, HeadlessLiteXMLBatchOperation, HeadlessLiteXMLInsertOperation, HeadlessLiteXMLOperation, HeadlessLiteXMLRemoveOperation, HeadlessLiteXMLReplaceOperation, type ImageListItem, type MediaLists, createHeadlessEditor, extractMediaFromEditorState };
@@ -1,4 +1,4 @@
1
- import { moment } from "../editor-kernel/utils.js";
1
+ import { init_utils, moment } from "../editor-kernel/utils.js";
2
2
  import Editor from "../editor-kernel/index.js";
3
3
  import { LITEXML_APPLY_COMMAND, LITEXML_INSERT_COMMAND, LITEXML_MODIFY_COMMAND, LITEXML_REMOVE_COMMAND } from "../plugins/litexml/command/symbols.js";
4
4
  import { INodePlugin } from "../plugins/inode/plugin/index.js";
@@ -15,8 +15,9 @@ import { ListPlugin } from "../plugins/list/plugin/index.js";
15
15
  import { MathPlugin } from "../plugins/math/plugin/index.js";
16
16
  import { MentionPlugin } from "../plugins/mention/plugin/index.js";
17
17
  import { TablePlugin } from "../plugins/table/plugin/index.js";
18
- import "./extract-media-from-editor-state.js";
18
+ import { extractMediaFromEditorState } from "./extract-media-from-editor-state.js";
19
19
  //#region src/headless/index.ts
20
+ init_utils();
20
21
  const getNumericId = (id) => {
21
22
  if (typeof id !== "number" && typeof id !== "string") return null;
22
23
  const numericId = Number(id);
@@ -196,4 +197,4 @@ function createHeadlessEditor(options) {
196
197
  return new HeadlessEditor(options);
197
198
  }
198
199
  //#endregion
199
- export { DEFAULT_HEADLESS_EDITOR_PLUGINS, HeadlessEditor, createHeadlessEditor };
200
+ export { DEFAULT_HEADLESS_EDITOR_PLUGINS, HeadlessEditor, createHeadlessEditor, extractMediaFromEditorState };
package/es/headless.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { o as LITEXML_MODIFY_COMMAND } from "./symbols-DEEvsKq4.js";
1
+ import { o as LITEXML_MODIFY_COMMAND } from "./symbols-Do7jD4Tt.js";
2
2
  import { HistoryState, HistoryStateEntry } from "@lexical/history";
3
3
  import { CommandListener, CommandListenerPriority, CommandPayloadType, EditorState, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, LexicalNodeConfig, SerializedEditorState, SerializedLexicalNode } from "lexical";
4
-
5
4
  //#region src/editor-kernel/data-source.d.ts
6
5
  interface IWriteOptions {
7
6
  selection?: boolean;
@@ -120,7 +119,7 @@ declare const _default: {
120
119
  * Internationalization key type declaration, plugins can extend through declaration merging
121
120
  */
122
121
  type LocaleType = typeof _default;
123
- type FlattenKeys<T, Prefix extends string = ''> = { [K in keyof T & string]: T[K] extends string ? Prefix extends '' ? K : `${Prefix}.${K}` : T[K] extends Record<string, any> ? FlattenKeys<T[K], Prefix extends '' ? K : `${Prefix}.${K}`> : never }[keyof T & string];
122
+ type FlattenKeys<T, Prefix extends string = ''> = { [K in keyof T & string]: T[K] extends string ? Prefix extends '' ? K : `${Prefix}.${K}` : T[K] extends Record<string, any> ? FlattenKeys<T[K], Prefix extends '' ? K : `${Prefix}.${K}`> : never; }[keyof T & string];
124
123
  type ILocaleKeys = Record<FlattenKeys<LocaleType>, string>;
125
124
  //#endregion
126
125
  //#region src/types/kernel.d.ts