@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.
- package/README.md +16 -15
- package/es/_virtual/_rolldown/runtime.js +8 -1
- package/es/codemirror/components/CopyButton.d.ts +0 -1
- package/es/codemirror/components/LanguageSelect.d.ts +0 -1
- package/es/codemirror/components/MoreOptions.d.ts +0 -1
- package/es/codemirror/components/Toolbar.d.ts +0 -1
- package/es/codemirror/constants.d.ts +0 -1
- package/es/codemirror/types.d.ts +0 -1
- package/es/common/sys.js +1 -1
- package/es/editor-kernel/data-source.d.ts +1 -2
- package/es/editor-kernel/event.d.ts +1 -3
- package/es/editor-kernel/index.d.ts +3 -2
- package/es/editor-kernel/index.js +4 -4
- package/es/editor-kernel/inode/i-element-node.d.ts +0 -1
- package/es/editor-kernel/inode/i-node.d.ts +0 -1
- package/es/editor-kernel/inode/index.d.ts +3 -1
- package/es/editor-kernel/inode/paragraph-node.d.ts +1 -1
- package/es/editor-kernel/inode/root-node.d.ts +0 -1
- package/es/editor-kernel/inode/text-node.d.ts +0 -1
- package/es/editor-kernel/kernel.d.ts +1 -2
- package/es/editor-kernel/react/LexicalErrorBoundary.d.ts +2 -6
- package/es/editor-kernel/react/PortalContainer.d.ts +7 -3
- package/es/editor-kernel/react/PortalContainer.js +4 -4
- package/es/editor-kernel/react/index.d.ts +2 -1
- package/es/editor-kernel/react/react-context.d.ts +3 -2
- package/es/editor-kernel/react/react-editor.d.ts +2 -2
- package/es/editor-kernel/react/useDecorators.js +3 -2
- package/es/editor-kernel/react/useLexicalEditor.d.ts +0 -1
- package/es/editor-kernel/react/useLexicalEditor.js +1 -1
- package/es/editor-kernel/utils.d.ts +2 -3
- package/es/headless/extract-media-from-editor-state.d.ts +0 -1
- package/es/headless/extract-media-from-editor-state.js +1 -1
- package/es/headless/index.d.ts +3 -2
- package/es/headless/index.js +4 -3
- package/es/headless.d.ts +2 -3
- package/es/headless.js +20 -41
- package/es/index.d.ts +45 -21
- package/es/index.js +6 -6
- package/es/locale/index.d.ts +1 -1
- package/es/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +1 -2
- package/es/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +1 -1
- package/es/plugins/auto-complete/index.d.ts +3 -1
- package/es/plugins/auto-complete/node/placeholderNode.js +1 -1
- package/es/plugins/auto-complete/plugin/index.d.ts +2 -1
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.d.ts +1 -2
- package/es/plugins/auto-complete/react/index.d.ts +2 -1
- package/es/plugins/auto-complete/react/type.d.ts +1 -0
- package/es/plugins/block/command/index.d.ts +1 -3
- package/es/plugins/block/index.d.ts +5 -2
- package/es/plugins/block/plugin/index.d.ts +1 -0
- package/es/plugins/block/react/ReactBlockPlugin.d.ts +3 -2
- package/es/plugins/block/react/ReactBlockPlugin.js +5 -3
- package/es/plugins/block/react/core/types.d.ts +0 -1
- package/es/plugins/block/react/index.d.ts +3 -2
- package/es/plugins/block/service/i-block-menu-service.d.ts +1 -1
- package/es/plugins/block/service/i-block-menu-service.js +2 -1
- package/es/plugins/block/service/index.d.ts +2 -1
- package/es/plugins/code/command/index.d.ts +1 -3
- package/es/plugins/code/index.d.ts +3 -1
- package/es/plugins/code/plugin/index.d.ts +2 -1
- package/es/plugins/code/react/CodeReactPlugin.d.ts +1 -2
- package/es/plugins/code/react/index.d.ts +2 -1
- package/es/plugins/codeblock/command/index.d.ts +3 -1
- package/es/plugins/codeblock/command/index.js +1 -1
- package/es/plugins/codeblock/command/symbols.d.ts +1 -3
- package/es/plugins/codeblock/index.d.ts +3 -1
- package/es/plugins/codeblock/index.js +4 -4
- package/es/plugins/codeblock/plugin/index.d.ts +1 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.d.ts +1 -2
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +1 -1
- package/es/plugins/codeblock/react/index.d.ts +2 -1
- package/es/plugins/codeblock/react/style.js +0 -1
- package/es/plugins/codeblock/react/type.d.ts +1 -0
- package/es/plugins/codemirror-block/command/index.d.ts +3 -5
- package/es/plugins/codemirror-block/index.d.ts +3 -1
- package/es/plugins/codemirror-block/node/CodeMirrorNode.d.ts +1 -2
- package/es/plugins/codemirror-block/plugin/index.d.ts +1 -1
- package/es/plugins/codemirror-block/react/ReactCodemirrorNode.d.ts +1 -2
- package/es/plugins/codemirror-block/react/index.d.ts +2 -1
- package/es/plugins/collaboration/index.d.ts +3 -1
- package/es/plugins/collaboration/react/ReactCollaborationPlugin.d.ts +1 -2
- package/es/plugins/collaboration/react/ReactCollaborationPlugin.js +1 -1
- package/es/plugins/collaboration/react/index.d.ts +2 -1
- package/es/plugins/collaboration/react/type.d.ts +0 -1
- package/es/plugins/collaboration/utils.d.ts +0 -1
- package/es/plugins/collaboration/utils.js +1 -1
- package/es/plugins/common/command/index.d.ts +2 -4
- package/es/plugins/common/data-source/json-data-source.js +1 -1
- package/es/plugins/common/index.d.ts +4 -2
- package/es/plugins/common/node/cursor.d.ts +1 -2
- package/es/plugins/common/plugin/index.d.ts +1 -1
- package/es/plugins/common/plugin/index.js +2 -1
- package/es/plugins/common/plugin/paste-handler.d.ts +0 -1
- package/es/plugins/common/plugin/register.js +4 -3
- package/es/plugins/common/react/Placeholder/index.js +2 -1
- package/es/plugins/common/react/ReactEditorContent.d.ts +1 -2
- package/es/plugins/common/react/ReactPlainText.d.ts +2 -4
- package/es/plugins/common/react/index.d.ts +3 -2
- package/es/plugins/common/react/type.d.ts +2 -1
- package/es/plugins/common/utils/index.js +1 -1
- package/es/plugins/content-blocks/data-source/content-blocks-data-source.d.ts +2 -2
- package/es/plugins/content-blocks/index.d.ts +2 -1
- package/es/plugins/content-blocks/plugin/index.d.ts +1 -1
- package/es/plugins/content-blocks/types.d.ts +1 -2
- package/es/plugins/content-blocks/utils/extract-media-lists.d.ts +0 -1
- package/es/plugins/content-blocks/utils/extract.d.ts +0 -1
- package/es/plugins/content-blocks/utils/extract.js +2 -2
- package/es/plugins/file/command/index.d.ts +1 -3
- package/es/plugins/file/index.d.ts +3 -1
- package/es/plugins/file/node/FileNode.d.ts +1 -2
- package/es/plugins/file/plugin/index.d.ts +1 -1
- package/es/plugins/file/react/ReactFilePlugin.d.ts +1 -2
- package/es/plugins/file/react/index.d.ts +2 -1
- package/es/plugins/file/react/type.d.ts +1 -1
- package/es/plugins/hr/command/index.d.ts +1 -3
- package/es/plugins/hr/index.d.ts +3 -1
- package/es/plugins/hr/node/HorizontalRuleNode.d.ts +1 -2
- package/es/plugins/hr/plugin/index.d.ts +1 -1
- package/es/plugins/hr/react/ReactHRPlugin.d.ts +1 -2
- package/es/plugins/hr/react/index.d.ts +2 -1
- package/es/plugins/image/command/index.d.ts +1 -3
- package/es/plugins/image/index.d.ts +3 -1
- package/es/plugins/image/node/basie-image-node.d.ts +0 -1
- package/es/plugins/image/node/block-image-node.d.ts +0 -1
- package/es/plugins/image/node/image-node.d.ts +0 -1
- package/es/plugins/image/plugin/index.d.ts +1 -1
- package/es/plugins/image/react/ReactImagePlugin.d.ts +1 -2
- package/es/plugins/image/react/components/Image.js +4 -2
- package/es/plugins/image/react/components/style.js +3 -3
- package/es/plugins/image/react/components/useSupenseImage.js +1 -1
- package/es/plugins/image/react/index.d.ts +2 -1
- package/es/plugins/inode/index.d.ts +2 -1
- package/es/plugins/inode/plugin/index.d.ts +1 -0
- package/es/plugins/inode/react/index.d.ts +1 -2
- package/es/plugins/inode/react/index.js +1 -1
- package/es/plugins/inode/service/index.d.ts +2 -0
- package/es/plugins/inode/service/index.js +2 -1
- package/es/plugins/link/command/index.d.ts +1 -3
- package/es/plugins/link/index.d.ts +3 -1
- package/es/plugins/link/node/LinkNode.d.ts +0 -1
- package/es/plugins/link/node/LinkNode.js +2 -2
- package/es/plugins/link/plugin/index.d.ts +1 -1
- package/es/plugins/link/plugin/registry.js +2 -1
- package/es/plugins/link/react/ReactLinkPlugin.d.ts +1 -2
- package/es/plugins/link/react/ReactLinkPlugin.js +1 -1
- package/es/plugins/link/react/index.d.ts +2 -1
- package/es/plugins/link/react/type.d.ts +0 -1
- package/es/plugins/link/service/i-link-service.d.ts +1 -1
- package/es/plugins/link/service/i-link-service.js +2 -1
- package/es/plugins/link/utils/index.js +1 -1
- package/es/plugins/link-highlight/command/index.d.ts +1 -3
- package/es/plugins/link-highlight/index.d.ts +3 -1
- package/es/plugins/link-highlight/plugin/index.d.ts +1 -0
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.d.ts +1 -2
- package/es/plugins/link-highlight/react/index.d.ts +2 -1
- package/es/plugins/list/command/index.d.ts +1 -1
- package/es/plugins/list/command/index.js +2 -2
- package/es/plugins/list/index.d.ts +3 -1
- package/es/plugins/list/plugin/checkList.d.ts +0 -1
- package/es/plugins/list/plugin/checkList.js +0 -7
- package/es/plugins/list/plugin/index.d.ts +1 -0
- package/es/plugins/list/react/ReactListPlugin.d.ts +1 -2
- package/es/plugins/list/react/index.d.ts +2 -1
- package/es/plugins/list/react/style.js +1 -1
- package/es/plugins/litexml/command/diffCommand.d.ts +2 -1
- package/es/plugins/litexml/command/diffCommand.js +2 -2
- package/es/plugins/litexml/command/index.d.ts +3 -1
- package/es/plugins/litexml/command/index.js +3 -2
- package/es/plugins/litexml/command/symbols.d.ts +6 -8
- package/es/plugins/litexml/data-source/litexml-data-source.d.ts +4 -3
- package/es/plugins/litexml/data-source/litexml-data-source.js +4 -2
- package/es/plugins/litexml/index.d.ts +5 -2
- package/es/plugins/litexml/node/DiffNode.d.ts +1 -2
- package/es/plugins/litexml/plugin/index.d.ts +1 -1
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +1 -1
- package/es/plugins/litexml/react/hooks/useHasDiffNode.d.ts +1 -0
- package/es/plugins/litexml/react/index.d.ts +1 -2
- package/es/plugins/litexml/react/index.js +1 -1
- package/es/plugins/litexml/service/litexml-service.d.ts +3 -3
- package/es/plugins/litexml/service/litexml-service.js +2 -1
- package/es/plugins/markdown/command/index.d.ts +4 -4
- package/es/plugins/markdown/data-source/markdown/parse.d.ts +3 -3
- package/es/plugins/markdown/data-source/markdown/parse.js +2 -2
- package/es/plugins/markdown/data-source/markdown-data-source.js +1 -1
- package/es/plugins/markdown/index.d.ts +3 -2
- package/es/plugins/markdown/plugin/index.d.ts +2 -1
- package/es/plugins/markdown/react/index.d.ts +1 -2
- package/es/plugins/markdown/service/shortcut.d.ts +2 -2
- package/es/plugins/markdown/service/shortcut.js +2 -1
- package/es/plugins/markdown/service/transformers.d.ts +1 -3
- package/es/plugins/markdown/utils/index.d.ts +1 -1
- package/es/plugins/markdown/utils/index.js +1 -1
- package/es/plugins/math/command/index.d.ts +1 -3
- package/es/plugins/math/index.d.ts +2 -1
- package/es/plugins/math/node/index.d.ts +1 -2
- package/es/plugins/math/node/index.js +3 -2
- package/es/plugins/math/plugin/index.d.ts +2 -2
- package/es/plugins/math/react/components/MathEditorContent.js +2 -1
- package/es/plugins/math/react/components/MathInline.js +2 -2
- package/es/plugins/math/react/index.d.ts +0 -1
- package/es/plugins/math/react/type.d.ts +0 -1
- package/es/plugins/mention/command/index.d.ts +1 -3
- package/es/plugins/mention/index.d.ts +3 -1
- package/es/plugins/mention/node/MentionNode.d.ts +0 -1
- package/es/plugins/mention/plugin/index.d.ts +2 -1
- package/es/plugins/mention/react/ReactMentionPlugin.d.ts +1 -2
- package/es/plugins/mention/react/index.d.ts +2 -1
- package/es/plugins/mention/react/type.d.ts +0 -1
- package/es/plugins/slash/index.d.ts +5 -3
- package/es/plugins/slash/plugin/index.d.ts +1 -1
- package/es/plugins/slash/react/ReactSlashOption.d.ts +1 -2
- package/es/plugins/slash/react/ReactSlashPlugin.d.ts +1 -2
- package/es/plugins/slash/react/ReactSlashPlugin.js +2 -1
- package/es/plugins/slash/react/components/SlashMenu.d.ts +1 -2
- package/es/plugins/slash/react/index.d.ts +4 -3
- package/es/plugins/slash/react/type.d.ts +2 -1
- package/es/plugins/slash/service/i-slash-service.d.ts +2 -1
- package/es/plugins/slash/service/i-slash-service.js +2 -1
- package/es/plugins/slash/utils/utils.js +1 -1
- package/es/plugins/table/command/index.d.ts +4 -6
- package/es/plugins/table/command/index.js +4 -4
- package/es/plugins/table/index.d.ts +3 -1
- package/es/plugins/table/node/index.js +2 -1
- package/es/plugins/table/plugin/index.d.ts +1 -1
- package/es/plugins/table/plugin/index.js +1 -2
- package/es/plugins/table/react/TableActionMenu/index.js +0 -7
- package/es/plugins/table/react/TableColController.js +2 -2
- package/es/plugins/table/react/TableController/hooks.js +3 -2
- package/es/plugins/table/react/TableHoverActions/utils.js +1 -1
- package/es/plugins/table/react/TableResize/index.js +1 -1
- package/es/plugins/table/react/TableRowController.js +1 -1
- package/es/plugins/table/react/hooks.js +0 -7
- package/es/plugins/table/react/index.d.ts +0 -1
- package/es/plugins/table/react/index.js +1 -1
- package/es/plugins/table/react/type.d.ts +2 -1
- package/es/plugins/table/service/i-table-controller-menu-service.d.ts +1 -1
- package/es/plugins/table/service/i-table-controller-menu-service.js +2 -1
- package/es/plugins/table/service/index.d.ts +2 -1
- package/es/plugins/table/utils/index.js +1 -1
- package/es/plugins/toolbar/command/index.d.ts +0 -1
- package/es/plugins/toolbar/index.d.ts +2 -1
- package/es/plugins/toolbar/react/index.d.ts +0 -1
- package/es/plugins/toolbar/react/type.d.ts +0 -1
- package/es/plugins/upload/index.d.ts +2 -1
- package/es/plugins/upload/plugin/index.d.ts +1 -0
- package/es/plugins/upload/service/i-upload-service.d.ts +2 -1
- package/es/plugins/upload/service/i-upload-service.js +2 -1
- package/es/plugins/virtual-block/index.d.ts +3 -1
- package/es/plugins/virtual-block/plugin/index.d.ts +1 -0
- package/es/plugins/virtual-block/plugin/register.js +3 -2
- package/es/plugins/virtual-block/react/ReactVirtualBlock.d.ts +1 -2
- package/es/plugins/virtual-block/react/index.d.ts +2 -1
- package/es/react/ChatInput/ChatInput.d.ts +1 -2
- package/es/react/ChatInput/ChatInput.js +2 -1
- package/es/react/ChatInput/index.d.ts +2 -1
- package/es/react/ChatInput/type.d.ts +0 -1
- package/es/react/ChatInputActionBar/ChatInputActionBar.d.ts +1 -2
- package/es/react/ChatInputActionBar/index.d.ts +2 -1
- package/es/react/ChatInputActionBar/type.d.ts +0 -1
- package/es/react/ChatInputActions/ChatInputActions.d.ts +2 -4
- package/es/react/ChatInputActions/index.d.ts +2 -1
- package/es/react/ChatInputActions/type.d.ts +0 -1
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +1 -2
- package/es/react/CodeLanguageSelect/index.d.ts +2 -1
- package/es/react/CodeLanguageSelect/type.d.ts +0 -1
- package/es/react/Editor/Editor.js +1 -1
- package/es/react/Editor/index.d.ts +1 -2
- package/es/react/Editor/index.js +1 -1
- package/es/react/Editor/type.d.ts +5 -1
- package/es/react/Editor/utils.d.ts +0 -1
- package/es/react/EditorProvider/index.d.ts +2 -7
- package/es/react/EditorProvider/index.js +1 -1
- package/es/react/FloatActions/FloatActions.d.ts +1 -2
- package/es/react/FloatActions/index.d.ts +2 -1
- package/es/react/FloatActions/type.d.ts +0 -1
- package/es/react/SendButton/SendButton.d.ts +1 -2
- package/es/react/SendButton/index.d.ts +2 -1
- package/es/react/SendButton/type.d.ts +0 -1
- package/es/react/hooks/useEditor.d.ts +1 -0
- package/es/react/hooks/useEditorState/index.d.ts +1 -0
- package/es/react/hooks/useEditorState/index.js +8 -4
- package/es/react.d.ts +14 -7
- package/es/renderer/LexicalDiff.d.ts +1 -16
- package/es/renderer/LexicalDiff.js +1 -1
- package/es/renderer/LexicalRenderer.d.ts +1 -11
- package/es/renderer/diff/style.js +1 -1
- package/es/renderer/diff/types.d.ts +0 -1
- package/es/renderer/engine/render-builtin-node.js +1 -1
- package/es/renderer/nodes/index.d.ts +0 -1
- package/es/renderer/renderers/index.d.ts +0 -1
- package/es/renderer/renderers/index.js +1 -1
- package/es/renderer/renderers/math.js +2 -2
- package/es/renderer/types.d.ts +0 -1
- package/es/{symbols-DEEvsKq4.d.ts → symbols-Do7jD4Tt.d.ts} +6 -8
- package/es/types/hotkey.d.ts +0 -1
- package/es/types/index.d.ts +2 -1
- package/es/types/kernel.d.ts +1 -2
- package/es/types/locale.d.ts +2 -3
- package/es/utils/debug.d.ts +1 -2
- package/es/utils/debug.js +1 -1
- package/es/utils/hotkey/parseHotkeys.js +1 -1
- package/es/utils/hotkey/registerHotkey.d.ts +0 -1
- 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,
|
|
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
|
|
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
|
|
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
|
-
|
|
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) => () =>
|
|
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, {
|
package/es/codemirror/types.d.ts
CHANGED
package/es/common/sys.js
CHANGED
|
@@ -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 {
|
|
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:
|
|
3
|
+
declare const HOVER_COMMAND: import("lexical").LexicalCommand<MouseEvent>;
|
|
6
4
|
//#endregion
|
|
7
5
|
export { HOVER_COMMAND };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
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,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
|
-
|
|
1
|
+
import "./i-element-node.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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:
|
|
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 {
|
|
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 =
|
|
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
|
-
|
|
10
|
+
const clears = [];
|
|
11
11
|
const handleInit = (editor) => {
|
|
12
|
-
|
|
12
|
+
const initialDecorators = editor.getDecorators();
|
|
13
|
+
setDecorators(initialDecorators);
|
|
13
14
|
clears.push(editor.registerDecoratorListener((nextDecorators) => {
|
|
14
15
|
flushSync(() => {
|
|
15
16
|
setDecorators(nextDecorators);
|
|
@@ -4,7 +4,7 @@ import { useEffect } from "react";
|
|
|
4
4
|
function useLexicalEditor(handleEditor, deps = []) {
|
|
5
5
|
const [editor] = useLexicalComposerContext();
|
|
6
6
|
useEffect(() => {
|
|
7
|
-
|
|
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
|
|
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():
|
|
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,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();
|
package/es/headless/index.d.ts
CHANGED
|
@@ -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 };
|
package/es/headless/index.js
CHANGED
|
@@ -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-
|
|
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
|