@ant-design/agentic-ui 2.7.1 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentRunBar/Robot.js +105 -57
- package/dist/AgentRunBar/icons/PauseIcon.js +38 -38
- package/dist/AgentRunBar/icons/PlayIcon.js +38 -38
- package/dist/AgentRunBar/icons/SimplePauseIcon.js +38 -38
- package/dist/AgentRunBar/icons/SimplePlayIcon.js +38 -38
- package/dist/AgentRunBar/icons/SimpleStopIcon.js +38 -38
- package/dist/AgentRunBar/icons/StopIcon.js +41 -50
- package/dist/AgentRunBar/icons/index.js +0 -1
- package/dist/AgentRunBar/index.js +270 -237
- package/dist/AgentRunBar/style.js +273 -239
- package/dist/AgenticLayout/index.js +140 -85
- package/dist/AgenticLayout/style.js +126 -107
- package/dist/AnswerAlert/components/CloseIcon.js +12 -21
- package/dist/AnswerAlert/components/ErrorIcon.js +42 -38
- package/dist/AnswerAlert/components/InfoIcon.js +42 -38
- package/dist/AnswerAlert/components/LoaderIcon.js +12 -21
- package/dist/AnswerAlert/components/SuccessIcon.js +42 -38
- package/dist/AnswerAlert/components/WarningIcon.js +42 -38
- package/dist/AnswerAlert/index.js +155 -75
- package/dist/AnswerAlert/style.js +159 -147
- package/dist/BackTo/BackBottom.js +154 -70
- package/dist/BackTo/BackTop.js +148 -68
- package/dist/BackTo/ScrollVisibleButton.js +124 -98
- package/dist/BackTo/hooks/useScrollVisible.js +79 -33
- package/dist/BackTo/icons/BottomIcon.js +37 -37
- package/dist/BackTo/icons/TopIcon.js +37 -37
- package/dist/BackTo/index.js +22 -7
- package/dist/BackTo/style.js +93 -70
- package/dist/Bubble/AIBubble.js +469 -406
- package/dist/Bubble/Avatar/index.js +139 -85
- package/dist/Bubble/Avatar/isEmoji.js +2 -6
- package/dist/Bubble/Bubble.js +114 -38
- package/dist/Bubble/BubbleBeforeNode.js +104 -74
- package/dist/Bubble/BubbleConfigProvide.js +3 -7
- package/dist/Bubble/FileView.js +63 -69
- package/dist/Bubble/List/PureBubbleList.js +130 -131
- package/dist/Bubble/List/SkeletonList.js +33 -24
- package/dist/Bubble/List/index.js +187 -124
- package/dist/Bubble/List/style.js +76 -47
- package/dist/Bubble/MessagesContent/BubbleContext.js +6 -12
- package/dist/Bubble/MessagesContent/BubbleExtra.js +663 -355
- package/dist/Bubble/MessagesContent/CopyButton/index.js +326 -96
- package/dist/Bubble/MessagesContent/DocInfo.js +351 -386
- package/dist/Bubble/MessagesContent/EXCEPTION.js +42 -22
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +206 -156
- package/dist/Bubble/MessagesContent/VoiceButton/index.js +213 -115
- package/dist/Bubble/MessagesContent/VoiceButton/style.js +129 -105
- package/dist/Bubble/MessagesContent/VoiceButton/types.js +9 -0
- package/dist/Bubble/MessagesContent/docInfoStyle.js +118 -88
- package/dist/Bubble/MessagesContent/icons.js +157 -57
- package/dist/Bubble/MessagesContent/index.js +609 -368
- package/dist/Bubble/PureBubble.js +439 -326
- package/dist/Bubble/Title.js +110 -87
- package/dist/Bubble/UserBubble.js +218 -279
- package/dist/Bubble/index.js +10 -16
- package/dist/Bubble/style.js +248 -227
- package/dist/Bubble/type.js +3 -0
- package/dist/Bubble/types/BubbleExtra.js +1 -0
- package/dist/Bubble/types/DocInfo.js +1 -0
- package/dist/ChatBootPage/ButtonTab.js +25 -45
- package/dist/ChatBootPage/ButtonTabGroup.js +74 -47
- package/dist/ChatBootPage/ButtonTabGroupStyle.js +73 -45
- package/dist/ChatBootPage/ButtonTabStyle.js +121 -98
- package/dist/ChatBootPage/CaseReply.js +119 -113
- package/dist/ChatBootPage/CaseReplyStyle.js +217 -189
- package/dist/ChatBootPage/Title.js +19 -23
- package/dist/ChatBootPage/index.js +9 -11
- package/dist/ChatBootPage/style.js +80 -50
- package/dist/ChatLayout/index.js +93 -57
- package/dist/ChatLayout/style.js +206 -176
- package/dist/ChatLayout/types.js +1 -0
- package/dist/Components/ActionIconBox/index.js +571 -197
- package/dist/Components/ActionIconBox/style.js +141 -111
- package/dist/Components/ActionItemBox/ActionItemBox.js +95 -149
- package/dist/Components/ActionItemBox/index.js +7 -7
- package/dist/Components/ActionItemBox/style.js +353 -361
- package/dist/Components/Button/IconButton/index.js +35 -43
- package/dist/Components/Button/IconButton/style.js +357 -331
- package/dist/Components/Button/SwitchButton/index.js +243 -87
- package/dist/Components/Button/SwitchButton/style.js +160 -146
- package/dist/Components/Button/ToggleButton/index.js +46 -57
- package/dist/Components/Button/ToggleButton/style.js +283 -258
- package/dist/Components/Button/index.js +6 -2
- package/dist/Components/GradientText/index.js +21 -27
- package/dist/Components/GradientText/style.js +88 -63
- package/dist/Components/ImageList.js +111 -133
- package/dist/Components/LayoutHeader/index.js +145 -81
- package/dist/Components/LayoutHeader/style.js +89 -64
- package/dist/Components/LayoutHeader/types.js +3 -0
- package/dist/Components/Loading/index.js +53 -22
- package/dist/Components/Robot/index.js +90 -56
- package/dist/Components/Robot/lotties/DazingLottie/index.js +78 -47
- package/dist/Components/Robot/lotties/ThinkingLottie/index.js +78 -47
- package/dist/Components/Robot/lotties/index.js +0 -1
- package/dist/Components/SuggestionList/index.js +354 -182
- package/dist/Components/SuggestionList/style.js +204 -186
- package/dist/Components/TextAnimate/index.js +494 -362
- package/dist/Components/TextAnimate/style.js +72 -48
- package/dist/Components/TypingAnimation/index.js +214 -169
- package/dist/Components/TypingAnimation/style.js +76 -52
- package/dist/Components/VisualList/index.js +267 -180
- package/dist/Components/VisualList/style.js +140 -124
- package/dist/Components/icons/LoadingSpinnerIcon.js +124 -73
- package/dist/Components/lotties/DazingLottie/index.js +78 -47
- package/dist/Components/lotties/LoadingLottie/index.js +82 -48
- package/dist/Components/lotties/TextLoading/index.js +73 -49
- package/dist/Components/lotties/TextLoading/style.js +95 -78
- package/dist/Components/lotties/ThinkingLottie/index.js +78 -47
- package/dist/Components/lotties/index.js +0 -1
- package/dist/Constants/colors.js +71 -97
- package/dist/History/components/HistoryActionsBox.js +407 -180
- package/dist/History/components/HistoryEmpty.js +38 -42
- package/dist/History/components/HistoryEmptyIcon.js +682 -964
- package/dist/History/components/HistoryItem.js +683 -471
- package/dist/History/components/HistoryList.js +170 -87
- package/dist/History/components/HistoryRunningIcon.js +160 -111
- package/dist/History/components/LoadMoreComponent.js +308 -103
- package/dist/History/components/NewChatComponent.js +261 -69
- package/dist/History/components/NewChatComponent.style.js +79 -53
- package/dist/History/components/SearchComponent.js +367 -156
- package/dist/History/components/index.js +11 -23
- package/dist/History/hooks/useHistory.js +404 -129
- package/dist/History/index.js +301 -186
- package/dist/History/menu.js +158 -212
- package/dist/History/style.js +282 -268
- package/dist/History/types/HistoryData.js +6 -10
- package/dist/History/types/HistoryList.js +3 -0
- package/dist/History/types/index.js +3 -0
- package/dist/History/utils/index.js +35 -32
- package/dist/Hooks/useAutoScroll.js +262 -84
- package/dist/Hooks/useClickAway.js +60 -21
- package/dist/Hooks/useCopied.js +72 -20
- package/dist/Hooks/useDebounceFn/index.js +213 -55
- package/dist/Hooks/useIntersectionOnce.js +163 -74
- package/dist/Hooks/useLanguage.js +67 -26
- package/dist/Hooks/useRefFunction/index.js +76 -11
- package/dist/Hooks/useSpeechSynthesis.js +143 -99
- package/dist/Hooks/useStyle/index.js +95 -60
- package/dist/Hooks/useThrottleFn/index.js +41 -41
- package/dist/I18n/index.js +246 -109
- package/dist/I18n/locales.js +718 -711
- package/dist/Icons/animated/VoicePlayLottie/index.js +75 -46
- package/dist/Icons/animated/VoicingLottie/index.js +78 -47
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +421 -349
- package/dist/MarkdownEditor/editor/Editor.js +1160 -843
- package/dist/MarkdownEditor/editor/components/CommentList/index.js +407 -239
- package/dist/MarkdownEditor/editor/components/CommentList/style.js +119 -89
- package/dist/MarkdownEditor/editor/components/ContributorAvatar/index.js +61 -63
- package/dist/MarkdownEditor/editor/components/ContributorAvatar/style.js +82 -52
- package/dist/MarkdownEditor/editor/components/LazyElement/index.js +208 -106
- package/dist/MarkdownEditor/editor/components/LazyElement/style.js +69 -42
- package/dist/MarkdownEditor/editor/components/fntTag/index.js +7 -11
- package/dist/MarkdownEditor/editor/components/fntTag/style.js +66 -36
- package/dist/MarkdownEditor/editor/components/index.js +0 -1
- package/dist/MarkdownEditor/editor/elements/Blockquote.js +95 -37
- package/dist/MarkdownEditor/editor/elements/Break.js +56 -25
- package/dist/MarkdownEditor/editor/elements/Card/index.js +131 -52
- package/dist/MarkdownEditor/editor/elements/Code.js +89 -67
- package/dist/MarkdownEditor/editor/elements/Comment/index.js +79 -50
- package/dist/MarkdownEditor/editor/elements/ErrorBoundary.js +117 -21
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition.js +83 -64
- package/dist/MarkdownEditor/editor/elements/FootnoteReference.js +115 -41
- package/dist/MarkdownEditor/editor/elements/Head.js +131 -67
- package/dist/MarkdownEditor/editor/elements/Hr.js +63 -38
- package/dist/MarkdownEditor/editor/elements/Image/index.js +636 -494
- package/dist/MarkdownEditor/editor/elements/InlineKatex.js +60 -44
- package/dist/MarkdownEditor/editor/elements/Katex.js +71 -55
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +79 -175
- package/dist/MarkdownEditor/editor/elements/LinkCard/style.js +130 -100
- package/dist/MarkdownEditor/editor/elements/List/List.js +96 -69
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +422 -247
- package/dist/MarkdownEditor/editor/elements/List/index.js +1 -5
- package/dist/MarkdownEditor/editor/elements/List/style.js +131 -117
- package/dist/MarkdownEditor/editor/elements/Media.js +637 -519
- package/dist/MarkdownEditor/editor/elements/Mermaid.js +79 -54
- package/dist/MarkdownEditor/editor/elements/Paragraph.js +144 -83
- package/dist/MarkdownEditor/editor/elements/Schema.js +167 -128
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +211 -178
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +73 -49
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +285 -204
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/index.js +397 -280
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/style.js +126 -101
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/index.js +381 -276
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/style.js +120 -98
- package/dist/MarkdownEditor/editor/elements/Table/TableContext.js +64 -21
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/index.js +52 -42
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/style.js +69 -39
- package/dist/MarkdownEditor/editor/elements/Table/Td/index.js +126 -72
- package/dist/MarkdownEditor/editor/elements/Table/Td/style.js +85 -55
- package/dist/MarkdownEditor/editor/elements/Table/index.js +204 -105
- package/dist/MarkdownEditor/editor/elements/Table/style.js +244 -233
- package/dist/MarkdownEditor/editor/elements/Table/useScrollShadow.js +119 -62
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +438 -276
- package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +103 -77
- package/dist/MarkdownEditor/editor/elements/index.js +437 -424
- package/dist/MarkdownEditor/editor/parser/json-parse.js +38 -9
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +1753 -1168
- package/dist/MarkdownEditor/editor/parser/parserMdToSchema.js +16 -20
- package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +1021 -606
- package/dist/MarkdownEditor/editor/parser/remarkParse.js +158 -102
- package/dist/MarkdownEditor/editor/plugins/catchError.js +78 -17
- package/dist/MarkdownEditor/editor/plugins/elements.js +458 -342
- package/dist/MarkdownEditor/editor/plugins/handlePaste.js +752 -300
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/arrow.js +215 -129
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/backspace.js +325 -180
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +576 -418
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.js +157 -47
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.js +331 -209
- package/dist/MarkdownEditor/editor/plugins/index.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +1245 -507
- package/dist/MarkdownEditor/editor/plugins/parseMarkdownToNodesAndInsert.js +36 -24
- package/dist/MarkdownEditor/editor/plugins/useHighlight.js +267 -116
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +234 -160
- package/dist/MarkdownEditor/editor/plugins/useOnchange.js +253 -92
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +728 -439
- package/dist/MarkdownEditor/editor/store.js +1819 -1389
- package/dist/MarkdownEditor/editor/style.js +551 -506
- package/dist/MarkdownEditor/editor/tagStyles.js +43 -43
- package/dist/MarkdownEditor/editor/tools/DragHandle.js +56 -54
- package/dist/MarkdownEditor/editor/tools/InsertAutocomplete.js +1049 -732
- package/dist/MarkdownEditor/editor/tools/InsertLink.js +232 -181
- package/dist/MarkdownEditor/editor/tools/Leading.js +566 -303
- package/dist/MarkdownEditor/editor/tools/ToolBar/BaseBar.js +415 -377
- package/dist/MarkdownEditor/editor/tools/ToolBar/FloatBar.js +162 -125
- package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +480 -258
- package/dist/MarkdownEditor/editor/tools/ToolBar/ToolBar.js +44 -44
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ClearFormatButton.js +20 -35
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ColorPickerButton.js +69 -73
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/FormatButton.js +13 -19
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/FormattingTools.js +34 -41
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/HeadingDropdown.js +53 -47
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/LinkButton.js +11 -19
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ToolBarItem.js +23 -43
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/UndoRedoButtons.js +14 -25
- package/dist/MarkdownEditor/editor/tools/ToolBar/config/toolsConfig.js +139 -102
- package/dist/MarkdownEditor/editor/tools/ToolBar/floatBarStyle.js +95 -65
- package/dist/MarkdownEditor/editor/tools/ToolBar/hooks/useToolBarLogic.js +252 -161
- package/dist/MarkdownEditor/editor/tools/ToolBar/index.js +14 -24
- package/dist/MarkdownEditor/editor/tools/ToolBar/toolBarStyle.js +95 -65
- package/dist/MarkdownEditor/editor/tools/insertAutocompleteStyle.js +82 -52
- package/dist/MarkdownEditor/editor/types/Table.js +1 -0
- package/dist/MarkdownEditor/editor/utils/InlineChromiumBugfix.js +11 -16
- package/dist/MarkdownEditor/editor/utils/ace.js +136 -40
- package/dist/MarkdownEditor/editor/utils/docx/docxDeserializer.js +29 -32
- package/dist/MarkdownEditor/editor/utils/docx/index.js +0 -1
- package/dist/MarkdownEditor/editor/utils/docx/module.js +193 -164
- package/dist/MarkdownEditor/editor/utils/docx/utils.js +113 -98
- package/dist/MarkdownEditor/editor/utils/dom.js +119 -90
- package/dist/MarkdownEditor/editor/utils/editorUtils.js +1369 -906
- package/dist/MarkdownEditor/editor/utils/htmlToMarkdown.js +196 -184
- package/dist/MarkdownEditor/editor/utils/index.js +354 -215
- package/dist/MarkdownEditor/editor/utils/isMarkdown.js +56 -44
- package/dist/MarkdownEditor/editor/utils/keyboard.js +1229 -664
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +294 -76
- package/dist/MarkdownEditor/editor/utils/media.js +274 -99
- package/dist/MarkdownEditor/editor/utils/path.js +22 -16
- package/dist/MarkdownEditor/editor/utils/performanceMonitor.js +370 -168
- package/dist/MarkdownEditor/editor/utils/useLocalState.js +96 -37
- package/dist/MarkdownEditor/el.js +1 -0
- package/dist/MarkdownEditor/hooks/editor.js +123 -41
- package/dist/MarkdownEditor/hooks/subscribe.js +18 -15
- package/dist/MarkdownEditor/index.js +118 -30
- package/dist/MarkdownEditor/plugin.js +2 -5
- package/dist/MarkdownEditor/style.js +96 -66
- package/dist/MarkdownEditor/types.js +1 -0
- package/dist/MarkdownEditor/utils/exportHtml.js +42 -83
- package/dist/MarkdownEditor/utils/native-table/index.js +0 -1
- package/dist/MarkdownEditor/utils/native-table/native-table-editor.js +337 -222
- package/dist/MarkdownEditor/utils/native-table/native-table-keyboard.js +201 -113
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +86 -79
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.js +62 -33
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +147 -125
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +174 -129
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +263 -237
- package/dist/MarkdownInputField/AttachmentButton/index.js +465 -205
- package/dist/MarkdownInputField/AttachmentButton/style.js +143 -114
- package/dist/MarkdownInputField/AttachmentButton/types.js +3 -0
- package/dist/MarkdownInputField/AttachmentButton/utils.js +64 -34
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +438 -404
- package/dist/MarkdownInputField/Enlargement/index.js +7 -17
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +193 -216
- package/dist/MarkdownInputField/FileMapView/index.js +387 -174
- package/dist/MarkdownInputField/FileMapView/style.js +281 -259
- package/dist/MarkdownInputField/FilePaste/index.js +239 -65
- package/dist/MarkdownInputField/FileUploadManager/index.js +460 -170
- package/dist/MarkdownInputField/MarkdownInputField.js +819 -549
- package/dist/MarkdownInputField/QuickActions/index.js +304 -134
- package/dist/MarkdownInputField/RefinePromptButton/index.js +24 -33
- package/dist/MarkdownInputField/RefinePromptButton/style.js +99 -73
- package/dist/MarkdownInputField/SendActions/index.js +179 -197
- package/dist/MarkdownInputField/SendButton/index.js +150 -110
- package/dist/MarkdownInputField/SendButton/style.js +95 -64
- package/dist/MarkdownInputField/SkillModeBar/hooks/index.js +3 -5
- package/dist/MarkdownInputField/SkillModeBar/hooks/useSkillModeState.js +51 -26
- package/dist/MarkdownInputField/SkillModeBar/index.js +119 -106
- package/dist/MarkdownInputField/SkillModeBar/style.js +124 -98
- package/dist/MarkdownInputField/Suggestion/index.js +391 -154
- package/dist/MarkdownInputField/TopOperatingArea/index.js +37 -44
- package/dist/MarkdownInputField/TopOperatingArea/style.js +98 -81
- package/dist/MarkdownInputField/VoiceInput/index.js +210 -82
- package/dist/MarkdownInputField/VoiceInput/style.js +85 -59
- package/dist/MarkdownInputField/VoiceInputManager/index.js +321 -94
- package/dist/MarkdownInputField/style.js +296 -233
- package/dist/Plugins/chart/AreaChart/index.js +541 -393
- package/dist/Plugins/chart/AreaChart/style.js +114 -90
- package/dist/Plugins/chart/BarChart/index.d.ts +4 -0
- package/dist/Plugins/chart/BarChart/index.js +865 -697
- package/dist/Plugins/chart/BarChart/style.js +114 -90
- package/dist/Plugins/chart/ChartAttrToolBar/ChartAttrToolBarStyle.js +82 -52
- package/dist/Plugins/chart/ChartAttrToolBar/index.js +94 -65
- package/dist/Plugins/chart/ChartMark/Area.js +176 -150
- package/dist/Plugins/chart/ChartMark/Bar.js +181 -152
- package/dist/Plugins/chart/ChartMark/Column.js +181 -151
- package/dist/Plugins/chart/ChartMark/Container.js +116 -75
- package/dist/Plugins/chart/ChartMark/Line.js +179 -151
- package/dist/Plugins/chart/ChartMark/Pie.js +79 -63
- package/dist/Plugins/chart/ChartMark/index.js +6 -13
- package/dist/Plugins/chart/ChartMark/useChart.js +1 -0
- package/dist/Plugins/chart/ChartRender.d.ts +2 -0
- package/dist/Plugins/chart/ChartRender.js +981 -705
- package/dist/Plugins/chart/ChartStatistic/index.js +47 -62
- package/dist/Plugins/chart/ChartStatistic/style.js +142 -143
- package/dist/Plugins/chart/ChartStatistic/utils.js +37 -27
- package/dist/Plugins/chart/DonutChart/Legend.js +94 -124
- package/dist/Plugins/chart/DonutChart/constants.js +4 -11
- package/dist/Plugins/chart/DonutChart/hooks.js +183 -112
- package/dist/Plugins/chart/DonutChart/index.js +588 -516
- package/dist/Plugins/chart/DonutChart/plugins.js +47 -44
- package/dist/Plugins/chart/DonutChart/style.js +186 -175
- package/dist/Plugins/chart/DonutChart/types.js +1 -0
- package/dist/Plugins/chart/FunnelChart/index.js +844 -647
- package/dist/Plugins/chart/FunnelChart/style.js +97 -71
- package/dist/Plugins/chart/LineChart/index.js +516 -393
- package/dist/Plugins/chart/LineChart/style.js +114 -90
- package/dist/Plugins/chart/RadarChart/index.js +580 -582
- package/dist/Plugins/chart/RadarChart/style.js +122 -112
- package/dist/Plugins/chart/ScatterChart/index.js +633 -640
- package/dist/Plugins/chart/ScatterChart/style.js +108 -94
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +151 -80
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.js +160 -41
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundaryExample.js +80 -62
- package/dist/Plugins/chart/components/ChartContainer/index.js +2 -7
- package/dist/Plugins/chart/components/ChartContainer/style.js +121 -91
- package/dist/Plugins/chart/components/ChartFilter/ChartFilter.js +58 -90
- package/dist/Plugins/chart/components/ChartFilter/style.js +169 -154
- package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +54 -59
- package/dist/Plugins/chart/components/ChartToolBar/style.js +132 -117
- package/dist/Plugins/chart/components/icons/TimeIcon.js +20 -26
- package/dist/Plugins/chart/components/index.js +32 -34
- package/dist/Plugins/chart/const.js +34 -25
- package/dist/Plugins/chart/hooks/useChartStatistic.js +1 -0
- package/dist/Plugins/chart/index.js +436 -339
- package/dist/Plugins/chart/loadChartRuntime.js +209 -87
- package/dist/Plugins/chart/utils.js +311 -87
- package/dist/Plugins/code/CodeUI/Katex/Katex.js +112 -66
- package/dist/Plugins/code/components/AceEditor.js +334 -237
- package/dist/Plugins/code/components/AceEditorContainer.js +23 -32
- package/dist/Plugins/code/components/CodeContainer.js +41 -56
- package/dist/Plugins/code/components/CodeRenderer.js +202 -155
- package/dist/Plugins/code/components/CodeToolbar.js +137 -181
- package/dist/Plugins/code/components/HtmlPreview.js +19 -22
- package/dist/Plugins/code/components/LanguageSelector.js +162 -96
- package/dist/Plugins/code/components/LoadImage.js +145 -46
- package/dist/Plugins/code/components/ThinkBlock.js +38 -42
- package/dist/Plugins/code/components/index.js +13 -23
- package/dist/Plugins/code/hooks/index.js +7 -9
- package/dist/Plugins/code/hooks/useCodeEditorState.js +139 -62
- package/dist/Plugins/code/hooks/useRenderConditions.js +31 -23
- package/dist/Plugins/code/hooks/useToolbarConfig.js +44 -46
- package/dist/Plugins/code/index.js +141 -89
- package/dist/Plugins/code/langIconMap.js +400 -108
- package/dist/Plugins/code/langIcons/AbapIcon.js +90 -57
- package/dist/Plugins/code/langIcons/ActionscriptIcon.js +89 -56
- package/dist/Plugins/code/langIcons/AdaIcon.js +89 -52
- package/dist/Plugins/code/langIcons/ApacheIcon.js +205 -254
- package/dist/Plugins/code/langIcons/ApexIcon.js +108 -82
- package/dist/Plugins/code/langIcons/AplIcon.js +90 -54
- package/dist/Plugins/code/langIcons/ApplescriptIcon.js +89 -56
- package/dist/Plugins/code/langIcons/AstroIcon.js +91 -58
- package/dist/Plugins/code/langIcons/AwkIcon.js +98 -68
- package/dist/Plugins/code/langIcons/BallerinaIcon.js +92 -59
- package/dist/Plugins/code/langIcons/BatIcon.js +158 -229
- package/dist/Plugins/code/langIcons/BicepIcon.js +91 -58
- package/dist/Plugins/code/langIcons/BladeIcon.js +90 -58
- package/dist/Plugins/code/langIcons/CIcon.js +90 -55
- package/dist/Plugins/code/langIcons/CadenceIcon.js +89 -56
- package/dist/Plugins/code/langIcons/ClojureIcon.js +96 -75
- package/dist/Plugins/code/langIcons/CmakeIcon.js +93 -62
- package/dist/Plugins/code/langIcons/CobolIcon.js +99 -70
- package/dist/Plugins/code/langIcons/CodeqlIcon.js +96 -76
- package/dist/Plugins/code/langIcons/CoffeeIcon.js +89 -56
- package/dist/Plugins/code/langIcons/ConsoleIcon.js +89 -56
- package/dist/Plugins/code/langIcons/CppIcon.js +90 -55
- package/dist/Plugins/code/langIcons/CrystalIcon.js +90 -57
- package/dist/Plugins/code/langIcons/CsharpIcon.js +90 -59
- package/dist/Plugins/code/langIcons/CssIcon.js +89 -52
- package/dist/Plugins/code/langIcons/DIcon.js +90 -53
- package/dist/Plugins/code/langIcons/DartIcon.js +92 -71
- package/dist/Plugins/code/langIcons/DatabaseIcon.js +90 -57
- package/dist/Plugins/code/langIcons/DiffIcon.js +90 -57
- package/dist/Plugins/code/langIcons/DockerIcon.js +89 -56
- package/dist/Plugins/code/langIcons/DotenvIcon.js +94 -56
- package/dist/Plugins/code/langIcons/ElixirIcon.js +91 -58
- package/dist/Plugins/code/langIcons/ElmIcon.js +105 -58
- package/dist/Plugins/code/langIcons/ErbIcon.js +90 -54
- package/dist/Plugins/code/langIcons/ErlangIcon.js +89 -56
- package/dist/Plugins/code/langIcons/FsharpIcon.js +93 -62
- package/dist/Plugins/code/langIcons/GdscriptIcon.js +96 -88
- package/dist/Plugins/code/langIcons/GlslIcon.js +90 -58
- package/dist/Plugins/code/langIcons/GnuplotIcon.js +98 -77
- package/dist/Plugins/code/langIcons/GoIcon.js +114 -93
- package/dist/Plugins/code/langIcons/GraphqlIcon.js +106 -66
- package/dist/Plugins/code/langIcons/GroovyIcon.js +89 -56
- package/dist/Plugins/code/langIcons/HackIcon.js +97 -64
- package/dist/Plugins/code/langIcons/HamlIcon.js +89 -56
- package/dist/Plugins/code/langIcons/HandlebarsIcon.js +89 -56
- package/dist/Plugins/code/langIcons/HaskellIcon.js +93 -64
- package/dist/Plugins/code/langIcons/HclIcon.js +118 -93
- package/dist/Plugins/code/langIcons/HclLightIcon.js +118 -97
- package/dist/Plugins/code/langIcons/HjsonIcon.js +94 -62
- package/dist/Plugins/code/langIcons/HlslIcon.js +96 -76
- package/dist/Plugins/code/langIcons/HtmlIcon.js +89 -56
- package/dist/Plugins/code/langIcons/HttpIcon.js +89 -56
- package/dist/Plugins/code/langIcons/ImbaIcon.js +98 -65
- package/dist/Plugins/code/langIcons/IniIcon.js +90 -54
- package/dist/Plugins/code/langIcons/JavaIcon.js +89 -56
- package/dist/Plugins/code/langIcons/JavascriptIcon.js +89 -56
- package/dist/Plugins/code/langIcons/JinjaIcon.js +100 -68
- package/dist/Plugins/code/langIcons/Json5Icon.js +100 -82
- package/dist/Plugins/code/langIcons/JsonIcon.js +89 -56
- package/dist/Plugins/code/langIcons/JsonnetIcon.js +102 -86
- package/dist/Plugins/code/langIcons/JuliaIcon.js +105 -52
- package/dist/Plugins/code/langIcons/KotlinIcon.js +104 -74
- package/dist/Plugins/code/langIcons/KustoIcon.js +90 -57
- package/dist/Plugins/code/langIcons/LessIcon.js +90 -57
- package/dist/Plugins/code/langIcons/LiquidIcon.js +91 -58
- package/dist/Plugins/code/langIcons/LispIcon.js +89 -56
- package/dist/Plugins/code/langIcons/LuaIcon.js +93 -60
- package/dist/Plugins/code/langIcons/MakefileIcon.js +91 -58
- package/dist/Plugins/code/langIcons/MarkdownIcon.js +89 -56
- package/dist/Plugins/code/langIcons/MarkojsIcon.js +96 -73
- package/dist/Plugins/code/langIcons/MatlabIcon.js +93 -64
- package/dist/Plugins/code/langIcons/MdxIcon.js +90 -53
- package/dist/Plugins/code/langIcons/MermaidIcon.js +95 -64
- package/dist/Plugins/code/langIcons/MojoIcon.js +95 -62
- package/dist/Plugins/code/langIcons/NginxIcon.js +94 -61
- package/dist/Plugins/code/langIcons/NimIcon.js +91 -54
- package/dist/Plugins/code/langIcons/NixIcon.js +92 -56
- package/dist/Plugins/code/langIcons/ObjectiveCIcon.js +90 -59
- package/dist/Plugins/code/langIcons/ObjectiveCppIcon.js +90 -57
- package/dist/Plugins/code/langIcons/OcamlIcon.js +90 -61
- package/dist/Plugins/code/langIcons/PascalIcon.js +95 -55
- package/dist/Plugins/code/langIcons/Perl6Icon.js +299 -320
- package/dist/Plugins/code/langIcons/PerlIcon.js +89 -56
- package/dist/Plugins/code/langIcons/PhpIcon.js +89 -52
- package/dist/Plugins/code/langIcons/PostcssIcon.js +130 -113
- package/dist/Plugins/code/langIcons/PowershellIcon.js +91 -58
- package/dist/Plugins/code/langIcons/PrismaIcon.js +97 -68
- package/dist/Plugins/code/langIcons/PrologIcon.js +91 -58
- package/dist/Plugins/code/langIcons/ProtoIcon.js +94 -68
- package/dist/Plugins/code/langIcons/PugIcon.js +177 -145
- package/dist/Plugins/code/langIcons/PuppetIcon.js +96 -52
- package/dist/Plugins/code/langIcons/PurescriptIcon.js +93 -61
- package/dist/Plugins/code/langIcons/PythonIcon.js +90 -61
- package/dist/Plugins/code/langIcons/RIcon.js +89 -52
- package/dist/Plugins/code/langIcons/RazorIcon.js +90 -57
- package/dist/Plugins/code/langIcons/ReactIcon.js +89 -56
- package/dist/Plugins/code/langIcons/ReactTsIcon.js +90 -57
- package/dist/Plugins/code/langIcons/RubyIcon.js +91 -58
- package/dist/Plugins/code/langIcons/RustIcon.js +89 -56
- package/dist/Plugins/code/langIcons/SasIcon.js +89 -52
- package/dist/Plugins/code/langIcons/SassIcon.js +90 -57
- package/dist/Plugins/code/langIcons/ScalaIcon.js +96 -53
- package/dist/Plugins/code/langIcons/SchemeIcon.js +91 -58
- package/dist/Plugins/code/langIcons/ShaderlabIcon.js +89 -56
- package/dist/Plugins/code/langIcons/SolidityIcon.js +94 -52
- package/dist/Plugins/code/langIcons/SparqlIcon.js +94 -64
- package/dist/Plugins/code/langIcons/StataIcon.js +126 -108
- package/dist/Plugins/code/langIcons/StylusIcon.js +92 -59
- package/dist/Plugins/code/langIcons/SvelteIcon.js +91 -58
- package/dist/Plugins/code/langIcons/SwiftIcon.js +90 -57
- package/dist/Plugins/code/langIcons/SystemverilogIcon.js +115 -102
- package/dist/Plugins/code/langIcons/TclIcon.js +89 -52
- package/dist/Plugins/code/langIcons/TexIcon.js +99 -65
- package/dist/Plugins/code/langIcons/TomlIcon.js +94 -70
- package/dist/Plugins/code/langIcons/TwigIcon.js +89 -56
- package/dist/Plugins/code/langIcons/TypescriptIcon.js +93 -60
- package/dist/Plugins/code/langIcons/VerilogIcon.js +89 -56
- package/dist/Plugins/code/langIcons/VhdlIcon.js +94 -64
- package/dist/Plugins/code/langIcons/VimIcon.js +278 -420
- package/dist/Plugins/code/langIcons/VueIcon.js +92 -59
- package/dist/Plugins/code/langIcons/WebassemblyIcon.js +103 -76
- package/dist/Plugins/code/langIcons/WenyanIcon.js +104 -100
- package/dist/Plugins/code/langIcons/WgslIcon.js +93 -77
- package/dist/Plugins/code/langIcons/WolframlanguageIcon.js +100 -71
- package/dist/Plugins/code/langIcons/XmlIcon.js +89 -52
- package/dist/Plugins/code/langIcons/XslIcon.js +94 -66
- package/dist/Plugins/code/langIcons/YamlIcon.js +89 -56
- package/dist/Plugins/code/langIcons/ZigIcon.js +106 -81
- package/dist/Plugins/code/langIcons/index.js +128 -259
- package/dist/Plugins/code/utils/index.js +5 -5
- package/dist/Plugins/code/utils/langOptions.js +86 -11
- package/dist/Plugins/defaultPlugins.js +9 -13
- package/dist/Plugins/formatter/index.js +205 -105
- package/dist/Plugins/index.js +6 -2
- package/dist/Plugins/katex/InlineKatex.js +196 -107
- package/dist/Plugins/katex/Katex.js +139 -65
- package/dist/Plugins/katex/index.js +163 -103
- package/dist/Plugins/mermaid/Mermaid.d.ts +9 -4
- package/dist/Plugins/mermaid/Mermaid.js +475 -178
- package/dist/Plugins/mermaid/index.js +237 -142
- package/dist/Quote/index.js +112 -73
- package/dist/Quote/style.js +176 -160
- package/dist/Schema/SchemaEditor/AceEditorWrapper.js +163 -119
- package/dist/Schema/SchemaEditor/index.js +385 -275
- package/dist/Schema/SchemaEditor/style.js +261 -269
- package/dist/Schema/SchemaForm/index.js +443 -268
- package/dist/Schema/SchemaForm/types.js +1 -0
- package/dist/Schema/SchemaRenderer/index.js +973 -588
- package/dist/Schema/SchemaRenderer/templateEngine.js +106 -26
- package/dist/Schema/index.js +7 -11
- package/dist/Schema/types.js +1 -0
- package/dist/Schema/validator.js +74 -36
- package/dist/TaskList/index.js +197 -142
- package/dist/TaskList/style.js +143 -122
- package/dist/ThoughtChainList/CostMillis.js +88 -54
- package/dist/ThoughtChainList/DeepThink.js +187 -152
- package/dist/ThoughtChainList/DotAni/index.js +29 -14
- package/dist/ThoughtChainList/DotAni/style.js +82 -50
- package/dist/ThoughtChainList/FlipText/index.js +74 -30
- package/dist/ThoughtChainList/MarkdownEditor.js +126 -72
- package/dist/ThoughtChainList/RagRetrievalInfo.js +113 -145
- package/dist/ThoughtChainList/TableSql.js +413 -459
- package/dist/ThoughtChainList/ThoughtChainListItem.js +388 -222
- package/dist/ThoughtChainList/TitleInfo.js +189 -185
- package/dist/ThoughtChainList/ToolCall.js +429 -463
- package/dist/ThoughtChainList/WebSearch.js +192 -162
- package/dist/ThoughtChainList/index.js +449 -410
- package/dist/ThoughtChainList/style.js +253 -232
- package/dist/ThoughtChainList/types.js +1 -0
- package/dist/ToolUseBar/ToolUseBarItem.js +183 -139
- package/dist/ToolUseBar/ToolUseBarItemComponents.js +345 -276
- package/dist/ToolUseBar/ToolUseBarThink.js +335 -396
- package/dist/ToolUseBar/index.js +226 -113
- package/dist/ToolUseBar/style.js +334 -308
- package/dist/ToolUseBar/thinkStyle.js +350 -328
- package/dist/Types/common.js +1 -0
- package/dist/Types/index.js +4 -2
- package/dist/Types/message.js +1 -0
- package/dist/Utils/easings.js +9 -12
- package/dist/Utils/formatTime.js +41 -17
- package/dist/Utils/getScroll.js +41 -41
- package/dist/Utils/language.js +355 -150
- package/dist/Utils/proxySandbox/ProxySandbox.js +1637 -1076
- package/dist/Utils/proxySandbox/SecurityContextManager.js +607 -343
- package/dist/Utils/proxySandbox/index.js +554 -267
- package/dist/Utils/proxySandbox/types.js +187 -52
- package/dist/Utils/scrollTo.js +48 -56
- package/dist/Utils/throttleByAnimationFrame.js +46 -20
- package/dist/WelcomeMessage/index.js +106 -58
- package/dist/WelcomeMessage/style.js +80 -55
- package/dist/Workspace/Browser/index.js +102 -40
- package/dist/Workspace/Browser/style.js +62 -33
- package/dist/Workspace/File/DataSourceStrategy.js +419 -217
- package/dist/Workspace/File/FileComponent.js +1004 -791
- package/dist/Workspace/File/FileTypeProcessor.js +337 -184
- package/dist/Workspace/File/PreviewComponent.js +472 -532
- package/dist/Workspace/File/index.js +3 -10
- package/dist/Workspace/File/style.js +397 -424
- package/dist/Workspace/File/utils.js +160 -106
- package/dist/Workspace/HtmlPreview/index.js +238 -137
- package/dist/Workspace/HtmlPreview/style.js +99 -77
- package/dist/Workspace/RealtimeFollow/index.js +411 -413
- package/dist/Workspace/RealtimeFollow/style.js +299 -303
- package/dist/Workspace/Task/index.js +53 -35
- package/dist/Workspace/Task/style.js +99 -73
- package/dist/Workspace/index.js +332 -254
- package/dist/Workspace/style.js +165 -146
- package/dist/Workspace/types.js +471 -252
- package/dist/Workspace/utils/codeLanguageUtils.js +148 -129
- package/dist/Workspace/utils.js +28 -20
- package/dist/index.js +27 -17
- package/package.json +3 -2
|
@@ -1,63 +1,242 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
+
}
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
13
|
+
try {
|
|
14
|
+
var info = gen[key](arg);
|
|
15
|
+
var value = info.value;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
reject(error);
|
|
18
|
+
return;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
reject
|
|
27
|
-
|
|
20
|
+
if (info.done) {
|
|
21
|
+
resolve(value);
|
|
22
|
+
} else {
|
|
23
|
+
Promise.resolve(value).then(_next, _throw);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function _async_to_generator(fn) {
|
|
27
|
+
return function() {
|
|
28
|
+
var self = this, args = arguments;
|
|
29
|
+
return new Promise(function(resolve, reject) {
|
|
30
|
+
var gen = fn.apply(self, args);
|
|
31
|
+
function _next(value) {
|
|
32
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
33
|
+
}
|
|
34
|
+
function _throw(err) {
|
|
35
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
36
|
+
}
|
|
37
|
+
_next(undefined);
|
|
38
|
+
});
|
|
28
39
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
}
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
|
+
if (key in obj) {
|
|
43
|
+
Object.defineProperty(obj, key, {
|
|
44
|
+
value: value,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
obj[key] = value;
|
|
51
|
+
}
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
function _iterable_to_array(iter) {
|
|
55
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
56
|
+
}
|
|
57
|
+
function _iterable_to_array_limit(arr, i) {
|
|
58
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
59
|
+
if (_i == null) return;
|
|
60
|
+
var _arr = [];
|
|
61
|
+
var _n = true;
|
|
62
|
+
var _d = false;
|
|
63
|
+
var _s, _e;
|
|
64
|
+
try {
|
|
65
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
66
|
+
_arr.push(_s.value);
|
|
67
|
+
if (i && _arr.length === i) break;
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
_d = true;
|
|
71
|
+
_e = err;
|
|
72
|
+
} finally{
|
|
73
|
+
try {
|
|
74
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
75
|
+
} finally{
|
|
76
|
+
if (_d) throw _e;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return _arr;
|
|
80
|
+
}
|
|
81
|
+
function _non_iterable_rest() {
|
|
82
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
83
|
+
}
|
|
84
|
+
function _non_iterable_spread() {
|
|
85
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
86
|
+
}
|
|
87
|
+
function _object_spread(target) {
|
|
88
|
+
for(var i = 1; i < arguments.length; i++){
|
|
89
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
90
|
+
var ownKeys = Object.keys(source);
|
|
91
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
92
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
93
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
ownKeys.forEach(function(key) {
|
|
97
|
+
_define_property(target, key, source[key]);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return target;
|
|
101
|
+
}
|
|
102
|
+
function ownKeys(object, enumerableOnly) {
|
|
103
|
+
var keys = Object.keys(object);
|
|
104
|
+
if (Object.getOwnPropertySymbols) {
|
|
105
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
106
|
+
if (enumerableOnly) {
|
|
107
|
+
symbols = symbols.filter(function(sym) {
|
|
108
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
keys.push.apply(keys, symbols);
|
|
112
|
+
}
|
|
113
|
+
return keys;
|
|
114
|
+
}
|
|
115
|
+
function _object_spread_props(target, source) {
|
|
116
|
+
source = source != null ? source : {};
|
|
117
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
118
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
119
|
+
} else {
|
|
120
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
121
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return target;
|
|
125
|
+
}
|
|
126
|
+
function _sliced_to_array(arr, i) {
|
|
127
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
128
|
+
}
|
|
129
|
+
function _to_consumable_array(arr) {
|
|
130
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
131
|
+
}
|
|
132
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
133
|
+
if (!o) return;
|
|
134
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
135
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
136
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
137
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
138
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
139
|
+
}
|
|
140
|
+
function _ts_generator(thisArg, body) {
|
|
141
|
+
var f, y, t, g, _ = {
|
|
142
|
+
label: 0,
|
|
143
|
+
sent: function() {
|
|
144
|
+
if (t[0] & 1) throw t[1];
|
|
145
|
+
return t[1];
|
|
146
|
+
},
|
|
147
|
+
trys: [],
|
|
148
|
+
ops: []
|
|
35
149
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
150
|
+
return g = {
|
|
151
|
+
next: verb(0),
|
|
152
|
+
"throw": verb(1),
|
|
153
|
+
"return": verb(2)
|
|
154
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
155
|
+
return this;
|
|
156
|
+
}), g;
|
|
157
|
+
function verb(n) {
|
|
158
|
+
return function(v) {
|
|
159
|
+
return step([
|
|
160
|
+
n,
|
|
161
|
+
v
|
|
162
|
+
]);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function step(op) {
|
|
166
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
167
|
+
while(_)try {
|
|
168
|
+
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;
|
|
169
|
+
if (y = 0, t) op = [
|
|
170
|
+
op[0] & 2,
|
|
171
|
+
t.value
|
|
172
|
+
];
|
|
173
|
+
switch(op[0]){
|
|
174
|
+
case 0:
|
|
175
|
+
case 1:
|
|
176
|
+
t = op;
|
|
177
|
+
break;
|
|
178
|
+
case 4:
|
|
179
|
+
_.label++;
|
|
180
|
+
return {
|
|
181
|
+
value: op[1],
|
|
182
|
+
done: false
|
|
183
|
+
};
|
|
184
|
+
case 5:
|
|
185
|
+
_.label++;
|
|
186
|
+
y = op[1];
|
|
187
|
+
op = [
|
|
188
|
+
0
|
|
189
|
+
];
|
|
190
|
+
continue;
|
|
191
|
+
case 7:
|
|
192
|
+
op = _.ops.pop();
|
|
193
|
+
_.trys.pop();
|
|
194
|
+
continue;
|
|
195
|
+
default:
|
|
196
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
197
|
+
_ = 0;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
201
|
+
_.label = op[1];
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
205
|
+
_.label = t[1];
|
|
206
|
+
t = op;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
if (t && _.label < t[2]) {
|
|
210
|
+
_.label = t[2];
|
|
211
|
+
_.ops.push(op);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
if (t[2]) _.ops.pop();
|
|
215
|
+
_.trys.pop();
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
op = body.call(thisArg, _);
|
|
219
|
+
} catch (e) {
|
|
220
|
+
op = [
|
|
221
|
+
6,
|
|
222
|
+
e
|
|
223
|
+
];
|
|
224
|
+
y = 0;
|
|
225
|
+
} finally{
|
|
226
|
+
f = t = 0;
|
|
227
|
+
}
|
|
228
|
+
if (op[0] & 5) throw op[1];
|
|
229
|
+
return {
|
|
230
|
+
value: op[0] ? op[1] : void 0,
|
|
231
|
+
done: true
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
import { CheckSquareOutlined, CodeOutlined, FontSizeOutlined, OrderedListOutlined, PlayCircleOutlined, TableOutlined, UnorderedListOutlined } from "@ant-design/icons";
|
|
51
236
|
import { Button, ConfigProvider, Input, Menu, Tabs } from "antd";
|
|
52
237
|
import classNames from "classnames";
|
|
53
238
|
import isHotkey from "is-hotkey";
|
|
54
|
-
import React, {
|
|
55
|
-
useCallback,
|
|
56
|
-
useContext,
|
|
57
|
-
useEffect,
|
|
58
|
-
useMemo,
|
|
59
|
-
useRef
|
|
60
|
-
} from "react";
|
|
239
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef } from "react";
|
|
61
240
|
import ReactDOM from "react-dom";
|
|
62
241
|
import { Editor, Element, Node, Transforms } from "slate";
|
|
63
242
|
import { ReactEditor } from "slate-react";
|
|
@@ -70,742 +249,880 @@ import { EditorUtils } from "../utils/editorUtils";
|
|
|
70
249
|
import { getRemoteMediaType } from "../utils/media";
|
|
71
250
|
import { useLocalState } from "../utils/useLocalState";
|
|
72
251
|
import { useStyle } from "./insertAutocompleteStyle";
|
|
73
|
-
var ImageIcon = ()
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
height: "1em"
|
|
82
|
-
},
|
|
83
|
-
/* @__PURE__ */ React.createElement(
|
|
84
|
-
"path",
|
|
85
|
-
{
|
|
252
|
+
var ImageIcon = function() {
|
|
253
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
254
|
+
className: "ant-menu-item-icon",
|
|
255
|
+
viewBox: "0 0 1024 1024",
|
|
256
|
+
version: "1.1",
|
|
257
|
+
width: "1em",
|
|
258
|
+
height: "1em"
|
|
259
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
86
260
|
fill: "currentColor",
|
|
87
261
|
d: "M0 128l0 768 1024 0L1024 128 0 128zM944 816 80 816 80 208l864 0L944 816zM704 368c0 53.024 42.976 96 96 96 53.024 0 96-42.976 96-96 0-53.024-42.976-96-96-96C746.976 272 704 314.976 704 368M888 760l-192-288-128 96-240-304-192 496L888 760z"
|
|
88
|
-
|
|
89
|
-
)
|
|
90
|
-
);
|
|
262
|
+
}));
|
|
91
263
|
};
|
|
92
|
-
var Quote = ()
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
height: "1em"
|
|
101
|
-
},
|
|
102
|
-
/* @__PURE__ */ React.createElement(
|
|
103
|
-
"path",
|
|
104
|
-
{
|
|
264
|
+
var Quote = function() {
|
|
265
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
266
|
+
className: "ant-menu-item-icon",
|
|
267
|
+
viewBox: "0 0 1024 1024",
|
|
268
|
+
version: "1.1",
|
|
269
|
+
width: "1em",
|
|
270
|
+
height: "1em"
|
|
271
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
105
272
|
d: "M128 472.896h341.344v341.344H128zM128 472.896L272.096 192h110.08l-144.128 280.896z",
|
|
106
273
|
fill: "currentColor"
|
|
107
|
-
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ React.createElement(
|
|
110
|
-
"path",
|
|
111
|
-
{
|
|
274
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
112
275
|
d: "M544 472.896h341.344v341.344H544zM544 472.896L688.096 192h110.08l-144.128 280.896z",
|
|
113
276
|
fill: "currentColor"
|
|
114
|
-
|
|
115
|
-
)
|
|
116
|
-
);
|
|
277
|
+
}));
|
|
117
278
|
};
|
|
118
279
|
var replaceUrl = [
|
|
119
|
-
{
|
|
120
|
-
reg: /https?:\/\/youtu.be\/([\w-]+)(\?si=\w+)?/i,
|
|
121
|
-
replace: (match) => {
|
|
122
|
-
return `https://www.youtube.com/embed/${match[1]}${match[2] || ""}`;
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
reg: /https?:\/\/www.bilibili.com\/video\/([\w-]+)\/?/,
|
|
127
|
-
replace: (match) => {
|
|
128
|
-
return `https://player.bilibili.com/player.html?isOutside=true&bvid=${match[1]}`;
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
reg: /src=["']([^"\n]+)["']/i,
|
|
133
|
-
replace: (match) => {
|
|
134
|
-
return match[1];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
];
|
|
138
|
-
var getInsertOptions = (ctx, locale) => {
|
|
139
|
-
const options = [
|
|
140
280
|
{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{
|
|
145
|
-
label: [(locale == null ? void 0 : locale.table) || "表格"],
|
|
146
|
-
key: "table",
|
|
147
|
-
task: "insertTable",
|
|
148
|
-
icon: /* @__PURE__ */ React.createElement(TableOutlined, null)
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
label: [(locale == null ? void 0 : locale.quote) || "引用"],
|
|
152
|
-
key: "quote",
|
|
153
|
-
task: "insertQuote",
|
|
154
|
-
icon: /* @__PURE__ */ React.createElement(Quote, null)
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
label: [(locale == null ? void 0 : locale.code) || "代码"],
|
|
158
|
-
key: "code",
|
|
159
|
-
task: "insertCode",
|
|
160
|
-
icon: /* @__PURE__ */ React.createElement(CodeOutlined, null)
|
|
281
|
+
reg: /https?:\/\/youtu.be\/([\w-]+)(\?si=\w+)?/i,
|
|
282
|
+
replace: function(match) {
|
|
283
|
+
return "https://www.youtube.com/embed/".concat(match[1]).concat(match[2] || '');
|
|
161
284
|
}
|
|
162
|
-
]
|
|
163
285
|
},
|
|
164
286
|
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
label: [(locale == null ? void 0 : locale.localeImage) || "本地图片"],
|
|
170
|
-
task: "uploadImage",
|
|
171
|
-
key: "localeImage",
|
|
172
|
-
args: ["", true],
|
|
173
|
-
icon: /* @__PURE__ */ React.createElement(ImageIcon, null)
|
|
287
|
+
reg: /https?:\/\/www.bilibili.com\/video\/([\w-]+)\/?/,
|
|
288
|
+
replace: function(match) {
|
|
289
|
+
return "https://player.bilibili.com/player.html?isOutside=true&bvid=".concat(match[1]);
|
|
174
290
|
}
|
|
175
|
-
]
|
|
176
291
|
},
|
|
177
292
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
label: [locale["b-list"] || "无序列表"],
|
|
183
|
-
task: "list",
|
|
184
|
-
key: "b-list",
|
|
185
|
-
args: ["unordered"],
|
|
186
|
-
icon: /* @__PURE__ */ React.createElement(UnorderedListOutlined, null)
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
label: [locale["n-list"] || "有序列表"],
|
|
190
|
-
task: "list",
|
|
191
|
-
key: "n-list",
|
|
192
|
-
args: ["ordered"],
|
|
193
|
-
icon: /* @__PURE__ */ React.createElement(OrderedListOutlined, null)
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
label: [locale["t-list"] || "任务列表"],
|
|
197
|
-
task: "list",
|
|
198
|
-
key: "t-list",
|
|
199
|
-
args: ["task"],
|
|
200
|
-
icon: /* @__PURE__ */ React.createElement(CheckSquareOutlined, null)
|
|
293
|
+
reg: /src=["']([^"\n]+)["']/i,
|
|
294
|
+
replace: function(match) {
|
|
295
|
+
return match[1];
|
|
201
296
|
}
|
|
202
|
-
]
|
|
203
297
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
options
|
|
207
|
-
label: ["标题", "Heading"],
|
|
208
|
-
key: "head",
|
|
209
|
-
children: [
|
|
298
|
+
];
|
|
299
|
+
export var getInsertOptions = function(ctx, locale) {
|
|
300
|
+
var options = [
|
|
210
301
|
{
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
302
|
+
label: [
|
|
303
|
+
'元素',
|
|
304
|
+
'Elements'
|
|
305
|
+
],
|
|
306
|
+
key: 'element',
|
|
307
|
+
children: [
|
|
308
|
+
{
|
|
309
|
+
label: [
|
|
310
|
+
(locale === null || locale === void 0 ? void 0 : locale.table) || '表格'
|
|
311
|
+
],
|
|
312
|
+
key: 'table',
|
|
313
|
+
task: 'insertTable',
|
|
314
|
+
icon: /*#__PURE__*/ React.createElement(TableOutlined, null)
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
label: [
|
|
318
|
+
(locale === null || locale === void 0 ? void 0 : locale.quote) || '引用'
|
|
319
|
+
],
|
|
320
|
+
key: 'quote',
|
|
321
|
+
task: 'insertQuote',
|
|
322
|
+
icon: /*#__PURE__*/ React.createElement(Quote, null)
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
label: [
|
|
326
|
+
(locale === null || locale === void 0 ? void 0 : locale.code) || '代码'
|
|
327
|
+
],
|
|
328
|
+
key: 'code',
|
|
329
|
+
task: 'insertCode',
|
|
330
|
+
icon: /*#__PURE__*/ React.createElement(CodeOutlined, null)
|
|
331
|
+
}
|
|
332
|
+
]
|
|
216
333
|
},
|
|
217
334
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
335
|
+
label: [
|
|
336
|
+
'媒体',
|
|
337
|
+
'media'
|
|
338
|
+
],
|
|
339
|
+
key: 'media',
|
|
340
|
+
children: [
|
|
341
|
+
{
|
|
342
|
+
label: [
|
|
343
|
+
(locale === null || locale === void 0 ? void 0 : locale.localeImage) || '本地图片'
|
|
344
|
+
],
|
|
345
|
+
task: 'uploadImage',
|
|
346
|
+
key: 'localeImage',
|
|
347
|
+
args: [
|
|
348
|
+
'',
|
|
349
|
+
true
|
|
350
|
+
],
|
|
351
|
+
icon: /*#__PURE__*/ React.createElement(ImageIcon, null)
|
|
352
|
+
}
|
|
353
|
+
]
|
|
223
354
|
},
|
|
224
355
|
{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
356
|
+
label: [
|
|
357
|
+
'列表',
|
|
358
|
+
'List'
|
|
359
|
+
],
|
|
360
|
+
key: 'list',
|
|
361
|
+
children: [
|
|
362
|
+
{
|
|
363
|
+
label: [
|
|
364
|
+
locale['b-list'] || '无序列表'
|
|
365
|
+
],
|
|
366
|
+
task: 'list',
|
|
367
|
+
key: 'b-list',
|
|
368
|
+
args: [
|
|
369
|
+
'unordered'
|
|
370
|
+
],
|
|
371
|
+
icon: /*#__PURE__*/ React.createElement(UnorderedListOutlined, null)
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
label: [
|
|
375
|
+
locale['n-list'] || '有序列表'
|
|
376
|
+
],
|
|
377
|
+
task: 'list',
|
|
378
|
+
key: 'n-list',
|
|
379
|
+
args: [
|
|
380
|
+
'ordered'
|
|
381
|
+
],
|
|
382
|
+
icon: /*#__PURE__*/ React.createElement(OrderedListOutlined, null)
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
label: [
|
|
386
|
+
locale['t-list'] || '任务列表'
|
|
387
|
+
],
|
|
388
|
+
task: 'list',
|
|
389
|
+
key: 't-list',
|
|
390
|
+
args: [
|
|
391
|
+
'task'
|
|
392
|
+
],
|
|
393
|
+
icon: /*#__PURE__*/ React.createElement(CheckSquareOutlined, null)
|
|
394
|
+
}
|
|
395
|
+
]
|
|
230
396
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
397
|
+
];
|
|
398
|
+
if (ctx.isTop) {
|
|
399
|
+
options.splice(2, 0, {
|
|
400
|
+
label: [
|
|
401
|
+
'标题',
|
|
402
|
+
'Heading'
|
|
403
|
+
],
|
|
404
|
+
key: 'head',
|
|
405
|
+
children: [
|
|
406
|
+
{
|
|
407
|
+
label: [
|
|
408
|
+
(locale === null || locale === void 0 ? void 0 : locale.head1) || '主标题'
|
|
409
|
+
],
|
|
410
|
+
task: 'head',
|
|
411
|
+
key: 'head1',
|
|
412
|
+
args: [
|
|
413
|
+
1
|
|
414
|
+
],
|
|
415
|
+
icon: /*#__PURE__*/ React.createElement(FontSizeOutlined, null)
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
label: [
|
|
419
|
+
(locale === null || locale === void 0 ? void 0 : locale.head2) || '段标题'
|
|
420
|
+
],
|
|
421
|
+
task: 'head',
|
|
422
|
+
key: 'head2',
|
|
423
|
+
icon: /*#__PURE__*/ React.createElement(FontSizeOutlined, null),
|
|
424
|
+
args: [
|
|
425
|
+
2
|
|
426
|
+
]
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
label: [
|
|
430
|
+
(locale === null || locale === void 0 ? void 0 : locale.head3) || '小标题'
|
|
431
|
+
],
|
|
432
|
+
task: 'head',
|
|
433
|
+
key: 'head3',
|
|
434
|
+
icon: /*#__PURE__*/ React.createElement(FontSizeOutlined, null),
|
|
435
|
+
args: [
|
|
436
|
+
3
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
});
|
|
265
441
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
insertUrl: ""
|
|
442
|
+
return options;
|
|
443
|
+
};
|
|
444
|
+
export var InsertAutocomplete = function(props) {
|
|
445
|
+
var _props_optionsRender;
|
|
446
|
+
var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, markdownContainerRef = _useEditorStore.markdownContainerRef, openInsertCompletion = _useEditorStore.openInsertCompletion, setOpenInsertCompletion = _useEditorStore.setOpenInsertCompletion, keyTask$ = _useEditorStore.keyTask$, insertCompletionText$ = _useEditorStore.insertCompletionText$;
|
|
447
|
+
var dom = useRef(null);
|
|
448
|
+
var ctx = useRef({
|
|
449
|
+
path: [],
|
|
450
|
+
isTop: true
|
|
276
451
|
});
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
return;
|
|
296
|
-
setOpenInsertCompletion == null ? void 0 : setOpenInsertCompletion(false);
|
|
297
|
-
close();
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
if (op.task === "image" || op.task === "attachment") {
|
|
301
|
-
if (op.task === "image") {
|
|
302
|
-
setState({ insertLink: true });
|
|
303
|
-
setTimeout(() => {
|
|
304
|
-
var _a3, _b;
|
|
305
|
-
(_b = (_a3 = dom.current) == null ? void 0 : _a3.querySelector("input")) == null ? void 0 : _b.focus();
|
|
306
|
-
}, 30);
|
|
307
|
-
} else {
|
|
308
|
-
setState({ insertAttachment: true });
|
|
452
|
+
var _useLocalState = _sliced_to_array(useLocalState({
|
|
453
|
+
index: 0,
|
|
454
|
+
filterOptions: [],
|
|
455
|
+
options: [],
|
|
456
|
+
left: 0,
|
|
457
|
+
insertLink: false,
|
|
458
|
+
insertAttachment: false,
|
|
459
|
+
loading: false,
|
|
460
|
+
insertUrl: '',
|
|
461
|
+
top: 0,
|
|
462
|
+
bottom: 0,
|
|
463
|
+
text: ''
|
|
464
|
+
}), 2), state = _useLocalState[0], setState = _useLocalState[1];
|
|
465
|
+
var clickClose = useCallback(function(e) {
|
|
466
|
+
var _dom_current;
|
|
467
|
+
if (!((_dom_current = dom.current) === null || _dom_current === void 0 ? void 0 : _dom_current.contains(e.target))) {
|
|
468
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
469
|
+
close();
|
|
309
470
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
471
|
+
}, []);
|
|
472
|
+
var close = useCallback(function() {
|
|
473
|
+
setState({
|
|
474
|
+
filterOptions: [],
|
|
475
|
+
options: [],
|
|
476
|
+
index: 0,
|
|
477
|
+
text: '',
|
|
478
|
+
insertLink: false,
|
|
479
|
+
insertAttachment: false,
|
|
480
|
+
insertUrl: ''
|
|
316
481
|
});
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
482
|
+
if (typeof window === 'undefined') return;
|
|
483
|
+
window.removeEventListener('click', clickClose);
|
|
484
|
+
}, []);
|
|
485
|
+
var runInsertTask = useCallback(/*#__PURE__*/ function() {
|
|
486
|
+
var _ref = _async_to_generator(function(op, params) {
|
|
487
|
+
var _props_runInsertTask;
|
|
488
|
+
return _ts_generator(this, function(_state) {
|
|
489
|
+
switch(_state.label){
|
|
490
|
+
case 0:
|
|
491
|
+
if (!(params === null || params === void 0 ? void 0 : params.isCustom)) return [
|
|
492
|
+
3,
|
|
493
|
+
2
|
|
494
|
+
];
|
|
495
|
+
Transforms.delete(markdownEditorRef.current, {
|
|
496
|
+
at: ctx.current.path
|
|
497
|
+
});
|
|
498
|
+
return [
|
|
499
|
+
4,
|
|
500
|
+
(_props_runInsertTask = props.runInsertTask) === null || _props_runInsertTask === void 0 ? void 0 : _props_runInsertTask.call(props, op, {
|
|
501
|
+
x: state.left,
|
|
502
|
+
y: state.top || state.bottom || 0
|
|
503
|
+
})
|
|
504
|
+
];
|
|
505
|
+
case 1:
|
|
506
|
+
_state.sent();
|
|
507
|
+
if (typeof window === 'undefined') return [
|
|
508
|
+
2
|
|
509
|
+
];
|
|
510
|
+
if (typeof window.matchMedia === 'undefined') return [
|
|
511
|
+
2
|
|
512
|
+
];
|
|
513
|
+
setOpenInsertCompletion === null || setOpenInsertCompletion === void 0 ? void 0 : setOpenInsertCompletion(false);
|
|
514
|
+
close();
|
|
515
|
+
return [
|
|
516
|
+
2
|
|
517
|
+
];
|
|
518
|
+
case 2:
|
|
519
|
+
//@ts-ignore
|
|
520
|
+
if (op.task === 'image' || op.task === 'attachment') {
|
|
521
|
+
//@ts-ignore
|
|
522
|
+
if (op.task === 'image') {
|
|
523
|
+
setState({
|
|
524
|
+
insertLink: true
|
|
525
|
+
});
|
|
526
|
+
setTimeout(function() {
|
|
527
|
+
var _dom_current_querySelector, _dom_current;
|
|
528
|
+
(_dom_current = dom.current) === null || _dom_current === void 0 ? void 0 : (_dom_current_querySelector = _dom_current.querySelector('input')) === null || _dom_current_querySelector === void 0 ? void 0 : _dom_current_querySelector.focus();
|
|
529
|
+
}, 30);
|
|
530
|
+
} else {
|
|
531
|
+
setState({
|
|
532
|
+
insertAttachment: true
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
} else if (op) {
|
|
536
|
+
Transforms.insertText(markdownEditorRef.current, '', {
|
|
537
|
+
at: {
|
|
538
|
+
anchor: Editor.start(markdownEditorRef.current, ctx.current.path),
|
|
539
|
+
focus: Editor.end(markdownEditorRef.current, ctx.current.path)
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
keyTask$.next({
|
|
543
|
+
key: op.task,
|
|
544
|
+
args: op.args
|
|
545
|
+
});
|
|
546
|
+
if (typeof window === 'undefined') return [
|
|
547
|
+
2
|
|
548
|
+
];
|
|
549
|
+
if (typeof window.matchMedia === 'undefined') return [
|
|
550
|
+
2
|
|
551
|
+
];
|
|
552
|
+
setOpenInsertCompletion === null || setOpenInsertCompletion === void 0 ? void 0 : setOpenInsertCompletion(false);
|
|
553
|
+
close();
|
|
554
|
+
}
|
|
555
|
+
return [
|
|
556
|
+
2
|
|
557
|
+
];
|
|
558
|
+
}
|
|
559
|
+
});
|
|
320
560
|
});
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
561
|
+
return function(op, params) {
|
|
562
|
+
return _ref.apply(this, arguments);
|
|
563
|
+
};
|
|
564
|
+
}(), []);
|
|
565
|
+
var insertAttachByLink = useCallback(/*#__PURE__*/ _async_to_generator(function() {
|
|
566
|
+
var url, size, name, res, match, node, next, _Editor_nodes, m;
|
|
567
|
+
return _ts_generator(this, function(_state) {
|
|
568
|
+
switch(_state.label){
|
|
569
|
+
case 0:
|
|
570
|
+
setState({
|
|
571
|
+
loading: true
|
|
572
|
+
});
|
|
573
|
+
_state.label = 1;
|
|
574
|
+
case 1:
|
|
575
|
+
_state.trys.push([
|
|
576
|
+
1,
|
|
577
|
+
,
|
|
578
|
+
4,
|
|
579
|
+
5
|
|
580
|
+
]);
|
|
581
|
+
url = state.insertUrl;
|
|
582
|
+
size = 0;
|
|
583
|
+
name = url;
|
|
584
|
+
if (!/^https?:\/\//.test(url)) return [
|
|
585
|
+
3,
|
|
586
|
+
3
|
|
587
|
+
];
|
|
588
|
+
return [
|
|
589
|
+
4,
|
|
590
|
+
fetch(url)
|
|
591
|
+
];
|
|
592
|
+
case 2:
|
|
593
|
+
res = _state.sent();
|
|
594
|
+
if (!res.ok) {
|
|
595
|
+
throw new Error();
|
|
596
|
+
}
|
|
597
|
+
size = Number(res.headers.get('content-length') || 0);
|
|
598
|
+
match = url.match(/([\w_-]+)\.\w+$/);
|
|
599
|
+
if (match) {
|
|
600
|
+
name = match[1];
|
|
601
|
+
}
|
|
602
|
+
_state.label = 3;
|
|
603
|
+
case 3:
|
|
604
|
+
Transforms.insertText(markdownEditorRef.current, '', {
|
|
605
|
+
at: {
|
|
606
|
+
anchor: Editor.start(markdownEditorRef.current, ctx.current.path),
|
|
607
|
+
focus: Editor.end(markdownEditorRef.current, ctx.current.path)
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
node = {
|
|
611
|
+
type: 'attach',
|
|
612
|
+
name: name,
|
|
613
|
+
url: url,
|
|
614
|
+
size: size,
|
|
615
|
+
children: [
|
|
616
|
+
{
|
|
617
|
+
text: ''
|
|
618
|
+
}
|
|
619
|
+
]
|
|
620
|
+
};
|
|
621
|
+
Transforms.setNodes(markdownEditorRef.current, node, {
|
|
622
|
+
at: ctx.current.path
|
|
623
|
+
});
|
|
624
|
+
EditorUtils.focus(markdownEditorRef.current);
|
|
625
|
+
next = Editor.next(markdownEditorRef.current, {
|
|
626
|
+
at: ctx.current.path
|
|
627
|
+
});
|
|
628
|
+
if ((next === null || next === void 0 ? void 0 : next[0].type) === 'paragraph' && !Node.string(next[0])) {
|
|
629
|
+
Transforms.delete(markdownEditorRef.current, {
|
|
630
|
+
at: next[1]
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
_Editor_nodes = _sliced_to_array(Editor.nodes(markdownEditorRef.current, {
|
|
634
|
+
match: function(n) {
|
|
635
|
+
return !!n.type;
|
|
636
|
+
},
|
|
637
|
+
mode: 'lowest'
|
|
638
|
+
}), 1), m = _Editor_nodes[0];
|
|
639
|
+
selChange$.next({
|
|
640
|
+
node: m,
|
|
641
|
+
sel: markdownEditorRef.current.selection
|
|
642
|
+
});
|
|
643
|
+
close();
|
|
644
|
+
return [
|
|
645
|
+
3,
|
|
646
|
+
5
|
|
647
|
+
];
|
|
648
|
+
case 4:
|
|
649
|
+
setState({
|
|
650
|
+
loading: false
|
|
651
|
+
});
|
|
652
|
+
return [
|
|
653
|
+
7
|
|
654
|
+
];
|
|
655
|
+
case 5:
|
|
656
|
+
return [
|
|
657
|
+
2
|
|
658
|
+
];
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
}), []);
|
|
662
|
+
var keydown = useCallback(function(e) {
|
|
663
|
+
if (state.options.length && (e.key === 'ArrowUp' || e.key === 'ArrowDown')) {
|
|
664
|
+
e.preventDefault();
|
|
665
|
+
if (e.key === 'ArrowUp' && state.index > 0) {
|
|
666
|
+
setState({
|
|
667
|
+
index: state.index - 1
|
|
668
|
+
});
|
|
669
|
+
var key = state.options[state.index].key;
|
|
670
|
+
var target = document.querySelector('[data-action="'.concat(key, '"]'));
|
|
671
|
+
if (target && dom.current.scrollTop > target.offsetTop) {
|
|
672
|
+
dom.current.scroll({
|
|
673
|
+
top: dom.current.scrollTop - 160 + 30
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (e.key === 'ArrowDown' && state.index < state.options.length - 1) {
|
|
678
|
+
setState({
|
|
679
|
+
index: state.index + 1
|
|
680
|
+
});
|
|
681
|
+
var key1 = state.options[state.index].key;
|
|
682
|
+
var target1 = document.querySelector('[data-action="'.concat(key1, '"]'));
|
|
683
|
+
if (target1 && target1.offsetTop > dom.current.scrollTop + dom.current.clientHeight - 30) {
|
|
684
|
+
dom.current.scroll({
|
|
685
|
+
top: target1.offsetTop - 30
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
}
|
|
346
689
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
690
|
+
if (e.key === 'Enter' && openInsertCompletion) {
|
|
691
|
+
var op = state.options[state.index];
|
|
692
|
+
if (op) {
|
|
693
|
+
e.preventDefault();
|
|
694
|
+
e.stopPropagation();
|
|
695
|
+
runInsertTask(op);
|
|
696
|
+
}
|
|
352
697
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
name,
|
|
357
|
-
url,
|
|
358
|
-
size,
|
|
359
|
-
children: [{ text: "" }]
|
|
360
|
-
};
|
|
361
|
-
Transforms.setNodes(markdownEditorRef.current, node, {
|
|
362
|
-
at: ctx.current.path
|
|
363
|
-
});
|
|
364
|
-
EditorUtils.focus(markdownEditorRef.current);
|
|
365
|
-
const next = Editor.next(markdownEditorRef.current, {
|
|
366
|
-
at: ctx.current.path
|
|
367
|
-
});
|
|
368
|
-
if ((next == null ? void 0 : next[0].type) === "paragraph" && !Node.string(next[0])) {
|
|
369
|
-
Transforms.delete(markdownEditorRef.current, { at: next[1] });
|
|
370
|
-
}
|
|
371
|
-
const [m] = Editor.nodes(markdownEditorRef.current, {
|
|
372
|
-
match: (n) => !!n.type,
|
|
373
|
-
mode: "lowest"
|
|
374
|
-
});
|
|
375
|
-
selChange$.next({ node: m, sel: markdownEditorRef.current.selection });
|
|
376
|
-
close();
|
|
377
|
-
} finally {
|
|
378
|
-
setState({ loading: false });
|
|
379
|
-
}
|
|
380
|
-
}), []);
|
|
381
|
-
const keydown = useCallback((e) => {
|
|
382
|
-
if (state.options.length && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
383
|
-
e.preventDefault();
|
|
384
|
-
if (e.key === "ArrowUp" && state.index > 0) {
|
|
385
|
-
setState({ index: state.index - 1 });
|
|
386
|
-
const key = state.options[state.index].key;
|
|
387
|
-
const target = document.querySelector(
|
|
388
|
-
`[data-action="${key}"]`
|
|
389
|
-
);
|
|
390
|
-
if (target && dom.current.scrollTop > target.offsetTop) {
|
|
391
|
-
dom.current.scroll({
|
|
392
|
-
top: dom.current.scrollTop - 160 + 30
|
|
393
|
-
});
|
|
698
|
+
if (isHotkey('esc', e)) {
|
|
699
|
+
setOpenInsertCompletion === null || setOpenInsertCompletion === void 0 ? void 0 : setOpenInsertCompletion(false);
|
|
700
|
+
EditorUtils.focus(markdownEditorRef.current);
|
|
394
701
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const key = state.options[state.index].key;
|
|
399
|
-
const target = document.querySelector(
|
|
400
|
-
`[data-action="${key}"]`
|
|
401
|
-
);
|
|
402
|
-
if (target && target.offsetTop > dom.current.scrollTop + dom.current.clientHeight - 30) {
|
|
403
|
-
dom.current.scroll({
|
|
404
|
-
top: target.offsetTop - 30
|
|
405
|
-
});
|
|
702
|
+
if (isHotkey('backspace', e)) {
|
|
703
|
+
setOpenInsertCompletion === null || setOpenInsertCompletion === void 0 ? void 0 : setOpenInsertCompletion(false);
|
|
704
|
+
EditorUtils.focus(markdownEditorRef.current);
|
|
406
705
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
706
|
+
}, []);
|
|
707
|
+
var i18n = useContext(I18nContext);
|
|
708
|
+
var insertOptions = useMemo(function() {
|
|
709
|
+
return getInsertOptions({
|
|
710
|
+
isTop: ctx.current.isTop
|
|
711
|
+
}, i18n.locale);
|
|
712
|
+
}, [
|
|
713
|
+
i18n.locale,
|
|
714
|
+
ctx.current.isTop
|
|
715
|
+
]);
|
|
716
|
+
/**
|
|
717
|
+
* 插入媒体
|
|
718
|
+
*/ var insertMedia = useCallback(/*#__PURE__*/ _async_to_generator(function() {
|
|
719
|
+
var url, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, r, m, type, node, _Editor_nodes, n;
|
|
720
|
+
return _ts_generator(this, function(_state) {
|
|
721
|
+
switch(_state.label){
|
|
722
|
+
case 0:
|
|
723
|
+
setState({
|
|
724
|
+
loading: true
|
|
725
|
+
});
|
|
726
|
+
_state.label = 1;
|
|
727
|
+
case 1:
|
|
728
|
+
_state.trys.push([
|
|
729
|
+
1,
|
|
730
|
+
,
|
|
731
|
+
3,
|
|
732
|
+
4
|
|
733
|
+
]);
|
|
734
|
+
url = state.insertUrl;
|
|
735
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
736
|
+
try {
|
|
737
|
+
for(_iterator = replaceUrl[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
738
|
+
r = _step.value;
|
|
739
|
+
m = url.match(r.reg);
|
|
740
|
+
if (m) {
|
|
741
|
+
url = r.replace(m);
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
} catch (err) {
|
|
746
|
+
_didIteratorError = true;
|
|
747
|
+
_iteratorError = err;
|
|
748
|
+
} finally{
|
|
749
|
+
try {
|
|
750
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
751
|
+
_iterator.return();
|
|
752
|
+
}
|
|
753
|
+
} finally{
|
|
754
|
+
if (_didIteratorError) {
|
|
755
|
+
throw _iteratorError;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (!/^(\w+:)?\/\//.test(url)) {
|
|
760
|
+
throw new Error();
|
|
761
|
+
}
|
|
762
|
+
return [
|
|
763
|
+
4,
|
|
764
|
+
getRemoteMediaType(url)
|
|
765
|
+
];
|
|
766
|
+
case 2:
|
|
767
|
+
type = _state.sent();
|
|
768
|
+
if (!type) {
|
|
769
|
+
throw new Error();
|
|
770
|
+
}
|
|
771
|
+
Transforms.insertText(markdownEditorRef.current, '', {
|
|
772
|
+
at: {
|
|
773
|
+
anchor: Editor.start(markdownEditorRef.current, ctx.current.path),
|
|
774
|
+
focus: Editor.end(markdownEditorRef.current, ctx.current.path)
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
node = EditorUtils.createMediaNode(url, 'image', {});
|
|
778
|
+
Transforms.setNodes(markdownEditorRef.current, node, {
|
|
779
|
+
at: ctx.current.path
|
|
780
|
+
});
|
|
781
|
+
EditorUtils.focus(markdownEditorRef.current);
|
|
782
|
+
_Editor_nodes = _sliced_to_array(Editor.nodes(markdownEditorRef.current, {
|
|
783
|
+
match: function(n) {
|
|
784
|
+
return !!n.type;
|
|
785
|
+
},
|
|
786
|
+
mode: 'lowest'
|
|
787
|
+
}), 1), n = _Editor_nodes[0];
|
|
788
|
+
selChange$.next({
|
|
789
|
+
sel: markdownEditorRef.current.selection,
|
|
790
|
+
node: n
|
|
791
|
+
});
|
|
792
|
+
close();
|
|
793
|
+
return [
|
|
794
|
+
3,
|
|
795
|
+
4
|
|
796
|
+
];
|
|
797
|
+
case 3:
|
|
798
|
+
setState({
|
|
799
|
+
loading: false
|
|
800
|
+
});
|
|
801
|
+
return [
|
|
802
|
+
7
|
|
803
|
+
];
|
|
804
|
+
case 4:
|
|
805
|
+
return [
|
|
806
|
+
2
|
|
807
|
+
];
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
}), []);
|
|
811
|
+
useSubject(insertCompletionText$, function(text) {
|
|
812
|
+
var _props_insertOptions;
|
|
813
|
+
var tempText = text || '';
|
|
814
|
+
var filterOptions = [];
|
|
815
|
+
var options = [];
|
|
816
|
+
if (tempText) {
|
|
817
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
818
|
+
try {
|
|
819
|
+
for(var _iterator = insertOptions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
820
|
+
var item = _step.value;
|
|
821
|
+
var _options;
|
|
822
|
+
var ops = item.children.filter(function(op) {
|
|
823
|
+
return op.label.some(function(l) {
|
|
824
|
+
return l.toLowerCase().includes(tempText.toLowerCase());
|
|
825
|
+
});
|
|
826
|
+
});
|
|
827
|
+
(_options = options).push.apply(_options, _to_consumable_array(ops));
|
|
828
|
+
if (ops.length) {
|
|
829
|
+
filterOptions.push(_object_spread_props(_object_spread({}, item), {
|
|
830
|
+
children: ops
|
|
831
|
+
}));
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
} catch (err) {
|
|
835
|
+
_didIteratorError = true;
|
|
836
|
+
_iteratorError = err;
|
|
837
|
+
} finally{
|
|
838
|
+
try {
|
|
839
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
840
|
+
_iterator.return();
|
|
841
|
+
}
|
|
842
|
+
} finally{
|
|
843
|
+
if (_didIteratorError) {
|
|
844
|
+
throw _iteratorError;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
} else {
|
|
849
|
+
filterOptions = insertOptions;
|
|
850
|
+
options = insertOptions.reduce(function(a, b) {
|
|
851
|
+
return a.concat(b.children);
|
|
852
|
+
}, []);
|
|
444
853
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
at: {
|
|
455
|
-
anchor: Editor.start(markdownEditorRef.current, ctx.current.path),
|
|
456
|
-
focus: Editor.end(markdownEditorRef.current, ctx.current.path)
|
|
854
|
+
if (props.insertOptions && (props === null || props === void 0 ? void 0 : (_props_insertOptions = props.insertOptions) === null || _props_insertOptions === void 0 ? void 0 : _props_insertOptions.length)) {
|
|
855
|
+
filterOptions.unshift({
|
|
856
|
+
label: [
|
|
857
|
+
'快捷设置',
|
|
858
|
+
'My Quick'
|
|
859
|
+
],
|
|
860
|
+
key: 'quick',
|
|
861
|
+
children: _to_consumable_array(props.insertOptions)
|
|
862
|
+
});
|
|
457
863
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
EditorUtils.focus(markdownEditorRef.current);
|
|
464
|
-
const [n] = Editor.nodes(markdownEditorRef.current, {
|
|
465
|
-
match: (n2) => !!n2.type,
|
|
466
|
-
mode: "lowest"
|
|
467
|
-
});
|
|
468
|
-
selChange$.next({
|
|
469
|
-
sel: markdownEditorRef.current.selection,
|
|
470
|
-
node: n
|
|
471
|
-
});
|
|
472
|
-
close();
|
|
473
|
-
} finally {
|
|
474
|
-
setState({ loading: false });
|
|
475
|
-
}
|
|
476
|
-
}), []);
|
|
477
|
-
useSubject(insertCompletionText$, (text) => {
|
|
478
|
-
var _a2;
|
|
479
|
-
let tempText = text || "";
|
|
480
|
-
let filterOptions = [];
|
|
481
|
-
let options = [];
|
|
482
|
-
if (tempText) {
|
|
483
|
-
for (let item of insertOptions) {
|
|
484
|
-
const ops = item.children.filter((op) => {
|
|
485
|
-
return op.label.some(
|
|
486
|
-
(l) => l.toLowerCase().includes(tempText.toLowerCase())
|
|
487
|
-
);
|
|
864
|
+
setState({
|
|
865
|
+
index: 0,
|
|
866
|
+
text: tempText,
|
|
867
|
+
options: options,
|
|
868
|
+
filterOptions: filterOptions
|
|
488
869
|
});
|
|
489
|
-
options.push(...ops);
|
|
490
|
-
if (ops.length) {
|
|
491
|
-
filterOptions.push(__spreadProps(__spreadValues({}, item), {
|
|
492
|
-
children: ops
|
|
493
|
-
}));
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
} else {
|
|
497
|
-
filterOptions = insertOptions;
|
|
498
|
-
options = insertOptions.reduce(
|
|
499
|
-
(a, b) => a.concat(b.children),
|
|
500
|
-
[]
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
if (props.insertOptions && ((_a2 = props == null ? void 0 : props.insertOptions) == null ? void 0 : _a2.length)) {
|
|
504
|
-
filterOptions.unshift({
|
|
505
|
-
label: ["快捷设置", "My Quick"],
|
|
506
|
-
key: "quick",
|
|
507
|
-
children: [...props.insertOptions]
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
setState({
|
|
511
|
-
index: 0,
|
|
512
|
-
text: tempText,
|
|
513
|
-
options,
|
|
514
|
-
filterOptions
|
|
515
870
|
});
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
871
|
+
useEffect(function() {
|
|
872
|
+
var calculatePosition = function(nodeEl, containerEl) {
|
|
873
|
+
var top = nodeEl.getBoundingClientRect().top;
|
|
874
|
+
var left = getOffsetLeft(nodeEl, containerEl) + 24;
|
|
875
|
+
var containerScrollTop = containerEl.scrollTop;
|
|
876
|
+
var containerHeight = document.documentElement.clientHeight;
|
|
877
|
+
var nodeHeight = nodeEl.clientHeight;
|
|
878
|
+
var nodeTopRelativeToContainer = top - containerScrollTop;
|
|
879
|
+
var nodeBottomRelativeToContainer = nodeTopRelativeToContainer + nodeHeight;
|
|
880
|
+
var spaceAbove = nodeTopRelativeToContainer;
|
|
881
|
+
var spaceBelow = containerHeight - nodeBottomRelativeToContainer;
|
|
882
|
+
// 当节点上方空间不足,且下方空间不足时,触底显示
|
|
883
|
+
if (spaceBelow < 212 && spaceAbove < 212) {
|
|
884
|
+
return {
|
|
885
|
+
top: undefined,
|
|
886
|
+
bottom: 0,
|
|
887
|
+
left: left
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
// 如果节点下方空间不足但上方有足够空间,显示在上方
|
|
891
|
+
if (spaceBelow < 212 && spaceAbove >= 212) {
|
|
892
|
+
return {
|
|
893
|
+
top: undefined,
|
|
894
|
+
bottom: containerHeight - nodeTopRelativeToContainer,
|
|
895
|
+
left: left
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
// 默认逻辑,优先显示在下方
|
|
899
|
+
if (spaceBelow >= 212) {
|
|
900
|
+
return {
|
|
901
|
+
top: nodeBottomRelativeToContainer,
|
|
902
|
+
bottom: undefined,
|
|
903
|
+
left: left
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
return undefined;
|
|
541
907
|
};
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
left
|
|
908
|
+
var setupEventListeners = function() {
|
|
909
|
+
var _markdownContainerRef_current, _markdownContainerRef_current1;
|
|
910
|
+
if (typeof window === 'undefined') return;
|
|
911
|
+
markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current = markdownContainerRef.current) === null || _markdownContainerRef_current === void 0 ? void 0 : _markdownContainerRef_current.addEventListener('keydown', keydown);
|
|
912
|
+
markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current1 = markdownContainerRef.current) === null || _markdownContainerRef_current1 === void 0 ? void 0 : _markdownContainerRef_current1.addEventListener('click', clickClose);
|
|
548
913
|
};
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (typeof window === "undefined")
|
|
555
|
-
return;
|
|
556
|
-
(_a3 = markdownContainerRef == null ? void 0 : markdownContainerRef.current) == null ? void 0 : _a3.addEventListener("keydown", keydown);
|
|
557
|
-
(_b = markdownContainerRef == null ? void 0 : markdownContainerRef.current) == null ? void 0 : _b.addEventListener("click", clickClose);
|
|
558
|
-
};
|
|
559
|
-
const removeEventListeners = () => {
|
|
560
|
-
var _a3, _b;
|
|
561
|
-
if (typeof window === "undefined")
|
|
562
|
-
return;
|
|
563
|
-
(_a3 = markdownContainerRef == null ? void 0 : markdownContainerRef.current) == null ? void 0 : _a3.removeEventListener("keydown", keydown);
|
|
564
|
-
(_b = markdownContainerRef == null ? void 0 : markdownContainerRef.current) == null ? void 0 : _b.removeEventListener("click", clickClose);
|
|
565
|
-
};
|
|
566
|
-
if (openInsertCompletion) {
|
|
567
|
-
const [node] = Editor.nodes(markdownEditorRef.current, {
|
|
568
|
-
match: (n) => Element.isElement(n),
|
|
569
|
-
mode: "lowest"
|
|
570
|
-
});
|
|
571
|
-
if (node) {
|
|
572
|
-
ctx.current = {
|
|
573
|
-
path: node[1],
|
|
574
|
-
isTop: EditorUtils.isTop(markdownEditorRef.current, node[1])
|
|
914
|
+
var removeEventListeners = function() {
|
|
915
|
+
var _markdownContainerRef_current, _markdownContainerRef_current1;
|
|
916
|
+
if (typeof window === 'undefined') return;
|
|
917
|
+
markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current = markdownContainerRef.current) === null || _markdownContainerRef_current === void 0 ? void 0 : _markdownContainerRef_current.removeEventListener('keydown', keydown);
|
|
918
|
+
markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current1 = markdownContainerRef.current) === null || _markdownContainerRef_current1 === void 0 ? void 0 : _markdownContainerRef_current1.removeEventListener('click', clickClose);
|
|
575
919
|
};
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
583
|
-
|
|
920
|
+
if (openInsertCompletion) {
|
|
921
|
+
var _Editor_nodes = _sliced_to_array(Editor.nodes(markdownEditorRef.current, {
|
|
922
|
+
match: function(n) {
|
|
923
|
+
return Element.isElement(n);
|
|
924
|
+
},
|
|
925
|
+
mode: 'lowest'
|
|
926
|
+
}), 1), node = _Editor_nodes[0];
|
|
927
|
+
if (node) {
|
|
928
|
+
var _node_;
|
|
929
|
+
ctx.current = {
|
|
930
|
+
path: node[1],
|
|
931
|
+
isTop: EditorUtils.isTop(markdownEditorRef.current, node[1])
|
|
932
|
+
};
|
|
933
|
+
if ((node === null || node === void 0 ? void 0 : (_node_ = node[0]) === null || _node_ === void 0 ? void 0 : _node_.type) === 'paragraph') {
|
|
934
|
+
var el = ReactEditor.toDOMNode(markdownEditorRef.current, node[0]);
|
|
935
|
+
if (el) {
|
|
936
|
+
var position = calculatePosition(el, document.body);
|
|
937
|
+
if (position) {
|
|
938
|
+
setState(position);
|
|
939
|
+
} else {
|
|
940
|
+
setState({
|
|
941
|
+
top: 0,
|
|
942
|
+
left: 0,
|
|
943
|
+
bottom: undefined
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
setupEventListeners();
|
|
949
|
+
setTimeout(function() {
|
|
950
|
+
var _dom_current;
|
|
951
|
+
(_dom_current = dom.current) === null || _dom_current === void 0 ? void 0 : _dom_current.scroll({
|
|
952
|
+
top: 0
|
|
953
|
+
});
|
|
954
|
+
});
|
|
584
955
|
}
|
|
585
|
-
|
|
956
|
+
} else {
|
|
957
|
+
removeEventListeners();
|
|
958
|
+
close();
|
|
586
959
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
const context = useContext(ConfigProvider.ConfigContext);
|
|
602
|
-
const baseClassName = context == null ? void 0 : context.getPrefixCls(`md-editor-insert-autocomplete`);
|
|
603
|
-
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
604
|
-
return ReactDOM.createPortal(
|
|
605
|
-
wrapSSR(
|
|
606
|
-
/* @__PURE__ */ React.createElement(
|
|
607
|
-
"div",
|
|
608
|
-
{
|
|
609
|
-
ref: dom,
|
|
610
|
-
className: classNames(baseClassName, hashId),
|
|
611
|
-
style: {
|
|
612
|
-
position: "absolute",
|
|
960
|
+
return function() {
|
|
961
|
+
removeEventListeners();
|
|
962
|
+
};
|
|
963
|
+
}, [
|
|
964
|
+
openInsertCompletion
|
|
965
|
+
]);
|
|
966
|
+
var context = useContext(ConfigProvider.ConfigContext);
|
|
967
|
+
var baseClassName = context === null || context === void 0 ? void 0 : context.getPrefixCls("md-editor-insert-autocomplete");
|
|
968
|
+
var _useStyle = useStyle(baseClassName), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
969
|
+
return /*#__PURE__*/ ReactDOM.createPortal(wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
970
|
+
ref: dom,
|
|
971
|
+
className: classNames(baseClassName, hashId),
|
|
972
|
+
style: {
|
|
973
|
+
position: 'absolute',
|
|
613
974
|
zIndex: 9999,
|
|
614
|
-
display: !openInsertCompletion || !state.filterOptions.length ?
|
|
615
|
-
width: state.insertLink || state.insertAttachment ? 320 :
|
|
975
|
+
display: !openInsertCompletion || !state.filterOptions.length ? 'none' : 'flex',
|
|
976
|
+
width: state.insertLink || state.insertAttachment ? 320 : undefined,
|
|
616
977
|
maxHeight: 212,
|
|
617
|
-
overflowY:
|
|
978
|
+
overflowY: 'auto',
|
|
618
979
|
left: state.left,
|
|
619
980
|
top: state.top,
|
|
620
981
|
bottom: state.bottom
|
|
621
|
-
},
|
|
622
|
-
onMouseDown: (e) => {
|
|
623
|
-
e.preventDefault();
|
|
624
|
-
}
|
|
625
982
|
},
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var _a3;
|
|
983
|
+
onMouseDown: function(e) {
|
|
984
|
+
e.preventDefault();
|
|
985
|
+
}
|
|
986
|
+
}, !state.insertLink && !state.insertAttachment && /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Menu, {
|
|
987
|
+
items: (_props_optionsRender = props.optionsRender) === null || _props_optionsRender === void 0 ? void 0 : _props_optionsRender.call(props, state.filterOptions.map(function(l) {
|
|
988
|
+
var _l_label, _l_children_, _l_children, _l_children1;
|
|
989
|
+
return {
|
|
990
|
+
label: l === null || l === void 0 ? void 0 : (_l_label = l.label) === null || _l_label === void 0 ? void 0 : _l_label[1],
|
|
991
|
+
key: l === null || l === void 0 ? void 0 : l.key,
|
|
992
|
+
icon: l === null || l === void 0 ? void 0 : (_l_children = l.children) === null || _l_children === void 0 ? void 0 : (_l_children_ = _l_children[0]) === null || _l_children_ === void 0 ? void 0 : _l_children_.icon,
|
|
993
|
+
children: l === null || l === void 0 ? void 0 : (_l_children1 = l.children) === null || _l_children1 === void 0 ? void 0 : _l_children1.map(function(el) {
|
|
994
|
+
var _el_label;
|
|
639
995
|
return {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
996
|
+
label: (_el_label = el.label) === null || _el_label === void 0 ? void 0 : _el_label[1],
|
|
997
|
+
key: el.key,
|
|
998
|
+
icon: el.icon,
|
|
999
|
+
onClick: function(_) {
|
|
1000
|
+
var _props_insertOptions_find, _props_insertOptions;
|
|
1001
|
+
_.domEvent.stopPropagation();
|
|
1002
|
+
_.domEvent.preventDefault();
|
|
1003
|
+
var task = insertOptions.map(function(o) {
|
|
1004
|
+
return o === null || o === void 0 ? void 0 : o.children;
|
|
1005
|
+
}).flat(1).find(function(o) {
|
|
1006
|
+
return o.key === el.key;
|
|
1007
|
+
});
|
|
1008
|
+
var myInsertOptions = props === null || props === void 0 ? void 0 : (_props_insertOptions = props.insertOptions) === null || _props_insertOptions === void 0 ? void 0 : (_props_insertOptions_find = _props_insertOptions.find) === null || _props_insertOptions_find === void 0 ? void 0 : _props_insertOptions_find.call(_props_insertOptions, function(o) {
|
|
1009
|
+
return o.key === el.key;
|
|
1010
|
+
});
|
|
1011
|
+
if (myInsertOptions) {
|
|
1012
|
+
runInsertTask(myInsertOptions, {
|
|
1013
|
+
isCustom: true
|
|
1014
|
+
});
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
if (task) {
|
|
1018
|
+
runInsertTask(task);
|
|
1019
|
+
}
|
|
662
1020
|
}
|
|
663
|
-
}
|
|
664
1021
|
};
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
/* @__PURE__ */ React.createElement(PlayCircleOutlined, null),
|
|
693
|
-
/* @__PURE__ */ React.createElement("span", null, "Embed media links")
|
|
694
|
-
),
|
|
695
|
-
/* @__PURE__ */ React.createElement(
|
|
696
|
-
Input,
|
|
697
|
-
{
|
|
698
|
-
placeholder: "Paste media link",
|
|
699
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
700
|
-
value: state.insertUrl,
|
|
701
|
-
onKeyDown: (e) => {
|
|
702
|
-
if (isHotkey("enter", e)) {
|
|
703
|
-
insertMedia();
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
onChange: (e) => setState({ insertUrl: e.target.value })
|
|
707
|
-
}
|
|
708
|
-
),
|
|
709
|
-
/* @__PURE__ */ React.createElement(
|
|
710
|
-
Button,
|
|
711
|
-
{
|
|
712
|
-
block: true,
|
|
713
|
-
loading: state.loading,
|
|
714
|
-
type: "primary",
|
|
715
|
-
size: "small",
|
|
716
|
-
style: {
|
|
717
|
-
marginTop: "1em"
|
|
718
|
-
},
|
|
719
|
-
onClick: insertMedia,
|
|
720
|
-
disabled: !state.insertUrl
|
|
721
|
-
},
|
|
722
|
-
"Embed"
|
|
723
|
-
)
|
|
724
|
-
),
|
|
725
|
-
state.insertAttachment && /* @__PURE__ */ React.createElement(
|
|
726
|
-
"div",
|
|
727
|
-
{
|
|
728
|
-
style: {
|
|
729
|
-
width: 320,
|
|
730
|
-
padding: 8
|
|
1022
|
+
})
|
|
1023
|
+
};
|
|
1024
|
+
}).map(function(l) {
|
|
1025
|
+
return l === null || l === void 0 ? void 0 : l.children;
|
|
1026
|
+
}).flat(1) || [])
|
|
1027
|
+
})), state.insertLink && /*#__PURE__*/ React.createElement("div", {
|
|
1028
|
+
style: {
|
|
1029
|
+
padding: 8
|
|
1030
|
+
}
|
|
1031
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
1032
|
+
style: {
|
|
1033
|
+
fontSize: '1em',
|
|
1034
|
+
color: 'rgba(0,0,0,0.8)',
|
|
1035
|
+
marginBottom: 4,
|
|
1036
|
+
display: 'flex',
|
|
1037
|
+
alignContent: 'center',
|
|
1038
|
+
gap: 4
|
|
1039
|
+
}
|
|
1040
|
+
}, /*#__PURE__*/ React.createElement(PlayCircleOutlined, null), /*#__PURE__*/ React.createElement("span", null, "Embed media links")), /*#__PURE__*/ React.createElement(Input, {
|
|
1041
|
+
placeholder: 'Paste media link',
|
|
1042
|
+
onMouseDown: function(e) {
|
|
1043
|
+
return e.stopPropagation();
|
|
1044
|
+
},
|
|
1045
|
+
value: state.insertUrl,
|
|
1046
|
+
onKeyDown: function(e) {
|
|
1047
|
+
if (isHotkey('enter', e)) {
|
|
1048
|
+
insertMedia();
|
|
731
1049
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1050
|
+
},
|
|
1051
|
+
onChange: function(e) {
|
|
1052
|
+
return setState({
|
|
1053
|
+
insertUrl: e.target.value
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}), /*#__PURE__*/ React.createElement(Button, {
|
|
1057
|
+
block: true,
|
|
1058
|
+
loading: state.loading,
|
|
1059
|
+
type: 'primary',
|
|
1060
|
+
size: 'small',
|
|
1061
|
+
style: {
|
|
1062
|
+
marginTop: '1em'
|
|
1063
|
+
},
|
|
1064
|
+
onClick: insertMedia,
|
|
1065
|
+
disabled: !state.insertUrl
|
|
1066
|
+
}, "Embed")), state.insertAttachment && /*#__PURE__*/ React.createElement("div", {
|
|
1067
|
+
style: {
|
|
1068
|
+
width: 320,
|
|
1069
|
+
padding: 8
|
|
1070
|
+
}
|
|
1071
|
+
}, /*#__PURE__*/ React.createElement(Tabs, {
|
|
1072
|
+
size: 'small',
|
|
1073
|
+
items: [
|
|
735
1074
|
{
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
{
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
markdownEditorRef.current,
|
|
752
|
-
ctx.current.path
|
|
753
|
-
),
|
|
754
|
-
focus: Editor.end(
|
|
755
|
-
markdownEditorRef.current,
|
|
756
|
-
ctx.current.path
|
|
757
|
-
)
|
|
758
|
-
}
|
|
1075
|
+
label: 'Local',
|
|
1076
|
+
key: 'local',
|
|
1077
|
+
children: /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(Button, {
|
|
1078
|
+
block: true,
|
|
1079
|
+
size: 'small',
|
|
1080
|
+
type: 'primary',
|
|
1081
|
+
onClick: function() {
|
|
1082
|
+
Transforms.insertText(markdownEditorRef.current, '', {
|
|
1083
|
+
at: {
|
|
1084
|
+
anchor: Editor.start(markdownEditorRef.current, ctx.current.path),
|
|
1085
|
+
focus: Editor.end(markdownEditorRef.current, ctx.current.path)
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
setState({
|
|
1089
|
+
insertUrl: ''
|
|
759
1090
|
});
|
|
760
|
-
setState({ insertUrl: "" });
|
|
761
1091
|
insertAttachByLink();
|
|
762
|
-
|
|
1092
|
+
}
|
|
1093
|
+
}, "Choose a file"))
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
label: 'Embed Link',
|
|
1097
|
+
key: 'embed',
|
|
1098
|
+
children: /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(Input, {
|
|
1099
|
+
placeholder: 'Paste attachment link',
|
|
1100
|
+
onMouseDown: function(e) {
|
|
1101
|
+
return e.stopPropagation();
|
|
763
1102
|
},
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
label: "Embed Link",
|
|
769
|
-
key: "embed",
|
|
770
|
-
children: /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
771
|
-
Input,
|
|
772
|
-
{
|
|
773
|
-
placeholder: "Paste attachment link",
|
|
774
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
775
|
-
value: state.insertUrl,
|
|
776
|
-
onKeyDown: (e) => {
|
|
777
|
-
if (isHotkey("enter", e)) {
|
|
778
|
-
insertAttachByLink();
|
|
1103
|
+
value: state.insertUrl,
|
|
1104
|
+
onKeyDown: function(e) {
|
|
1105
|
+
if (isHotkey('enter', e)) {
|
|
1106
|
+
insertAttachByLink();
|
|
779
1107
|
}
|
|
780
|
-
|
|
781
|
-
|
|
1108
|
+
},
|
|
1109
|
+
onChange: function(e) {
|
|
1110
|
+
return setState({
|
|
1111
|
+
insertUrl: e.target.value
|
|
1112
|
+
});
|
|
782
1113
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
style: {
|
|
790
|
-
marginTop: "1em"
|
|
791
|
-
},
|
|
792
|
-
size: "small",
|
|
793
|
-
onClick: insertAttachByLink,
|
|
794
|
-
disabled: !state.insertUrl
|
|
1114
|
+
}), /*#__PURE__*/ React.createElement(Button, {
|
|
1115
|
+
block: true,
|
|
1116
|
+
loading: state.loading,
|
|
1117
|
+
type: 'primary',
|
|
1118
|
+
style: {
|
|
1119
|
+
marginTop: '1em'
|
|
795
1120
|
},
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
1121
|
+
size: 'small',
|
|
1122
|
+
onClick: insertAttachByLink,
|
|
1123
|
+
disabled: !state.insertUrl
|
|
1124
|
+
}, "Embed"))
|
|
800
1125
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
)
|
|
804
|
-
),
|
|
805
|
-
document.body
|
|
806
|
-
);
|
|
807
|
-
};
|
|
808
|
-
export {
|
|
809
|
-
InsertAutocomplete,
|
|
810
|
-
getInsertOptions
|
|
1126
|
+
]
|
|
1127
|
+
})))), document.body);
|
|
811
1128
|
};
|