@lobehub/editor 4.15.0 → 4.15.2
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/es/_virtual/_rolldown/runtime.js +28 -0
- package/es/codemirror/components/CopyButton.d.ts +7 -0
- package/es/codemirror/components/CopyButton.js +24 -0
- package/es/codemirror/components/LanguageSelect.d.ts +7 -0
- package/es/codemirror/components/LanguageSelect.js +59 -0
- package/es/codemirror/components/MoreOptions.d.ts +7 -0
- package/es/codemirror/components/MoreOptions.js +66 -0
- package/es/codemirror/components/Toolbar.d.ts +7 -0
- package/es/codemirror/components/Toolbar.js +51 -0
- package/es/codemirror/components/style.js +7 -0
- package/es/codemirror/constants.d.ts +6 -0
- package/es/codemirror/constants.js +512 -0
- package/es/codemirror/loader.d.ts +61 -0
- package/es/codemirror/loader.js +77 -0
- package/es/codemirror/style.d.ts +4 -0
- package/es/codemirror/style.js +82 -0
- package/es/codemirror/theme.d.ts +132 -0
- package/es/codemirror/theme.js +75 -0
- package/es/codemirror/types.d.ts +53 -0
- package/es/codemirror.d.ts +9 -263
- package/es/codemirror.js +8 -1
- package/es/common/canUseDOM.js +11 -0
- package/es/common/sys.js +27 -0
- package/es/const/hotkey.js +100 -0
- package/es/editor-kernel/data-source.d.ts +15 -0
- package/es/editor-kernel/data-source.js +15 -0
- package/es/editor-kernel/event.d.ts +7 -0
- package/es/editor-kernel/event.js +19 -0
- package/es/editor-kernel/index.d.ts +5 -0
- package/es/editor-kernel/index.js +17 -0
- package/es/editor-kernel/inode/helper.js +87 -0
- package/es/editor-kernel/inode/i-element-node.d.ts +6 -0
- package/es/editor-kernel/inode/i-node.d.ts +6 -0
- package/es/editor-kernel/inode/index.d.ts +4 -0
- package/es/editor-kernel/inode/paragraph-node.d.ts +1 -0
- package/es/editor-kernel/inode/root-node.d.ts +9 -0
- package/es/editor-kernel/inode/text-node.d.ts +9 -0
- package/es/editor-kernel/kernel.d.ts +122 -0
- package/es/editor-kernel/kernel.js +661 -0
- package/es/editor-kernel/plugin.js +59 -0
- package/es/editor-kernel/react/LexicalErrorBoundary.d.ts +13 -0
- package/es/editor-kernel/react/LexicalErrorBoundary.js +19 -0
- package/es/editor-kernel/react/PortalAnchor.js +12 -0
- package/es/editor-kernel/react/PortalContainer.d.ts +14 -0
- package/es/editor-kernel/react/PortalContainer.js +25 -0
- package/es/editor-kernel/react/index.d.ts +5 -0
- package/es/editor-kernel/react/react-context.d.ts +11 -0
- package/es/editor-kernel/react/react-context.js +21 -0
- package/es/editor-kernel/react/react-editor.d.ts +16 -0
- package/es/editor-kernel/react/react-editor.js +32 -0
- package/es/editor-kernel/react/useAnchor.js +17 -0
- package/es/editor-kernel/react/useDecorators.js +54 -0
- package/es/editor-kernel/react/useEditable.js +25 -0
- package/es/editor-kernel/react/useLexicalEditor.d.ts +6 -0
- package/es/editor-kernel/react/useLexicalEditor.js +23 -0
- package/es/editor-kernel/react/useLexicalNodeSelection.js +86 -0
- package/es/editor-kernel/react/useTranslation.js +9 -0
- package/es/editor-kernel/utils.d.ts +46 -0
- package/es/editor-kernel/utils.js +138 -0
- package/es/headless/extract-media-from-editor-state.d.ts +22 -0
- package/es/headless/extract-media-from-editor-state.js +49 -0
- package/es/headless/index.d.ts +69 -0
- package/es/headless/index.js +189 -0
- package/es/headless/plugins/codeblock.js +82 -0
- package/es/headless.d.ts +20 -1
- package/es/headless.js +219 -20307
- package/es/index.d.ts +112 -3059
- package/es/index.js +100 -8484
- package/es/locale/index.d.ts +61 -0
- package/es/locale/index.js +62 -0
- package/es/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +953 -0
- package/es/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +83 -0
- package/es/plugins/auto-complete/index.d.ts +2 -0
- package/es/plugins/auto-complete/node/placeholderNode.js +89 -0
- package/es/plugins/auto-complete/plugin/index.d.ts +31 -0
- package/es/plugins/auto-complete/plugin/index.js +395 -0
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.d.ts +7 -0
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.js +60 -0
- package/es/plugins/auto-complete/react/index.d.ts +1 -0
- package/es/plugins/auto-complete/react/style.js +12 -0
- package/es/plugins/auto-complete/react/type.d.ts +25 -0
- package/es/plugins/block/command/index.d.ts +13 -0
- package/es/plugins/block/command/index.js +161 -0
- package/es/plugins/block/index.d.ts +5 -0
- package/es/plugins/block/plugin/index.d.ts +9 -0
- package/es/plugins/block/plugin/index.js +86 -0
- package/es/plugins/block/react/ReactBlockPlugin.d.ts +18 -0
- package/es/plugins/block/react/ReactBlockPlugin.js +457 -0
- package/es/plugins/block/react/core/runtime-context.js +19 -0
- package/es/plugins/block/react/core/types.d.ts +6 -0
- package/es/plugins/block/react/drag/drag-session.js +264 -0
- package/es/plugins/block/react/drag/drag-utils.js +95 -0
- package/es/plugins/block/react/index.d.ts +2 -0
- package/es/plugins/block/react/style.js +66 -0
- package/es/plugins/block/service/i-block-menu-service.d.ts +44 -0
- package/es/plugins/block/service/i-block-menu-service.js +43 -0
- package/es/plugins/block/service/index.d.ts +1 -0
- package/es/plugins/code/command/index.d.ts +7 -0
- package/es/plugins/code/command/index.js +30 -0
- package/es/plugins/code/index.d.ts +3 -0
- package/es/plugins/code/node/code.js +91 -0
- package/es/plugins/code/plugin/index.d.ts +9 -0
- package/es/plugins/code/plugin/index.js +74 -0
- package/es/plugins/code/plugin/registry.js +33 -0
- package/es/plugins/code/react/CodeReactPlugin.d.ts +7 -0
- package/es/plugins/code/react/CodeReactPlugin.js +27 -0
- package/es/plugins/code/react/index.d.ts +1 -0
- package/es/plugins/code/react/style.js +21 -0
- package/es/plugins/code/react/type.d.ts +7 -0
- package/es/plugins/codeblock/command/index.d.ts +8 -0
- package/es/plugins/codeblock/command/index.js +40 -0
- package/es/plugins/codeblock/index.d.ts +6 -0
- package/es/plugins/codeblock/index.js +5 -0
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +415 -0
- package/es/plugins/codeblock/plugin/FacadeShiki.js +193 -0
- package/es/plugins/codeblock/plugin/index.d.ts +16 -0
- package/es/plugins/codeblock/plugin/index.js +157 -0
- package/es/plugins/codeblock/plugin/invariant.js +14 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.d.ts +7 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +27 -0
- package/es/plugins/codeblock/react/index.d.ts +2 -0
- package/es/plugins/codeblock/react/style.js +58 -0
- package/es/plugins/codeblock/react/type.d.ts +8 -0
- package/es/plugins/codeblock/utils/language.js +9 -0
- package/es/plugins/codemirror-block/command/index.d.ts +13 -0
- package/es/plugins/codemirror-block/command/index.js +67 -0
- package/es/plugins/codemirror-block/index.d.ts +3 -0
- package/es/plugins/codemirror-block/lib/mode.js +8 -0
- package/es/plugins/codemirror-block/node/CodeMirrorNode.d.ts +48 -0
- package/es/plugins/codemirror-block/node/CodeMirrorNode.js +205 -0
- package/es/plugins/codemirror-block/plugin/index.d.ts +12 -0
- package/es/plugins/codemirror-block/plugin/index.js +80 -0
- package/es/plugins/codemirror-block/react/CodemirrorNode.js +219 -0
- package/es/plugins/codemirror-block/react/ReactCodemirrorNode.d.ts +7 -0
- package/es/plugins/codemirror-block/react/ReactCodemirrorNode.js +26 -0
- package/es/plugins/codemirror-block/react/index.d.ts +1 -0
- package/es/plugins/codemirror-block/react/type.d.ts +6 -0
- package/es/plugins/common/command/index.d.ts +11 -0
- package/es/plugins/common/command/index.js +24 -0
- package/es/plugins/common/data-source/json-data-source.js +133 -0
- package/es/plugins/common/data-source/text-data-source.js +32 -0
- package/es/plugins/common/index.d.ts +6 -0
- package/es/plugins/common/node/ElementDOMSlot.js +30 -0
- package/es/plugins/common/node/cursor.d.ts +16 -0
- package/es/plugins/common/node/cursor.js +189 -0
- package/es/plugins/common/plugin/index.d.ts +43 -0
- package/es/plugins/common/plugin/index.js +338 -0
- package/es/plugins/common/plugin/mdReader.js +62 -0
- package/es/plugins/common/plugin/paste-handler.d.ts +11 -0
- package/es/plugins/common/plugin/paste-handler.js +61 -0
- package/es/plugins/common/plugin/register.js +306 -0
- package/es/plugins/common/react/Placeholder/index.js +65 -0
- package/es/plugins/common/react/Placeholder/style.js +22 -0
- package/es/plugins/common/react/ReactEditorContent.d.ts +7 -0
- package/es/plugins/common/react/ReactEditorContent.js +8 -0
- package/es/plugins/common/react/ReactPlainText.d.ts +7 -0
- package/es/plugins/common/react/ReactPlainText.js +192 -0
- package/es/plugins/common/react/index.d.ts +3 -0
- package/es/plugins/common/react/style.js +206 -0
- package/es/plugins/common/react/type.d.ts +94 -0
- package/es/plugins/common/utils/index.js +135 -0
- package/es/plugins/content-blocks/data-source/content-blocks-data-source.d.ts +15 -0
- package/es/plugins/content-blocks/data-source/content-blocks-data-source.js +21 -0
- package/es/plugins/content-blocks/index.d.ts +6 -0
- package/es/plugins/content-blocks/plugin/index.d.ts +10 -0
- package/es/plugins/content-blocks/plugin/index.js +24 -0
- package/es/plugins/content-blocks/types.d.ts +33 -0
- package/es/plugins/content-blocks/types.js +4 -0
- package/es/plugins/content-blocks/utils/extract-media-lists.d.ts +7 -0
- package/es/plugins/content-blocks/utils/extract-media-lists.js +32 -0
- package/es/plugins/content-blocks/utils/extract.d.ts +8 -0
- package/es/plugins/content-blocks/utils/extract.js +188 -0
- package/es/plugins/file/command/index.d.ts +9 -0
- package/es/plugins/file/command/index.js +31 -0
- package/es/plugins/file/index.d.ts +4 -0
- package/es/plugins/file/node/FileNode.d.ts +38 -0
- package/es/plugins/file/node/FileNode.js +106 -0
- package/es/plugins/file/plugin/index.d.ts +18 -0
- package/es/plugins/file/plugin/index.js +103 -0
- package/es/plugins/file/react/ReactFilePlugin.d.ts +7 -0
- package/es/plugins/file/react/ReactFilePlugin.js +35 -0
- package/es/plugins/file/react/components/ReactFile.js +50 -0
- package/es/plugins/file/react/index.d.ts +2 -0
- package/es/plugins/file/react/style.js +32 -0
- package/es/plugins/file/react/type.d.ts +17 -0
- package/es/plugins/file/utils/index.js +29 -0
- package/es/plugins/hr/command/index.d.ts +7 -0
- package/es/plugins/hr/command/index.js +14 -0
- package/es/plugins/hr/index.d.ts +4 -0
- package/es/plugins/hr/node/HorizontalRuleNode.d.ts +18 -0
- package/es/plugins/hr/node/HorizontalRuleNode.js +59 -0
- package/es/plugins/hr/plugin/index.d.ts +12 -0
- package/es/plugins/hr/plugin/index.js +60 -0
- package/es/plugins/hr/react/ReactHRPlugin.d.ts +7 -0
- package/es/plugins/hr/react/ReactHRPlugin.js +28 -0
- package/es/plugins/hr/react/components/HRNode.js +36 -0
- package/es/plugins/hr/react/index.d.ts +2 -0
- package/es/plugins/hr/react/style.js +32 -0
- package/es/plugins/hr/react/type.d.ts +6 -0
- package/es/plugins/image/command/index.d.ts +12 -0
- package/es/plugins/image/command/index.js +53 -0
- package/es/plugins/image/index.d.ts +4 -0
- package/es/plugins/image/node/basie-image-node.d.ts +33 -0
- package/es/plugins/image/node/basie-image-node.js +68 -0
- package/es/plugins/image/node/block-image-node.d.ts +43 -0
- package/es/plugins/image/node/block-image-node.js +137 -0
- package/es/plugins/image/node/image-node.d.ts +41 -0
- package/es/plugins/image/node/image-node.js +128 -0
- package/es/plugins/image/plugin/index.d.ts +24 -0
- package/es/plugins/image/plugin/index.js +183 -0
- package/es/plugins/image/react/ReactImagePlugin.d.ts +7 -0
- package/es/plugins/image/react/ReactImagePlugin.js +41 -0
- package/es/plugins/image/react/components/BrokenImage.js +16 -0
- package/es/plugins/image/react/components/Image.js +190 -0
- package/es/plugins/image/react/components/ImageEditPopover.js +160 -0
- package/es/plugins/image/react/components/LazyImage.js +73 -0
- package/es/plugins/image/react/components/ResizeHandle.js +62 -0
- package/es/plugins/image/react/components/style.js +135 -0
- package/es/plugins/image/react/components/useSupenseImage.js +22 -0
- package/es/plugins/image/react/index.d.ts +2 -0
- package/es/plugins/image/react/style.js +31 -0
- package/es/plugins/image/react/type.d.ts +23 -0
- package/es/plugins/inode/index.d.ts +3 -0
- package/es/plugins/inode/plugin/index.d.ts +19 -0
- package/es/plugins/inode/plugin/index.js +23 -0
- package/es/plugins/inode/react/index.d.ts +6 -0
- package/es/plugins/inode/react/index.js +15 -0
- package/es/plugins/inode/service/index.d.ts +17 -0
- package/es/plugins/inode/service/index.js +22 -0
- package/es/plugins/link/command/index.d.ts +10 -0
- package/es/plugins/link/command/index.js +33 -0
- package/es/plugins/link/index.d.ts +5 -0
- package/es/plugins/link/node/LinkNode.d.ts +10 -0
- package/es/plugins/link/node/LinkNode.js +448 -0
- package/es/plugins/link/plugin/index.d.ts +16 -0
- package/es/plugins/link/plugin/index.js +106 -0
- package/es/plugins/link/plugin/registry.js +82 -0
- package/es/plugins/link/react/ReactLinkPlugin.d.ts +7 -0
- package/es/plugins/link/react/ReactLinkPlugin.js +50 -0
- package/es/plugins/link/react/components/LinkEdit.js +204 -0
- package/es/plugins/link/react/components/LinkToolbar.js +148 -0
- package/es/plugins/link/react/index.d.ts +2 -0
- package/es/plugins/link/react/style.js +34 -0
- package/es/plugins/link/react/type.d.ts +14 -0
- package/es/plugins/link/service/i-link-service.d.ts +10 -0
- package/es/plugins/link/service/i-link-service.js +19 -0
- package/es/plugins/link/utils/index.js +45 -0
- package/es/plugins/link-highlight/command/index.d.ts +8 -0
- package/es/plugins/link-highlight/command/index.js +30 -0
- package/es/plugins/link-highlight/index.d.ts +3 -0
- package/es/plugins/link-highlight/node/link-highlight.js +80 -0
- package/es/plugins/link-highlight/plugin/index.d.ts +18 -0
- package/es/plugins/link-highlight/plugin/index.js +109 -0
- package/es/plugins/link-highlight/plugin/registry.js +33 -0
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.d.ts +7 -0
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.js +29 -0
- package/es/plugins/link-highlight/react/index.d.ts +1 -0
- package/es/plugins/link-highlight/react/style.js +14 -0
- package/es/plugins/link-highlight/react/type.d.ts +16 -0
- package/es/plugins/list/command/index.d.ts +3 -0
- package/es/plugins/list/command/index.js +3 -0
- package/es/plugins/list/index.d.ts +5 -0
- package/es/plugins/list/plugin/checkList.d.ts +6 -0
- package/es/plugins/list/plugin/checkList.js +140 -0
- package/es/plugins/list/plugin/index.d.ts +9 -0
- package/es/plugins/list/plugin/index.js +195 -0
- package/es/plugins/list/plugin/registry.js +68 -0
- package/es/plugins/list/react/ReactListPlugin.d.ts +7 -0
- package/es/plugins/list/react/ReactListPlugin.js +21 -0
- package/es/plugins/list/react/index.d.ts +2 -0
- package/es/plugins/list/react/style.js +123 -0
- package/es/plugins/list/react/type.d.ts +7 -0
- package/es/plugins/list/utils/index.js +58 -0
- package/es/plugins/litexml/command/diffCommand.d.ts +17 -0
- package/es/plugins/litexml/command/diffCommand.js +97 -0
- package/es/plugins/litexml/command/index.d.ts +38 -0
- package/es/plugins/litexml/command/index.js +333 -0
- package/es/plugins/litexml/data-source/litexml-data-source.d.ts +65 -0
- package/es/plugins/litexml/data-source/litexml-data-source.js +286 -0
- package/es/plugins/litexml/index.d.ts +7 -0
- package/es/plugins/litexml/node/DiffNode.d.ts +29 -0
- package/es/plugins/litexml/node/DiffNode.js +95 -0
- package/es/plugins/litexml/plugin/index.d.ts +24 -0
- package/es/plugins/litexml/plugin/index.js +100 -0
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +60 -0
- package/es/plugins/litexml/react/DiffNodeToolbar/style.js +24 -0
- package/es/plugins/litexml/react/hooks/useHasDiffNode.d.ts +7 -0
- package/es/plugins/litexml/react/hooks/useHasDiffNode.js +35 -0
- package/es/plugins/litexml/react/index.d.ts +6 -0
- package/es/plugins/litexml/react/index.js +26 -0
- package/es/plugins/litexml/react/style.js +124 -0
- package/es/plugins/litexml/service/litexml-service.d.ts +93 -0
- package/es/plugins/litexml/service/litexml-service.js +42 -0
- package/es/plugins/litexml/utils/index.js +59 -0
- package/es/plugins/markdown/command/index.d.ts +14 -0
- package/es/plugins/markdown/command/index.js +74 -0
- package/es/plugins/markdown/data-source/markdown/parse.d.ts +14 -0
- package/es/plugins/markdown/data-source/markdown/parse.js +195 -0
- package/es/plugins/markdown/data-source/markdown-data-source.js +148 -0
- package/es/plugins/markdown/data-source/markdown-writer-context.js +40 -0
- package/es/plugins/markdown/index.d.ts +7 -0
- package/es/plugins/markdown/plugin/index.d.ts +22 -0
- package/es/plugins/markdown/plugin/index.js +285 -0
- package/es/plugins/markdown/react/index.d.ts +6 -0
- package/es/plugins/markdown/react/index.js +31 -0
- package/es/plugins/markdown/service/shortcut.d.ts +57 -0
- package/es/plugins/markdown/service/shortcut.js +101 -0
- package/es/plugins/markdown/service/transformers.d.ts +61 -0
- package/es/plugins/markdown/service/transformers.js +119 -0
- package/es/plugins/markdown/utils/detectLanguage.d.ts +22 -0
- package/es/plugins/markdown/utils/detectLanguage.js +251 -0
- package/es/plugins/markdown/utils/index.d.ts +11 -0
- package/es/plugins/markdown/utils/index.js +143 -0
- package/es/plugins/markdown/utils/logger.js +6 -0
- package/es/plugins/math/command/index.d.ts +9 -0
- package/es/plugins/math/command/index.js +38 -0
- package/es/plugins/math/index.d.ts +3 -0
- package/es/plugins/math/node/index.d.ts +44 -0
- package/es/plugins/math/node/index.js +161 -0
- package/es/plugins/math/plugin/index.d.ts +15 -0
- package/es/plugins/math/plugin/index.js +119 -0
- package/es/plugins/math/react/components/MathEditor.js +198 -0
- package/es/plugins/math/react/components/MathEditorContainer.js +101 -0
- package/es/plugins/math/react/components/MathEditorContent.js +133 -0
- package/es/plugins/math/react/components/MathInline.js +86 -0
- package/es/plugins/math/react/components/Placeholder.js +24 -0
- package/es/plugins/math/react/index.d.ts +7 -0
- package/es/plugins/math/react/index.js +35 -0
- package/es/plugins/math/react/style.js +96 -0
- package/es/plugins/math/react/type.d.ts +17 -0
- package/es/plugins/math/utils/index.js +23 -0
- package/es/plugins/mention/command/index.d.ts +10 -0
- package/es/plugins/mention/command/index.js +18 -0
- package/es/plugins/mention/index.d.ts +5 -0
- package/es/plugins/mention/node/MentionNode.d.ts +28 -0
- package/es/plugins/mention/node/MentionNode.js +86 -0
- package/es/plugins/mention/plugin/index.d.ts +18 -0
- package/es/plugins/mention/plugin/index.js +63 -0
- package/es/plugins/mention/plugin/register.js +30 -0
- package/es/plugins/mention/react/ReactMentionPlugin.d.ts +7 -0
- package/es/plugins/mention/react/ReactMentionPlugin.js +36 -0
- package/es/plugins/mention/react/components/Mention.js +33 -0
- package/es/plugins/mention/react/index.d.ts +2 -0
- package/es/plugins/mention/react/style.js +34 -0
- package/es/plugins/mention/react/type.d.ts +12 -0
- package/es/plugins/slash/index.d.ts +6 -0
- package/es/plugins/slash/plugin/index.d.ts +27 -0
- package/es/plugins/slash/plugin/index.js +160 -0
- package/es/plugins/slash/react/ReactSlashOption.d.ts +7 -0
- package/es/plugins/slash/react/ReactSlashOption.js +8 -0
- package/es/plugins/slash/react/ReactSlashPlugin.d.ts +7 -0
- package/es/plugins/slash/react/ReactSlashPlugin.js +190 -0
- package/es/plugins/slash/react/components/DefaultSlashMenu.js +168 -0
- package/es/plugins/slash/react/components/SlashMenu.d.ts +11 -0
- package/es/plugins/slash/react/components/SlashMenu.js +40 -0
- package/es/plugins/slash/react/index.d.ts +4 -0
- package/es/plugins/slash/react/type.d.ts +114 -0
- package/es/plugins/slash/react/utils.js +18 -0
- package/es/plugins/slash/service/i-slash-service.d.ts +50 -0
- package/es/plugins/slash/service/i-slash-service.js +55 -0
- package/es/plugins/slash/utils/utils.d.ts +1 -0
- package/es/plugins/slash/utils/utils.js +97 -0
- package/es/plugins/table/command/index.d.ts +17 -0
- package/es/plugins/table/command/index.js +57 -0
- package/es/plugins/table/index.d.ts +3 -0
- package/es/plugins/table/node/index.js +18 -0
- package/es/plugins/table/plugin/index.d.ts +8 -0
- package/es/plugins/table/plugin/index.js +172 -0
- package/es/plugins/table/react/TableActionMenu/ActionMenu.js +220 -0
- package/es/plugins/table/react/TableActionMenu/index.js +128 -0
- package/es/plugins/table/react/TableActionMenu/style.js +20 -0
- package/es/plugins/table/react/TableActionMenu/utils.js +34 -0
- package/es/plugins/table/react/TableHoverActions/index.js +147 -0
- package/es/plugins/table/react/TableHoverActions/style.js +14 -0
- package/es/plugins/table/react/TableHoverActions/utils.js +32 -0
- package/es/plugins/table/react/TableResize/index.js +253 -0
- package/es/plugins/table/react/TableResize/style.js +16 -0
- package/es/plugins/table/react/TableResize/utils.js +9 -0
- package/es/plugins/table/react/index.d.ts +7 -0
- package/es/plugins/table/react/index.js +49 -0
- package/es/plugins/table/react/style.js +63 -0
- package/es/plugins/table/react/type.d.ts +8 -0
- package/es/plugins/table/utils/index.js +48 -0
- package/es/plugins/toolbar/command/index.d.ts +12 -0
- package/es/plugins/toolbar/command/index.js +17 -0
- package/es/plugins/toolbar/index.d.ts +2 -0
- package/es/plugins/toolbar/react/index.d.ts +7 -0
- package/es/plugins/toolbar/react/index.js +109 -0
- package/es/plugins/toolbar/react/style.js +55 -0
- package/es/plugins/toolbar/react/type.d.ts +9 -0
- package/es/plugins/toolbar/utils/getDOMRangeRect.js +20 -0
- package/es/plugins/toolbar/utils/setFloatingElemPosition.js +50 -0
- package/es/plugins/upload/index.d.ts +2 -0
- package/es/plugins/upload/plugin/index.d.ts +6 -0
- package/es/plugins/upload/plugin/index.js +47 -0
- package/es/plugins/upload/service/i-upload-service.d.ts +13 -0
- package/es/plugins/upload/service/i-upload-service.js +30 -0
- package/es/plugins/upload/utils/index.js +15 -0
- package/es/plugins/virtual-block/index.d.ts +2 -0
- package/es/plugins/virtual-block/plugin/index.d.ts +8 -0
- package/es/plugins/virtual-block/plugin/index.js +19 -0
- package/es/plugins/virtual-block/plugin/register.js +150 -0
- package/es/plugins/virtual-block/react/ReactVirtualBlock.d.ts +6 -0
- package/es/plugins/virtual-block/react/ReactVirtualBlock.js +15 -0
- package/es/plugins/virtual-block/react/index.d.ts +1 -0
- package/es/react/ChatInput/ChatInput.d.ts +7 -0
- package/es/react/ChatInput/ChatInput.js +91 -0
- package/es/react/ChatInput/index.d.ts +2 -0
- package/es/react/ChatInput/style.js +115 -0
- package/es/react/ChatInput/type.d.ts +32 -0
- package/es/react/ChatInputActionBar/ChatInputActionBar.d.ts +7 -0
- package/es/react/ChatInputActionBar/ChatInputActionBar.js +22 -0
- package/es/react/ChatInputActionBar/index.d.ts +2 -0
- package/es/react/ChatInputActionBar/style.js +7 -0
- package/es/react/ChatInputActionBar/type.d.ts +10 -0
- package/es/react/ChatInputActions/ChatInputActions.d.ts +7 -0
- package/es/react/ChatInputActions/ChatInputActions.js +65 -0
- package/es/react/ChatInputActions/components/ActionItem.js +46 -0
- package/es/react/ChatInputActions/components/ActionRender.js +45 -0
- package/es/react/ChatInputActions/components/CollapsedActions.js +60 -0
- package/es/react/ChatInputActions/components/useDisplayActionCount.js +45 -0
- package/es/react/ChatInputActions/index.d.ts +2 -0
- package/es/react/ChatInputActions/style.js +20 -0
- package/es/react/ChatInputActions/type.d.ts +36 -0
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +7 -0
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +67 -0
- package/es/react/CodeLanguageSelect/index.d.ts +2 -0
- package/es/react/CodeLanguageSelect/style.js +7 -0
- package/es/react/CodeLanguageSelect/type.d.ts +6 -0
- package/es/react/Editor/Editor.js +108 -0
- package/es/react/Editor/index.d.ts +16 -0
- package/es/react/Editor/index.js +11 -0
- package/es/react/Editor/type.d.ts +64 -0
- package/es/react/Editor/utils.d.ts +6 -0
- package/es/react/Editor/utils.js +6 -0
- package/es/react/EditorProvider/index.d.ts +28 -0
- package/es/react/EditorProvider/index.js +18 -0
- package/es/react/FloatActions/FloatActions.d.ts +7 -0
- package/es/react/FloatActions/FloatActions.js +34 -0
- package/es/react/FloatActions/components/ActionItem.js +46 -0
- package/es/react/FloatActions/components/ActionRender.js +45 -0
- package/es/react/FloatActions/components/CollapsedActions.js +60 -0
- package/es/react/FloatActions/index.d.ts +2 -0
- package/es/react/FloatActions/style.js +19 -0
- package/es/react/FloatActions/type.d.ts +33 -0
- package/es/react/FloatMenu/FloatMenu.d.ts +7 -0
- package/es/react/FloatMenu/FloatMenu.js +32 -0
- package/es/react/FloatMenu/index.d.ts +2 -0
- package/es/react/FloatMenu/style.js +28 -0
- package/es/react/FloatMenu/type.d.ts +25 -0
- package/es/react/SendButton/SendButton.d.ts +7 -0
- package/es/react/SendButton/SendButton.js +107 -0
- package/es/react/SendButton/components/SendIcon.js +23 -0
- package/es/react/SendButton/components/StopIcon.js +56 -0
- package/es/react/SendButton/index.d.ts +2 -0
- package/es/react/SendButton/style.js +68 -0
- package/es/react/SendButton/type.d.ts +12 -0
- package/es/react/SlashMenu/SlashMenu.d.ts +7 -0
- package/es/react/SlashMenu/SlashMenu.js +40 -0
- package/es/react/SlashMenu/index.d.ts +2 -0
- package/es/react/SlashMenu/type.d.ts +17 -0
- package/es/react/hooks/useEditor.d.ts +5 -0
- package/es/react/hooks/useEditor.js +8 -0
- package/es/react/hooks/useEditorState/index.d.ts +71 -0
- package/es/react/hooks/useEditorState/index.js +347 -0
- package/es/react/hooks/useEditorState/utils.js +28 -0
- package/es/react/hooks/useSize.js +61 -0
- package/es/react.d.ts +22 -334
- package/es/react.js +13 -1573
- package/es/renderer/LexicalDiff.d.ts +41 -0
- package/es/renderer/LexicalDiff.js +96 -0
- package/es/renderer/LexicalRenderer.d.ts +16 -0
- package/es/renderer/LexicalRenderer.js +48 -0
- package/es/renderer/diff/compute.js +396 -0
- package/es/renderer/diff/style.d.ts +4 -0
- package/es/renderer/diff/style.js +104 -0
- package/es/renderer/diff/types.d.ts +32 -0
- package/es/renderer/engine/render-builtin-node.js +196 -0
- package/es/renderer/engine/render-text-node.js +33 -0
- package/es/renderer/engine/render-tree.js +35 -0
- package/es/renderer/engine/shiki.d.ts +4 -0
- package/es/renderer/engine/shiki.js +24 -0
- package/es/renderer/engine/utils.js +16 -0
- package/es/renderer/nodes/index.d.ts +6 -0
- package/es/renderer/nodes/index.js +44 -0
- package/es/renderer/renderers/codeblock.js +21 -0
- package/es/renderer/renderers/file.js +29 -0
- package/es/renderer/renderers/horizontalrule.js +29 -0
- package/es/renderer/renderers/image.js +35 -0
- package/es/renderer/renderers/index.d.ts +6 -0
- package/es/renderer/renderers/index.js +21 -0
- package/es/renderer/renderers/math.js +19 -0
- package/es/renderer/renderers/mention.js +15 -0
- package/es/renderer/renderers/mermaid.js +17 -0
- package/es/renderer/style.js +52 -0
- package/es/renderer/types.d.ts +29 -0
- package/es/renderer.d.ts +8 -114
- package/es/renderer.js +5 -1153
- package/es/types/hotkey.d.ts +76 -0
- package/es/types/hotkey.js +65 -0
- package/es/types/index.d.ts +2 -0
- package/es/types/kernel.d.ts +359 -0
- package/es/types/locale.d.ts +11 -0
- package/es/utils/cx.js +4 -0
- package/es/utils/debug.d.ts +425 -0
- package/es/{debug-CIvbNHJu.js → utils/debug.js} +3 -35
- package/es/utils/hotkey/isHotkeyMatch.js +17 -0
- package/es/utils/hotkey/parseHotkeys.js +53 -0
- package/es/utils/hotkey/registerHotkey.d.ts +18 -0
- package/es/utils/hotkey/registerHotkey.js +35 -0
- package/es/utils/scrollIntoView.d.ts +8 -0
- package/es/utils/scrollIntoView.js +29 -0
- package/es/utils/updatePosition.js +26 -0
- package/es/utils/url.d.ts +18 -0
- package/es/utils/url.js +34 -0
- package/package.json +4 -1
- package/es/ReactSlashPlugin-BiVy_Iwf.js +0 -23072
- package/es/codemirror-3POv7f__.js +0 -923
- package/es/index-DHGp94p0.d.ts +0 -916
- package/es/style-DADgHVA1.js +0 -2889
- package/es/style-DMdPzCo-.js +0 -999
package/es/react.js
CHANGED
|
@@ -1,1574 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { $createCodeNode, $isCodeNode } from "@lexical/code-core";
|
|
15
|
-
import { createPortal } from "react-dom";
|
|
16
|
-
import { bundledLanguagesInfo } from "shiki";
|
|
17
|
-
import { Resizable } from "re-resizable";
|
|
18
|
-
import useMergeState from "use-merge-value";
|
|
19
|
-
import { debounce } from "es-toolkit";
|
|
20
|
-
//#region src/react/hooks/useSize.ts
|
|
21
|
-
const useWidth = (options = {}) => {
|
|
22
|
-
const { debounceMs = 100 } = options;
|
|
23
|
-
const ref = useRef(null);
|
|
24
|
-
const [size, setSize] = useState();
|
|
25
|
-
const resizeObserverRef = useRef(null);
|
|
26
|
-
const updateSize = useCallback(debounce((entries) => {
|
|
27
|
-
if (entries[0]) {
|
|
28
|
-
const { width } = entries[0].contentRect;
|
|
29
|
-
setSize(Math.floor(width));
|
|
30
|
-
}
|
|
31
|
-
}, debounceMs), [debounceMs]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const element = ref.current;
|
|
34
|
-
if (!element) return;
|
|
35
|
-
resizeObserverRef.current = new ResizeObserver(updateSize);
|
|
36
|
-
resizeObserverRef.current.observe(element);
|
|
37
|
-
return () => {
|
|
38
|
-
if (resizeObserverRef.current) {
|
|
39
|
-
resizeObserverRef.current.disconnect();
|
|
40
|
-
updateSize.cancel?.();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}, [updateSize]);
|
|
44
|
-
return {
|
|
45
|
-
ref,
|
|
46
|
-
width: size
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
const useHeight = (options = {}) => {
|
|
50
|
-
const { debounceMs = 100 } = options;
|
|
51
|
-
const ref = useRef(null);
|
|
52
|
-
const [size, setSize] = useState();
|
|
53
|
-
const resizeObserverRef = useRef(null);
|
|
54
|
-
const updateSize = useCallback(debounce((entries) => {
|
|
55
|
-
if (entries[0]) {
|
|
56
|
-
const { height } = entries[0].contentRect;
|
|
57
|
-
setSize(Math.floor(height));
|
|
58
|
-
}
|
|
59
|
-
}, debounceMs), [debounceMs]);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
const element = ref.current;
|
|
62
|
-
if (!element) return;
|
|
63
|
-
resizeObserverRef.current = new ResizeObserver(updateSize);
|
|
64
|
-
resizeObserverRef.current.observe(element);
|
|
65
|
-
return () => {
|
|
66
|
-
if (resizeObserverRef.current) {
|
|
67
|
-
resizeObserverRef.current.disconnect();
|
|
68
|
-
updateSize.cancel?.();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}, [updateSize]);
|
|
72
|
-
return {
|
|
73
|
-
height: size,
|
|
74
|
-
ref
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/react/ChatInput/style.ts
|
|
79
|
-
const styles$8 = createStaticStyles(({ css, cssVar }) => ({
|
|
80
|
-
bodyEditor: css`
|
|
81
|
-
z-index: 0;
|
|
82
|
-
flex: 1;
|
|
83
|
-
`,
|
|
84
|
-
containerDark: css`
|
|
85
|
-
position: relative;
|
|
86
|
-
|
|
87
|
-
display: flex;
|
|
88
|
-
flex-direction: column;
|
|
89
|
-
|
|
90
|
-
height: 100%;
|
|
91
|
-
border: 1px solid ${cssVar.colorFillSecondary};
|
|
92
|
-
border-radius: ${cssVar.borderRadiusLG};
|
|
93
|
-
|
|
94
|
-
background-color: ${cssVar.colorBgElevated};
|
|
95
|
-
box-shadow: 0 4px 4px color-mix(in srgb, #000 40%, transparent);
|
|
96
|
-
`,
|
|
97
|
-
containerLight: css`
|
|
98
|
-
position: relative;
|
|
99
|
-
|
|
100
|
-
display: flex;
|
|
101
|
-
flex-direction: column;
|
|
102
|
-
|
|
103
|
-
height: 100%;
|
|
104
|
-
border: 1px solid ${cssVar.colorFill};
|
|
105
|
-
border-radius: ${cssVar.borderRadiusLG};
|
|
106
|
-
|
|
107
|
-
background-color: ${cssVar.colorBgElevated};
|
|
108
|
-
box-shadow: 0 4px 4px color-mix(in srgb, #000 4%, transparent);
|
|
109
|
-
`,
|
|
110
|
-
editor: css`
|
|
111
|
-
cursor: text;
|
|
112
|
-
|
|
113
|
-
overflow: hidden auto;
|
|
114
|
-
flex: 1;
|
|
115
|
-
|
|
116
|
-
width: 100%;
|
|
117
|
-
padding-block: 8px 0;
|
|
118
|
-
padding-inline: 12px;
|
|
119
|
-
`,
|
|
120
|
-
footer: css`
|
|
121
|
-
z-index: 1;
|
|
122
|
-
width: 100%;
|
|
123
|
-
`,
|
|
124
|
-
header: css`
|
|
125
|
-
z-index: 1;
|
|
126
|
-
width: 100%;
|
|
127
|
-
`,
|
|
128
|
-
resizableContainer: css`
|
|
129
|
-
position: relative;
|
|
130
|
-
|
|
131
|
-
display: flex;
|
|
132
|
-
flex: 1 1 auto;
|
|
133
|
-
flex-direction: column;
|
|
134
|
-
align-self: flex-end;
|
|
135
|
-
|
|
136
|
-
width: 100%;
|
|
137
|
-
|
|
138
|
-
&:hover .resize-handle {
|
|
139
|
-
opacity: 1;
|
|
140
|
-
}
|
|
141
|
-
`,
|
|
142
|
-
resizeHandle: css`
|
|
143
|
-
position: absolute;
|
|
144
|
-
inset-block-start: -4px;
|
|
145
|
-
inset-inline-start: 50%;
|
|
146
|
-
transform: translateX(-50%);
|
|
147
|
-
|
|
148
|
-
width: 100%;
|
|
149
|
-
height: 8px;
|
|
150
|
-
|
|
151
|
-
opacity: 0;
|
|
152
|
-
|
|
153
|
-
transition: opacity 0.2s ease-in-out;
|
|
154
|
-
|
|
155
|
-
&::before {
|
|
156
|
-
content: '';
|
|
157
|
-
|
|
158
|
-
position: absolute;
|
|
159
|
-
inset-block-start: 0;
|
|
160
|
-
inset-inline-start: 50%;
|
|
161
|
-
transform: translateX(-50%);
|
|
162
|
-
|
|
163
|
-
width: 32px;
|
|
164
|
-
height: 4px;
|
|
165
|
-
border-radius: 4px;
|
|
166
|
-
|
|
167
|
-
background-color: ${cssVar.colorPrimary};
|
|
168
|
-
box-shadow: 0 1px 2px color-mix(in srgb, ${cssVar.colorTextSecondary} 12.5%, transparent);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
&:hover {
|
|
172
|
-
opacity: 1 !important;
|
|
173
|
-
|
|
174
|
-
&::before {
|
|
175
|
-
background-color: ${cssVar.colorPrimaryHover};
|
|
176
|
-
box-shadow: 0 2px 4px color-mix(in srgb, ${cssVar.colorTextSecondary} 25%, transparent);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&:active {
|
|
181
|
-
&::before {
|
|
182
|
-
background-color: ${cssVar.colorPrimaryActive};
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
`,
|
|
186
|
-
root: css`
|
|
187
|
-
position: relative;
|
|
188
|
-
`
|
|
189
|
-
}));
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/react/ChatInput/ChatInput.tsx
|
|
192
|
-
const ChatInput = (props) => {
|
|
193
|
-
const { defaultHeight = props.defaultHeight || props.minHeight || 64, height, maxHeight = 320, minHeight = 64, resizeMaxHeightOffset = 120, resize = true, onSizeChange, onSizeDragging, className, children, footer, header, style, slashMenuRef, classNames, fullscreen, showResizeHandle, onBodyClick, styles: customStyles, ...rest } = props;
|
|
194
|
-
const { isDarkMode } = useThemeMode();
|
|
195
|
-
const { ref: headerRef, height: headerHeight = 0 } = useHeight();
|
|
196
|
-
const [currentHeight, setCurrentHeight] = useMergeState(defaultHeight, {
|
|
197
|
-
defaultValue: defaultHeight,
|
|
198
|
-
onChange: onSizeChange,
|
|
199
|
-
value: height
|
|
200
|
-
});
|
|
201
|
-
const handleResizeStop = useCallback((e, direction, ref) => {
|
|
202
|
-
setCurrentHeight(ref.style.height ? parseInt(ref.style.height) : defaultHeight);
|
|
203
|
-
}, [setCurrentHeight, defaultHeight]);
|
|
204
|
-
const handleResize = useCallback((e, direction, ref) => {
|
|
205
|
-
const newHeight = ref.style.height ? parseInt(ref.style.height) : defaultHeight;
|
|
206
|
-
onSizeDragging?.(newHeight);
|
|
207
|
-
}, [onSizeDragging, defaultHeight]);
|
|
208
|
-
const bodyNode = /* @__PURE__ */ jsx("div", {
|
|
209
|
-
className: cx(styles$8.editor, styles$8.bodyEditor, classNames?.body),
|
|
210
|
-
draggable: false,
|
|
211
|
-
onClick: onBodyClick,
|
|
212
|
-
style: {
|
|
213
|
-
...customStyles?.body,
|
|
214
|
-
maxHeight: fullscreen ? "100%" : maxHeight,
|
|
215
|
-
minHeight: resize ? currentHeight : minHeight
|
|
216
|
-
},
|
|
217
|
-
children
|
|
218
|
-
});
|
|
219
|
-
return /* @__PURE__ */ jsxs(Flexbox, {
|
|
220
|
-
className: cx(isDarkMode ? styles$8.containerDark : styles$8.containerLight, styles$8.root, className),
|
|
221
|
-
height: fullscreen ? "100%" : void 0,
|
|
222
|
-
style,
|
|
223
|
-
width: "100%",
|
|
224
|
-
...rest,
|
|
225
|
-
children: [
|
|
226
|
-
slashMenuRef && /* @__PURE__ */ jsx("div", { ref: slashMenuRef }),
|
|
227
|
-
/* @__PURE__ */ jsx("div", {
|
|
228
|
-
className: cx(styles$8.header, classNames?.header),
|
|
229
|
-
ref: headerRef,
|
|
230
|
-
style: customStyles?.header,
|
|
231
|
-
children: header
|
|
232
|
-
}),
|
|
233
|
-
resize ? /* @__PURE__ */ jsx(Resizable, {
|
|
234
|
-
className: styles$8.resizableContainer,
|
|
235
|
-
enable: fullscreen ? false : { top: true },
|
|
236
|
-
handleClasses: { top: showResizeHandle ? styles$8.resizeHandle : void 0 },
|
|
237
|
-
handleStyles: { top: {
|
|
238
|
-
backgroundColor: "transparent",
|
|
239
|
-
borderRadius: "4px",
|
|
240
|
-
cursor: "ns-resize",
|
|
241
|
-
height: "8px",
|
|
242
|
-
left: "50%",
|
|
243
|
-
top: !!header ? -3 - headerHeight : -3,
|
|
244
|
-
transform: "translateX(-50%)",
|
|
245
|
-
width: "100%"
|
|
246
|
-
} },
|
|
247
|
-
maxHeight: fullscreen ? void 0 : maxHeight + resizeMaxHeightOffset,
|
|
248
|
-
minHeight: fullscreen ? void 0 : minHeight,
|
|
249
|
-
onResize: handleResize,
|
|
250
|
-
onResizeStop: handleResizeStop,
|
|
251
|
-
size: {
|
|
252
|
-
height: fullscreen ? void 0 : "auto",
|
|
253
|
-
width: "100%"
|
|
254
|
-
},
|
|
255
|
-
style: fullscreen ? {
|
|
256
|
-
flex: 1,
|
|
257
|
-
overflow: "hidden",
|
|
258
|
-
position: "relative"
|
|
259
|
-
} : void 0,
|
|
260
|
-
children: bodyNode
|
|
261
|
-
}) : bodyNode,
|
|
262
|
-
/* @__PURE__ */ jsx("div", {
|
|
263
|
-
className: cx(styles$8.footer, classNames?.footer),
|
|
264
|
-
style: customStyles?.footer,
|
|
265
|
-
children: footer
|
|
266
|
-
})
|
|
267
|
-
]
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
ChatInput.displayName = "ChatInput";
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region src/react/ChatInputActionBar/style.ts
|
|
273
|
-
const styles$7 = createStaticStyles(({ css }) => ({ container: css`
|
|
274
|
-
overflow: hidden;
|
|
275
|
-
` }));
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/react/ChatInputActionBar/ChatInputActionBar.tsx
|
|
278
|
-
const ChatInputActionBar = ({ className, style, left, right, ...rest }) => {
|
|
279
|
-
return /* @__PURE__ */ jsxs(Flexbox, {
|
|
280
|
-
align: "center",
|
|
281
|
-
className: cx(styles$7.container, className),
|
|
282
|
-
gap: 4,
|
|
283
|
-
horizontal: true,
|
|
284
|
-
justify: "space-between",
|
|
285
|
-
padding: 4,
|
|
286
|
-
style,
|
|
287
|
-
...rest,
|
|
288
|
-
children: [left, right]
|
|
289
|
-
});
|
|
290
|
-
};
|
|
291
|
-
ChatInputActionBar.displayName = "ChatInputActionBar";
|
|
292
|
-
//#endregion
|
|
293
|
-
//#region src/react/ChatInputActions/style.ts
|
|
294
|
-
const styles$6 = createStaticStyles(({ css }) => ({
|
|
295
|
-
collapsedContainer: css`
|
|
296
|
-
overflow: hidden;
|
|
297
|
-
display: flex;
|
|
298
|
-
align-items: center;
|
|
299
|
-
`,
|
|
300
|
-
container: css`
|
|
301
|
-
position: relative;
|
|
302
|
-
overflow: hidden;
|
|
303
|
-
width: 100%;
|
|
304
|
-
`,
|
|
305
|
-
divider: css`
|
|
306
|
-
height: 20px;
|
|
307
|
-
margin-inline: 4px;
|
|
308
|
-
`
|
|
309
|
-
}));
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region src/react/ChatInputActions/components/ActionRender.tsx
|
|
312
|
-
const ActionRender$1 = ({ item, onActionClick, disabled }) => {
|
|
313
|
-
if (item.type === "divider") return /* @__PURE__ */ jsx(Divider, {
|
|
314
|
-
className: styles$6.divider,
|
|
315
|
-
orientation: "vertical"
|
|
316
|
-
});
|
|
317
|
-
const { wrapper, icon, key, label, onClick, danger, loading, active, tooltipProps, ...itemRest } = item;
|
|
318
|
-
if (item.children && isValidElement(item.children)) {
|
|
319
|
-
if (!wrapper) return item.children;
|
|
320
|
-
return wrapper(item.children);
|
|
321
|
-
}
|
|
322
|
-
const action = /* @__PURE__ */ jsx(ActionIcon, {
|
|
323
|
-
active,
|
|
324
|
-
danger,
|
|
325
|
-
disabled: disabled || loading || itemRest?.disabled,
|
|
326
|
-
icon,
|
|
327
|
-
loading,
|
|
328
|
-
onClick: (e) => {
|
|
329
|
-
onActionClick?.({
|
|
330
|
-
domEvent: e,
|
|
331
|
-
key: String(key),
|
|
332
|
-
keyPath: [String(key)]
|
|
333
|
-
});
|
|
334
|
-
onClick?.(e);
|
|
335
|
-
},
|
|
336
|
-
size: {
|
|
337
|
-
blockSize: 36,
|
|
338
|
-
size: 20
|
|
339
|
-
},
|
|
340
|
-
title: label,
|
|
341
|
-
tooltipProps: {
|
|
342
|
-
placement: "top",
|
|
343
|
-
...tooltipProps
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
if (!wrapper) return action;
|
|
347
|
-
return wrapper(action);
|
|
348
|
-
};
|
|
349
|
-
//#endregion
|
|
350
|
-
//#region src/react/ChatInputActions/components/CollapsedActions.tsx
|
|
351
|
-
const CollapsedActions$1 = ({ children, groupCollapse = false, onGroupCollapseChange, gap, mode }) => {
|
|
352
|
-
const Motion = useMotionComponent();
|
|
353
|
-
if (mode === "popup") return /* @__PURE__ */ jsx(Popover, {
|
|
354
|
-
arrow: false,
|
|
355
|
-
content: /* @__PURE__ */ jsx(Flexbox, {
|
|
356
|
-
align: "center",
|
|
357
|
-
gap,
|
|
358
|
-
horizontal: true,
|
|
359
|
-
children
|
|
360
|
-
}),
|
|
361
|
-
styles: { content: { padding: 4 } },
|
|
362
|
-
children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
363
|
-
icon: CircleChevronUpIcon,
|
|
364
|
-
size: {
|
|
365
|
-
blockSize: 36,
|
|
366
|
-
size: 20
|
|
367
|
-
}
|
|
368
|
-
})
|
|
369
|
-
});
|
|
370
|
-
return /* @__PURE__ */ jsxs(Flexbox, {
|
|
371
|
-
align: "center",
|
|
372
|
-
flex: "none",
|
|
373
|
-
gap,
|
|
374
|
-
horizontal: true,
|
|
375
|
-
children: [/* @__PURE__ */ jsx(Motion.div, {
|
|
376
|
-
animate: groupCollapse ? "closed" : "open",
|
|
377
|
-
className: styles$6.collapsedContainer,
|
|
378
|
-
initial: groupCollapse ? "closed" : "open",
|
|
379
|
-
style: { gap },
|
|
380
|
-
transition: { duration: .2 },
|
|
381
|
-
variants: {
|
|
382
|
-
closed: {
|
|
383
|
-
opacity: 0,
|
|
384
|
-
width: 0
|
|
385
|
-
},
|
|
386
|
-
open: {
|
|
387
|
-
opacity: 1,
|
|
388
|
-
width: "auto"
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
children
|
|
392
|
-
}), /* @__PURE__ */ jsx(ActionIcon, {
|
|
393
|
-
icon: groupCollapse ? CircleChevronRightIcon : CircleChevronLeftIcon,
|
|
394
|
-
onClick: () => onGroupCollapseChange?.(!groupCollapse),
|
|
395
|
-
size: {
|
|
396
|
-
blockSize: 36,
|
|
397
|
-
size: 20
|
|
398
|
-
}
|
|
399
|
-
})]
|
|
400
|
-
});
|
|
401
|
-
};
|
|
402
|
-
CollapsedActions$1.displayName = "ChatInputActionsCollapse";
|
|
403
|
-
//#endregion
|
|
404
|
-
//#region src/react/ChatInputActions/components/ActionItem.tsx
|
|
405
|
-
const ActionItem$1 = ({ item, disabled, onActionClick, groupCollapsed, collapsed, gap, setGroupCollapsed }) => {
|
|
406
|
-
if (item.type === "collapse") return /* @__PURE__ */ jsx(CollapsedActions$1, {
|
|
407
|
-
gap,
|
|
408
|
-
groupCollapse: groupCollapsed,
|
|
409
|
-
mode: collapsed ? "popup" : "default",
|
|
410
|
-
onGroupCollapseChange: setGroupCollapsed,
|
|
411
|
-
children: item.children.map((child, childIndex) => /* @__PURE__ */ jsx(ActionRender$1, {
|
|
412
|
-
disabled,
|
|
413
|
-
item: child,
|
|
414
|
-
onActionClick
|
|
415
|
-
}, child?.key || `action-${childIndex}`))
|
|
416
|
-
});
|
|
417
|
-
if (item.type === "dropdown") return /* @__PURE__ */ jsx(Dropdown, {
|
|
418
|
-
menu: { items: item.children },
|
|
419
|
-
children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
420
|
-
active: item.active,
|
|
421
|
-
danger: item.danger,
|
|
422
|
-
disabled: disabled || item.loading || item?.disabled,
|
|
423
|
-
icon: item.icon,
|
|
424
|
-
loading: item.loading,
|
|
425
|
-
size: {
|
|
426
|
-
blockSize: 36,
|
|
427
|
-
size: 20
|
|
428
|
-
},
|
|
429
|
-
title: item.label,
|
|
430
|
-
tooltipProps: {
|
|
431
|
-
placement: "top",
|
|
432
|
-
...item.tooltipProps
|
|
433
|
-
}
|
|
434
|
-
})
|
|
435
|
-
}, item.key);
|
|
436
|
-
return /* @__PURE__ */ jsx(ActionRender$1, {
|
|
437
|
-
disabled,
|
|
438
|
-
item,
|
|
439
|
-
onActionClick
|
|
440
|
-
});
|
|
441
|
-
};
|
|
442
|
-
ActionItem$1.displayName = "ChatInputActionItem";
|
|
443
|
-
//#endregion
|
|
444
|
-
//#region src/react/ChatInputActions/components/useDisplayActionCount.ts
|
|
445
|
-
const useDisplayActionCount = ({ items = [], collapseOffset = 0, autoCollapse } = {}) => {
|
|
446
|
-
const { ref, width } = useWidth();
|
|
447
|
-
const [collapsed, setCollapsed] = useState(false);
|
|
448
|
-
const flatItems = useMemo(() => items.flatMap((item) => {
|
|
449
|
-
if (item.type === "collapse" && item.children) return item.children;
|
|
450
|
-
return item;
|
|
451
|
-
}).filter((item) => item.type !== "divider"), [items]);
|
|
452
|
-
const alwaysDisplayCount = useMemo(() => items.filter((item) => item.alwaysDisplay).length, [items]);
|
|
453
|
-
const rawMaxCount = useMemo(() => flatItems.length + 1, [flatItems.length]);
|
|
454
|
-
const [maxCount, setMaxCount] = useState(rawMaxCount);
|
|
455
|
-
useEffect(() => {
|
|
456
|
-
if (!autoCollapse) {
|
|
457
|
-
setCollapsed(false);
|
|
458
|
-
setMaxCount(rawMaxCount);
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
if (!width) return;
|
|
462
|
-
const atLeastCount = 1 + alwaysDisplayCount;
|
|
463
|
-
let calcMaxCount = Math.floor((width - collapseOffset) / 38);
|
|
464
|
-
if (calcMaxCount < atLeastCount) calcMaxCount = atLeastCount;
|
|
465
|
-
setCollapsed(calcMaxCount < rawMaxCount);
|
|
466
|
-
if (calcMaxCount >= rawMaxCount) return;
|
|
467
|
-
setMaxCount(calcMaxCount);
|
|
468
|
-
}, [
|
|
469
|
-
autoCollapse,
|
|
470
|
-
width,
|
|
471
|
-
rawMaxCount,
|
|
472
|
-
collapseOffset,
|
|
473
|
-
alwaysDisplayCount
|
|
474
|
-
]);
|
|
475
|
-
return useMemo(() => ({
|
|
476
|
-
collapsed,
|
|
477
|
-
maxCount,
|
|
478
|
-
ref
|
|
479
|
-
}), [
|
|
480
|
-
collapsed,
|
|
481
|
-
maxCount,
|
|
482
|
-
ref
|
|
483
|
-
]);
|
|
484
|
-
};
|
|
485
|
-
//#endregion
|
|
486
|
-
//#region src/react/ChatInputActions/ChatInputActions.tsx
|
|
487
|
-
const ChatInputActions = memo(({ gap = 2, disabled, items = [], onActionClick, className, collapseOffset = 0, autoCollapse = true, defaultGroupCollapse = false, onGroupCollapseChange, groupCollapse, ...rest }) => {
|
|
488
|
-
const [groupCollapsed, setGroupCollapsed] = useMergeState(defaultGroupCollapse, {
|
|
489
|
-
defaultValue: defaultGroupCollapse,
|
|
490
|
-
onChange: onGroupCollapseChange,
|
|
491
|
-
value: groupCollapse
|
|
492
|
-
});
|
|
493
|
-
const { ref, maxCount, collapsed } = useDisplayActionCount({
|
|
494
|
-
autoCollapse,
|
|
495
|
-
collapseOffset,
|
|
496
|
-
items
|
|
497
|
-
});
|
|
498
|
-
const calcItem = useMemo(() => {
|
|
499
|
-
if (!collapsed) return items;
|
|
500
|
-
const alwaysDisplayItems = items.filter((item) => item.alwaysDisplay);
|
|
501
|
-
const normalItems = items.filter((item) => item.type !== "collapse" && !item.alwaysDisplay);
|
|
502
|
-
const collapseItems = items.find((item) => item.type === "collapse" && item.children) || {
|
|
503
|
-
children: [],
|
|
504
|
-
type: "collapse"
|
|
505
|
-
};
|
|
506
|
-
const sliceCount = maxCount - alwaysDisplayItems.length - 1;
|
|
507
|
-
return [
|
|
508
|
-
...normalItems.slice(0, sliceCount),
|
|
509
|
-
{
|
|
510
|
-
...collapseItems,
|
|
511
|
-
children: [...normalItems.filter((item) => item.type !== "divider").slice(sliceCount), ...collapseItems.children]
|
|
512
|
-
},
|
|
513
|
-
...alwaysDisplayItems
|
|
514
|
-
].filter(Boolean);
|
|
515
|
-
}, [
|
|
516
|
-
collapsed,
|
|
517
|
-
items,
|
|
518
|
-
maxCount
|
|
519
|
-
]);
|
|
520
|
-
return /* @__PURE__ */ jsx(TooltipGroup, { children: /* @__PURE__ */ jsx(Flexbox, {
|
|
521
|
-
align: "center",
|
|
522
|
-
className: cx(styles$6.container, className),
|
|
523
|
-
flex: 1,
|
|
524
|
-
gap,
|
|
525
|
-
horizontal: true,
|
|
526
|
-
ref,
|
|
527
|
-
...rest,
|
|
528
|
-
children: calcItem.map((item, index) => /* @__PURE__ */ jsx(ActionItem$1, {
|
|
529
|
-
collapsed,
|
|
530
|
-
disabled,
|
|
531
|
-
gap,
|
|
532
|
-
groupCollapsed,
|
|
533
|
-
item,
|
|
534
|
-
onActionClick,
|
|
535
|
-
setGroupCollapsed
|
|
536
|
-
}, item.key || index))
|
|
537
|
-
}) });
|
|
538
|
-
});
|
|
539
|
-
ChatInputActions.displayName = "ChatInputActions";
|
|
540
|
-
//#endregion
|
|
541
|
-
//#region src/react/CodeLanguageSelect/style.ts
|
|
542
|
-
const styles$5 = createStaticStyles(({ css }) => ({ container: css`
|
|
543
|
-
width: 160px;
|
|
544
|
-
` }));
|
|
545
|
-
//#endregion
|
|
546
|
-
//#region src/react/CodeLanguageSelect/CodeLanguageSelect.tsx
|
|
547
|
-
const CodeLanguageSelect = ({ className, ...rest }) => {
|
|
548
|
-
const options = useMemo(() => [{
|
|
549
|
-
aliases: ["text", "txt"],
|
|
550
|
-
label: /* @__PURE__ */ jsxs(Flexbox, {
|
|
551
|
-
align: "center",
|
|
552
|
-
gap: 4,
|
|
553
|
-
horizontal: true,
|
|
554
|
-
children: [/* @__PURE__ */ jsx(MaterialFileTypeIcon, {
|
|
555
|
-
fallbackUnknownType: false,
|
|
556
|
-
filename: `*.txt`,
|
|
557
|
-
size: 18,
|
|
558
|
-
type: "file",
|
|
559
|
-
variant: "raw"
|
|
560
|
-
}), /* @__PURE__ */ jsx(Text, {
|
|
561
|
-
ellipsis: true,
|
|
562
|
-
fontSize: 13,
|
|
563
|
-
children: "Plaintext"
|
|
564
|
-
})]
|
|
565
|
-
}),
|
|
566
|
-
value: "plaintext"
|
|
567
|
-
}, ...bundledLanguagesInfo.map((item) => ({
|
|
568
|
-
aliases: item.aliases,
|
|
569
|
-
label: /* @__PURE__ */ jsxs(Flexbox, {
|
|
570
|
-
align: "center",
|
|
571
|
-
gap: 4,
|
|
572
|
-
horizontal: true,
|
|
573
|
-
children: [/* @__PURE__ */ jsx(MaterialFileTypeIcon, {
|
|
574
|
-
fallbackUnknownType: false,
|
|
575
|
-
filename: `*.${item?.aliases?.[0] || item.id}`,
|
|
576
|
-
size: 18,
|
|
577
|
-
type: "file",
|
|
578
|
-
variant: "raw"
|
|
579
|
-
}), /* @__PURE__ */ jsx(Text, {
|
|
580
|
-
ellipsis: true,
|
|
581
|
-
fontSize: 13,
|
|
582
|
-
children: item.name
|
|
583
|
-
})]
|
|
584
|
-
}),
|
|
585
|
-
title: (item.aliases || [item.id]).filter(Boolean).map((item) => `*.${item}`).join(","),
|
|
586
|
-
value: item.id
|
|
587
|
-
}))], []);
|
|
588
|
-
return /* @__PURE__ */ jsx(Select, {
|
|
589
|
-
className: cx(styles$5.container, className),
|
|
590
|
-
defaultValue: "plaintext",
|
|
591
|
-
filterOption: (input, option) => {
|
|
592
|
-
const lang = input.toLowerCase();
|
|
593
|
-
if ((option?.value)?.startsWith(lang)) return true;
|
|
594
|
-
if (option?.aliases?.some((item) => item.startsWith(lang))) return true;
|
|
595
|
-
return false;
|
|
596
|
-
},
|
|
597
|
-
options,
|
|
598
|
-
showSearch: true,
|
|
599
|
-
variant: "filled",
|
|
600
|
-
...rest
|
|
601
|
-
});
|
|
602
|
-
};
|
|
603
|
-
CodeLanguageSelect.displayName = "CodeLanguageSelect";
|
|
604
|
-
//#endregion
|
|
605
|
-
//#region src/react/hooks/useEditor.ts
|
|
606
|
-
const useEditor = () => {
|
|
607
|
-
return useMemo(() => Editor$2.createEditor(), []);
|
|
608
|
-
};
|
|
609
|
-
//#endregion
|
|
610
|
-
//#region src/react/hooks/useEditorState/utils.ts
|
|
611
|
-
init_utils();
|
|
612
|
-
const $findTopLevelElement = (node) => {
|
|
613
|
-
let topLevelElement = node.getKey() === "root" ? node : $findMatchingParent(node, (e) => {
|
|
614
|
-
const parent = e.getParent();
|
|
615
|
-
return parent !== null && $isRootOrShadowRoot(parent);
|
|
616
|
-
});
|
|
617
|
-
if (topLevelElement === null) topLevelElement = node.getTopLevelElementOrThrow();
|
|
618
|
-
return topLevelElement;
|
|
619
|
-
};
|
|
620
|
-
const formatParagraph = (editor) => {
|
|
621
|
-
editor?.update(() => {
|
|
622
|
-
$setBlocksType($getSelection(), () => $createParagraphNode());
|
|
623
|
-
});
|
|
624
|
-
};
|
|
625
|
-
const getSelectedNode = (selection) => {
|
|
626
|
-
const anchor = selection.anchor;
|
|
627
|
-
const focus = selection.focus;
|
|
628
|
-
const anchorNode = selection.anchor.getNode();
|
|
629
|
-
const focusNode = selection.focus.getNode();
|
|
630
|
-
if (anchorNode === focusNode) return anchorNode;
|
|
631
|
-
if (selection.isBackward()) return $isAtNodeEnd(focus) ? anchorNode : focusNode;
|
|
632
|
-
else return $isAtNodeEnd(anchor) ? anchorNode : focusNode;
|
|
633
|
-
};
|
|
634
|
-
//#endregion
|
|
635
|
-
//#region src/react/hooks/useEditorState/index.ts
|
|
636
|
-
/**
|
|
637
|
-
* Provide toolbar state and toolbar methods
|
|
638
|
-
* @param editor - Editor instance
|
|
639
|
-
* @returns Editor state and methods for toolbar functionality
|
|
640
|
-
*/
|
|
641
|
-
function useEditorState(editor) {
|
|
642
|
-
const [canUndo, setCanUndo] = useState(false);
|
|
643
|
-
const [canRedo, setCanRedo] = useState(false);
|
|
644
|
-
const [editable, setEditable] = useState(editor?.isEditable() ?? true);
|
|
645
|
-
const [isBold, setIsBold] = useState(false);
|
|
646
|
-
const [isItalic, setIsItalic] = useState(false);
|
|
647
|
-
const [isUnderline, setIsUnderline] = useState(false);
|
|
648
|
-
const [isStrikethrough, setIsStrikethrough] = useState(false);
|
|
649
|
-
const [isSubscript, setIsSubscript] = useState(false);
|
|
650
|
-
const [isSuperscript, setIsSuperscript] = useState(false);
|
|
651
|
-
const [isCode, setIsCode] = useState(false);
|
|
652
|
-
const [isLink, setIsLink] = useState(false);
|
|
653
|
-
const [isCodeblock, setIsInCodeblok] = useState(false);
|
|
654
|
-
const [isBlockquote, setIsInBlockquote] = useState(false);
|
|
655
|
-
const [codeblockLang, setCodeblockLang] = useState(null);
|
|
656
|
-
const [isEmpty, setIsEmpty] = useState(true);
|
|
657
|
-
const [isSelected, setIsSelected] = useState(false);
|
|
658
|
-
const [blockType, setBlockType] = useState(null);
|
|
659
|
-
const $handleHeadingNode = useCallback((selectedElement) => {
|
|
660
|
-
setBlockType($isHeadingNode(selectedElement) ? selectedElement.getTag() : selectedElement.getType());
|
|
661
|
-
}, [setBlockType]);
|
|
662
|
-
const $updateToolbar = useCallback(() => {
|
|
663
|
-
const selection = $getSelection();
|
|
664
|
-
const lexicalEditor = editor?.getLexicalEditor();
|
|
665
|
-
setIsSelected(false);
|
|
666
|
-
setEditable(editor?.isEditable() ?? true);
|
|
667
|
-
if (lexicalEditor) setIsEmpty($isRootTextContentEmpty(lexicalEditor.isComposing(), false));
|
|
668
|
-
if ($isRangeSelection(selection)) {
|
|
669
|
-
setIsSelected(!!selection._cachedNodes);
|
|
670
|
-
setIsBold(selection.hasFormat("bold"));
|
|
671
|
-
setIsItalic(selection.hasFormat("italic"));
|
|
672
|
-
setIsUnderline(selection.hasFormat("underline"));
|
|
673
|
-
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
674
|
-
setIsSubscript(selection.hasFormat("subscript"));
|
|
675
|
-
setIsSuperscript(selection.hasFormat("superscript"));
|
|
676
|
-
setIsCode($isSelectionInCodeInline(lexicalEditor));
|
|
677
|
-
const anchorNode = selection.anchor.getNode();
|
|
678
|
-
const focusNode = selection.focus.getNode();
|
|
679
|
-
const element = $findTopLevelElement(anchorNode);
|
|
680
|
-
const focusElement = $findTopLevelElement(focusNode);
|
|
681
|
-
const elementKey = element.getKey();
|
|
682
|
-
const elementDOM = editor?.getLexicalEditor()?.getElementByKey(elementKey);
|
|
683
|
-
const node = getSelectedNode(selection);
|
|
684
|
-
const parent = node.getParent();
|
|
685
|
-
setIsLink($isLinkNode(parent) || $isLinkNode(node) || $isLinkHighlightNode(parent) || $isLinkHighlightNode(node));
|
|
686
|
-
const isLexicalCodeBlock = $isCodeNode(element) && $isCodeNode(focusElement) && elementKey === focusElement.getKey();
|
|
687
|
-
const isCodeMirrorBlock = $isCodeMirrorNode(element) && $isCodeMirrorNode(focusElement) && elementKey === focusElement.getKey();
|
|
688
|
-
setIsInCodeblok(isLexicalCodeBlock || isCodeMirrorBlock);
|
|
689
|
-
if (isLexicalCodeBlock) setCodeblockLang(element.getLanguage());
|
|
690
|
-
else if (isCodeMirrorBlock) setCodeblockLang(element.lang);
|
|
691
|
-
else setCodeblockLang("");
|
|
692
|
-
setIsInBlockquote($isQuoteNode(element) && $isQuoteNode(focusElement) && elementKey === focusElement.getKey());
|
|
693
|
-
if (elementDOM !== null) if ($isListNode(element)) {
|
|
694
|
-
const parentList = $getNearestNodeOfType(anchorNode, ListNode);
|
|
695
|
-
setBlockType(parentList ? parentList.getListType() : element.getListType());
|
|
696
|
-
} else $handleHeadingNode(element);
|
|
697
|
-
} else if (!selection) {
|
|
698
|
-
setIsSelected(false);
|
|
699
|
-
setIsBold(false);
|
|
700
|
-
setIsItalic(false);
|
|
701
|
-
setIsUnderline(false);
|
|
702
|
-
setIsStrikethrough(false);
|
|
703
|
-
setIsSubscript(false);
|
|
704
|
-
setIsSuperscript(false);
|
|
705
|
-
setIsCode(false);
|
|
706
|
-
setIsLink(false);
|
|
707
|
-
setIsInCodeblok(false);
|
|
708
|
-
setIsInBlockquote(false);
|
|
709
|
-
setCodeblockLang(null);
|
|
710
|
-
setBlockType(null);
|
|
711
|
-
}
|
|
712
|
-
}, [editor]);
|
|
713
|
-
const undo = useCallback(() => {
|
|
714
|
-
editor?.dispatchCommand(UNDO_COMMAND, void 0);
|
|
715
|
-
}, [editor]);
|
|
716
|
-
const redo = useCallback(() => {
|
|
717
|
-
editor?.dispatchCommand(REDO_COMMAND, void 0);
|
|
718
|
-
}, [editor]);
|
|
719
|
-
const formatText = useCallback((type) => {
|
|
720
|
-
editor?.dispatchCommand(FORMAT_TEXT_COMMAND, type);
|
|
721
|
-
}, [editor]);
|
|
722
|
-
const bold = useCallback(() => {
|
|
723
|
-
formatText("bold");
|
|
724
|
-
}, [formatText]);
|
|
725
|
-
const underline = useCallback(() => {
|
|
726
|
-
formatText("underline");
|
|
727
|
-
}, [formatText]);
|
|
728
|
-
const strikethrough = useCallback(() => {
|
|
729
|
-
formatText("strikethrough");
|
|
730
|
-
}, [formatText]);
|
|
731
|
-
const italic = useCallback(() => {
|
|
732
|
-
formatText("italic");
|
|
733
|
-
}, [formatText]);
|
|
734
|
-
const subscript = useCallback(() => {
|
|
735
|
-
formatText("subscript");
|
|
736
|
-
}, [formatText]);
|
|
737
|
-
const superscript = useCallback(() => {
|
|
738
|
-
formatText("superscript");
|
|
739
|
-
}, [formatText]);
|
|
740
|
-
const code = useCallback(() => {
|
|
741
|
-
editor?.dispatchCommand(INSERT_CODEINLINE_COMMAND, void 0);
|
|
742
|
-
}, [formatText]);
|
|
743
|
-
const bulletList = useCallback(() => {
|
|
744
|
-
if (blockType !== "bullet") editor?.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, void 0);
|
|
745
|
-
else formatParagraph(editor?.getLexicalEditor());
|
|
746
|
-
}, [blockType, editor]);
|
|
747
|
-
const numberList = useCallback(() => {
|
|
748
|
-
if (blockType !== "number") editor?.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
749
|
-
else formatParagraph(editor?.getLexicalEditor());
|
|
750
|
-
}, [blockType, editor]);
|
|
751
|
-
const checkList = useCallback(() => {
|
|
752
|
-
if (blockType !== "check") editor?.dispatchCommand(INSERT_CHECK_LIST_COMMAND, void 0);
|
|
753
|
-
else formatParagraph(editor?.getLexicalEditor());
|
|
754
|
-
}, [blockType, editor]);
|
|
755
|
-
const codeblock = useCallback(() => {
|
|
756
|
-
if (blockType !== "code") editor?.getLexicalEditor()?.update(() => {
|
|
757
|
-
let selection = $getSelection();
|
|
758
|
-
if (!selection) return;
|
|
759
|
-
const lexicalEditor = editor?.getLexicalEditor();
|
|
760
|
-
if (lexicalEditor ? lexicalEditor._nodes.has("code") && lexicalEditor._nodes.get("code")?.klass.name === "CodeMirrorNode" : false) if (!$isRangeSelection(selection) || selection.isCollapsed()) {
|
|
761
|
-
const codeMirrorNode = $createCodeMirrorNode("plain", selection.getTextContent());
|
|
762
|
-
const nodeSelection = $createNodeSelection();
|
|
763
|
-
nodeSelection.add(codeMirrorNode.getKey());
|
|
764
|
-
selection.insertNodes([codeMirrorNode]);
|
|
765
|
-
$setSelection(nodeSelection);
|
|
766
|
-
} else {
|
|
767
|
-
const codeMirrorNode = $createCodeMirrorNode("plain", selection.getTextContent());
|
|
768
|
-
selection.insertNodes([codeMirrorNode]);
|
|
769
|
-
const nodeSelection = $createNodeSelection();
|
|
770
|
-
nodeSelection.add(codeMirrorNode.getKey());
|
|
771
|
-
$setSelection(nodeSelection);
|
|
772
|
-
}
|
|
773
|
-
else if (!$isRangeSelection(selection) || selection.isCollapsed()) $setBlocksType(selection, () => $createCodeNode());
|
|
774
|
-
else {
|
|
775
|
-
const textContent = selection.getTextContent();
|
|
776
|
-
const codeNode = $createCodeNode();
|
|
777
|
-
selection.insertNodes([codeNode]);
|
|
778
|
-
selection = $getSelection();
|
|
779
|
-
if ($isRangeSelection(selection)) selection.insertRawText(textContent);
|
|
780
|
-
}
|
|
781
|
-
});
|
|
782
|
-
else formatParagraph(editor?.getLexicalEditor());
|
|
783
|
-
}, [blockType, editor]);
|
|
784
|
-
const blockquote = useCallback(() => {
|
|
785
|
-
if (blockType !== "quote") editor?.getLexicalEditor()?.update(() => {
|
|
786
|
-
const selection = $getSelection();
|
|
787
|
-
if ($isRangeSelection(selection)) $setBlocksType(selection, () => $createQuoteNode());
|
|
788
|
-
});
|
|
789
|
-
else formatParagraph(editor?.getLexicalEditor());
|
|
790
|
-
}, [blockType, editor]);
|
|
791
|
-
const updateCodeblockLang = useCallback((lang) => {
|
|
792
|
-
if (!isCodeblock) return;
|
|
793
|
-
editor?.dispatchCommand(UPDATE_CODEBLOCK_LANG, { lang });
|
|
794
|
-
}, [editor, isCodeblock]);
|
|
795
|
-
const insertLink = useCallback(() => {
|
|
796
|
-
const lexical = editor?.getLexicalEditor();
|
|
797
|
-
if (!lexical) return;
|
|
798
|
-
let inLinkNode = false;
|
|
799
|
-
let inLinkHighlightNode = false;
|
|
800
|
-
lexical.getEditorState().read(() => {
|
|
801
|
-
const selection = $getSelection();
|
|
802
|
-
if ($isRangeSelection(selection)) {
|
|
803
|
-
const node = getSelectedNode(selection);
|
|
804
|
-
const parent = node.getParent();
|
|
805
|
-
if ($isLinkNode(parent) || $isLinkNode(node)) inLinkNode = true;
|
|
806
|
-
if ($isLinkHighlightNode(parent) || $isLinkHighlightNode(node)) inLinkHighlightNode = true;
|
|
807
|
-
}
|
|
808
|
-
});
|
|
809
|
-
if (inLinkHighlightNode) {
|
|
810
|
-
lexical.dispatchCommand(INSERT_LINK_HIGHLIGHT_COMMAND, void 0);
|
|
811
|
-
setIsLink(false);
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
if (inLinkNode) {
|
|
815
|
-
setIsLink(false);
|
|
816
|
-
lexical.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
if (!isLink) {
|
|
820
|
-
if (lexical.dispatchCommand(INSERT_LINK_HIGHLIGHT_COMMAND, void 0)) {
|
|
821
|
-
setIsLink(true);
|
|
822
|
-
return;
|
|
823
|
-
}
|
|
824
|
-
let nextUrl = sanitizeUrl("https://");
|
|
825
|
-
let expandTo = null;
|
|
826
|
-
lexical.getEditorState().read(() => {
|
|
827
|
-
const selection = $getSelection();
|
|
828
|
-
if ($isRangeSelection(selection)) {
|
|
829
|
-
const text = selection.getTextContent();
|
|
830
|
-
if (!selection.isCollapsed()) {
|
|
831
|
-
const maybeUrl = formatUrl(text.trim());
|
|
832
|
-
if (validateUrl(maybeUrl)) nextUrl = maybeUrl;
|
|
833
|
-
} else {
|
|
834
|
-
const found = extractUrlFromText(selection.anchor.getNode().getTextContent());
|
|
835
|
-
if (found && validateUrl(formatUrl(found.url))) expandTo = {
|
|
836
|
-
index: found.index,
|
|
837
|
-
length: found.length
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
setIsLink(true);
|
|
843
|
-
lexical.update(() => {
|
|
844
|
-
if (expandTo) {
|
|
845
|
-
const selection = $getSelection();
|
|
846
|
-
if ($isRangeSelection(selection)) {
|
|
847
|
-
const anchorNode = selection.anchor.getNode();
|
|
848
|
-
selection.anchor.set(anchorNode.getKey(), expandTo.index, "text");
|
|
849
|
-
selection.focus.set(anchorNode.getKey(), expandTo.index + expandTo.length, "text");
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
lexical.dispatchCommand(TOGGLE_LINK_COMMAND, validateUrl(nextUrl) ? nextUrl : sanitizeUrl("https://"));
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
}, [editor, isLink]);
|
|
856
|
-
const insertMath = useCallback(() => {
|
|
857
|
-
editor?.getLexicalEditor()?.update(() => {
|
|
858
|
-
const selection = $getSelection();
|
|
859
|
-
if ($isRangeSelection(selection)) {
|
|
860
|
-
const element = $findTopLevelElement(selection.anchor.getNode());
|
|
861
|
-
const mathNode = $isParagraphNode(element) && selection.isCollapsed() && selection.anchor.offset === 0 && element.getTextContentSize() === 0 || !selection.isCollapsed() && selection.anchor.offset === 0 && selection.focus.offset === element.getTextContentSize() ? $createMathBlockNode("") : $createMathInlineNode("");
|
|
862
|
-
selection.insertNodes([mathNode]);
|
|
863
|
-
const nodeSelection = $createNodeSelection();
|
|
864
|
-
nodeSelection.add(mathNode.getKey());
|
|
865
|
-
$setSelection(nodeSelection);
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
|
-
}, [editor]);
|
|
869
|
-
useEffect(() => {
|
|
870
|
-
if (!editor) return;
|
|
871
|
-
const lexicalEditor = editor.getLexicalEditor();
|
|
872
|
-
let cleanup = noop;
|
|
873
|
-
const debounceUpdate = debounce(() => {
|
|
874
|
-
lexicalEditor?.read(() => {
|
|
875
|
-
$updateToolbar();
|
|
876
|
-
});
|
|
877
|
-
}, 500);
|
|
878
|
-
const handleLexicalEditor = (lexicalEditor) => {
|
|
879
|
-
cleanup = mergeRegister(lexicalEditor.registerUpdateListener(debounce(({ editorState }) => {
|
|
880
|
-
editorState.read(() => {
|
|
881
|
-
$updateToolbar();
|
|
882
|
-
});
|
|
883
|
-
}, 500)), lexicalEditor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
884
|
-
if (lexicalEditor.isComposing()) return false;
|
|
885
|
-
debounceUpdate();
|
|
886
|
-
return false;
|
|
887
|
-
}, COMMAND_PRIORITY_LOW), lexicalEditor.registerCommand(CAN_UNDO_COMMAND, (payload) => {
|
|
888
|
-
setCanUndo(payload);
|
|
889
|
-
return false;
|
|
890
|
-
}, COMMAND_PRIORITY_LOW), lexicalEditor.registerCommand(CAN_REDO_COMMAND, (payload) => {
|
|
891
|
-
setCanRedo(payload);
|
|
892
|
-
return false;
|
|
893
|
-
}, COMMAND_PRIORITY_LOW));
|
|
894
|
-
return cleanup;
|
|
895
|
-
};
|
|
896
|
-
if (!lexicalEditor) {
|
|
897
|
-
editor.on("initialized", handleLexicalEditor);
|
|
898
|
-
return () => {
|
|
899
|
-
cleanup();
|
|
900
|
-
editor.off("initialized", handleLexicalEditor);
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
return handleLexicalEditor(lexicalEditor);
|
|
904
|
-
}, [editor, $updateToolbar]);
|
|
905
|
-
return useMemo(() => ({
|
|
906
|
-
blockType,
|
|
907
|
-
blockquote,
|
|
908
|
-
bold,
|
|
909
|
-
bulletList,
|
|
910
|
-
canRedo,
|
|
911
|
-
canUndo,
|
|
912
|
-
checkList,
|
|
913
|
-
code,
|
|
914
|
-
codeblock,
|
|
915
|
-
codeblockLang,
|
|
916
|
-
editable,
|
|
917
|
-
insertLink,
|
|
918
|
-
insertMath,
|
|
919
|
-
isBlockquote,
|
|
920
|
-
isBold,
|
|
921
|
-
isCode,
|
|
922
|
-
isCodeblock,
|
|
923
|
-
isEmpty,
|
|
924
|
-
isItalic,
|
|
925
|
-
isSelected,
|
|
926
|
-
isStrikethrough,
|
|
927
|
-
isSubscript,
|
|
928
|
-
isSuperscript,
|
|
929
|
-
isUnderline,
|
|
930
|
-
italic,
|
|
931
|
-
numberList,
|
|
932
|
-
redo,
|
|
933
|
-
strikethrough,
|
|
934
|
-
subscript,
|
|
935
|
-
superscript,
|
|
936
|
-
underline,
|
|
937
|
-
undo,
|
|
938
|
-
updateCodeblockLang
|
|
939
|
-
}), [
|
|
940
|
-
blockType,
|
|
941
|
-
canRedo,
|
|
942
|
-
canUndo,
|
|
943
|
-
codeblockLang,
|
|
944
|
-
isBold,
|
|
945
|
-
isCode,
|
|
946
|
-
isEmpty,
|
|
947
|
-
isBlockquote,
|
|
948
|
-
isCodeblock,
|
|
949
|
-
isItalic,
|
|
950
|
-
isSelected,
|
|
951
|
-
isStrikethrough,
|
|
952
|
-
isUnderline,
|
|
953
|
-
isSubscript,
|
|
954
|
-
isSuperscript,
|
|
955
|
-
italic
|
|
956
|
-
]);
|
|
957
|
-
}
|
|
958
|
-
//#endregion
|
|
959
|
-
//#region src/react/EditorProvider/index.tsx
|
|
960
|
-
const EditorContext = createContext({ config: {} });
|
|
961
|
-
const EditorProvider = ({ children, config = {} }) => {
|
|
962
|
-
const value = useMemo(() => ({ config }), [config]);
|
|
963
|
-
return /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
964
|
-
value,
|
|
965
|
-
children
|
|
966
|
-
});
|
|
967
|
-
};
|
|
968
|
-
const useEditorContent = () => {
|
|
969
|
-
return use(EditorContext);
|
|
970
|
-
};
|
|
971
|
-
EditorProvider.displayName = "EditorProvider";
|
|
972
|
-
//#endregion
|
|
973
|
-
//#region src/react/Editor/Editor.tsx
|
|
974
|
-
const Editor$1 = memo(({ content, style, className, debounceWait = 100, editable, editor, onInit, onChange, placeholder, lineEmptyPlaceholder, plugins = [], slashOption = {}, slashPlacement, getPopupContainer, mentionOption = {}, variant, onKeyDown, children, type = "json", onPressEnter, onFocus, onBlur, autoFocus, enablePasteMarkdown = true, autoFormatMarkdown = true, markdownOption = true, pasteMarkdownAutoConvertThreshold, pasteAsPlainText = false, pasteVSCodeAsCodeBlock = true, onCompositionStart, onCompositionEnd, onContextMenu, onTextChange }) => {
|
|
975
|
-
const { config } = useEditorContent();
|
|
976
|
-
const enableSlash = Boolean(slashOption?.items && slashOption.items.length > 0);
|
|
977
|
-
const enableMention = Boolean(mentionOption?.items && mentionOption.items.length > 0);
|
|
978
|
-
const { markdownWriter, ...restMentionOption } = mentionOption;
|
|
979
|
-
const debouncedOnChange = useMemo(() => onChange ? debounce(onChange, debounceWait) : void 0, [onChange, debounceWait]);
|
|
980
|
-
const debouncedOnTextChange = useMemo(() => onTextChange ? debounce(onTextChange, debounceWait) : void 0, [onTextChange, debounceWait]);
|
|
981
|
-
const memoPlugins = useMemo(() => [enablePasteMarkdown && autoFormatMarkdown && ReactMarkdownPlugin, ...plugins].filter(Boolean).map((plugin, index) => {
|
|
982
|
-
if (typeof plugin === "function") return createElement(plugin, { key: index });
|
|
983
|
-
return createElement(plugin[0], {
|
|
984
|
-
key: index,
|
|
985
|
-
...plugin[1]
|
|
986
|
-
});
|
|
987
|
-
}), [
|
|
988
|
-
plugins,
|
|
989
|
-
enablePasteMarkdown,
|
|
990
|
-
autoFormatMarkdown,
|
|
991
|
-
ReactMarkdownPlugin
|
|
992
|
-
]);
|
|
993
|
-
const memoMention = useMemo(() => {
|
|
994
|
-
if (!enableMention) return;
|
|
995
|
-
return /* @__PURE__ */ jsx(ReactMentionPlugin, {
|
|
996
|
-
className,
|
|
997
|
-
markdownWriter
|
|
998
|
-
});
|
|
999
|
-
}, [
|
|
1000
|
-
enableMention,
|
|
1001
|
-
markdownWriter,
|
|
1002
|
-
className
|
|
1003
|
-
]);
|
|
1004
|
-
return /* @__PURE__ */ jsxs(ReactEditor, {
|
|
1005
|
-
config,
|
|
1006
|
-
editor,
|
|
1007
|
-
onInit,
|
|
1008
|
-
children: [
|
|
1009
|
-
memoPlugins,
|
|
1010
|
-
useMemo(() => {
|
|
1011
|
-
if (!enableSlash && !enableMention) return null;
|
|
1012
|
-
return /* @__PURE__ */ jsxs(ReactSlashPlugin, {
|
|
1013
|
-
getPopupContainer,
|
|
1014
|
-
placement: slashPlacement,
|
|
1015
|
-
children: [enableSlash ? /* @__PURE__ */ jsx(ReactSlashOption, {
|
|
1016
|
-
maxLength: 8,
|
|
1017
|
-
trigger: "/",
|
|
1018
|
-
...slashOption
|
|
1019
|
-
}) : void 0, enableMention ? /* @__PURE__ */ jsx(ReactSlashOption, {
|
|
1020
|
-
maxLength: 8,
|
|
1021
|
-
trigger: "@",
|
|
1022
|
-
...restMentionOption
|
|
1023
|
-
}) : void 0]
|
|
1024
|
-
});
|
|
1025
|
-
}, [
|
|
1026
|
-
enableSlash,
|
|
1027
|
-
enableMention,
|
|
1028
|
-
slashOption,
|
|
1029
|
-
slashPlacement,
|
|
1030
|
-
getPopupContainer,
|
|
1031
|
-
restMentionOption
|
|
1032
|
-
]),
|
|
1033
|
-
memoMention,
|
|
1034
|
-
/* @__PURE__ */ jsx(ReactPlainText, {
|
|
1035
|
-
autoFocus,
|
|
1036
|
-
autoFormatMarkdown,
|
|
1037
|
-
className,
|
|
1038
|
-
editable,
|
|
1039
|
-
enablePasteMarkdown,
|
|
1040
|
-
markdownOption,
|
|
1041
|
-
onBlur,
|
|
1042
|
-
onChange: debouncedOnChange,
|
|
1043
|
-
onCompositionEnd,
|
|
1044
|
-
onCompositionStart,
|
|
1045
|
-
onContextMenu,
|
|
1046
|
-
onFocus,
|
|
1047
|
-
onKeyDown,
|
|
1048
|
-
onPressEnter,
|
|
1049
|
-
onTextChange: debouncedOnTextChange,
|
|
1050
|
-
pasteAsPlainText,
|
|
1051
|
-
pasteMarkdownAutoConvertThreshold,
|
|
1052
|
-
pasteVSCodeAsCodeBlock,
|
|
1053
|
-
style,
|
|
1054
|
-
variant,
|
|
1055
|
-
children: /* @__PURE__ */ jsx(ReactEditorContent, {
|
|
1056
|
-
content,
|
|
1057
|
-
lineEmptyPlaceholder,
|
|
1058
|
-
placeholder,
|
|
1059
|
-
type
|
|
1060
|
-
})
|
|
1061
|
-
}),
|
|
1062
|
-
children
|
|
1063
|
-
]
|
|
1064
|
-
});
|
|
1065
|
-
});
|
|
1066
|
-
Editor$1.displayName = "Editor";
|
|
1067
|
-
//#endregion
|
|
1068
|
-
//#region src/react/Editor/utils.ts
|
|
1069
|
-
function withProps(plugin, props) {
|
|
1070
|
-
return [plugin, props];
|
|
1071
|
-
}
|
|
1072
|
-
//#endregion
|
|
1073
|
-
//#region src/react/Editor/index.ts
|
|
1074
|
-
const Editor = Editor$1;
|
|
1075
|
-
Editor.useEditor = useEditor;
|
|
1076
|
-
Editor.useEditorState = useEditorState;
|
|
1077
|
-
Editor.withProps = withProps;
|
|
1078
|
-
//#endregion
|
|
1079
|
-
//#region src/react/FloatActions/style.ts
|
|
1080
|
-
const styles$4 = createStaticStyles(({ css }) => ({
|
|
1081
|
-
collapsedContainer: css`
|
|
1082
|
-
overflow: hidden;
|
|
1083
|
-
display: flex;
|
|
1084
|
-
align-items: center;
|
|
1085
|
-
`,
|
|
1086
|
-
container: css`
|
|
1087
|
-
position: relative;
|
|
1088
|
-
width: 100%;
|
|
1089
|
-
`,
|
|
1090
|
-
divider: css`
|
|
1091
|
-
height: 20px;
|
|
1092
|
-
margin-inline: 4px;
|
|
1093
|
-
`
|
|
1094
|
-
}));
|
|
1095
|
-
//#endregion
|
|
1096
|
-
//#region src/react/FloatActions/components/ActionRender.tsx
|
|
1097
|
-
const ActionRender = ({ item, onActionClick, disabled }) => {
|
|
1098
|
-
if (item.type === "divider") return /* @__PURE__ */ jsx(Divider, {
|
|
1099
|
-
className: styles$4.divider,
|
|
1100
|
-
orientation: "vertical"
|
|
1101
|
-
});
|
|
1102
|
-
const { wrapper, icon, key, label, onClick, danger, loading, active, tooltipProps, ...itemRest } = item;
|
|
1103
|
-
if (item.children && isValidElement(item.children)) {
|
|
1104
|
-
if (!wrapper) return item.children;
|
|
1105
|
-
return wrapper(item.children);
|
|
1106
|
-
}
|
|
1107
|
-
const action = /* @__PURE__ */ jsx(ActionIcon, {
|
|
1108
|
-
active,
|
|
1109
|
-
danger,
|
|
1110
|
-
disabled: disabled || loading || itemRest?.disabled,
|
|
1111
|
-
icon,
|
|
1112
|
-
loading,
|
|
1113
|
-
onClick: (e) => {
|
|
1114
|
-
onActionClick?.({
|
|
1115
|
-
domEvent: e,
|
|
1116
|
-
key: String(key),
|
|
1117
|
-
keyPath: [String(key)]
|
|
1118
|
-
});
|
|
1119
|
-
onClick?.(e);
|
|
1120
|
-
},
|
|
1121
|
-
size: {
|
|
1122
|
-
blockSize: 36,
|
|
1123
|
-
size: 20
|
|
1124
|
-
},
|
|
1125
|
-
title: label,
|
|
1126
|
-
tooltipProps: {
|
|
1127
|
-
placement: "top",
|
|
1128
|
-
...tooltipProps
|
|
1129
|
-
}
|
|
1130
|
-
});
|
|
1131
|
-
if (!wrapper) return action;
|
|
1132
|
-
return wrapper(action);
|
|
1133
|
-
};
|
|
1134
|
-
//#endregion
|
|
1135
|
-
//#region src/react/FloatActions/components/CollapsedActions.tsx
|
|
1136
|
-
const CollapsedActions = ({ children, groupCollapse = false, onGroupCollapseChange, gap, mode }) => {
|
|
1137
|
-
const Motion = useMotionComponent();
|
|
1138
|
-
if (mode === "popup") return /* @__PURE__ */ jsx(Popover, {
|
|
1139
|
-
arrow: false,
|
|
1140
|
-
content: /* @__PURE__ */ jsx(Flexbox, {
|
|
1141
|
-
align: "center",
|
|
1142
|
-
gap,
|
|
1143
|
-
horizontal: true,
|
|
1144
|
-
children
|
|
1145
|
-
}),
|
|
1146
|
-
styles: { content: { padding: 4 } },
|
|
1147
|
-
children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
1148
|
-
icon: CircleChevronUpIcon,
|
|
1149
|
-
size: {
|
|
1150
|
-
blockSize: 36,
|
|
1151
|
-
size: 20
|
|
1152
|
-
}
|
|
1153
|
-
})
|
|
1154
|
-
});
|
|
1155
|
-
return /* @__PURE__ */ jsxs(Flexbox, {
|
|
1156
|
-
align: "center",
|
|
1157
|
-
flex: "none",
|
|
1158
|
-
gap,
|
|
1159
|
-
horizontal: true,
|
|
1160
|
-
children: [/* @__PURE__ */ jsx(Motion.div, {
|
|
1161
|
-
animate: groupCollapse ? "closed" : "open",
|
|
1162
|
-
className: styles$4.collapsedContainer,
|
|
1163
|
-
initial: groupCollapse ? "closed" : "open",
|
|
1164
|
-
style: { gap },
|
|
1165
|
-
transition: { duration: .2 },
|
|
1166
|
-
variants: {
|
|
1167
|
-
closed: {
|
|
1168
|
-
opacity: 0,
|
|
1169
|
-
width: 0
|
|
1170
|
-
},
|
|
1171
|
-
open: {
|
|
1172
|
-
opacity: 1,
|
|
1173
|
-
width: "auto"
|
|
1174
|
-
}
|
|
1175
|
-
},
|
|
1176
|
-
children
|
|
1177
|
-
}), /* @__PURE__ */ jsx(ActionIcon, {
|
|
1178
|
-
icon: groupCollapse ? CircleChevronRightIcon : CircleChevronLeftIcon,
|
|
1179
|
-
onClick: () => onGroupCollapseChange?.(!groupCollapse),
|
|
1180
|
-
size: {
|
|
1181
|
-
blockSize: 36,
|
|
1182
|
-
size: 20
|
|
1183
|
-
}
|
|
1184
|
-
})]
|
|
1185
|
-
});
|
|
1186
|
-
};
|
|
1187
|
-
CollapsedActions.displayName = "FloatActionsCollapse";
|
|
1188
|
-
//#endregion
|
|
1189
|
-
//#region src/react/FloatActions/components/ActionItem.tsx
|
|
1190
|
-
const ActionItem = ({ item, disabled, onActionClick, groupCollapsed, gap, setGroupCollapsed }) => {
|
|
1191
|
-
if (item.type === "collapse") return /* @__PURE__ */ jsx(CollapsedActions, {
|
|
1192
|
-
gap,
|
|
1193
|
-
groupCollapse: groupCollapsed,
|
|
1194
|
-
mode: "default",
|
|
1195
|
-
onGroupCollapseChange: setGroupCollapsed,
|
|
1196
|
-
children: item.children.map((child, childIndex) => /* @__PURE__ */ jsx(ActionRender, {
|
|
1197
|
-
disabled,
|
|
1198
|
-
item: child,
|
|
1199
|
-
onActionClick
|
|
1200
|
-
}, child?.key || `action-${childIndex}`))
|
|
1201
|
-
});
|
|
1202
|
-
if (item.type === "dropdown") return /* @__PURE__ */ jsx(Dropdown, {
|
|
1203
|
-
menu: { items: item.children },
|
|
1204
|
-
children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
1205
|
-
active: item.active,
|
|
1206
|
-
danger: item.danger,
|
|
1207
|
-
disabled: disabled || item.loading || item?.disabled,
|
|
1208
|
-
icon: item.icon,
|
|
1209
|
-
loading: item.loading,
|
|
1210
|
-
size: {
|
|
1211
|
-
blockSize: 36,
|
|
1212
|
-
size: 20
|
|
1213
|
-
},
|
|
1214
|
-
title: item.label,
|
|
1215
|
-
tooltipProps: {
|
|
1216
|
-
placement: "top",
|
|
1217
|
-
...item.tooltipProps
|
|
1218
|
-
}
|
|
1219
|
-
})
|
|
1220
|
-
}, item.key);
|
|
1221
|
-
return /* @__PURE__ */ jsx(ActionRender, {
|
|
1222
|
-
disabled,
|
|
1223
|
-
item,
|
|
1224
|
-
onActionClick
|
|
1225
|
-
});
|
|
1226
|
-
};
|
|
1227
|
-
ActionItem.displayName = "FloatActionsItem";
|
|
1228
|
-
//#endregion
|
|
1229
|
-
//#region src/react/FloatActions/FloatActions.tsx
|
|
1230
|
-
const FloatActions = ({ gap = 2, disabled, items = [], onActionClick, className, defaultGroupCollapse = false, onGroupCollapseChange, groupCollapse, ...rest }) => {
|
|
1231
|
-
const [groupCollapsed, setGroupCollapsed] = useMergeState(defaultGroupCollapse, {
|
|
1232
|
-
defaultValue: defaultGroupCollapse,
|
|
1233
|
-
onChange: onGroupCollapseChange,
|
|
1234
|
-
value: groupCollapse
|
|
1235
|
-
});
|
|
1236
|
-
return /* @__PURE__ */ jsx(Flexbox, {
|
|
1237
|
-
align: "center",
|
|
1238
|
-
className: cx(styles$4.container, className),
|
|
1239
|
-
flex: 1,
|
|
1240
|
-
gap,
|
|
1241
|
-
horizontal: true,
|
|
1242
|
-
...rest,
|
|
1243
|
-
children: items.map((item, index) => /* @__PURE__ */ jsx(ActionItem, {
|
|
1244
|
-
disabled,
|
|
1245
|
-
gap,
|
|
1246
|
-
groupCollapsed,
|
|
1247
|
-
item,
|
|
1248
|
-
onActionClick,
|
|
1249
|
-
setGroupCollapsed
|
|
1250
|
-
}, item.key || index))
|
|
1251
|
-
});
|
|
1252
|
-
};
|
|
1253
|
-
FloatActions.displayName = "FloatActions";
|
|
1254
|
-
//#endregion
|
|
1255
|
-
//#region src/react/FloatMenu/style.ts
|
|
1256
|
-
const styles$3 = createStaticStyles(({ css, cssVar }) => ({
|
|
1257
|
-
container: css`
|
|
1258
|
-
position: relative;
|
|
1259
|
-
overflow: hidden auto;
|
|
1260
|
-
background: ${cssVar.colorBgElevated};
|
|
1261
|
-
`,
|
|
1262
|
-
containerWithMaxHeight: css`
|
|
1263
|
-
/* maxHeight is set via inline style as it's dynamic */
|
|
1264
|
-
`,
|
|
1265
|
-
rootBottom: css`
|
|
1266
|
-
position: absolute;
|
|
1267
|
-
z-index: 9999;
|
|
1268
|
-
inset-block-start: 100%;
|
|
1269
|
-
inset-inline-start: 0;
|
|
1270
|
-
|
|
1271
|
-
padding-block-start: 8px;
|
|
1272
|
-
`,
|
|
1273
|
-
rootTop: css`
|
|
1274
|
-
position: absolute;
|
|
1275
|
-
inset-block-start: -8px;
|
|
1276
|
-
inset-inline-start: 0;
|
|
1277
|
-
transform: translateY(-100%);
|
|
1278
|
-
`
|
|
1279
|
-
}));
|
|
1280
|
-
//#endregion
|
|
1281
|
-
//#region src/react/FloatMenu/FloatMenu.tsx
|
|
1282
|
-
const FloatMenu = ({ className, style, getPopupContainer, children, maxHeight = "min(50vh, 640px)", open, placement = "top", styles: customStyles, classNames }) => {
|
|
1283
|
-
const parent = getPopupContainer();
|
|
1284
|
-
if (!parent) return;
|
|
1285
|
-
if (!open) return;
|
|
1286
|
-
return createPortal(/* @__PURE__ */ jsx(Flexbox, {
|
|
1287
|
-
className: cx(placement === "bottom" ? styles$3.rootBottom : styles$3.rootTop, classNames?.root),
|
|
1288
|
-
paddingInline: 8,
|
|
1289
|
-
style: customStyles?.root,
|
|
1290
|
-
width: "100%",
|
|
1291
|
-
children: /* @__PURE__ */ jsx(Block, {
|
|
1292
|
-
className: cx(styles$3.container, className, classNames?.container),
|
|
1293
|
-
shadow: true,
|
|
1294
|
-
style: {
|
|
1295
|
-
maxHeight,
|
|
1296
|
-
...style,
|
|
1297
|
-
...customStyles?.container
|
|
1298
|
-
},
|
|
1299
|
-
variant: "outlined",
|
|
1300
|
-
children
|
|
1301
|
-
})
|
|
1302
|
-
}), parent);
|
|
1303
|
-
};
|
|
1304
|
-
FloatMenu.displayName = "FloatMenu";
|
|
1305
|
-
//#endregion
|
|
1306
|
-
//#region src/react/SendButton/components/SendIcon.tsx
|
|
1307
|
-
const styles$2 = createStaticStyles(({ css }) => ({ icon: css`
|
|
1308
|
-
flex: none;
|
|
1309
|
-
line-height: 1;
|
|
1310
|
-
` }));
|
|
1311
|
-
const SendIcon = ({ size = "1em", style }) => {
|
|
1312
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
1313
|
-
className: cx("anticon", styles$2.icon),
|
|
1314
|
-
fill: "currentColor",
|
|
1315
|
-
fillRule: "evenodd",
|
|
1316
|
-
height: size,
|
|
1317
|
-
style,
|
|
1318
|
-
viewBox: "0 0 14 14",
|
|
1319
|
-
width: size,
|
|
1320
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1321
|
-
children: /* @__PURE__ */ jsx("path", { 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" })
|
|
1322
|
-
});
|
|
1323
|
-
};
|
|
1324
|
-
//#endregion
|
|
1325
|
-
//#region src/react/SendButton/components/StopIcon.tsx
|
|
1326
|
-
const styles$1 = createStaticStyles(({ css }) => ({ icon: css`
|
|
1327
|
-
flex: none;
|
|
1328
|
-
line-height: 1;
|
|
1329
|
-
` }));
|
|
1330
|
-
const StopIcon = ({ size = "1.5em", style }) => {
|
|
1331
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
1332
|
-
className: cx("anticon", styles$1.icon),
|
|
1333
|
-
color: "currentColor",
|
|
1334
|
-
height: size,
|
|
1335
|
-
style,
|
|
1336
|
-
viewBox: "0 0 1024 1024",
|
|
1337
|
-
width: size,
|
|
1338
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1339
|
-
children: /* @__PURE__ */ jsxs("g", {
|
|
1340
|
-
fill: "none",
|
|
1341
|
-
children: [
|
|
1342
|
-
/* @__PURE__ */ jsx("circle", {
|
|
1343
|
-
cx: "512",
|
|
1344
|
-
cy: "512",
|
|
1345
|
-
fill: "none",
|
|
1346
|
-
r: "426",
|
|
1347
|
-
stroke: cssVar.colorBorder,
|
|
1348
|
-
strokeWidth: "72"
|
|
1349
|
-
}),
|
|
1350
|
-
/* @__PURE__ */ jsx("rect", {
|
|
1351
|
-
fill: "currentColor",
|
|
1352
|
-
height: "252",
|
|
1353
|
-
rx: "24",
|
|
1354
|
-
ry: "24",
|
|
1355
|
-
width: "252",
|
|
1356
|
-
x: "386",
|
|
1357
|
-
y: "386"
|
|
1358
|
-
}),
|
|
1359
|
-
/* @__PURE__ */ jsx("path", {
|
|
1360
|
-
d: "M938.667 512C938.667 276.359 747.64 85.333 512 85.333",
|
|
1361
|
-
stroke: "currentColor",
|
|
1362
|
-
strokeLinecap: "round",
|
|
1363
|
-
strokeWidth: "73",
|
|
1364
|
-
children: /* @__PURE__ */ jsx("animateTransform", {
|
|
1365
|
-
attributeName: "transform",
|
|
1366
|
-
dur: "1s",
|
|
1367
|
-
from: "0 512 512",
|
|
1368
|
-
repeatCount: "indefinite",
|
|
1369
|
-
to: "360 512 512",
|
|
1370
|
-
type: "rotate"
|
|
1371
|
-
})
|
|
1372
|
-
})
|
|
1373
|
-
]
|
|
1374
|
-
})
|
|
1375
|
-
});
|
|
1376
|
-
};
|
|
1377
|
-
//#endregion
|
|
1378
|
-
//#region src/react/SendButton/style.ts
|
|
1379
|
-
const prefixCls = "ant";
|
|
1380
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
1381
|
-
button: css`
|
|
1382
|
-
&.${prefixCls}-btn {
|
|
1383
|
-
flex: none;
|
|
1384
|
-
width: var(--send-button-size, 32px) !important;
|
|
1385
|
-
height: var(--send-button-size, 32px);
|
|
1386
|
-
padding-inline: 0 !important;
|
|
1387
|
-
}
|
|
1388
|
-
`,
|
|
1389
|
-
disabled: css`
|
|
1390
|
-
&.${prefixCls}-btn {
|
|
1391
|
-
cursor: default;
|
|
1392
|
-
border-color: ${cssVar.colorBorderSecondary};
|
|
1393
|
-
background: transparent;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
.${prefixCls}-btn-compact-first-item {
|
|
1397
|
-
cursor: default;
|
|
1398
|
-
border-color: ${cssVar.colorBorderSecondary};
|
|
1399
|
-
background: transparent;
|
|
1400
|
-
}
|
|
1401
|
-
.${prefixCls}-dropdown-trigger {
|
|
1402
|
-
cursor: default;
|
|
1403
|
-
border-color: ${cssVar.colorBorderSecondary};
|
|
1404
|
-
border-inline-start-color: transparent;
|
|
1405
|
-
background: transparent;
|
|
1406
|
-
}
|
|
1407
|
-
`,
|
|
1408
|
-
dropdownButton: css`
|
|
1409
|
-
flex: none;
|
|
1410
|
-
width: fit-content;
|
|
1411
|
-
.${prefixCls}-btn {
|
|
1412
|
-
width: calc(var(--send-button-size, 32px) * 1.2);
|
|
1413
|
-
height: var(--send-button-size, 32px);
|
|
1414
|
-
}
|
|
1415
|
-
.${prefixCls}-dropdown-trigger {
|
|
1416
|
-
width: calc(var(--send-button-size, 32px) * 0.8);
|
|
1417
|
-
&.${prefixCls}-btn-primary {
|
|
1418
|
-
&::before {
|
|
1419
|
-
background-color: color-mix(in srgb, ${cssVar.colorBgLayout} 10%, transparent) !important;
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
`,
|
|
1424
|
-
dropdownButtonRound: css`
|
|
1425
|
-
.${prefixCls}-btn-compact-first-item {
|
|
1426
|
-
border-start-start-radius: calc(var(--send-button-size, 32px) / 2);
|
|
1427
|
-
border-end-start-radius: calc(var(--send-button-size, 32px) / 2);
|
|
1428
|
-
}
|
|
1429
|
-
.${prefixCls}-dropdown-trigger {
|
|
1430
|
-
width: var(--send-button-size, 32px);
|
|
1431
|
-
border-start-end-radius: calc(var(--send-button-size, 32px) / 2);
|
|
1432
|
-
border-end-end-radius: calc(var(--send-button-size, 32px) / 2);
|
|
1433
|
-
}
|
|
1434
|
-
`,
|
|
1435
|
-
loadingButton: css`
|
|
1436
|
-
&.${prefixCls}-btn {
|
|
1437
|
-
flex: none;
|
|
1438
|
-
height: var(--send-button-size, 32px);
|
|
1439
|
-
padding-inline: 0 !important;
|
|
1440
|
-
}
|
|
1441
|
-
`
|
|
1442
|
-
}));
|
|
1443
|
-
//#endregion
|
|
1444
|
-
//#region src/react/SendButton/SendButton.tsx
|
|
1445
|
-
const SendButton = ({ type = "primary", menu, className, style, loading, generating, size = 32, shape, onSend, onStop, disabled, onClick, styles: _styles, classNames: _classNames, ...rest }) => {
|
|
1446
|
-
const cssVariables = useMemo(() => ({ "--send-button-size": `${size}px` }), [size]);
|
|
1447
|
-
if (generating) return /* @__PURE__ */ jsx(Button, {
|
|
1448
|
-
className: cx(styles.loadingButton, className),
|
|
1449
|
-
onClick: (e) => {
|
|
1450
|
-
e.stopPropagation();
|
|
1451
|
-
e.preventDefault();
|
|
1452
|
-
if (onStop) onStop(e);
|
|
1453
|
-
if (onClick) onClick(e);
|
|
1454
|
-
},
|
|
1455
|
-
shape,
|
|
1456
|
-
style: {
|
|
1457
|
-
...cssVariables,
|
|
1458
|
-
...style,
|
|
1459
|
-
width: menu ? size * 2 : size
|
|
1460
|
-
},
|
|
1461
|
-
variant: "filled",
|
|
1462
|
-
...rest,
|
|
1463
|
-
children: /* @__PURE__ */ jsx(StopIcon, { size: size * .75 })
|
|
1464
|
-
});
|
|
1465
|
-
if (loading) return /* @__PURE__ */ jsx(Button, {
|
|
1466
|
-
className: cx(styles.loadingButton, className),
|
|
1467
|
-
disabled: true,
|
|
1468
|
-
loading,
|
|
1469
|
-
shape,
|
|
1470
|
-
style: {
|
|
1471
|
-
...cssVariables,
|
|
1472
|
-
...style,
|
|
1473
|
-
width: menu ? size * 2 : size
|
|
1474
|
-
},
|
|
1475
|
-
type,
|
|
1476
|
-
...rest
|
|
1477
|
-
});
|
|
1478
|
-
if (!menu) return /* @__PURE__ */ jsx(Button, {
|
|
1479
|
-
className: cx(styles.button, disabled && styles.disabled, className),
|
|
1480
|
-
disabled,
|
|
1481
|
-
icon: /* @__PURE__ */ jsx(SendIcon, {}),
|
|
1482
|
-
onClick: (e) => {
|
|
1483
|
-
e.stopPropagation();
|
|
1484
|
-
e.preventDefault();
|
|
1485
|
-
if (onSend) onSend(e);
|
|
1486
|
-
if (onClick) onClick(e);
|
|
1487
|
-
},
|
|
1488
|
-
shape,
|
|
1489
|
-
style: {
|
|
1490
|
-
...cssVariables,
|
|
1491
|
-
...style
|
|
1492
|
-
},
|
|
1493
|
-
type,
|
|
1494
|
-
...rest
|
|
1495
|
-
});
|
|
1496
|
-
return /* @__PURE__ */ jsxs(Space.Compact, {
|
|
1497
|
-
className: cx(styles.dropdownButton, disabled && styles.disabled, shape === "round" && styles.dropdownButtonRound, className),
|
|
1498
|
-
style: {
|
|
1499
|
-
...cssVariables,
|
|
1500
|
-
...style
|
|
1501
|
-
},
|
|
1502
|
-
...rest,
|
|
1503
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
1504
|
-
className: cx(styles.button, disabled && styles.disabled, className),
|
|
1505
|
-
disabled,
|
|
1506
|
-
icon: /* @__PURE__ */ jsx(SendIcon, {}),
|
|
1507
|
-
onClick: (e) => {
|
|
1508
|
-
e.stopPropagation();
|
|
1509
|
-
e.preventDefault();
|
|
1510
|
-
if (onSend) onSend(e);
|
|
1511
|
-
if (onClick) onClick(e);
|
|
1512
|
-
},
|
|
1513
|
-
shape,
|
|
1514
|
-
style: {
|
|
1515
|
-
...cssVariables,
|
|
1516
|
-
...style
|
|
1517
|
-
},
|
|
1518
|
-
type,
|
|
1519
|
-
...rest
|
|
1520
|
-
}), /* @__PURE__ */ jsx(Dropdown$1, {
|
|
1521
|
-
menu,
|
|
1522
|
-
placement: "topRight",
|
|
1523
|
-
...rest,
|
|
1524
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
1525
|
-
className: cx(styles.button, disabled && styles.disabled, className),
|
|
1526
|
-
disabled,
|
|
1527
|
-
icon: /* @__PURE__ */ jsx(Icon, { icon: ChevronDownIcon }),
|
|
1528
|
-
shape,
|
|
1529
|
-
style: {
|
|
1530
|
-
...cssVariables,
|
|
1531
|
-
cursor: "pointer"
|
|
1532
|
-
},
|
|
1533
|
-
type
|
|
1534
|
-
})
|
|
1535
|
-
})]
|
|
1536
|
-
});
|
|
1537
|
-
};
|
|
1538
|
-
SendButton.displayName = "SendButton";
|
|
1539
|
-
//#endregion
|
|
1540
|
-
//#region src/react/SlashMenu/SlashMenu.tsx
|
|
1541
|
-
const SlashMenu = ({ options, activeKey, loading, onSelect, classNames, styles: customStyles, menuProps, ...floatMenuProps }) => {
|
|
1542
|
-
const handleMenuClick = useCallback(({ key }) => {
|
|
1543
|
-
if (!onSelect) return;
|
|
1544
|
-
const option = options.find((item) => "key" in item && item.key === key);
|
|
1545
|
-
if (option) onSelect?.(option);
|
|
1546
|
-
}, [options, onSelect]);
|
|
1547
|
-
return /* @__PURE__ */ jsx(FloatMenu, {
|
|
1548
|
-
classNames: {
|
|
1549
|
-
container: classNames?.container,
|
|
1550
|
-
root: classNames?.root
|
|
1551
|
-
},
|
|
1552
|
-
styles: {
|
|
1553
|
-
container: customStyles?.container,
|
|
1554
|
-
root: customStyles?.root
|
|
1555
|
-
},
|
|
1556
|
-
...floatMenuProps,
|
|
1557
|
-
children: /* @__PURE__ */ jsx(Menu, {
|
|
1558
|
-
className: classNames?.menu,
|
|
1559
|
-
items: loading ? [{
|
|
1560
|
-
disabled: true,
|
|
1561
|
-
key: "loading",
|
|
1562
|
-
label: "Loading..."
|
|
1563
|
-
}] : options,
|
|
1564
|
-
mode: "inline",
|
|
1565
|
-
onClick: handleMenuClick,
|
|
1566
|
-
selectedKeys: activeKey ? [activeKey] : void 0,
|
|
1567
|
-
style: customStyles?.menu,
|
|
1568
|
-
...menuProps
|
|
1569
|
-
})
|
|
1570
|
-
});
|
|
1571
|
-
};
|
|
1572
|
-
SlashMenu.displayName = "SlashMenu";
|
|
1573
|
-
//#endregion
|
|
1
|
+
import ChatInput from "./react/ChatInput/ChatInput.js";
|
|
2
|
+
import ChatInputActionBar from "./react/ChatInputActionBar/ChatInputActionBar.js";
|
|
3
|
+
import ChatInputActions from "./react/ChatInputActions/ChatInputActions.js";
|
|
4
|
+
import CodeLanguageSelect from "./react/CodeLanguageSelect/CodeLanguageSelect.js";
|
|
5
|
+
import { useEditor } from "./react/hooks/useEditor.js";
|
|
6
|
+
import { useEditorState } from "./react/hooks/useEditorState/index.js";
|
|
7
|
+
import { EditorProvider, useEditorContent } from "./react/EditorProvider/index.js";
|
|
8
|
+
import { withProps } from "./react/Editor/utils.js";
|
|
9
|
+
import Editor from "./react/Editor/index.js";
|
|
10
|
+
import FloatActions from "./react/FloatActions/FloatActions.js";
|
|
11
|
+
import FloatMenu from "./react/FloatMenu/FloatMenu.js";
|
|
12
|
+
import SendButton from "./react/SendButton/SendButton.js";
|
|
13
|
+
import SlashMenu from "./react/SlashMenu/SlashMenu.js";
|
|
1574
14
|
export { ChatInput, ChatInputActionBar, ChatInputActions, CodeLanguageSelect, Editor, EditorProvider, FloatActions, FloatMenu, SendButton, SlashMenu, useEditor, useEditorContent, useEditorState, withProps };
|