@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
|
@@ -1,494 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
function _array_without_holes(arr) {
|
|
10
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
-
}
|
|
12
|
-
function _define_property(obj, key, value) {
|
|
13
|
-
if (key in obj) {
|
|
14
|
-
Object.defineProperty(obj, key, {
|
|
15
|
-
value: value,
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
obj[key] = value;
|
|
22
|
-
}
|
|
23
|
-
return obj;
|
|
24
|
-
}
|
|
25
|
-
function _iterable_to_array(iter) {
|
|
26
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
27
|
-
}
|
|
28
|
-
function _iterable_to_array_limit(arr, i) {
|
|
29
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
30
|
-
if (_i == null) return;
|
|
31
|
-
var _arr = [];
|
|
32
|
-
var _n = true;
|
|
33
|
-
var _d = false;
|
|
34
|
-
var _s, _e;
|
|
35
|
-
try {
|
|
36
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
37
|
-
_arr.push(_s.value);
|
|
38
|
-
if (i && _arr.length === i) break;
|
|
39
|
-
}
|
|
40
|
-
} catch (err) {
|
|
41
|
-
_d = true;
|
|
42
|
-
_e = err;
|
|
43
|
-
} finally{
|
|
44
|
-
try {
|
|
45
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
46
|
-
} finally{
|
|
47
|
-
if (_d) throw _e;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return _arr;
|
|
51
|
-
}
|
|
52
|
-
function _non_iterable_rest() {
|
|
53
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
54
|
-
}
|
|
55
|
-
function _non_iterable_spread() {
|
|
56
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
-
}
|
|
58
|
-
function _object_spread(target) {
|
|
59
|
-
for(var i = 1; i < arguments.length; i++){
|
|
60
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
61
|
-
var ownKeys = Object.keys(source);
|
|
62
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
63
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
64
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
ownKeys.forEach(function(key) {
|
|
68
|
-
_define_property(target, key, source[key]);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return target;
|
|
72
|
-
}
|
|
73
|
-
function ownKeys(object, enumerableOnly) {
|
|
74
|
-
var keys = Object.keys(object);
|
|
75
|
-
if (Object.getOwnPropertySymbols) {
|
|
76
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
77
|
-
if (enumerableOnly) {
|
|
78
|
-
symbols = symbols.filter(function(sym) {
|
|
79
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
keys.push.apply(keys, symbols);
|
|
83
|
-
}
|
|
84
|
-
return keys;
|
|
85
|
-
}
|
|
86
|
-
function _object_spread_props(target, source) {
|
|
87
|
-
source = source != null ? source : {};
|
|
88
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
89
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
90
|
-
} else {
|
|
91
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
92
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
return target;
|
|
96
|
-
}
|
|
97
|
-
function _sliced_to_array(arr, i) {
|
|
98
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
99
|
-
}
|
|
100
|
-
function _to_consumable_array(arr) {
|
|
101
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
102
|
-
}
|
|
103
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
104
|
-
if (!o) return;
|
|
105
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
106
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
107
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
108
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
109
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
110
|
-
}
|
|
111
|
-
import { Editor, Node, Path, Range, Transforms } from "slate";
|
|
112
|
-
import { ReactEditor } from "slate-react";
|
|
113
|
-
export var inlineNode = new Set([
|
|
114
|
-
'break',
|
|
115
|
-
'inline-katex'
|
|
116
|
-
]);
|
|
117
|
-
var voidNode = new Set([
|
|
118
|
-
'hr',
|
|
119
|
-
'break'
|
|
120
|
-
]);
|
|
121
|
-
function hasRange(editor, range) {
|
|
122
|
-
var anchor = range.anchor, focus = range.focus;
|
|
123
|
-
return Editor.hasPath(editor, anchor.path) && Editor.hasPath(editor, focus.path);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* 清空卡片区域的文本内容 - 使用零宽字符替换
|
|
127
|
-
* @param editor - Slate编辑器实例
|
|
128
|
-
* @param path - 要清空的节点路径
|
|
129
|
-
*/ var clearCardAreaText = function(editor, path) {
|
|
130
|
-
try {
|
|
131
|
-
var node = Node.get(editor, path);
|
|
132
|
-
if (node) {
|
|
133
|
-
// 尝试直接DOM操作,设置为零宽字符
|
|
134
|
-
try {
|
|
135
|
-
var domNode = ReactEditor.toDOMNode(editor, node);
|
|
136
|
-
if (domNode) {
|
|
137
|
-
var zeroWidthNode = domNode === null || domNode === void 0 ? void 0 : domNode.querySelector('[data-slate-zero-width]');
|
|
138
|
-
if (zeroWidthNode) {
|
|
139
|
-
zeroWidthNode.textContent = '\uFEFF';
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
} catch (domError) {
|
|
143
|
-
// DOM operation failed, falling back to Slate transforms
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
// 如果操作失败,忽略错误
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* 检查卡片是否为空
|
|
152
|
-
* @param cardNode - 卡片节点
|
|
153
|
-
* @returns 如果卡片为空则返回true
|
|
154
|
-
*/ var isCardEmpty = function(cardNode) {
|
|
155
|
-
if (!cardNode || cardNode.type !== 'card' || !cardNode.children) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
// 查找实际内容节点(非card-before和card-after的节点)
|
|
159
|
-
var contentNodes = cardNode.children.filter(function(child) {
|
|
160
|
-
return child.type !== 'card-before' && child.type !== 'card-after';
|
|
161
|
-
});
|
|
162
|
-
// 如果没有内容节点,则为空
|
|
163
|
-
if (contentNodes.length === 0) {
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
// 检查内容节点是否为空
|
|
167
|
-
return contentNodes.every(function(node) {
|
|
168
|
-
if (!node.children || node.children.length === 0) {
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
// 检查是否只包含空文本
|
|
172
|
-
return node.children.every(function(child) {
|
|
173
|
-
return child.text === '' || child.text && child.text.trim() === '';
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* 处理卡片相关节点的操作
|
|
179
|
-
*
|
|
180
|
-
* @param editor - Slate编辑器实例
|
|
181
|
-
* @param operation - 要处理的操作
|
|
182
|
-
* @param apply - 原始的apply函数
|
|
183
|
-
* @returns 如果操作被处理则返回true,否则返回false
|
|
184
|
-
*
|
|
185
|
-
* @description
|
|
186
|
-
* 处理以下卡片相关操作:
|
|
187
|
-
* - 删除卡片节点 (remove_node),包括card、card-before和card-after
|
|
188
|
-
* - 在卡片后插入文本 (insert_text)
|
|
189
|
-
* - 在卡片内插入节点 (insert_node)
|
|
190
|
-
* - 检查并删除空卡片
|
|
191
|
-
*/ var handleCardOperation = function(editor, operation, apply) {
|
|
192
|
-
if (operation.type === 'remove_node') {
|
|
193
|
-
var node = operation.node;
|
|
194
|
-
// 删除card时,直接删除整个卡片
|
|
195
|
-
if (node.type === 'card') {
|
|
196
|
-
// 直接执行原始操作,避免递归
|
|
197
|
-
apply(operation);
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
// 删除card-after时,删除整个卡片
|
|
201
|
-
if (node.type === 'card-after') {
|
|
202
|
-
Transforms.removeNodes(editor, {
|
|
203
|
-
at: Path.parent(operation.path)
|
|
204
|
-
});
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
// 删除card-before时,阻止操作
|
|
208
|
-
if (node.type === 'card-before') {
|
|
209
|
-
return true;
|
|
210
|
-
}
|
|
211
|
-
// 检查操作后的父级是否为空卡片,如果是则删除
|
|
212
|
-
if (operation.path && operation.path.length > 0) {
|
|
213
|
-
try {
|
|
214
|
-
var parentPath = Path.parent(operation.path);
|
|
215
|
-
var parentNode = Node.get(editor, parentPath);
|
|
216
|
-
if (parentNode && parentNode.type === 'card' && isCardEmpty(parentNode)) {
|
|
217
|
-
Transforms.removeNodes(editor, {
|
|
218
|
-
at: parentPath
|
|
219
|
-
});
|
|
220
|
-
return true;
|
|
221
|
-
}
|
|
222
|
-
} catch (error) {
|
|
223
|
-
// 如果无法获取父节点,忽略错误
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (operation.type === 'insert_text') {
|
|
228
|
-
try {
|
|
229
|
-
var parentNode1 = Node.get(editor, Path.parent(operation.path));
|
|
230
|
-
// card-before 不允许任何文本输入
|
|
231
|
-
if (parentNode1.type === 'card-before') {
|
|
232
|
-
return true; // 阻止输入
|
|
233
|
-
}
|
|
234
|
-
// card-after 的输入会插入到卡片后面的新段落中
|
|
235
|
-
if (parentNode1.type === 'card-after') {
|
|
236
|
-
try {
|
|
237
|
-
var grandParentPath = Path.parent(Path.parent(operation.path));
|
|
238
|
-
var grandParentNode = Node.get(editor, grandParentPath);
|
|
239
|
-
if (grandParentNode.type === 'card') {
|
|
240
|
-
// 使用 Editor.withoutNormalizing 确保操作的原子性
|
|
241
|
-
Editor.withoutNormalizing(editor, function() {
|
|
242
|
-
// 先创建新段落
|
|
243
|
-
Transforms.insertNodes(editor, {
|
|
244
|
-
type: 'paragraph',
|
|
245
|
-
children: [
|
|
246
|
-
{
|
|
247
|
-
text: operation.text
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
}, {
|
|
251
|
-
at: Path.next(grandParentPath)
|
|
252
|
-
});
|
|
253
|
-
// 然后选中新创建的段落
|
|
254
|
-
var newParagraphPath = Path.next(grandParentPath);
|
|
255
|
-
var textPath = _to_consumable_array(newParagraphPath).concat([
|
|
256
|
-
0
|
|
257
|
-
]);
|
|
258
|
-
Transforms.select(editor, {
|
|
259
|
-
anchor: {
|
|
260
|
-
path: textPath,
|
|
261
|
-
offset: operation.text.length
|
|
262
|
-
},
|
|
263
|
-
focus: {
|
|
264
|
-
path: textPath,
|
|
265
|
-
offset: operation.text.length
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
clearCardAreaText(editor, operation.path);
|
|
269
|
-
});
|
|
270
|
-
return true;
|
|
271
|
-
}
|
|
272
|
-
} catch (error) {
|
|
273
|
-
// 如果获取父级节点失败,继续阻止输入
|
|
274
|
-
}
|
|
275
|
-
return true;
|
|
276
|
-
}
|
|
277
|
-
} catch (error) {
|
|
278
|
-
// 如果无法获取父节点,允许操作继续
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (operation.type === 'insert_node') {
|
|
282
|
-
var parentNode2 = Node.get(editor, Path.parent(operation.path));
|
|
283
|
-
// card-before 不允许任何节点插入
|
|
284
|
-
if (parentNode2.type === 'card-before') {
|
|
285
|
-
return true; // 阻止插入
|
|
286
|
-
}
|
|
287
|
-
// card-after 的节点插入会放到卡片后面
|
|
288
|
-
if (parentNode2.type === 'card-after') {
|
|
289
|
-
if (Node.get(editor, Path.parent(Path.parent(operation.path))).type === 'card') {
|
|
290
|
-
var cardPath = Path.parent(Path.parent(operation.path));
|
|
291
|
-
Transforms.insertNodes(editor, operation.node, {
|
|
292
|
-
at: Path.next(cardPath)
|
|
293
|
-
});
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
Transforms.insertNodes(editor, operation.node, {
|
|
297
|
-
at: Path.parent(operation.path)
|
|
298
|
-
});
|
|
299
|
-
return true;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
// 对于删除文本操作,我们需要在操作执行后检查卡片是否变空
|
|
303
|
-
// 这将在 editor.apply 的最后处理
|
|
304
|
-
return false;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* 处理链接卡片和媒体相关节点的操作
|
|
308
|
-
*
|
|
309
|
-
* @param editor - Slate编辑器实例
|
|
310
|
-
* @param operation - 要处理的操作
|
|
311
|
-
* @param apply - 原始的apply函数
|
|
312
|
-
* @returns 如果操作被处理则返回true,否则返回false
|
|
313
|
-
*
|
|
314
|
-
* @description
|
|
315
|
-
* 处理以下链接和媒体相关操作:
|
|
316
|
-
* - 拆分链接卡片或媒体节点 (split_node)
|
|
317
|
-
* - 删除链接卡片内的节点 (remove_node)
|
|
318
|
-
*/ var handleLinkAndMediaOperation = function(editor, operation) {
|
|
319
|
-
var _operation_properties, _operation_properties1;
|
|
320
|
-
if (operation.type === 'split_node' && (((_operation_properties = operation.properties) === null || _operation_properties === void 0 ? void 0 : _operation_properties.type) === 'link-card' || ((_operation_properties1 = operation.properties) === null || _operation_properties1 === void 0 ? void 0 : _operation_properties1.type) === 'media')) {
|
|
321
|
-
var node = Node.get(editor, operation.path);
|
|
322
|
-
if ([
|
|
323
|
-
'link-card',
|
|
324
|
-
'media'
|
|
325
|
-
].includes(node === null || node === void 0 ? void 0 : node.type)) {
|
|
326
|
-
Transforms.insertNodes(editor, [
|
|
327
|
-
{
|
|
328
|
-
type: 'paragraph',
|
|
329
|
-
children: [
|
|
330
|
-
{
|
|
331
|
-
text: '',
|
|
332
|
-
p: 'true'
|
|
333
|
-
}
|
|
334
|
-
]
|
|
335
|
-
}
|
|
336
|
-
], {
|
|
337
|
-
at: Path.next([
|
|
338
|
-
operation.path.at(0)
|
|
339
|
-
]),
|
|
340
|
-
select: true
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
if (operation.type === 'remove_node') {
|
|
346
|
-
var parentNode = Node.get(editor, Path.parent(operation.path));
|
|
347
|
-
if ('link-card' === parentNode.type) {
|
|
348
|
-
Transforms.removeNodes(editor, {
|
|
349
|
-
at: Path.parent(operation.path)
|
|
350
|
-
});
|
|
351
|
-
return true;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
return false;
|
|
355
|
-
};
|
|
356
|
-
/**
|
|
357
|
-
* 处理schema相关节点的操作
|
|
358
|
-
*
|
|
359
|
-
* @param editor - Slate编辑器实例
|
|
360
|
-
* @param operation - 要处理的操作
|
|
361
|
-
* @param apply - 原始的apply函数
|
|
362
|
-
* @returns 如果操作被处理则返回true,否则返回false
|
|
363
|
-
*
|
|
364
|
-
* @description
|
|
365
|
-
* 处理以下schema相关操作:
|
|
366
|
-
* - 拆分schema节点 (split_node),在拆分点之后插入新的段落节点
|
|
367
|
-
*/ var handleSchemaOperation = function(editor, operation) {
|
|
368
|
-
var _operation_properties;
|
|
369
|
-
if (operation.type === 'split_node' && ((_operation_properties = operation.properties) === null || _operation_properties === void 0 ? void 0 : _operation_properties.type) === 'schema') {
|
|
370
|
-
var node = Node.get(editor, operation.path);
|
|
371
|
-
if ((node === null || node === void 0 ? void 0 : node.type) === 'schema') {
|
|
372
|
-
Transforms.insertNodes(editor, [
|
|
373
|
-
{
|
|
374
|
-
type: 'paragraph',
|
|
375
|
-
children: [
|
|
376
|
-
{
|
|
377
|
-
text: '',
|
|
378
|
-
p: 'true'
|
|
379
|
-
}
|
|
380
|
-
]
|
|
381
|
-
}
|
|
382
|
-
], {
|
|
383
|
-
at: Path.next(operation.path),
|
|
384
|
-
select: true
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
return false;
|
|
390
|
-
};
|
|
391
|
-
/**
|
|
392
|
-
* 处理代码和标签相关节点的操作
|
|
393
|
-
*
|
|
394
|
-
* @param editor - Slate编辑器实例
|
|
395
|
-
* @param operation - 要处理的操作
|
|
396
|
-
* @param apply - 原始的apply函数
|
|
397
|
-
* @returns 如果操作被处理则返回true,否则返回false
|
|
398
|
-
*
|
|
399
|
-
* @description
|
|
400
|
-
* 处理以下代码和标签相关操作:
|
|
401
|
-
* - 删除文本 (remove_text),处理特殊触发文本和空标签
|
|
402
|
-
* - 删除节点 (remove_node),处理代码块周围的空格
|
|
403
|
-
* - 插入文本 (insert_text),处理代码块中的空格插入
|
|
404
|
-
*/ var handleCodeTagOperation = function(editor, operation, apply) {
|
|
405
|
-
if (operation.type === 'remove_text') {
|
|
406
|
-
var currentNode = Node.get(editor, operation.path);
|
|
407
|
-
if (currentNode === null || currentNode === void 0 ? void 0 : currentNode.tag) {
|
|
408
|
-
var _currentNode_text;
|
|
409
|
-
// 处理空标签的删除
|
|
410
|
-
if (((_currentNode_text = currentNode.text) === null || _currentNode_text === void 0 ? void 0 : _currentNode_text.trim()) === '') {
|
|
411
|
-
Editor.withoutNormalizing(editor, function() {
|
|
412
|
-
Transforms.setNodes(editor, {
|
|
413
|
-
tag: false,
|
|
414
|
-
code: false,
|
|
415
|
-
text: ' ',
|
|
416
|
-
triggerText: undefined
|
|
417
|
-
}, {
|
|
418
|
-
at: operation.path
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
return true;
|
|
422
|
-
}
|
|
423
|
-
if (currentNode.text === operation.text) {
|
|
424
|
-
Editor.withoutNormalizing(editor, function() {
|
|
425
|
-
Transforms.removeNodes(editor, {
|
|
426
|
-
at: operation.path
|
|
427
|
-
});
|
|
428
|
-
Transforms.insertNodes(editor, _object_spread_props(_object_spread({}, currentNode), {
|
|
429
|
-
tag: true,
|
|
430
|
-
code: true,
|
|
431
|
-
text: ' '
|
|
432
|
-
}), {
|
|
433
|
-
at: operation.path,
|
|
434
|
-
select: true
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
return true;
|
|
438
|
-
}
|
|
439
|
-
// 光标在 tag 内部,执行原始的删除操作
|
|
440
|
-
apply(operation);
|
|
441
|
-
return true;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
if (operation.type === 'insert_text') {
|
|
445
|
-
var _editor_selection;
|
|
446
|
-
var currentNode1 = Node.get(editor, operation.path);
|
|
447
|
-
if ((currentNode1 === null || currentNode1 === void 0 ? void 0 : currentNode1.tag) && operation.text === ' ' && ((_editor_selection = editor.selection) === null || _editor_selection === void 0 ? void 0 : _editor_selection.focus.offset) === currentNode1.text.length) {
|
|
448
|
-
// 检查前一个字符是否是空格
|
|
449
|
-
var lastChar = currentNode1.text.charAt(currentNode1.text.length - 1);
|
|
450
|
-
if (lastChar === ' ') {
|
|
451
|
-
// 如果前一个输入是空格,且当前输入也是空格,则插入一个空格到 tag 节点外
|
|
452
|
-
Transforms.insertNodes(editor, [
|
|
453
|
-
{
|
|
454
|
-
text: ' '
|
|
455
|
-
}
|
|
456
|
-
]);
|
|
457
|
-
return true;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
if ((currentNode1 === null || currentNode1 === void 0 ? void 0 : currentNode1.tag) && operation.text.trim().length > 0 && currentNode1.text.trim().length === 0) {
|
|
461
|
-
Editor.withoutNormalizing(editor, function() {
|
|
462
|
-
Transforms.removeNodes(editor, {
|
|
463
|
-
at: operation.path
|
|
464
|
-
});
|
|
465
|
-
Transforms.insertNodes(editor, _object_spread_props(_object_spread({}, currentNode1), {
|
|
466
|
-
tag: true,
|
|
467
|
-
code: true,
|
|
468
|
-
text: operation.text
|
|
469
|
-
}), {
|
|
470
|
-
at: operation.path,
|
|
471
|
-
select: true
|
|
472
|
-
});
|
|
473
|
-
});
|
|
474
|
-
return true;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (operation.type === 'split_node') {
|
|
478
|
-
var node = Node.get(editor, operation.path);
|
|
479
|
-
if ((node === null || node === void 0 ? void 0 : node.tag) || (node === null || node === void 0 ? void 0 : node.code)) {
|
|
480
|
-
return true;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return false;
|
|
484
|
-
};
|
|
485
|
-
// 将所有处理函数放入数组
|
|
486
|
-
var operationHandlers = [
|
|
487
|
-
handleCardOperation,
|
|
488
|
-
handleLinkAndMediaOperation,
|
|
489
|
-
handleSchemaOperation,
|
|
490
|
-
handleCodeTagOperation
|
|
491
|
-
];
|
|
1
|
+
import { withCardPlugin } from "./withCardPlugin";
|
|
2
|
+
import { withCodeTagPlugin } from "./withCodeTagPlugin";
|
|
3
|
+
import { withInlineNodes } from "./withInlineNodes";
|
|
4
|
+
import { withLinkAndMediaPlugin } from "./withLinkAndMediaPlugin";
|
|
5
|
+
import { withListsPlugin } from "./withListsPlugin";
|
|
6
|
+
import { withSchemaPlugin } from "./withSchemaPlugin";
|
|
7
|
+
import { withVoidNodes } from "./withVoidNodes";
|
|
492
8
|
/**
|
|
493
9
|
* 为Slate编辑器添加Markdown支持的插件函数
|
|
494
10
|
*
|
|
@@ -496,278 +12,15 @@ var operationHandlers = [
|
|
|
496
12
|
* @returns 增强后的编辑器实例,具有Markdown处理能力
|
|
497
13
|
*
|
|
498
14
|
* @description
|
|
499
|
-
*
|
|
500
|
-
* -
|
|
501
|
-
* -
|
|
502
|
-
* -
|
|
503
|
-
* -
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
* 3. 否则,调用原始的apply方法处理操作
|
|
15
|
+
* 该插件通过组合多个子插件,为编辑器提供完整的Markdown支持:
|
|
16
|
+
* - 行内节点识别(withInlineNodes)
|
|
17
|
+
* - 空节点识别(withVoidNodes)
|
|
18
|
+
* - 卡片功能(withCardPlugin)
|
|
19
|
+
* - 链接和媒体功能(withLinkAndMediaPlugin)
|
|
20
|
+
* - Schema功能(withSchemaPlugin)
|
|
21
|
+
* - 代码标签功能(withCodeTagPlugin)
|
|
22
|
+
*
|
|
23
|
+
* 插件按顺序应用,每个插件都会增强编辑器的特定功能。
|
|
509
24
|
*/ export var withMarkdown = function(editor) {
|
|
510
|
-
|
|
511
|
-
editor.isInline = function(element) {
|
|
512
|
-
return inlineNode.has(element.type) || isInline(element);
|
|
513
|
-
};
|
|
514
|
-
editor.isVoid = function(element) {
|
|
515
|
-
return voidNode.has(element.type) || isVoid(element);
|
|
516
|
-
};
|
|
517
|
-
editor.apply = function(operation) {
|
|
518
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
519
|
-
try {
|
|
520
|
-
// 依次尝试每个处理函数
|
|
521
|
-
for(var _iterator = operationHandlers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
522
|
-
var handler = _step.value;
|
|
523
|
-
if (handler(editor, operation, apply)) {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
} catch (err) {
|
|
528
|
-
_didIteratorError = true;
|
|
529
|
-
_iteratorError = err;
|
|
530
|
-
} finally{
|
|
531
|
-
try {
|
|
532
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
533
|
-
_iterator.return();
|
|
534
|
-
}
|
|
535
|
-
} finally{
|
|
536
|
-
if (_didIteratorError) {
|
|
537
|
-
throw _iteratorError;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
// 记录操作前可能涉及的卡片路径,用于操作后检查
|
|
542
|
-
var cardPathsToCheck = [];
|
|
543
|
-
if (operation.type === 'remove_text' || operation.type === 'insert_text') {
|
|
544
|
-
if (operation.path && operation.path.length > 0) {
|
|
545
|
-
try {
|
|
546
|
-
// 向上查找是否在卡片内
|
|
547
|
-
var currentPath = operation.path;
|
|
548
|
-
while(currentPath.length > 0){
|
|
549
|
-
var node = Node.get(editor, currentPath);
|
|
550
|
-
if (node && node.type === 'card') {
|
|
551
|
-
cardPathsToCheck.push(currentPath);
|
|
552
|
-
break;
|
|
553
|
-
}
|
|
554
|
-
currentPath = Path.parent(currentPath);
|
|
555
|
-
}
|
|
556
|
-
} catch (error) {
|
|
557
|
-
// 如果无法获取节点,忽略错误
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
// 执行原始操作
|
|
562
|
-
apply(operation);
|
|
563
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
564
|
-
try {
|
|
565
|
-
// 操作执行后,检查涉及的卡片是否变空
|
|
566
|
-
for(var _iterator1 = cardPathsToCheck[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
567
|
-
var cardPath = _step1.value;
|
|
568
|
-
try {
|
|
569
|
-
var cardNode = Node.get(editor, cardPath);
|
|
570
|
-
if (cardNode && cardNode.type === 'card' && isCardEmpty(cardNode)) {
|
|
571
|
-
Transforms.removeNodes(editor, {
|
|
572
|
-
at: cardPath
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
} catch (error) {
|
|
576
|
-
// 如果节点已被删除或不存在,忽略错误
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
} catch (err) {
|
|
580
|
-
_didIteratorError1 = true;
|
|
581
|
-
_iteratorError1 = err;
|
|
582
|
-
} finally{
|
|
583
|
-
try {
|
|
584
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
585
|
-
_iterator1.return();
|
|
586
|
-
}
|
|
587
|
-
} finally{
|
|
588
|
-
if (_didIteratorError1) {
|
|
589
|
-
throw _iteratorError1;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
editor.insertText = function(text) {
|
|
595
|
-
var selection = editor.selection;
|
|
596
|
-
if (selection && Range.isCollapsed(selection)) {
|
|
597
|
-
try {
|
|
598
|
-
var node = Node.get(editor, Path.parent(selection.anchor.path));
|
|
599
|
-
// card-before 不允许任何文本输入
|
|
600
|
-
if (node.type === 'card-before') {
|
|
601
|
-
return; // 阻止输入
|
|
602
|
-
}
|
|
603
|
-
// card-after 的输入会插入到卡片后面的新段落中
|
|
604
|
-
if (node.type === 'card-after') {
|
|
605
|
-
var grandParentPath = Path.parent(Path.parent(selection.anchor.path));
|
|
606
|
-
var grandParent = Node.get(editor, grandParentPath);
|
|
607
|
-
if (grandParent.type === 'card') {
|
|
608
|
-
Editor.withoutNormalizing(editor, function() {
|
|
609
|
-
Transforms.insertNodes(editor, {
|
|
610
|
-
type: 'paragraph',
|
|
611
|
-
children: [
|
|
612
|
-
{
|
|
613
|
-
text: text
|
|
614
|
-
}
|
|
615
|
-
]
|
|
616
|
-
}, {
|
|
617
|
-
at: Path.next(grandParentPath)
|
|
618
|
-
});
|
|
619
|
-
// 选中新创建的段落
|
|
620
|
-
var newParagraphPath = Path.next(grandParentPath);
|
|
621
|
-
var textPath = _to_consumable_array(newParagraphPath).concat([
|
|
622
|
-
0
|
|
623
|
-
]);
|
|
624
|
-
Transforms.select(editor, {
|
|
625
|
-
anchor: {
|
|
626
|
-
path: textPath,
|
|
627
|
-
offset: text.length
|
|
628
|
-
},
|
|
629
|
-
focus: {
|
|
630
|
-
path: textPath,
|
|
631
|
-
offset: text.length
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
var cardAfterPath = _to_consumable_array(grandParentPath).concat([
|
|
635
|
-
2,
|
|
636
|
-
0
|
|
637
|
-
]);
|
|
638
|
-
clearCardAreaText(editor, cardAfterPath);
|
|
639
|
-
});
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
} catch (error) {
|
|
644
|
-
// 如果无法获取节点,继续原有逻辑
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
insertText(text);
|
|
648
|
-
};
|
|
649
|
-
editor.insertFragment = function(fragment) {
|
|
650
|
-
var selection = editor.selection;
|
|
651
|
-
if (selection && Range.isCollapsed(selection)) {
|
|
652
|
-
try {
|
|
653
|
-
var node = Node.get(editor, Path.parent(selection.anchor.path));
|
|
654
|
-
// card-before 不允许任何片段插入
|
|
655
|
-
if (node.type === 'card-before') {
|
|
656
|
-
return; // 阻止插入
|
|
657
|
-
}
|
|
658
|
-
// card-after 的片段插入会放到卡片后面
|
|
659
|
-
if (node.type === 'card-after') {
|
|
660
|
-
var grandParentPath = Path.parent(Path.parent(selection.anchor.path));
|
|
661
|
-
var grandParent = Node.get(editor, grandParentPath);
|
|
662
|
-
if (grandParent.type === 'card') {
|
|
663
|
-
// 将片段内容插入到卡片后面
|
|
664
|
-
Transforms.insertNodes(editor, fragment, {
|
|
665
|
-
at: Path.next(grandParentPath),
|
|
666
|
-
select: true
|
|
667
|
-
});
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
} catch (error) {
|
|
672
|
-
// 如果无法获取节点,继续原有逻辑
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
insertFragment(fragment);
|
|
676
|
-
};
|
|
677
|
-
editor.deleteBackward = function(unit) {
|
|
678
|
-
var selection = editor.selection;
|
|
679
|
-
if (selection && hasRange(editor, selection) && Range.isCollapsed(selection)) {
|
|
680
|
-
var node = Node.get(editor, Path.parent(selection.anchor.path));
|
|
681
|
-
if (node.type === 'card-before') {
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
if (node.type === 'card-after') {
|
|
685
|
-
Transforms.removeNodes(editor, {
|
|
686
|
-
at: Path.parent(selection.anchor.path)
|
|
687
|
-
});
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
var curNode = Node.get(editor, selection.anchor.path);
|
|
691
|
-
// 检查前一个节点是否是 tag
|
|
692
|
-
try {
|
|
693
|
-
var _ref = _sliced_to_array(Editor.previous(editor, {
|
|
694
|
-
at: selection.anchor.path
|
|
695
|
-
}) || [], 2), previousNode = _ref[0], previousPath = _ref[1];
|
|
696
|
-
var isBeforeTag = selection && selection.anchor.offset <= 1;
|
|
697
|
-
if ((previousNode === null || previousNode === void 0 ? void 0 : previousNode.tag) && previousPath && isBeforeTag) {
|
|
698
|
-
var _curNode_text, _curNode_text1;
|
|
699
|
-
// 如果当前节点不为空,且只有一个文本
|
|
700
|
-
if (((_curNode_text = curNode.text) === null || _curNode_text === void 0 ? void 0 : _curNode_text.trim()) && curNode.text.trimEnd().length === 1 && selection.anchor.offset > 0) {
|
|
701
|
-
Transforms.insertText(editor, '', {
|
|
702
|
-
at: selection.anchor.path
|
|
703
|
-
});
|
|
704
|
-
Transforms.insertNodes(editor, {
|
|
705
|
-
type: 'paragraph',
|
|
706
|
-
children: [
|
|
707
|
-
{
|
|
708
|
-
text: ' '
|
|
709
|
-
}
|
|
710
|
-
]
|
|
711
|
-
}, {
|
|
712
|
-
at: selection.anchor.path,
|
|
713
|
-
select: true
|
|
714
|
-
});
|
|
715
|
-
return;
|
|
716
|
-
} else if (((_curNode_text1 = curNode.text) === null || _curNode_text1 === void 0 ? void 0 : _curNode_text1.trim()) && selection.anchor.offset > 0) {
|
|
717
|
-
deleteBackward(unit);
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
// 如果前一个节点是 tag,直接删除整个 tag
|
|
721
|
-
Editor.withoutNormalizing(editor, function() {
|
|
722
|
-
var parent = Node.get(editor, Path.parent(previousPath));
|
|
723
|
-
var index = previousPath[previousPath.length - 1];
|
|
724
|
-
if (parent.children.length === 1) {
|
|
725
|
-
// 如果是唯一的节点,转换为普通文本
|
|
726
|
-
Transforms.setNodes(editor, {
|
|
727
|
-
tag: false,
|
|
728
|
-
code: false,
|
|
729
|
-
text: ' ',
|
|
730
|
-
triggerText: undefined
|
|
731
|
-
}, {
|
|
732
|
-
at: previousPath
|
|
733
|
-
});
|
|
734
|
-
} else if (index === 0) {
|
|
735
|
-
// 如果是第一个节点,删除并合并下一个节点
|
|
736
|
-
Transforms.removeNodes(editor, {
|
|
737
|
-
at: previousPath
|
|
738
|
-
});
|
|
739
|
-
} else {
|
|
740
|
-
// 如果是中间或最后节点,先合并再删除
|
|
741
|
-
Transforms.removeNodes(editor, {
|
|
742
|
-
at: previousPath
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
} catch (error) {
|
|
749
|
-
// 如果获取前一个节点失败,继续执行原始删除操作
|
|
750
|
-
}
|
|
751
|
-
try {
|
|
752
|
-
var _node_text_trim, _node_text, _selection_anchor;
|
|
753
|
-
var node1 = Node.get(editor, selection.anchor.path);
|
|
754
|
-
if ((node1 === null || node1 === void 0 ? void 0 : node1.tag) && (node1 === null || node1 === void 0 ? void 0 : (_node_text = node1.text) === null || _node_text === void 0 ? void 0 : (_node_text_trim = _node_text.trim()) === null || _node_text_trim === void 0 ? void 0 : _node_text_trim.length) < 1 && (selection === null || selection === void 0 ? void 0 : (_selection_anchor = selection.anchor) === null || _selection_anchor === void 0 ? void 0 : _selection_anchor.offset) < 1) {
|
|
755
|
-
var _node_text1;
|
|
756
|
-
var text = node1 === null || node1 === void 0 ? void 0 : (_node_text1 = node1.text) === null || _node_text1 === void 0 ? void 0 : _node_text1.replace(node1.triggerText || '', '');
|
|
757
|
-
Transforms.setNodes(editor, {
|
|
758
|
-
tag: false,
|
|
759
|
-
code: false
|
|
760
|
-
}, {
|
|
761
|
-
at: selection.anchor.path
|
|
762
|
-
});
|
|
763
|
-
Transforms.insertText(editor, text, {
|
|
764
|
-
at: selection.anchor.path
|
|
765
|
-
});
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
} catch (e) {}
|
|
769
|
-
}
|
|
770
|
-
deleteBackward(unit);
|
|
771
|
-
};
|
|
772
|
-
return editor;
|
|
25
|
+
return withCodeTagPlugin(withSchemaPlugin(withLinkAndMediaPlugin(withCardPlugin(withListsPlugin(withVoidNodes(withInlineNodes(editor)))))));
|
|
773
26
|
};
|