@ant-design/agentic-ui 2.29.6 → 2.29.8
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/dist/AILabel/index.js +17 -8
- package/dist/AgenticLayout/index.js +3 -5
- package/dist/BackTo/BackBottom.js +17 -8
- package/dist/BackTo/BackTop.js +17 -8
- package/dist/BackTo/ScrollVisibleButton.js +75 -11
- package/dist/Bubble/AIBubble.js +131 -121
- package/dist/Bubble/Avatar/index.js +19 -10
- package/dist/Bubble/FileView.js +2 -2
- package/dist/Bubble/List/PureBubbleList.js +4 -5
- package/dist/Bubble/List/index.js +4 -5
- package/dist/Bubble/List/style.js +3 -0
- package/dist/Bubble/MessagesContent/BubbleExtra.js +108 -93
- package/dist/Bubble/MessagesContent/CopyButton/index.js +36 -26
- package/dist/Bubble/MessagesContent/DocInfo.js +19 -10
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +2 -2
- package/dist/Bubble/MessagesContent/index.js +149 -130
- package/dist/Bubble/PureBubble.js +151 -133
- package/dist/Bubble/UserBubble.js +1 -1
- package/dist/Bubble/style.js +2 -2
- package/dist/Bubble/types/BubbleExtra.js +4 -1
- package/dist/Bubble/types/DocInfo.js +9 -1
- package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_0.png +0 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_1.png +0 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_2.png +0 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/index.d.ts +51 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/index.js +45 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/lottie.d.ts +85 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/lottie.js +382 -0
- package/dist/ChatLayout/index.js +52 -14
- package/dist/ChatLayout/style.js +11 -0
- package/dist/ChatLayout/types.d.ts +28 -0
- package/dist/Components/ActionIconBox/index.js +30 -38
- package/dist/Components/ActionItemBox/ActionItemBox.js +1 -1
- package/dist/Components/Button/SwitchButton/index.js +18 -17
- package/dist/Components/LayoutHeader/index.js +5 -3
- package/dist/Components/LayoutHeader/style.js +5 -0
- package/dist/Components/Loading/CreativeRecommendationLoading.js +2 -2
- package/dist/Components/Loading/CreativeSparkLoading.js +2 -2
- package/dist/Components/SuggestionList/index.js +20 -19
- package/dist/Components/TextAnimate/index.js +19 -10
- package/dist/Components/TypingAnimation/index.js +19 -10
- package/dist/Components/effects/EffectPlayer.js +20 -11
- package/dist/Components/icons/LoadingSpinnerIcon.js +19 -10
- package/dist/History/components/HistoryActionsBox.js +21 -23
- package/dist/History/components/HistoryItem.js +61 -53
- package/dist/History/components/HistoryRunningIcon.js +19 -10
- package/dist/History/components/LoadMoreComponent.js +61 -55
- package/dist/History/components/NewChatComponent.js +53 -47
- package/dist/History/components/SearchComponent.js +24 -26
- package/dist/History/hooks/useHistory.js +80 -73
- package/dist/History/index.js +17 -16
- package/dist/History/menu.js +17 -8
- package/dist/Hooks/useAutoScroll.js +19 -19
- package/dist/Hooks/useDebounceFn/index.js +51 -45
- package/dist/Hooks/useElementSize.d.ts +5 -0
- package/dist/Hooks/useElementSize.js +71 -0
- package/dist/Hooks/useIntersectionOnce.js +17 -8
- package/dist/Hooks/useLanguage.d.ts +3 -0
- package/dist/I18n/locales.d.ts +3 -0
- package/dist/I18n/locales.js +8 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +23 -13
- package/dist/MarkdownEditor/editor/Editor.js +31 -39
- package/dist/MarkdownEditor/editor/components/CommentList/index.js +29 -37
- package/dist/MarkdownEditor/editor/elements/Blockquote/ReadonlyBlockquote.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/Blockquote/ReadonlyBlockquote.js +69 -0
- package/dist/MarkdownEditor/editor/elements/Break/ReadonlyBreak.d.ts +30 -0
- package/dist/MarkdownEditor/editor/elements/Break/ReadonlyBreak.js +88 -0
- package/dist/MarkdownEditor/editor/elements/Card/ReadonlyCard.d.ts +34 -0
- package/dist/MarkdownEditor/editor/elements/Card/ReadonlyCard.js +96 -0
- package/dist/MarkdownEditor/editor/elements/Code/ReadonlyCode.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/Code/ReadonlyCode.js +145 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/ReadonlyFootnoteDefinition.d.ts +34 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/ReadonlyFootnoteDefinition.js +125 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/ReadonlyFootnoteReference.d.ts +34 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/ReadonlyFootnoteReference.js +101 -0
- package/dist/MarkdownEditor/editor/elements/Head/ReadonlyHead.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/Head/ReadonlyHead.js +111 -0
- package/dist/MarkdownEditor/editor/elements/Head/index.d.ts +3 -0
- package/dist/MarkdownEditor/editor/elements/Head/index.js +3 -1
- package/dist/MarkdownEditor/editor/elements/Hr/ReadonlyHr.d.ts +30 -0
- package/dist/MarkdownEditor/editor/elements/Hr/ReadonlyHr.js +95 -0
- package/dist/MarkdownEditor/editor/elements/Image/ReadonlyEditorImage.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/Image/ReadonlyEditorImage.js +426 -0
- package/dist/MarkdownEditor/editor/elements/Image/index.js +124 -121
- package/dist/MarkdownEditor/editor/elements/InlineKatex/ReadonlyInlineKatex.d.ts +32 -0
- package/dist/MarkdownEditor/editor/elements/InlineKatex/ReadonlyInlineKatex.js +100 -0
- package/dist/MarkdownEditor/editor/elements/Katex/ReadonlyKatex.d.ts +32 -0
- package/dist/MarkdownEditor/editor/elements/Katex/ReadonlyKatex.js +110 -0
- package/dist/MarkdownEditor/editor/elements/LinkCard/ReadonlyLinkCard.d.ts +40 -0
- package/dist/MarkdownEditor/editor/elements/LinkCard/ReadonlyLinkCard.js +215 -0
- package/dist/MarkdownEditor/editor/elements/List/List.js +27 -12
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +17 -16
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyList.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyList.js +93 -0
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyListItem.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyListItem.js +138 -0
- package/dist/MarkdownEditor/editor/elements/Media/ReadonlyMedia.d.ts +36 -0
- package/dist/MarkdownEditor/editor/elements/Media/ReadonlyMedia.js +600 -0
- package/dist/MarkdownEditor/editor/elements/Media/index.js +107 -92
- package/dist/MarkdownEditor/editor/elements/Mermaid/ReadonlyMermaid.d.ts +32 -0
- package/dist/MarkdownEditor/editor/elements/Mermaid/ReadonlyMermaid.js +101 -0
- package/dist/MarkdownEditor/editor/elements/Paragraph/ReadonlyParagraph.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/Paragraph/ReadonlyParagraph.js +109 -0
- package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +2 -1
- package/dist/MarkdownEditor/editor/elements/Schema/ReadonlySchema.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/Schema/ReadonlySchema.js +163 -0
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +19 -10
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +17 -16
- package/dist/MarkdownEditor/editor/elements/index.d.ts +20 -1
- package/dist/MarkdownEditor/editor/elements/index.js +65 -29
- package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +19 -11
- package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +1 -1
- package/dist/MarkdownEditor/editor/parser/parse/parseEmptyLines.js +1 -1
- package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +4 -1
- package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +66 -23
- package/dist/MarkdownEditor/editor/parser/remarkParse.js +3 -1
- package/dist/MarkdownEditor/editor/plugins/elements.js +60 -6
- package/dist/MarkdownEditor/editor/plugins/handlePaste.js +25 -30
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/arrow.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/backspace.js +97 -39
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.d.ts +14 -0
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.js +117 -91
- package/dist/MarkdownEditor/editor/plugins/index.d.ts +8 -0
- package/dist/MarkdownEditor/editor/plugins/index.js +8 -0
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.d.ts +12 -6
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +106 -95
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +1 -1
- package/dist/MarkdownEditor/editor/plugins/useOnchange.js +28 -22
- package/dist/MarkdownEditor/editor/plugins/utils.d.ts +31 -0
- package/dist/MarkdownEditor/editor/plugins/utils.js +75 -0
- package/dist/MarkdownEditor/editor/plugins/withCardPlugin.d.ts +15 -0
- package/dist/MarkdownEditor/editor/plugins/withCardPlugin.js +329 -0
- package/dist/MarkdownEditor/editor/plugins/withCodeTagPlugin.d.ts +11 -0
- package/dist/MarkdownEditor/editor/plugins/withCodeTagPlugin.js +299 -0
- package/dist/MarkdownEditor/editor/plugins/withInlineNodes.d.ts +12 -0
- package/dist/MarkdownEditor/editor/plugins/withInlineNodes.js +17 -0
- package/dist/MarkdownEditor/editor/plugins/withLinkAndMediaPlugin.d.ts +11 -0
- package/dist/MarkdownEditor/editor/plugins/withLinkAndMediaPlugin.js +70 -0
- package/dist/MarkdownEditor/editor/plugins/withListsPlugin.d.ts +23 -0
- package/dist/MarkdownEditor/editor/plugins/withListsPlugin.js +204 -0
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.d.ts +9 -12
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +17 -764
- package/dist/MarkdownEditor/editor/plugins/withSchemaPlugin.d.ts +11 -0
- package/dist/MarkdownEditor/editor/plugins/withSchemaPlugin.js +55 -0
- package/dist/MarkdownEditor/editor/plugins/withVoidNodes.d.ts +12 -0
- package/dist/MarkdownEditor/editor/plugins/withVoidNodes.js +17 -0
- package/dist/MarkdownEditor/editor/store.js +18 -14
- package/dist/MarkdownEditor/editor/tools/InsertAutocomplete.js +202 -197
- package/dist/MarkdownEditor/editor/tools/InsertLink.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +142 -134
- package/dist/MarkdownEditor/editor/utils/ace.js +61 -61
- package/dist/MarkdownEditor/editor/utils/docx/module.js +41 -8
- package/dist/MarkdownEditor/editor/utils/editorCommands.d.ts +97 -0
- package/dist/MarkdownEditor/editor/utils/editorCommands.js +966 -0
- package/dist/MarkdownEditor/editor/utils/editorUtils.js +13 -6
- package/dist/MarkdownEditor/editor/utils/index.js +8 -2
- package/dist/MarkdownEditor/editor/utils/keyboard.js +46 -426
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +23 -17
- package/dist/MarkdownEditor/editor/utils/media.js +21 -23
- package/dist/MarkdownEditor/editor/utils/performanceMonitor.js +55 -50
- package/dist/MarkdownEditor/editor/utils/useLocalState.js +11 -4
- package/dist/MarkdownEditor/el.d.ts +12 -5
- package/dist/MarkdownEditor/types.d.ts +1 -0
- package/dist/MarkdownEditor/types.js +4 -1
- package/dist/MarkdownEditor/utils/native-table/native-table-editor.js +14 -14
- package/dist/MarkdownEditor/utils/native-table/native-table-keyboard.js +2 -2
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -0
- package/dist/MarkdownInputField/AttachmentButton/index.js +33 -31
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +14 -7
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +2 -2
- package/dist/MarkdownInputField/FileMapView/index.js +17 -16
- package/dist/MarkdownInputField/FilePaste/index.js +25 -30
- package/dist/MarkdownInputField/FileUploadManager/index.js +39 -40
- package/dist/MarkdownInputField/MarkdownInputField.js +47 -51
- package/dist/MarkdownInputField/QuickActions/index.js +66 -60
- package/dist/MarkdownInputField/SendButton/index.js +22 -13
- package/dist/MarkdownInputField/Suggestion/index.js +17 -16
- package/dist/MarkdownInputField/VoiceInput/index.js +51 -45
- package/dist/MarkdownInputField/VoiceInputManager/index.js +133 -125
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +103 -101
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldStyles.js +1 -1
- package/dist/MarkdownInputField/style.js +8 -4
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.js +14 -1
- package/dist/Plugins/chart/BarChart/index.js +8 -8
- package/dist/Plugins/chart/ChartRender.js +52 -46
- package/dist/Plugins/chart/DonutChart/index.js +26 -17
- package/dist/Plugins/chart/DonutChart/plugins.js +1 -1
- package/dist/Plugins/chart/DonutChart/types.js +1 -1
- package/dist/Plugins/chart/FunnelChart/index.js +31 -28
- package/dist/Plugins/chart/LineChart/index.js +19 -10
- package/dist/Plugins/chart/RadarChart/index.js +19 -10
- package/dist/Plugins/chart/ScatterChart/index.js +19 -10
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +20 -11
- package/dist/Plugins/chart/index.js +31 -13
- package/dist/Plugins/chart/loadChartRuntime.js +17 -16
- package/dist/Plugins/chart/types/classNames.js +4 -1
- package/dist/Plugins/chart/utils.js +20 -20
- package/dist/Plugins/code/CodeUI/Katex/Katex.js +52 -46
- package/dist/Plugins/code/components/AceEditor.js +149 -133
- package/dist/Plugins/code/components/CodeRenderer.js +7 -7
- package/dist/Plugins/code/components/CodeToolbar.js +2 -2
- package/dist/Plugins/code/components/LanguageSelector.js +6 -6
- package/dist/Plugins/code/components/LoadImage.js +5 -5
- package/dist/Plugins/code/components/ThinkBlock.js +8 -8
- package/dist/Plugins/code/hooks/useCodeEditorState.js +5 -5
- package/dist/Plugins/code/index.js +6 -6
- package/dist/Plugins/code/langIconMap.js +0 -1
- package/dist/Plugins/code/langIcons/AbapIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ActionscriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AdaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ApacheIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ApexIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AplIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ApplescriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AstroIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AwkIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BallerinaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BatIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BicepIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BladeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CadenceIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ClojureIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CmakeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CobolIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CodeqlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CoffeeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ConsoleIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CppIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CrystalIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CsharpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CssIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DartIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DatabaseIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DiffIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DockerIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DotenvIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ElixirIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ElmIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ErbIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ErlangIcon.js +19 -10
- package/dist/Plugins/code/langIcons/FsharpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GdscriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GlslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GnuplotIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GraphqlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GroovyIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HackIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HamlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HandlebarsIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HaskellIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HclIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HclLightIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HjsonIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HlslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HtmlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HttpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ImbaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/IniIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JavaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JavascriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JinjaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/Json5Icon.js +19 -10
- package/dist/Plugins/code/langIcons/JsonIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JsonnetIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JuliaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/KotlinIcon.js +19 -10
- package/dist/Plugins/code/langIcons/KustoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LessIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LiquidIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LispIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LuaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MakefileIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MarkdownIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MarkojsIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MatlabIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MdxIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MermaidIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MojoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/NginxIcon.js +19 -10
- package/dist/Plugins/code/langIcons/NimIcon.js +19 -10
- package/dist/Plugins/code/langIcons/NixIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ObjectiveCIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ObjectiveCppIcon.js +19 -10
- package/dist/Plugins/code/langIcons/OcamlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PascalIcon.js +19 -10
- package/dist/Plugins/code/langIcons/Perl6Icon.js +19 -10
- package/dist/Plugins/code/langIcons/PerlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PhpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PostcssIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PowershellIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PrismaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PrologIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ProtoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PugIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PuppetIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PurescriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PythonIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RazorIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ReactIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ReactTsIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RubyIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RustIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SasIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SassIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ScalaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SchemeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ShaderlabIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SolidityIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SparqlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/StataIcon.js +19 -10
- package/dist/Plugins/code/langIcons/StylusIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SvelteIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SwiftIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SystemverilogIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TclIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TexIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TomlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TwigIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TypescriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VerilogIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VhdlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VimIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VueIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WebassemblyIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WenyanIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WgslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WolframlanguageIcon.js +19 -10
- package/dist/Plugins/code/langIcons/XmlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/XslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/YamlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ZigIcon.js +19 -10
- package/dist/Plugins/code/loadAceEditor.js +21 -23
- package/dist/Plugins/code/utils/langOptions.js +6 -6
- package/dist/Plugins/formatter/index.js +6 -6
- package/dist/Plugins/katex/InlineKatex.js +52 -46
- package/dist/Plugins/katex/Katex.js +53 -47
- package/dist/Plugins/katex/index.js +6 -6
- package/dist/Plugins/katex/loadKatex.js +27 -29
- package/dist/Plugins/mermaid/Mermaid.js +34 -28
- package/dist/Plugins/mermaid/useMermaidRender.js +103 -97
- package/dist/Plugins/mermaid/utils.js +25 -17
- package/dist/Schema/SchemaEditor/AceEditorWrapper.js +162 -150
- package/dist/Schema/SchemaEditor/index.js +8 -1
- package/dist/Schema/SchemaForm/index.js +2 -2
- package/dist/Schema/SchemaRenderer/index.js +45 -46
- package/dist/ThoughtChainList/index.js +22 -13
- package/dist/ToolUseBar/BarItem/Content.js +3 -3
- package/dist/ToolUseBar/BarItem/index.js +10 -3
- package/dist/ToolUseBar/index.js +19 -10
- package/dist/ToolUseBar/style.js +4 -4
- package/dist/Types/common.js +4 -1
- package/dist/Types/message.js +4 -1
- package/dist/Utils/debugUtils.js +8 -8
- package/dist/Utils/getScroll.js +12 -5
- package/dist/Utils/loadCSS.js +23 -22
- package/dist/Utils/proxySandbox/ProxySandbox.js +42 -34
- package/dist/Utils/proxySandbox/SecurityContextManager.js +54 -54
- package/dist/Utils/proxySandbox/index.js +25 -22
- package/dist/Utils/proxySandbox/types.js +11 -11
- package/dist/Utils/scrollTo.js +8 -1
- package/dist/WelcomeMessage/index.js +1 -1
- package/dist/Workspace/File/FileComponent.js +91 -66
- package/dist/Workspace/File/PreviewComponent.js +15 -8
- package/dist/Workspace/File/index.d.ts +1 -1
- package/dist/Workspace/File/style.js +7 -0
- package/dist/Workspace/RealtimeFollow/index.js +1 -2
- package/dist/Workspace/index.js +13 -11
- package/dist/Workspace/style.js +8 -14
- package/dist/Workspace/types.d.ts +50 -0
- package/dist/Workspace/types.js +0 -1
- package/package.json +27 -27
|
@@ -118,7 +118,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
118
118
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
119
119
|
}
|
|
120
120
|
function _ts_generator(thisArg, body) {
|
|
121
|
-
var f, y, t,
|
|
121
|
+
var f, y, t, _ = {
|
|
122
122
|
label: 0,
|
|
123
123
|
sent: function() {
|
|
124
124
|
if (t[0] & 1) throw t[1];
|
|
@@ -126,13 +126,17 @@ function _ts_generator(thisArg, body) {
|
|
|
126
126
|
},
|
|
127
127
|
trys: [],
|
|
128
128
|
ops: []
|
|
129
|
-
};
|
|
130
|
-
return g
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
|
|
129
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
130
|
+
return d(g, "next", {
|
|
131
|
+
value: verb(0)
|
|
132
|
+
}), d(g, "throw", {
|
|
133
|
+
value: verb(1)
|
|
134
|
+
}), d(g, "return", {
|
|
135
|
+
value: verb(2)
|
|
136
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
137
|
+
value: function() {
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
136
140
|
}), g;
|
|
137
141
|
function verb(n) {
|
|
138
142
|
return function(v) {
|
|
@@ -144,7 +148,7 @@ function _ts_generator(thisArg, body) {
|
|
|
144
148
|
}
|
|
145
149
|
function step(op) {
|
|
146
150
|
if (f) throw new TypeError("Generator is already executing.");
|
|
147
|
-
while(_)try {
|
|
151
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
148
152
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
149
153
|
if (y = 0, t) op = [
|
|
150
154
|
op[0] & 2,
|
|
@@ -215,11 +219,12 @@ function _ts_generator(thisArg, body) {
|
|
|
215
219
|
import { message } from "antd";
|
|
216
220
|
import copy from "copy-to-clipboard";
|
|
217
221
|
import isHotkey from "is-hotkey";
|
|
218
|
-
import {
|
|
219
|
-
import { Editor, Element, Node, Path, Range,
|
|
222
|
+
import { useEffect, useMemo } from "react";
|
|
223
|
+
import { Editor, Element, Node, Path, Range, Transforms } from "slate";
|
|
220
224
|
import { ReactEditor } from "slate-react";
|
|
225
|
+
import { useRefFunction } from "../../../Hooks/useRefFunction";
|
|
221
226
|
import { useSubject } from "../../hooks/subscribe";
|
|
222
|
-
import {
|
|
227
|
+
import { convertToParagraph, createList, decreaseHeadingLevel, increaseHeadingLevel, insertCodeBlock, insertHorizontalLine, insertTable as insertTableCommand, setHeading, toggleQuote } from "./editorCommands";
|
|
223
228
|
import { EditorUtils } from "./editorUtils";
|
|
224
229
|
export var KeyboardTask = /*#__PURE__*/ function() {
|
|
225
230
|
"use strict";
|
|
@@ -358,7 +363,6 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
358
363
|
*
|
|
359
364
|
* @returns {Promise<void>} 一个表示异步操作的 Promise 对象。
|
|
360
365
|
*/ function pastePlainText() {
|
|
361
|
-
var _this = this;
|
|
362
366
|
return _async_to_generator(function() {
|
|
363
367
|
var text, _node_, _this_curNodes, node;
|
|
364
368
|
return _ts_generator(this, function(_state) {
|
|
@@ -372,11 +376,11 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
372
376
|
text = _state.sent();
|
|
373
377
|
if (text) {
|
|
374
378
|
;
|
|
375
|
-
_this_curNodes = _sliced_to_array(
|
|
379
|
+
_this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
376
380
|
if ((node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type) === 'table-cell') {
|
|
377
|
-
Editor.insertText(
|
|
381
|
+
Editor.insertText(this.editor, text.replace(/\n/g, ' '));
|
|
378
382
|
} else {
|
|
379
|
-
Editor.insertText(
|
|
383
|
+
Editor.insertText(this.editor, text);
|
|
380
384
|
}
|
|
381
385
|
}
|
|
382
386
|
return [
|
|
@@ -384,7 +388,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
384
388
|
];
|
|
385
389
|
}
|
|
386
390
|
});
|
|
387
|
-
})();
|
|
391
|
+
}).call(this);
|
|
388
392
|
}
|
|
389
393
|
},
|
|
390
394
|
{
|
|
@@ -396,19 +400,19 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
396
400
|
* 支持列单元格、普通节点和空编辑器的不同插入逻辑。
|
|
397
401
|
*/ key: "uploadImage",
|
|
398
402
|
value: function uploadImage() {
|
|
403
|
+
var _this = this;
|
|
399
404
|
var input = document.createElement('input');
|
|
400
405
|
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
401
406
|
input.id = 'uploadImage' + '_' + Math.random();
|
|
402
407
|
input.type = 'file';
|
|
403
408
|
input.accept = 'image/*';
|
|
404
|
-
var
|
|
405
|
-
|
|
406
|
-
var _ref = _async_to_generator(function(url) {
|
|
409
|
+
var insertMedia = function(url) {
|
|
410
|
+
return _async_to_generator(function() {
|
|
407
411
|
return _ts_generator(this, function(_state) {
|
|
408
412
|
if (node && [
|
|
409
413
|
'column-cell'
|
|
410
414
|
].includes(node[0].type)) {
|
|
411
|
-
Transforms.insertNodes(
|
|
415
|
+
Transforms.insertNodes(this.editor, [
|
|
412
416
|
EditorUtils.createMediaNode(url, 'image', {})
|
|
413
417
|
], {
|
|
414
418
|
at: _to_consumable_array(node[1]).concat([
|
|
@@ -420,13 +424,13 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
420
424
|
];
|
|
421
425
|
}
|
|
422
426
|
if (node) {
|
|
423
|
-
Transforms.insertNodes(
|
|
427
|
+
Transforms.insertNodes(this.editor, [
|
|
424
428
|
EditorUtils.createMediaNode(url, 'image', {})
|
|
425
429
|
], {
|
|
426
430
|
at: Path.next(node[1])
|
|
427
431
|
});
|
|
428
432
|
} else {
|
|
429
|
-
Transforms.insertNodes(
|
|
433
|
+
Transforms.insertNodes(this.editor, [
|
|
430
434
|
EditorUtils.createMediaNode(url, 'image', {})
|
|
431
435
|
], {
|
|
432
436
|
select: true
|
|
@@ -436,14 +440,10 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
436
440
|
2
|
|
437
441
|
];
|
|
438
442
|
});
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}();
|
|
444
|
-
var _this1 = this;
|
|
445
|
-
input.onchange = /*#__PURE__*/ function() {
|
|
446
|
-
var _ref = _async_to_generator(function(e) {
|
|
443
|
+
}).call(_this);
|
|
444
|
+
};
|
|
445
|
+
input.onchange = function(e) {
|
|
446
|
+
return _async_to_generator(function() {
|
|
447
447
|
var hideLoading, _this_props_image, _this_props, url, error;
|
|
448
448
|
return _ts_generator(this, function(_state) {
|
|
449
449
|
switch(_state.label){
|
|
@@ -463,7 +463,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
463
463
|
4,
|
|
464
464
|
5
|
|
465
465
|
]);
|
|
466
|
-
if (!((_this_props =
|
|
466
|
+
if (!((_this_props = this.props) === null || _this_props === void 0 ? void 0 : (_this_props_image = _this_props.image) === null || _this_props_image === void 0 ? void 0 : _this_props_image.upload)) {
|
|
467
467
|
message.error('图片上传功能未配置');
|
|
468
468
|
return [
|
|
469
469
|
2
|
|
@@ -471,7 +471,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
471
471
|
}
|
|
472
472
|
return [
|
|
473
473
|
4,
|
|
474
|
-
|
|
474
|
+
this.props.image.upload(Array.from(e.target.files) || [])
|
|
475
475
|
];
|
|
476
476
|
case 2:
|
|
477
477
|
url = _state.sent() || [];
|
|
@@ -507,11 +507,8 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
507
507
|
];
|
|
508
508
|
}
|
|
509
509
|
});
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
return _ref.apply(this, arguments);
|
|
513
|
-
};
|
|
514
|
-
}();
|
|
510
|
+
}).call(_this);
|
|
511
|
+
};
|
|
515
512
|
if (input.dataset.readonly) {
|
|
516
513
|
return;
|
|
517
514
|
}
|
|
@@ -529,23 +526,11 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
529
526
|
* @param level 标题级别(1-3)或4(表示普通段落)
|
|
530
527
|
*/ key: "head",
|
|
531
528
|
value: function head(level) {
|
|
532
|
-
var _node_;
|
|
533
|
-
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
534
529
|
if (level === 4) {
|
|
535
530
|
this.paragraph();
|
|
536
531
|
return;
|
|
537
532
|
}
|
|
538
|
-
|
|
539
|
-
'paragraph',
|
|
540
|
-
'head'
|
|
541
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type) && EditorUtils.isTop(this.editor, node[1])) {
|
|
542
|
-
Transforms.setNodes(this.editor, {
|
|
543
|
-
type: 'head',
|
|
544
|
-
level: level
|
|
545
|
-
}, {
|
|
546
|
-
at: node[1]
|
|
547
|
-
});
|
|
548
|
-
}
|
|
533
|
+
setHeading(this.editor, level);
|
|
549
534
|
}
|
|
550
535
|
},
|
|
551
536
|
{
|
|
@@ -555,17 +540,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
555
540
|
* 如果当前节点是标题类型,将其转换为普通段落
|
|
556
541
|
*/ key: "paragraph",
|
|
557
542
|
value: function paragraph() {
|
|
558
|
-
|
|
559
|
-
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
560
|
-
if (node && [
|
|
561
|
-
'head'
|
|
562
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type)) {
|
|
563
|
-
Transforms.setNodes(this.editor, {
|
|
564
|
-
type: 'paragraph'
|
|
565
|
-
}, {
|
|
566
|
-
at: node[1]
|
|
567
|
-
});
|
|
568
|
-
}
|
|
543
|
+
convertToParagraph(this.editor);
|
|
569
544
|
}
|
|
570
545
|
},
|
|
571
546
|
{
|
|
@@ -577,34 +552,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
577
552
|
* 或将其他级别标题升级一级(数字变小)
|
|
578
553
|
*/ key: "increaseHead",
|
|
579
554
|
value: function increaseHead() {
|
|
580
|
-
|
|
581
|
-
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
582
|
-
if (node && [
|
|
583
|
-
'paragraph',
|
|
584
|
-
'head'
|
|
585
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type) && EditorUtils.isTop(this.editor, node[1])) {
|
|
586
|
-
var _node_1;
|
|
587
|
-
if ((node === null || node === void 0 ? void 0 : (_node_1 = node[0]) === null || _node_1 === void 0 ? void 0 : _node_1.type) === 'paragraph') {
|
|
588
|
-
Transforms.setNodes(this.editor, {
|
|
589
|
-
type: 'head',
|
|
590
|
-
level: 4
|
|
591
|
-
}, {
|
|
592
|
-
at: node[1]
|
|
593
|
-
});
|
|
594
|
-
} else if (node[0].level === 1) {
|
|
595
|
-
Transforms.setNodes(this.editor, {
|
|
596
|
-
type: 'paragraph'
|
|
597
|
-
}, {
|
|
598
|
-
at: node[1]
|
|
599
|
-
});
|
|
600
|
-
} else {
|
|
601
|
-
Transforms.setNodes(this.editor, {
|
|
602
|
-
level: node[0].level - 1
|
|
603
|
-
}, {
|
|
604
|
-
at: node[1]
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
}
|
|
555
|
+
increaseHeadingLevel(this.editor);
|
|
608
556
|
}
|
|
609
557
|
},
|
|
610
558
|
{
|
|
@@ -616,34 +564,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
616
564
|
* 或将其他级别标题降级一级(数字变大)
|
|
617
565
|
*/ key: "decreaseHead",
|
|
618
566
|
value: function decreaseHead() {
|
|
619
|
-
|
|
620
|
-
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
621
|
-
if (node && [
|
|
622
|
-
'paragraph',
|
|
623
|
-
'head'
|
|
624
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type) && EditorUtils.isTop(this.editor, node[1])) {
|
|
625
|
-
var _node_1;
|
|
626
|
-
if ((node === null || node === void 0 ? void 0 : (_node_1 = node[0]) === null || _node_1 === void 0 ? void 0 : _node_1.type) === 'paragraph') {
|
|
627
|
-
Transforms.setNodes(this.editor, {
|
|
628
|
-
type: 'head',
|
|
629
|
-
level: 1
|
|
630
|
-
}, {
|
|
631
|
-
at: node[1]
|
|
632
|
-
});
|
|
633
|
-
} else if (node[0].level === 4) {
|
|
634
|
-
Transforms.setNodes(this.editor, {
|
|
635
|
-
type: 'paragraph'
|
|
636
|
-
}, {
|
|
637
|
-
at: node[1]
|
|
638
|
-
});
|
|
639
|
-
} else {
|
|
640
|
-
Transforms.setNodes(this.editor, {
|
|
641
|
-
level: node[0].level + 1
|
|
642
|
-
}, {
|
|
643
|
-
at: node[1]
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
}
|
|
567
|
+
decreaseHeadingLevel(this.editor);
|
|
647
568
|
}
|
|
648
569
|
},
|
|
649
570
|
{
|
|
@@ -655,29 +576,8 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
655
576
|
* 如果当前节点是标题,先将其转换为普通段落。
|
|
656
577
|
*/ key: "insertQuote",
|
|
657
578
|
value: function insertQuote() {
|
|
658
|
-
var _node_, _node_1;
|
|
659
579
|
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
660
|
-
|
|
661
|
-
'paragraph',
|
|
662
|
-
'head'
|
|
663
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type)) return;
|
|
664
|
-
if (Node.parent(this.editor, node[1]).type === 'blockquote') {
|
|
665
|
-
Transforms.unwrapNodes(this.editor, {
|
|
666
|
-
at: Path.parent(node[1])
|
|
667
|
-
});
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
if ((node === null || node === void 0 ? void 0 : (_node_1 = node[0]) === null || _node_1 === void 0 ? void 0 : _node_1.type) === 'head') {
|
|
671
|
-
Transforms.setNodes(this.editor, {
|
|
672
|
-
type: 'paragraph'
|
|
673
|
-
}, {
|
|
674
|
-
at: node[1]
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
Transforms.wrapNodes(this.editor, {
|
|
678
|
-
type: 'blockquote',
|
|
679
|
-
children: []
|
|
680
|
-
});
|
|
580
|
+
toggleQuote(this.editor, node);
|
|
681
581
|
}
|
|
682
582
|
},
|
|
683
583
|
{
|
|
@@ -689,38 +589,8 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
689
589
|
* 决定在何处插入表格及如何处理现有内容。
|
|
690
590
|
*/ key: "insertTable",
|
|
691
591
|
value: function insertTable() {
|
|
692
|
-
var _node_, _node_1;
|
|
693
592
|
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
694
|
-
|
|
695
|
-
'paragraph',
|
|
696
|
-
'head'
|
|
697
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type)) {
|
|
698
|
-
var _node_2, _node_3;
|
|
699
|
-
var path = (node === null || node === void 0 ? void 0 : (_node_2 = node[0]) === null || _node_2 === void 0 ? void 0 : _node_2.type) === 'paragraph' && !Node.string(node[0]) ? node[1] : Path.next(node[1]);
|
|
700
|
-
// 使用原生表格编辑器插入表格
|
|
701
|
-
NativeTableEditor.insertTable(this.editor, {
|
|
702
|
-
rows: 3,
|
|
703
|
-
cols: 3,
|
|
704
|
-
at: path
|
|
705
|
-
});
|
|
706
|
-
if ((node === null || node === void 0 ? void 0 : (_node_3 = node[0]) === null || _node_3 === void 0 ? void 0 : _node_3.type) === 'paragraph' && !Node.string(node[0])) {
|
|
707
|
-
Transforms.delete(this.editor, {
|
|
708
|
-
at: Path.next(path)
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
Transforms.select(this.editor, Editor.start(this.editor, path));
|
|
712
|
-
}
|
|
713
|
-
if (node && [
|
|
714
|
-
'column-cell'
|
|
715
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_1 = node[0]) === null || _node_1 === void 0 ? void 0 : _node_1.type)) {
|
|
716
|
-
NativeTableEditor.insertTable(this.editor, {
|
|
717
|
-
rows: 3,
|
|
718
|
-
cols: 3,
|
|
719
|
-
at: _to_consumable_array(node[1]).concat([
|
|
720
|
-
0
|
|
721
|
-
])
|
|
722
|
-
});
|
|
723
|
-
}
|
|
593
|
+
insertTableCommand(this.editor, node);
|
|
724
594
|
}
|
|
725
595
|
},
|
|
726
596
|
{
|
|
@@ -739,29 +609,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
739
609
|
*/ key: "insertCode",
|
|
740
610
|
value: function insertCode(type) {
|
|
741
611
|
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
742
|
-
|
|
743
|
-
'paragraph',
|
|
744
|
-
'head'
|
|
745
|
-
].includes(node[0].type)) {
|
|
746
|
-
var path = node[0].type === 'paragraph' && !Node.string(node[0]) ? node[1] : Path.next(node[1]);
|
|
747
|
-
var lang = '';
|
|
748
|
-
if (type === 'mermaid') {
|
|
749
|
-
lang = 'mermaid';
|
|
750
|
-
}
|
|
751
|
-
Transforms.insertNodes(this.editor, {
|
|
752
|
-
type: 'code',
|
|
753
|
-
language: lang ? lang : undefined,
|
|
754
|
-
children: [
|
|
755
|
-
{
|
|
756
|
-
text: "flowchart TD\n Start --> Stop"
|
|
757
|
-
}
|
|
758
|
-
],
|
|
759
|
-
render: type === 'html' ? true : undefined
|
|
760
|
-
}, {
|
|
761
|
-
at: path
|
|
762
|
-
});
|
|
763
|
-
Transforms.select(this.editor, Editor.end(this.editor, path));
|
|
764
|
-
}
|
|
612
|
+
insertCodeBlock(this.editor, type, node);
|
|
765
613
|
}
|
|
766
614
|
},
|
|
767
615
|
{
|
|
@@ -772,40 +620,8 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
772
620
|
* 如果分割线后没有内容,则自动插入一个空段落并将光标定位到该段落。
|
|
773
621
|
*/ key: "horizontalLine",
|
|
774
622
|
value: function horizontalLine() {
|
|
775
|
-
var _node_;
|
|
776
623
|
var _this_curNodes = _sliced_to_array(this.curNodes, 1), node = _this_curNodes[0];
|
|
777
|
-
|
|
778
|
-
'paragraph',
|
|
779
|
-
'head'
|
|
780
|
-
].includes(node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type)) {
|
|
781
|
-
var _node_1;
|
|
782
|
-
var path = (node === null || node === void 0 ? void 0 : (_node_1 = node[0]) === null || _node_1 === void 0 ? void 0 : _node_1.type) === 'paragraph' && !Node.string(node[0]) ? node[1] : Path.next(node[1]);
|
|
783
|
-
Transforms.insertNodes(this.editor, {
|
|
784
|
-
type: 'hr',
|
|
785
|
-
children: [
|
|
786
|
-
{
|
|
787
|
-
text: ''
|
|
788
|
-
}
|
|
789
|
-
]
|
|
790
|
-
}, {
|
|
791
|
-
at: path
|
|
792
|
-
});
|
|
793
|
-
if (Editor.hasPath(this.editor, Path.next(path))) {
|
|
794
|
-
Transforms.select(this.editor, Editor.start(this.editor, Path.next(path)));
|
|
795
|
-
} else {
|
|
796
|
-
Transforms.insertNodes(this.editor, {
|
|
797
|
-
type: 'paragraph',
|
|
798
|
-
children: [
|
|
799
|
-
{
|
|
800
|
-
text: ''
|
|
801
|
-
}
|
|
802
|
-
]
|
|
803
|
-
}, {
|
|
804
|
-
at: Path.next(path),
|
|
805
|
-
select: true
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
}
|
|
624
|
+
insertHorizontalLine(this.editor, node);
|
|
809
625
|
}
|
|
810
626
|
},
|
|
811
627
|
{
|
|
@@ -818,203 +634,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
818
634
|
* @param mode 列表类型 'ordered'(有序列表), 'unordered'(无序列表), 'task'(任务列表)
|
|
819
635
|
*/ key: "list",
|
|
820
636
|
value: function list(mode) {
|
|
821
|
-
|
|
822
|
-
if (curNode && [
|
|
823
|
-
'paragraph',
|
|
824
|
-
'head'
|
|
825
|
-
].includes(curNode[0].type)) {
|
|
826
|
-
var parent = Editor.parent(this.editor, curNode[1]);
|
|
827
|
-
if (parent[0].type === 'list-item' && !Path.hasPrevious(curNode[1])) {
|
|
828
|
-
Transforms.setNodes(this.editor, {
|
|
829
|
-
order: mode === 'ordered',
|
|
830
|
-
task: mode === 'task'
|
|
831
|
-
}, {
|
|
832
|
-
at: Path.parent(parent[1])
|
|
833
|
-
});
|
|
834
|
-
var listItems = Array.from(Editor.nodes(this.editor, {
|
|
835
|
-
match: function(n) {
|
|
836
|
-
return n.type === 'list-item';
|
|
837
|
-
},
|
|
838
|
-
at: Path.parent(parent[1]),
|
|
839
|
-
reverse: true,
|
|
840
|
-
mode: 'lowest'
|
|
841
|
-
}));
|
|
842
|
-
Transforms.setNodes(this.editor, {
|
|
843
|
-
start: undefined
|
|
844
|
-
}, {
|
|
845
|
-
at: Path.parent(parent[1])
|
|
846
|
-
});
|
|
847
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
848
|
-
try {
|
|
849
|
-
for(var _iterator = listItems[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
850
|
-
var l = _step.value;
|
|
851
|
-
Transforms.setNodes(this.editor, {
|
|
852
|
-
checked: mode === 'task' ? l[0].checked || false : undefined
|
|
853
|
-
}, {
|
|
854
|
-
at: l[1]
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
} catch (err) {
|
|
858
|
-
_didIteratorError = true;
|
|
859
|
-
_iteratorError = err;
|
|
860
|
-
} finally{
|
|
861
|
-
try {
|
|
862
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
863
|
-
_iterator.return();
|
|
864
|
-
}
|
|
865
|
-
} finally{
|
|
866
|
-
if (_didIteratorError) {
|
|
867
|
-
throw _iteratorError;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
} else {
|
|
872
|
-
var childrenList = [];
|
|
873
|
-
var selection = this.editor.selection;
|
|
874
|
-
if (!selection || Range.isCollapsed(selection)) {
|
|
875
|
-
// 如果没有选区或选区已折叠,使用当前节点
|
|
876
|
-
var textNodes = curNode[0].type === 'paragraph' ? curNode[0].children : [
|
|
877
|
-
{
|
|
878
|
-
text: Node.string(curNode[0])
|
|
879
|
-
}
|
|
880
|
-
];
|
|
881
|
-
var item = {
|
|
882
|
-
type: 'list-item',
|
|
883
|
-
checked: mode === 'task' ? false : undefined,
|
|
884
|
-
children: [
|
|
885
|
-
{
|
|
886
|
-
type: 'paragraph',
|
|
887
|
-
children: textNodes
|
|
888
|
-
}
|
|
889
|
-
]
|
|
890
|
-
};
|
|
891
|
-
childrenList.push(item);
|
|
892
|
-
// 删除原节点
|
|
893
|
-
Transforms.delete(this.editor, {
|
|
894
|
-
at: curNode[1]
|
|
895
|
-
});
|
|
896
|
-
} else {
|
|
897
|
-
// 有选区时,获取选区内的所有节点
|
|
898
|
-
var selectedNodes = Array.from(Editor.nodes(this.editor, {
|
|
899
|
-
at: selection,
|
|
900
|
-
match: function(n) {
|
|
901
|
-
return Element.isElement(n) && [
|
|
902
|
-
'paragraph',
|
|
903
|
-
'head'
|
|
904
|
-
].includes(n.type);
|
|
905
|
-
}
|
|
906
|
-
}));
|
|
907
|
-
if (selectedNodes.length === 0) {
|
|
908
|
-
// 如果没有选中块级元素,尝试选中文本节点
|
|
909
|
-
var textNodes1 = Array.from(Editor.nodes(this.editor, {
|
|
910
|
-
at: selection,
|
|
911
|
-
match: function(n) {
|
|
912
|
-
return Text.isText(n);
|
|
913
|
-
}
|
|
914
|
-
}));
|
|
915
|
-
if (textNodes1.length > 0) {
|
|
916
|
-
// 获取文本节点的父节点
|
|
917
|
-
var parentPath = Path.parent(textNodes1[0][1]);
|
|
918
|
-
var _Editor_node = _sliced_to_array(Editor.node(this.editor, parentPath), 1), parentNode = _Editor_node[0];
|
|
919
|
-
if (Element.isElement(parentNode) && [
|
|
920
|
-
'paragraph',
|
|
921
|
-
'head'
|
|
922
|
-
].includes(parentNode.type)) {
|
|
923
|
-
selectedNodes.push([
|
|
924
|
-
parentNode,
|
|
925
|
-
parentPath
|
|
926
|
-
]);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
931
|
-
try {
|
|
932
|
-
// 处理选中的节点
|
|
933
|
-
for(var _iterator1 = selectedNodes[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
934
|
-
var _step_value = _sliced_to_array(_step1.value, 2), node = _step_value[0], path = _step_value[1];
|
|
935
|
-
// 检查节点是否完全被选中
|
|
936
|
-
var nodeRange = Editor.range(this.editor, path);
|
|
937
|
-
var isFullySelected = Range.equals(selection, nodeRange) || Range.includes(selection, nodeRange) && Range.includes(nodeRange, selection);
|
|
938
|
-
if (isFullySelected) {
|
|
939
|
-
// 完全选中的节点,直接删除并转换为列表项
|
|
940
|
-
var textNodes2 = node.type === 'paragraph' ? node.children : [
|
|
941
|
-
{
|
|
942
|
-
text: Node.string(node)
|
|
943
|
-
}
|
|
944
|
-
];
|
|
945
|
-
var item1 = {
|
|
946
|
-
type: 'list-item',
|
|
947
|
-
checked: mode === 'task' ? false : undefined,
|
|
948
|
-
children: [
|
|
949
|
-
{
|
|
950
|
-
type: 'paragraph',
|
|
951
|
-
children: textNodes2
|
|
952
|
-
}
|
|
953
|
-
]
|
|
954
|
-
};
|
|
955
|
-
childrenList.push(item1);
|
|
956
|
-
Transforms.delete(this.editor, {
|
|
957
|
-
at: path
|
|
958
|
-
});
|
|
959
|
-
} else {
|
|
960
|
-
// 部分选中的节点,使用选区内容创建列表项
|
|
961
|
-
var selectedText = Editor.string(this.editor, selection);
|
|
962
|
-
if (selectedText.trim()) {
|
|
963
|
-
var item2 = {
|
|
964
|
-
type: 'list-item',
|
|
965
|
-
checked: mode === 'task' ? false : undefined,
|
|
966
|
-
children: [
|
|
967
|
-
{
|
|
968
|
-
type: 'paragraph',
|
|
969
|
-
children: [
|
|
970
|
-
{
|
|
971
|
-
text: selectedText
|
|
972
|
-
}
|
|
973
|
-
]
|
|
974
|
-
}
|
|
975
|
-
]
|
|
976
|
-
};
|
|
977
|
-
childrenList.push(item2);
|
|
978
|
-
// 删除选中的内容
|
|
979
|
-
Transforms.delete(this.editor, {
|
|
980
|
-
at: selection
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
} catch (err) {
|
|
986
|
-
_didIteratorError1 = true;
|
|
987
|
-
_iteratorError1 = err;
|
|
988
|
-
} finally{
|
|
989
|
-
try {
|
|
990
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
991
|
-
_iterator1.return();
|
|
992
|
-
}
|
|
993
|
-
} finally{
|
|
994
|
-
if (_didIteratorError1) {
|
|
995
|
-
throw _iteratorError1;
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
Transforms.insertNodes(this.editor, {
|
|
1001
|
-
type: 'list',
|
|
1002
|
-
order: mode === 'ordered',
|
|
1003
|
-
task: mode === 'task',
|
|
1004
|
-
children: childrenList
|
|
1005
|
-
}, {
|
|
1006
|
-
at: this.editor.selection || curNode[1],
|
|
1007
|
-
select: true
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
} else if (curNode && curNode[0].type === 'list-item') {
|
|
1011
|
-
Transforms.setNodes(this.editor, {
|
|
1012
|
-
order: mode === 'ordered',
|
|
1013
|
-
task: mode === 'task'
|
|
1014
|
-
}, {
|
|
1015
|
-
at: curNode[1]
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
637
|
+
createList(this.editor, mode);
|
|
1018
638
|
}
|
|
1019
639
|
},
|
|
1020
640
|
{
|
|
@@ -1252,7 +872,7 @@ export var useSystemKeyboard = function(keyTask$, store, props, markdownContaine
|
|
|
1252
872
|
(_task = task)[key].apply(_task, _to_consumable_array(args || []));
|
|
1253
873
|
});
|
|
1254
874
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1255
|
-
var keydown =
|
|
875
|
+
var keydown = useRefFunction(function(e) {
|
|
1256
876
|
if (!store) return;
|
|
1257
877
|
if (isHotkey('mod+c', e) || isHotkey('mod+x', e)) {
|
|
1258
878
|
var _node_, _node_1, _node_2;
|
|
@@ -1343,7 +963,7 @@ export var useSystemKeyboard = function(keyTask$, store, props, markdownContaine
|
|
|
1343
963
|
}
|
|
1344
964
|
}
|
|
1345
965
|
}
|
|
1346
|
-
}
|
|
966
|
+
});
|
|
1347
967
|
useEffect(function() {
|
|
1348
968
|
var _markdownContainerRef_current;
|
|
1349
969
|
if (props.readonly) return;
|