@lobehub/editor 1.0.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/LICENSE +21 -0
- package/README.md +635 -0
- package/es/common/canUseDOM.d.ts +8 -0
- package/es/common/canUseDOM.js +9 -0
- package/es/common/sys.d.ts +17 -0
- package/es/common/sys.js +30 -0
- package/es/editor-kernel/data-source.d.ts +8 -0
- package/es/editor-kernel/data-source.js +30 -0
- package/es/editor-kernel/event.d.ts +3 -0
- package/es/editor-kernel/event.js +11 -0
- package/es/editor-kernel/index.d.ts +11 -0
- package/es/editor-kernel/index.js +14 -0
- package/es/editor-kernel/inode/helper.d.ts +11 -0
- package/es/editor-kernel/inode/helper.js +48 -0
- package/es/editor-kernel/inode/i-element-node.d.ts +5 -0
- package/es/editor-kernel/inode/i-element-node.js +1 -0
- package/es/editor-kernel/inode/i-node.d.ts +6 -0
- package/es/editor-kernel/inode/i-node.js +1 -0
- package/es/editor-kernel/inode/index.d.ts +5 -0
- package/es/editor-kernel/inode/index.js +5 -0
- package/es/editor-kernel/inode/paragraph-node.d.ts +6 -0
- package/es/editor-kernel/inode/paragraph-node.js +1 -0
- package/es/editor-kernel/inode/root-node.d.ts +7 -0
- package/es/editor-kernel/inode/root-node.js +1 -0
- package/es/editor-kernel/inode/text-node.d.ts +12 -0
- package/es/editor-kernel/inode/text-node.js +1 -0
- package/es/editor-kernel/kernel.d.ts +46 -0
- package/es/editor-kernel/kernel.js +273 -0
- package/es/editor-kernel/plugin.d.ts +7 -0
- package/es/editor-kernel/plugin.js +54 -0
- package/es/editor-kernel/react/LexicalErrorBoundary.d.ts +13 -0
- package/es/editor-kernel/react/LexicalErrorBoundary.js +26 -0
- package/es/editor-kernel/react/index.d.ts +5 -0
- package/es/editor-kernel/react/index.js +5 -0
- package/es/editor-kernel/react/react-context.d.ts +10 -0
- package/es/editor-kernel/react/react-context.js +25 -0
- package/es/editor-kernel/react/react-editor.d.ts +12 -0
- package/es/editor-kernel/react/react-editor.js +57 -0
- package/es/editor-kernel/react/useDecorators.d.ts +9 -0
- package/es/editor-kernel/react/useDecorators.js +69 -0
- package/es/editor-kernel/react/useLexicalEditor.d.ts +2 -0
- package/es/editor-kernel/react/useLexicalEditor.js +31 -0
- package/es/editor-kernel/react/useLexicalNodeSelection.d.ts +17 -0
- package/es/editor-kernel/react/useLexicalNodeSelection.js +99 -0
- package/es/editor-kernel/react/useToolbarState.d.ts +31 -0
- package/es/editor-kernel/react/useToolbarState.js +302 -0
- package/es/editor-kernel/react/useTranslation.d.ts +3 -0
- package/es/editor-kernel/react/useTranslation.js +19 -0
- package/es/editor-kernel/types.d.ts +189 -0
- package/es/editor-kernel/types.js +1 -0
- package/es/editor-kernel/utils.d.ts +25 -0
- package/es/editor-kernel/utils.js +69 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +14 -0
- package/es/locale/index.d.ts +25 -0
- package/es/locale/index.js +24 -0
- package/es/plugins/codeblock/command/index.d.ts +20 -0
- package/es/plugins/codeblock/command/index.js +84 -0
- package/es/plugins/codeblock/index.d.ts +4 -0
- package/es/plugins/codeblock/index.js +4 -0
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.d.ts +24 -0
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +680 -0
- package/es/plugins/codeblock/plugin/FacadeShiki.d.ts +51 -0
- package/es/plugins/codeblock/plugin/FacadeShiki.js +348 -0
- package/es/plugins/codeblock/plugin/index.d.ts +18 -0
- package/es/plugins/codeblock/plugin/index.js +90 -0
- package/es/plugins/codeblock/plugin/invariant.d.ts +8 -0
- package/es/plugins/codeblock/plugin/invariant.js +17 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.d.ts +4 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +51 -0
- package/es/plugins/codeblock/react/index.d.ts +2 -0
- package/es/plugins/codeblock/react/index.js +1 -0
- package/es/plugins/codeblock/react/style.d.ts +6 -0
- package/es/plugins/codeblock/react/style.js +38 -0
- package/es/plugins/codeblock/react/type.d.ts +5 -0
- package/es/plugins/codeblock/react/type.js +1 -0
- package/es/plugins/codeblock/utils/language.d.ts +1 -0
- package/es/plugins/codeblock/utils/language.js +12 -0
- package/es/plugins/common/command/index.d.ts +7 -0
- package/es/plugins/common/command/index.js +31 -0
- package/es/plugins/common/data-source/json-data-source.d.ts +7 -0
- package/es/plugins/common/data-source/json-data-source.js +39 -0
- package/es/plugins/common/data-source/text-data-source.d.ts +6 -0
- package/es/plugins/common/data-source/text-data-source.js +54 -0
- package/es/plugins/common/index.d.ts +3 -0
- package/es/plugins/common/index.js +3 -0
- package/es/plugins/common/node/ElementDOMSlot.d.ts +5 -0
- package/es/plugins/common/node/ElementDOMSlot.js +59 -0
- package/es/plugins/common/node/LexicalLineBreakNode.d.ts +31 -0
- package/es/plugins/common/node/LexicalLineBreakNode.js +140 -0
- package/es/plugins/common/node/ParagraphNode.d.ts +7 -0
- package/es/plugins/common/node/ParagraphNode.js +47 -0
- package/es/plugins/common/plugin/index.d.ts +16 -0
- package/es/plugins/common/plugin/index.js +245 -0
- package/es/plugins/common/plugin/register.d.ts +4 -0
- package/es/plugins/common/plugin/register.js +230 -0
- package/es/plugins/common/react/Placeholder/index.d.ts +7 -0
- package/es/plugins/common/react/Placeholder/index.js +53 -0
- package/es/plugins/common/react/Placeholder/style.d.ts +4 -0
- package/es/plugins/common/react/Placeholder/style.js +12 -0
- package/es/plugins/common/react/ReactEditorContent.d.ts +4 -0
- package/es/plugins/common/react/ReactEditorContent.js +7 -0
- package/es/plugins/common/react/ReactPlainText.d.ts +4 -0
- package/es/plugins/common/react/ReactPlainText.js +100 -0
- package/es/plugins/common/react/index.d.ts +3 -0
- package/es/plugins/common/react/index.js +3 -0
- package/es/plugins/common/react/style.d.ts +18 -0
- package/es/plugins/common/react/style.js +38 -0
- package/es/plugins/common/react/type.d.ts +21 -0
- package/es/plugins/common/react/type.js +1 -0
- package/es/plugins/common/utils/index.d.ts +28 -0
- package/es/plugins/common/utils/index.js +96 -0
- package/es/plugins/file/command/index.d.ts +7 -0
- package/es/plugins/file/command/index.js +28 -0
- package/es/plugins/file/index.d.ts +3 -0
- package/es/plugins/file/index.js +3 -0
- package/es/plugins/file/node/FileNode.d.ts +36 -0
- package/es/plugins/file/node/FileNode.js +177 -0
- package/es/plugins/file/plugin/index.d.ts +14 -0
- package/es/plugins/file/plugin/index.js +116 -0
- package/es/plugins/file/react/ReactFilePlugin.d.ts +4 -0
- package/es/plugins/file/react/ReactFilePlugin.js +74 -0
- package/es/plugins/file/react/components/ReactFile.d.ts +10 -0
- package/es/plugins/file/react/components/ReactFile.js +65 -0
- package/es/plugins/file/react/index.d.ts +2 -0
- package/es/plugins/file/react/index.js +1 -0
- package/es/plugins/file/react/style.d.ts +3 -0
- package/es/plugins/file/react/style.js +11 -0
- package/es/plugins/file/react/type.d.ts +13 -0
- package/es/plugins/file/react/type.js +1 -0
- package/es/plugins/file/utils/index.d.ts +2 -0
- package/es/plugins/file/utils/index.js +45 -0
- package/es/plugins/hr/command/index.d.ts +3 -0
- package/es/plugins/hr/command/index.js +13 -0
- package/es/plugins/hr/index.d.ts +3 -0
- package/es/plugins/hr/index.js +3 -0
- package/es/plugins/hr/node/HorizontalRuleNode.d.ts +16 -0
- package/es/plugins/hr/node/HorizontalRuleNode.js +100 -0
- package/es/plugins/hr/plugin/index.d.ts +8 -0
- package/es/plugins/hr/plugin/index.js +70 -0
- package/es/plugins/hr/react/ReactHRPlugin.d.ts +4 -0
- package/es/plugins/hr/react/ReactHRPlugin.js +36 -0
- package/es/plugins/hr/react/components/HRNode.d.ts +10 -0
- package/es/plugins/hr/react/components/HRNode.js +45 -0
- package/es/plugins/hr/react/index.d.ts +2 -0
- package/es/plugins/hr/react/index.js +1 -0
- package/es/plugins/hr/react/style.d.ts +1 -0
- package/es/plugins/hr/react/style.js +8 -0
- package/es/plugins/hr/react/type.d.ts +3 -0
- package/es/plugins/hr/react/type.js +1 -0
- package/es/plugins/image/command/index.d.ts +8 -0
- package/es/plugins/image/command/index.js +46 -0
- package/es/plugins/image/index.d.ts +3 -0
- package/es/plugins/image/index.js +3 -0
- package/es/plugins/image/node/basie-image-node.d.ts +44 -0
- package/es/plugins/image/node/basie-image-node.js +151 -0
- package/es/plugins/image/node/image-node.d.ts +26 -0
- package/es/plugins/image/node/image-node.js +176 -0
- package/es/plugins/image/plugin/index.d.ts +13 -0
- package/es/plugins/image/plugin/index.js +74 -0
- package/es/plugins/image/react/ReactImagePlugin.d.ts +4 -0
- package/es/plugins/image/react/ReactImagePlugin.js +48 -0
- package/es/plugins/image/react/components/BrokenImage.d.ts +3 -0
- package/es/plugins/image/react/components/BrokenImage.js +18 -0
- package/es/plugins/image/react/components/Image.d.ts +7 -0
- package/es/plugins/image/react/components/Image.js +71 -0
- package/es/plugins/image/react/components/LazyImage.d.ts +8 -0
- package/es/plugins/image/react/components/LazyImage.js +99 -0
- package/es/plugins/image/react/components/useSupenseImage.d.ts +2 -0
- package/es/plugins/image/react/components/useSupenseImage.js +24 -0
- package/es/plugins/image/react/index.d.ts +2 -0
- package/es/plugins/image/react/index.js +1 -0
- package/es/plugins/image/react/style.d.ts +12 -0
- package/es/plugins/image/react/style.js +17 -0
- package/es/plugins/image/react/type.d.ts +6 -0
- package/es/plugins/image/react/type.js +1 -0
- package/es/plugins/link/command/index.d.ts +6 -0
- package/es/plugins/link/command/index.js +20 -0
- package/es/plugins/link/index.d.ts +3 -0
- package/es/plugins/link/index.js +3 -0
- package/es/plugins/link/node/LinkNode.d.ts +126 -0
- package/es/plugins/link/node/LinkNode.js +721 -0
- package/es/plugins/link/plugin/index.d.ts +8 -0
- package/es/plugins/link/plugin/index.js +94 -0
- package/es/plugins/link/react/ReactLinkPlugin.d.ts +4 -0
- package/es/plugins/link/react/ReactLinkPlugin.js +168 -0
- package/es/plugins/link/react/components/LinkEdit.d.ts +7 -0
- package/es/plugins/link/react/components/LinkEdit.js +138 -0
- package/es/plugins/link/react/components/Toolbar.d.ts +7 -0
- package/es/plugins/link/react/components/Toolbar.js +63 -0
- package/es/plugins/link/react/index.d.ts +2 -0
- package/es/plugins/link/react/index.js +1 -0
- package/es/plugins/link/react/style.d.ts +5 -0
- package/es/plugins/link/react/style.js +12 -0
- package/es/plugins/link/react/type.d.ts +9 -0
- package/es/plugins/link/react/type.js +1 -0
- package/es/plugins/link/utils/index.d.ts +4 -0
- package/es/plugins/link/utils/index.js +37 -0
- package/es/plugins/list/command/index.d.ts +1 -0
- package/es/plugins/list/command/index.js +1 -0
- package/es/plugins/list/index.d.ts +3 -0
- package/es/plugins/list/index.js +3 -0
- package/es/plugins/list/plugin/index.d.ts +5 -0
- package/es/plugins/list/plugin/index.js +193 -0
- package/es/plugins/list/react/ReactListPlugin.d.ts +4 -0
- package/es/plugins/list/react/ReactListPlugin.js +29 -0
- package/es/plugins/list/react/index.d.ts +2 -0
- package/es/plugins/list/react/index.js +1 -0
- package/es/plugins/list/react/style.d.ts +1 -0
- package/es/plugins/list/react/style.js +7 -0
- package/es/plugins/list/react/type.d.ts +3 -0
- package/es/plugins/list/react/type.js +1 -0
- package/es/plugins/list/utils/index.d.ts +5 -0
- package/es/plugins/list/utils/index.js +88 -0
- package/es/plugins/markdown/data-source/markdown-data-source.d.ts +10 -0
- package/es/plugins/markdown/data-source/markdown-data-source.js +64 -0
- package/es/plugins/markdown/data-source/markdown-writer-context.d.ts +12 -0
- package/es/plugins/markdown/data-source/markdown-writer-context.js +51 -0
- package/es/plugins/markdown/index.d.ts +2 -0
- package/es/plugins/markdown/index.js +2 -0
- package/es/plugins/markdown/plugin/index.d.ts +4 -0
- package/es/plugins/markdown/plugin/index.js +122 -0
- package/es/plugins/markdown/service/shortcut.d.ts +139 -0
- package/es/plugins/markdown/service/shortcut.js +401 -0
- package/es/plugins/markdown/utils/index.d.ts +12 -0
- package/es/plugins/markdown/utils/index.js +61 -0
- package/es/plugins/mention/command/index.d.ts +6 -0
- package/es/plugins/mention/command/index.js +19 -0
- package/es/plugins/mention/index.d.ts +3 -0
- package/es/plugins/mention/index.js +3 -0
- package/es/plugins/mention/node/MentionNode.d.ts +26 -0
- package/es/plugins/mention/node/MentionNode.js +143 -0
- package/es/plugins/mention/plugin/index.d.ts +11 -0
- package/es/plugins/mention/plugin/index.js +61 -0
- package/es/plugins/mention/plugin/register.d.ts +2 -0
- package/es/plugins/mention/plugin/register.js +46 -0
- package/es/plugins/mention/react/ReactMentionPlugin.d.ts +4 -0
- package/es/plugins/mention/react/ReactMentionPlugin.js +42 -0
- package/es/plugins/mention/react/components/Mention.d.ts +9 -0
- package/es/plugins/mention/react/components/Mention.js +39 -0
- package/es/plugins/mention/react/index.d.ts +2 -0
- package/es/plugins/mention/react/index.js +1 -0
- package/es/plugins/mention/react/style.d.ts +3 -0
- package/es/plugins/mention/react/style.js +11 -0
- package/es/plugins/mention/react/type.d.ts +8 -0
- package/es/plugins/mention/react/type.js +1 -0
- package/es/plugins/slash/index.d.ts +3 -0
- package/es/plugins/slash/index.js +3 -0
- package/es/plugins/slash/plugin/index.d.ts +23 -0
- package/es/plugins/slash/plugin/index.js +132 -0
- package/es/plugins/slash/react/ReactSlashOption.d.ts +4 -0
- package/es/plugins/slash/react/ReactSlashOption.js +7 -0
- package/es/plugins/slash/react/ReactSlashPlugin.d.ts +4 -0
- package/es/plugins/slash/react/ReactSlashPlugin.js +228 -0
- package/es/plugins/slash/react/components/SlashMenu.d.ts +8 -0
- package/es/plugins/slash/react/components/SlashMenu.js +72 -0
- package/es/plugins/slash/react/index.d.ts +4 -0
- package/es/plugins/slash/react/index.js +3 -0
- package/es/plugins/slash/react/style.d.ts +1 -0
- package/es/plugins/slash/react/style.js +9 -0
- package/es/plugins/slash/react/type.d.ts +82 -0
- package/es/plugins/slash/react/type.js +1 -0
- package/es/plugins/slash/react/utils.d.ts +5 -0
- package/es/plugins/slash/react/utils.js +20 -0
- package/es/plugins/slash/service/i-slash-service.d.ts +38 -0
- package/es/plugins/slash/service/i-slash-service.js +64 -0
- package/es/plugins/slash/utils/utils.d.ts +38 -0
- package/es/plugins/slash/utils/utils.js +192 -0
- package/es/plugins/table/command/index.d.ts +13 -0
- package/es/plugins/table/command/index.js +73 -0
- package/es/plugins/table/index.d.ts +3 -0
- package/es/plugins/table/index.js +3 -0
- package/es/plugins/table/node/index.d.ts +2 -0
- package/es/plugins/table/node/index.js +16 -0
- package/es/plugins/table/plugin/index.d.ts +5 -0
- package/es/plugins/table/plugin/index.js +85 -0
- package/es/plugins/table/react/TableActionMenu/index.d.ts +8 -0
- package/es/plugins/table/react/TableActionMenu/index.js +481 -0
- package/es/plugins/table/react/TableActionMenu/style.d.ts +1 -0
- package/es/plugins/table/react/TableActionMenu/style.js +7 -0
- package/es/plugins/table/react/TableActionMenu/utils.d.ts +9 -0
- package/es/plugins/table/react/TableActionMenu/utils.js +49 -0
- package/es/plugins/table/react/TableHoverActions/index.d.ts +7 -0
- package/es/plugins/table/react/TableHoverActions/index.js +268 -0
- package/es/plugins/table/react/TableHoverActions/style.d.ts +5 -0
- package/es/plugins/table/react/TableHoverActions/style.js +11 -0
- package/es/plugins/table/react/TableHoverActions/utils.d.ts +8 -0
- package/es/plugins/table/react/TableHoverActions/utils.js +43 -0
- package/es/plugins/table/react/TableResize/index.d.ts +10 -0
- package/es/plugins/table/react/TableResize/index.js +378 -0
- package/es/plugins/table/react/TableResize/style.d.ts +3 -0
- package/es/plugins/table/react/TableResize/style.js +10 -0
- package/es/plugins/table/react/TableResize/utils.d.ts +4 -0
- package/es/plugins/table/react/TableResize/utils.js +40 -0
- package/es/plugins/table/react/hooks.d.ts +1 -0
- package/es/plugins/table/react/hooks.js +22 -0
- package/es/plugins/table/react/index.d.ts +3 -0
- package/es/plugins/table/react/index.js +77 -0
- package/es/plugins/table/react/style.d.ts +1 -0
- package/es/plugins/table/react/style.js +8 -0
- package/es/plugins/table/react/type.d.ts +5 -0
- package/es/plugins/table/react/type.js +1 -0
- package/es/plugins/table/utils/index.d.ts +8 -0
- package/es/plugins/table/utils/index.js +83 -0
- package/es/plugins/upload/index.d.ts +3 -0
- package/es/plugins/upload/index.js +3 -0
- package/es/plugins/upload/plugin/index.d.ts +4 -0
- package/es/plugins/upload/plugin/index.js +82 -0
- package/es/plugins/upload/service/i-upload-service.d.ts +15 -0
- package/es/plugins/upload/service/i-upload-service.js +115 -0
- package/es/plugins/upload/utils/index.d.ts +1 -0
- package/es/plugins/upload/utils/index.js +20 -0
- package/es/react/ChatInput/ChatInput.d.ts +4 -0
- package/es/react/ChatInput/ChatInput.js +41 -0
- package/es/react/ChatInput/index.d.ts +2 -0
- package/es/react/ChatInput/index.js +2 -0
- package/es/react/ChatInput/style.d.ts +4 -0
- package/es/react/ChatInput/style.js +11 -0
- package/es/react/ChatInput/type.d.ts +10 -0
- package/es/react/ChatInput/type.js +1 -0
- package/es/react/ChatInputActionBar/ChatInputActionBar.d.ts +4 -0
- package/es/react/ChatInputActionBar/ChatInputActionBar.js +27 -0
- package/es/react/ChatInputActionBar/index.d.ts +2 -0
- package/es/react/ChatInputActionBar/index.js +2 -0
- package/es/react/ChatInputActionBar/style.d.ts +3 -0
- package/es/react/ChatInputActionBar/style.js +9 -0
- package/es/react/ChatInputActionBar/type.d.ts +7 -0
- package/es/react/ChatInputActionBar/type.js +1 -0
- package/es/react/ChatInputActions/ChatInputActions.d.ts +4 -0
- package/es/react/ChatInputActions/ChatInputActions.js +187 -0
- package/es/react/ChatInputActions/components/ChatInputActionsCollapse.d.ts +4 -0
- package/es/react/ChatInputActions/components/ChatInputActionsCollapse.js +97 -0
- package/es/react/ChatInputActions/index.d.ts +2 -0
- package/es/react/ChatInputActions/index.js +1 -0
- package/es/react/ChatInputActions/style.d.ts +4 -0
- package/es/react/ChatInputActions/style.js +10 -0
- package/es/react/ChatInputActions/type.d.ts +38 -0
- package/es/react/ChatInputActions/type.js +1 -0
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +4 -0
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +96 -0
- package/es/react/CodeLanguageSelect/index.d.ts +2 -0
- package/es/react/CodeLanguageSelect/index.js +2 -0
- package/es/react/CodeLanguageSelect/style.d.ts +3 -0
- package/es/react/CodeLanguageSelect/style.js +9 -0
- package/es/react/CodeLanguageSelect/type.d.ts +2 -0
- package/es/react/CodeLanguageSelect/type.js +1 -0
- package/es/react/Editor/Editor.d.ts +4 -0
- package/es/react/Editor/Editor.js +78 -0
- package/es/react/Editor/index.d.ts +14 -0
- package/es/react/Editor/index.js +10 -0
- package/es/react/Editor/type.d.ts +24 -0
- package/es/react/Editor/type.js +1 -0
- package/es/react/Editor/useEditor.d.ts +3 -0
- package/es/react/Editor/useEditor.js +4 -0
- package/es/react/Editor/utils.d.ts +2 -0
- package/es/react/Editor/utils.js +3 -0
- package/es/react/EditorProvider/index.d.ts +20 -0
- package/es/react/EditorProvider/index.js +25 -0
- package/es/react/SendButton/SendButton.d.ts +4 -0
- package/es/react/SendButton/SendButton.js +77 -0
- package/es/react/SendButton/components/SendIcon.d.ts +6 -0
- package/es/react/SendButton/components/SendIcon.js +32 -0
- package/es/react/SendButton/components/StopIcon.d.ts +6 -0
- package/es/react/SendButton/components/StopIcon.js +61 -0
- package/es/react/SendButton/index.d.ts +2 -0
- package/es/react/SendButton/index.js +2 -0
- package/es/react/SendButton/style.d.ts +6 -0
- package/es/react/SendButton/style.js +15 -0
- package/es/react/SendButton/type.d.ts +6 -0
- package/es/react/SendButton/type.js +1 -0
- package/es/react/SlashMenu/SlashMenu.d.ts +4 -0
- package/es/react/SlashMenu/SlashMenu.js +68 -0
- package/es/react/SlashMenu/index.d.ts +2 -0
- package/es/react/SlashMenu/index.js +2 -0
- package/es/react/SlashMenu/style.d.ts +4 -0
- package/es/react/SlashMenu/style.js +11 -0
- package/es/react/SlashMenu/type.d.ts +8 -0
- package/es/react/SlashMenu/type.js +1 -0
- package/es/react/index.d.ts +8 -0
- package/es/react/index.js +8 -0
- package/es/types/global.d.ts +20 -0
- package/es/types/index.d.ts +2 -0
- package/es/types/index.js +2 -0
- package/es/types/kernel.d.ts +180 -0
- package/es/types/kernel.js +1 -0
- package/es/types/locale.d.ts +10 -0
- package/es/types/locale.js +1 -0
- package/package.json +66 -0
- package/patches/lexical+0.33.1.patch +88 -0
- package/react.d.ts +1 -0
- package/react.js +1 -0
- package/scripts/patch-lexical-package-json.js +20 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
type LocaleType = typeof import("../../locale").default;
|
|
3
|
+
export interface EditorProviderConfig {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
locale?: Partial<LocaleType>;
|
|
6
|
+
theme?: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
interface EditorContextValue {
|
|
9
|
+
config: EditorProviderConfig;
|
|
10
|
+
}
|
|
11
|
+
export interface EditorProviderProps {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
config?: EditorProviderConfig;
|
|
14
|
+
}
|
|
15
|
+
export declare const EditorProvider: {
|
|
16
|
+
({ children, config }: EditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const useEditorContent: () => EditorContextValue;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createContext, use, useMemo } from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
var EditorContext = /*#__PURE__*/createContext({
|
|
6
|
+
config: {}
|
|
7
|
+
});
|
|
8
|
+
export var EditorProvider = function EditorProvider(_ref) {
|
|
9
|
+
var children = _ref.children,
|
|
10
|
+
_ref$config = _ref.config,
|
|
11
|
+
config = _ref$config === void 0 ? {} : _ref$config;
|
|
12
|
+
var value = useMemo(function () {
|
|
13
|
+
return {
|
|
14
|
+
config: config
|
|
15
|
+
};
|
|
16
|
+
}, [config]);
|
|
17
|
+
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
|
18
|
+
value: value,
|
|
19
|
+
children: children
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export var useEditorContent = function useEditorContent() {
|
|
23
|
+
return use(EditorContext);
|
|
24
|
+
};
|
|
25
|
+
EditorProvider.displayName = 'EditorProvider';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["type", "menu", "className", "style", "loading", "generating", "size", "shape"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
+
import { Button, Icon } from '@lobehub/ui';
|
|
13
|
+
import { Dropdown } from 'antd';
|
|
14
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
15
|
+
import { memo } from 'react';
|
|
16
|
+
import SendIcon from "./components/SendIcon";
|
|
17
|
+
import StopIcon from "./components/StopIcon";
|
|
18
|
+
import { useStyles } from "./style";
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
var SendButton = /*#__PURE__*/memo(function (_ref) {
|
|
21
|
+
var _ref$type = _ref.type,
|
|
22
|
+
type = _ref$type === void 0 ? 'primary' : _ref$type,
|
|
23
|
+
menu = _ref.menu,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
style = _ref.style,
|
|
26
|
+
loading = _ref.loading,
|
|
27
|
+
generating = _ref.generating,
|
|
28
|
+
_ref$size = _ref.size,
|
|
29
|
+
size = _ref$size === void 0 ? 32 : _ref$size,
|
|
30
|
+
shape = _ref.shape,
|
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var _useStyles = useStyles(size),
|
|
33
|
+
cx = _useStyles.cx,
|
|
34
|
+
styles = _useStyles.styles;
|
|
35
|
+
if (generating) return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
36
|
+
className: cx(styles.loadingButton, className),
|
|
37
|
+
shape: shape,
|
|
38
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
39
|
+
width: menu ? size * 2 : size
|
|
40
|
+
})
|
|
41
|
+
}, rest), {}, {
|
|
42
|
+
children: /*#__PURE__*/_jsx(StopIcon, {
|
|
43
|
+
size: size * 0.75
|
|
44
|
+
})
|
|
45
|
+
}));
|
|
46
|
+
if (loading) return /*#__PURE__*/_jsx(Button, _objectSpread({
|
|
47
|
+
className: cx(styles.loadingButton, className),
|
|
48
|
+
disabled: true,
|
|
49
|
+
loading: loading,
|
|
50
|
+
shape: shape,
|
|
51
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
52
|
+
width: menu ? size * 2 : size
|
|
53
|
+
}),
|
|
54
|
+
type: type
|
|
55
|
+
}, rest));
|
|
56
|
+
if (!menu) return /*#__PURE__*/_jsx(Button, _objectSpread({
|
|
57
|
+
className: cx(styles.button, className),
|
|
58
|
+
icon: /*#__PURE__*/_jsx(SendIcon, {}),
|
|
59
|
+
shape: shape,
|
|
60
|
+
style: style,
|
|
61
|
+
type: type
|
|
62
|
+
}, rest));
|
|
63
|
+
return /*#__PURE__*/_jsx(Dropdown.Button, _objectSpread(_objectSpread({
|
|
64
|
+
className: cx(styles.dropdownButton, shape === 'round' && styles.dropdownButtonRound, className),
|
|
65
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
66
|
+
icon: ChevronDownIcon
|
|
67
|
+
}),
|
|
68
|
+
menu: menu,
|
|
69
|
+
placement: 'topRight',
|
|
70
|
+
style: style,
|
|
71
|
+
type: type
|
|
72
|
+
}, rest), {}, {
|
|
73
|
+
children: !loading && /*#__PURE__*/_jsx(SendIcon, {})
|
|
74
|
+
}));
|
|
75
|
+
});
|
|
76
|
+
SendButton.displayName = 'SendButton';
|
|
77
|
+
export default SendButton;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
import { memo } from 'react';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
var SendIcon = /*#__PURE__*/memo(function (_ref) {
|
|
12
|
+
var _ref$size = _ref.size,
|
|
13
|
+
size = _ref$size === void 0 ? '1em' : _ref$size,
|
|
14
|
+
style = _ref.style;
|
|
15
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
16
|
+
className: 'anticon',
|
|
17
|
+
fill: "currentColor",
|
|
18
|
+
fillRule: "evenodd",
|
|
19
|
+
height: size,
|
|
20
|
+
style: _objectSpread({
|
|
21
|
+
flex: 'none',
|
|
22
|
+
lineHeight: 1
|
|
23
|
+
}, style),
|
|
24
|
+
viewBox: "0 0 14 14",
|
|
25
|
+
width: size,
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
28
|
+
d: "M.743 3.773c-.818-.555-.422-1.834.567-1.828l11.496.074a1 1 0 01.837 1.538l-6.189 9.689c-.532.833-1.822.47-1.842-.518L5.525 8.51a1 1 0 01.522-.9l1.263-.686a.808.808 0 00-.772-1.42l-1.263.686a1 1 0 01-1.039-.051L.743 3.773z"
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
export default SendIcon;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { useTheme } from 'antd-style';
|
|
8
|
+
import { memo } from 'react';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var StopIcon = /*#__PURE__*/memo(function (_ref) {
|
|
12
|
+
var _ref$size = _ref.size,
|
|
13
|
+
size = _ref$size === void 0 ? '1.5em' : _ref$size,
|
|
14
|
+
style = _ref.style;
|
|
15
|
+
var theme = useTheme();
|
|
16
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
17
|
+
className: 'anticon',
|
|
18
|
+
color: "currentColor",
|
|
19
|
+
height: size,
|
|
20
|
+
style: _objectSpread({
|
|
21
|
+
flex: 'none',
|
|
22
|
+
lineHeight: 1
|
|
23
|
+
}, style),
|
|
24
|
+
viewBox: "0 0 1024 1024",
|
|
25
|
+
width: size,
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
children: /*#__PURE__*/_jsxs("g", {
|
|
28
|
+
fill: "none",
|
|
29
|
+
children: [/*#__PURE__*/_jsx("circle", {
|
|
30
|
+
cx: "512",
|
|
31
|
+
cy: "512",
|
|
32
|
+
fill: "none",
|
|
33
|
+
r: "426",
|
|
34
|
+
stroke: theme.colorBorder,
|
|
35
|
+
strokeWidth: "72"
|
|
36
|
+
}), /*#__PURE__*/_jsx("rect", {
|
|
37
|
+
fill: "currentColor",
|
|
38
|
+
height: "252",
|
|
39
|
+
rx: "24",
|
|
40
|
+
ry: "24",
|
|
41
|
+
width: "252",
|
|
42
|
+
x: "386",
|
|
43
|
+
y: "386"
|
|
44
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
45
|
+
d: "M938.667 512C938.667 276.359 747.64 85.333 512 85.333",
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeWidth: "73",
|
|
49
|
+
children: /*#__PURE__*/_jsx("animateTransform", {
|
|
50
|
+
attributeName: "transform",
|
|
51
|
+
dur: "1s",
|
|
52
|
+
from: "0 512 512",
|
|
53
|
+
repeatCount: "indefinite",
|
|
54
|
+
to: "360 512 512",
|
|
55
|
+
type: "rotate"
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
export default StopIcon;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const useStyles: (props?: number | undefined) => import("antd-style").ReturnStyles<{
|
|
2
|
+
button: import("antd-style").SerializedStyles;
|
|
3
|
+
dropdownButton: import("antd-style").SerializedStyles;
|
|
4
|
+
dropdownButtonRound: import("antd-style").SerializedStyles;
|
|
5
|
+
loadingButton: import("antd-style").SerializedStyles;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
import { rgba } from 'polished';
|
|
5
|
+
export var useStyles = createStyles(function (_ref, size) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
token = _ref.token,
|
|
8
|
+
prefixCls = _ref.prefixCls;
|
|
9
|
+
return {
|
|
10
|
+
button: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", "-btn {\n flex: none;\n width: ", "px !important;\n height: ", "px;\n padding-inline: 0 !important;\n }\n "])), prefixCls, size, size),
|
|
11
|
+
dropdownButton: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: none;\n width: fit-content;\n .", "-btn {\n width: ", "px;\n height: ", "px;\n }\n .", "-dropdown-trigger {\n width: ", "px;\n &.", "-btn-primary {\n &::before {\n background-color: ", " !important;\n }\n }\n }\n "])), prefixCls, size * 1.2, size, prefixCls, size * 0.8, prefixCls, rgba(token.colorBgLayout, 0.1)),
|
|
12
|
+
dropdownButtonRound: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-btn-compact-first-item {\n border-start-start-radius: ", "px;\n border-end-start-radius: ", "px;\n }\n .", "-dropdown-trigger {\n width: ", "px;\n border-start-end-radius: ", "px;\n border-end-end-radius: ", "px;\n }\n "])), prefixCls, size / 2, size / 2, prefixCls, size, size / 2, size / 2),
|
|
13
|
+
loadingButton: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n &.", "-btn {\n flex: none;\n height: ", "px;\n padding-inline: 0 !important;\n }\n "])), prefixCls, size)
|
|
14
|
+
};
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
import { Block, Menu } from '@lobehub/ui';
|
|
10
|
+
import { memo, useCallback } from 'react';
|
|
11
|
+
import { createPortal } from 'react-dom';
|
|
12
|
+
import { Flexbox } from 'react-layout-kit';
|
|
13
|
+
import { useStyles } from "./style";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
var SlashMenu = /*#__PURE__*/memo(function (_ref) {
|
|
16
|
+
var className = _ref.className,
|
|
17
|
+
style = _ref.style,
|
|
18
|
+
getPopupContainer = _ref.getPopupContainer,
|
|
19
|
+
open = _ref.open,
|
|
20
|
+
options = _ref.options,
|
|
21
|
+
activeKey = _ref.activeKey,
|
|
22
|
+
loading = _ref.loading,
|
|
23
|
+
_ref$maxHeight = _ref.maxHeight,
|
|
24
|
+
maxHeight = _ref$maxHeight === void 0 ? 'min(50vh, 640px)' : _ref$maxHeight,
|
|
25
|
+
onSelect = _ref.onSelect;
|
|
26
|
+
var _useStyles = useStyles(),
|
|
27
|
+
cx = _useStyles.cx,
|
|
28
|
+
styles = _useStyles.styles;
|
|
29
|
+
var parent = getPopupContainer();
|
|
30
|
+
var handleMenuClick = useCallback(function (_ref2) {
|
|
31
|
+
var key = _ref2.key;
|
|
32
|
+
if (!onSelect) return;
|
|
33
|
+
var option = options.find(function (item) {
|
|
34
|
+
return 'key' in item && item.key === key;
|
|
35
|
+
});
|
|
36
|
+
if (option) onSelect === null || onSelect === void 0 || onSelect(option);
|
|
37
|
+
}, [options, onSelect]);
|
|
38
|
+
if (!parent) return;
|
|
39
|
+
if (!open) return;
|
|
40
|
+
var node = /*#__PURE__*/_jsx(Flexbox, {
|
|
41
|
+
className: styles.root,
|
|
42
|
+
paddingInline: 8,
|
|
43
|
+
width: '100%',
|
|
44
|
+
children: /*#__PURE__*/_jsx(Block, {
|
|
45
|
+
className: cx(styles.container, className),
|
|
46
|
+
gap: 4,
|
|
47
|
+
horizontal: true,
|
|
48
|
+
shadow: true,
|
|
49
|
+
style: _objectSpread({
|
|
50
|
+
maxHeight: maxHeight
|
|
51
|
+
}, style),
|
|
52
|
+
variant: 'outlined',
|
|
53
|
+
children: /*#__PURE__*/_jsx(Menu, {
|
|
54
|
+
items: loading ? [{
|
|
55
|
+
disabled: true,
|
|
56
|
+
key: 'loading',
|
|
57
|
+
label: 'Loading...'
|
|
58
|
+
}] : options,
|
|
59
|
+
mode: 'inline',
|
|
60
|
+
onClick: handleMenuClick,
|
|
61
|
+
selectedKeys: activeKey ? [activeKey] : undefined
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
return /*#__PURE__*/createPortal(node, parent);
|
|
66
|
+
});
|
|
67
|
+
SlashMenu.displayName = 'SlashMenu';
|
|
68
|
+
export default SlashMenu;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
7
|
+
return {
|
|
8
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden auto;\n background: ", ";\n "])), token.colorBgElevated),
|
|
9
|
+
root: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n inset-block-start: -8px;\n inset-inline-start: 0;\n transform: translateY(-100%);\n "])))
|
|
10
|
+
};
|
|
11
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { MenuRenderProps } from "../../plugins/slash";
|
|
3
|
+
export interface SlashMenuProps extends MenuRenderProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
getPopupContainer: () => HTMLDivElement | null;
|
|
6
|
+
maxHeight?: string | number;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as ChatInput, type ChatInputProps } from './ChatInput';
|
|
2
|
+
export { default as ChatInputActionBar, type ChatInputActionBarProps } from './ChatInputActionBar';
|
|
3
|
+
export { type ChatInputActionEvent, default as ChatInputActions, type ChatInputActionsProps, } from './ChatInputActions';
|
|
4
|
+
export { default as CodeLanguageSelect, type CodeLanguageSelectProps } from './CodeLanguageSelect';
|
|
5
|
+
export { default as Editor, type EditorProps, useEditor, withProps } from './Editor';
|
|
6
|
+
export { EditorProvider, type EditorProviderConfig, type EditorProviderProps, useEditorContent, } from './EditorProvider';
|
|
7
|
+
export { default as SendButton, type SendButtonProps } from './SendButton';
|
|
8
|
+
export { default as SlashMenu, type SlashMenuProps } from './SlashMenu';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as ChatInput } from "./ChatInput";
|
|
2
|
+
export { default as ChatInputActionBar } from "./ChatInputActionBar";
|
|
3
|
+
export { default as ChatInputActions } from "./ChatInputActions";
|
|
4
|
+
export { default as CodeLanguageSelect } from "./CodeLanguageSelect";
|
|
5
|
+
export { default as Editor, useEditor, withProps } from "./Editor";
|
|
6
|
+
export { EditorProvider, useEditorContent } from "./EditorProvider";
|
|
7
|
+
export { default as SendButton } from "./SendButton";
|
|
8
|
+
export { default as SlashMenu } from "./SlashMenu";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LobeCustomStylish, LobeCustomToken } from '@lobehub/ui';
|
|
2
|
+
import 'antd-style';
|
|
3
|
+
import 'lexical/LexicalEditor';
|
|
4
|
+
|
|
5
|
+
declare module 'antd-style' {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
7
|
+
export interface CustomToken extends LobeCustomToken {}
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
9
|
+
export interface CustomStylish extends LobeCustomStylish {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module '*.png' {
|
|
13
|
+
const content: any;
|
|
14
|
+
export default content;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module '*.svg' {
|
|
18
|
+
const content: any;
|
|
19
|
+
export default content;
|
|
20
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { CommandPayloadType, DecoratorNode, LexicalCommand, LexicalEditor, LexicalNodeConfig } from 'lexical';
|
|
2
|
+
import type DataSource from "../editor-kernel/data-source";
|
|
3
|
+
import { ILocaleKeys } from './locale';
|
|
4
|
+
/**
|
|
5
|
+
* Service ID type
|
|
6
|
+
*/
|
|
7
|
+
export type IServiceID<Service> = {
|
|
8
|
+
readonly __serviceId: string;
|
|
9
|
+
__serviceType?: Service;
|
|
10
|
+
};
|
|
11
|
+
export interface IKernelEventMap {
|
|
12
|
+
/**
|
|
13
|
+
* Editor error event
|
|
14
|
+
*/
|
|
15
|
+
error: (error: Error) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Initialization event
|
|
18
|
+
* @param editor Lexical editor instance
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
initialized: (editor: LexicalEditor) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* External API
|
|
25
|
+
*/
|
|
26
|
+
export interface IEditor {
|
|
27
|
+
/**
|
|
28
|
+
* Lose focus
|
|
29
|
+
*/
|
|
30
|
+
blur(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Destroy editor instance
|
|
33
|
+
*/
|
|
34
|
+
destroy(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Execute editor commands to manipulate editor content
|
|
37
|
+
* @param type
|
|
38
|
+
* @param payload
|
|
39
|
+
*/
|
|
40
|
+
dispatchCommand<TCommand extends LexicalCommand<unknown>>(type: TCommand, payload: CommandPayloadType<TCommand>): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Focus editor
|
|
43
|
+
*/
|
|
44
|
+
focus(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get editor content of specified type
|
|
47
|
+
*/
|
|
48
|
+
getDocument(type: string): DataSource | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Get Lexical editor instance
|
|
51
|
+
*/
|
|
52
|
+
getLexicalEditor(): LexicalEditor | null;
|
|
53
|
+
/**
|
|
54
|
+
* Get document editor root node
|
|
55
|
+
*/
|
|
56
|
+
getRootElement(): HTMLElement | null;
|
|
57
|
+
/**
|
|
58
|
+
* Get editor theme
|
|
59
|
+
*/
|
|
60
|
+
getTheme(): Record<string, string | Record<string, string>>;
|
|
61
|
+
/**
|
|
62
|
+
* Remove editor event listener
|
|
63
|
+
* @param event
|
|
64
|
+
* @param listener
|
|
65
|
+
*/
|
|
66
|
+
off<T extends keyof IKernelEventMap>(event: T, listener: IKernelEventMap[T]): this;
|
|
67
|
+
/**
|
|
68
|
+
* Add editor event listener
|
|
69
|
+
* @param event
|
|
70
|
+
* @param listener
|
|
71
|
+
*/
|
|
72
|
+
on<T extends keyof IKernelEventMap>(event: T, listener: IKernelEventMap[T]): this;
|
|
73
|
+
/**
|
|
74
|
+
* Listen to event once, automatically remove listener after trigger
|
|
75
|
+
* @param event
|
|
76
|
+
* @param listener
|
|
77
|
+
*/
|
|
78
|
+
once<T extends keyof IKernelEventMap>(event: T, listener: IKernelEventMap[T]): this;
|
|
79
|
+
/**
|
|
80
|
+
* Register internationalization text
|
|
81
|
+
* @param locale Internationalization text object
|
|
82
|
+
*/
|
|
83
|
+
registerLocale(locale: Partial<Record<keyof ILocaleKeys, string>>): void;
|
|
84
|
+
/**
|
|
85
|
+
* Register editor plugin
|
|
86
|
+
*/
|
|
87
|
+
registerPlugin<T>(plugin: IEditorPluginConstructor<T>, config?: T): IEditor;
|
|
88
|
+
/**
|
|
89
|
+
* Register multiple editor plugins
|
|
90
|
+
*/
|
|
91
|
+
registerPlugins(plugins: Array<IPlugin>): IEditor;
|
|
92
|
+
/**
|
|
93
|
+
* Get editor Service, usually provided by plugins to extend certain functionalities
|
|
94
|
+
* @param serviceId
|
|
95
|
+
*/
|
|
96
|
+
requireService<T>(serviceId: IServiceID<T>): T | null;
|
|
97
|
+
/**
|
|
98
|
+
* Set editor content, type is content type, content is content data
|
|
99
|
+
* @param type
|
|
100
|
+
* @param content
|
|
101
|
+
*/
|
|
102
|
+
setDocument(type: string, content: any): void;
|
|
103
|
+
/**
|
|
104
|
+
* Set document editor root node
|
|
105
|
+
* @param dom
|
|
106
|
+
*/
|
|
107
|
+
setRootElement(dom: HTMLElement): LexicalEditor;
|
|
108
|
+
/**
|
|
109
|
+
* Get translation text
|
|
110
|
+
* @param key Translation key
|
|
111
|
+
* @param params Parameter replacement
|
|
112
|
+
*/
|
|
113
|
+
t<K extends keyof ILocaleKeys>(key: K, params?: Record<string, any>): string;
|
|
114
|
+
/**
|
|
115
|
+
* Update editor theme
|
|
116
|
+
* @param key
|
|
117
|
+
* @param value
|
|
118
|
+
*/
|
|
119
|
+
updateTheme(key: string, value: string | Record<string, string>): void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* API provided to plugins
|
|
123
|
+
*/
|
|
124
|
+
export interface IEditorKernel extends IEditor {
|
|
125
|
+
/**
|
|
126
|
+
* Get editor Node decorator for specific Node rendering
|
|
127
|
+
* @param name
|
|
128
|
+
*/
|
|
129
|
+
getDecorator(name: string): ((_node: DecoratorNode<any>, _editor: LexicalEditor) => any) | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Register data source for multi-format data conversion
|
|
132
|
+
* @param dataSource
|
|
133
|
+
*/
|
|
134
|
+
registerDataSource(dataSource: DataSource): void;
|
|
135
|
+
/**
|
|
136
|
+
* Register editor node decorator
|
|
137
|
+
* @param name
|
|
138
|
+
* @param decorator
|
|
139
|
+
*/
|
|
140
|
+
registerDecorator(name: string, decorator: (_node: DecoratorNode<any>, _editor: LexicalEditor) => any): void;
|
|
141
|
+
/**
|
|
142
|
+
* Register Lexical Node
|
|
143
|
+
* @param nodes
|
|
144
|
+
*/
|
|
145
|
+
registerNodes(nodes: Array<LexicalNodeConfig>): void;
|
|
146
|
+
/**
|
|
147
|
+
* Register service
|
|
148
|
+
* @param serviceId
|
|
149
|
+
* @param service
|
|
150
|
+
*/
|
|
151
|
+
registerService<T>(serviceId: IServiceID<T>, service: T): void;
|
|
152
|
+
/**
|
|
153
|
+
* Register theme
|
|
154
|
+
* @param themes
|
|
155
|
+
*/
|
|
156
|
+
registerThemes(themes: Record<string, any>): void;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Plugin interface
|
|
160
|
+
*/
|
|
161
|
+
export interface IEditorPlugin<IConfig> {
|
|
162
|
+
config?: IConfig;
|
|
163
|
+
/**
|
|
164
|
+
* Editor destruction
|
|
165
|
+
*/
|
|
166
|
+
destroy(): void;
|
|
167
|
+
/**
|
|
168
|
+
* After Lexical editor instantiation
|
|
169
|
+
* @param editor Lexical editor instance
|
|
170
|
+
*/
|
|
171
|
+
onInit?(editor: LexicalEditor): void;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Plugin class interface
|
|
175
|
+
*/
|
|
176
|
+
export interface IEditorPluginConstructor<IConfig> {
|
|
177
|
+
readonly pluginName: string;
|
|
178
|
+
new (kernel: IEditorKernel, config?: IConfig): IEditorPlugin<IConfig>;
|
|
179
|
+
}
|
|
180
|
+
export type IPlugin<T = any> = IEditorPluginConstructor<T> | [IEditorPluginConstructor<T>, T?];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|