@ant-design/agentic-ui 2.29.30 → 2.29.32
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/Bubble/AIBubble.d.ts +2 -0
- package/dist/Bubble/AIBubble.js +11 -11
- package/dist/Bubble/Avatar/index.js +3 -3
- package/dist/Bubble/List/PureBubbleList.js +3 -3
- package/dist/Bubble/List/index.js +3 -3
- package/dist/Bubble/PureBubble.js +9 -9
- package/dist/Bubble/Title.js +3 -3
- package/dist/Bubble/UserBubble.js +9 -9
- package/dist/Components/ActionIconBox/index.js +3 -3
- package/dist/Components/TextAnimate/index.js +1 -0
- package/dist/Components/lotties/TextLoading/index.js +2 -2
- package/dist/MarkdownEditor/editor/elements/CommentLeaf/index.d.ts +5 -0
- package/dist/MarkdownEditor/editor/elements/CommentLeaf/index.js +2 -1
- package/dist/MarkdownEditor/editor/plugins/elements.js +34 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/arrow.js +3 -3
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/backspace.js +2 -3
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.d.ts +2 -2
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.js +14 -11
- package/dist/MarkdownEditor/editor/plugins/useHighlight.js +2 -1
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +12 -5
- package/dist/MarkdownEditor/editor/plugins/withListsPlugin.js +7 -9
- package/dist/MarkdownEditor/editor/tools/InsertAutocomplete.js +5 -4
- package/dist/MarkdownEditor/editor/tools/ToolBar/BaseBar.js +5 -5
- package/dist/MarkdownEditor/editor/tools/ToolBar/FloatBar.js +3 -1
- package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +4 -4
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ClearFormatButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ColorPickerButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/FormatButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/FormattingTools.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/HeadingDropdown.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/LinkButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/UndoRedoButtons.js +3 -3
- package/dist/MarkdownEditor/editor/tools/ToolBar/floatBarStyle.js +1 -1
- package/dist/MarkdownEditor/editor/tools/ToolBar/toolBarStyle.js +1 -1
- package/dist/MarkdownEditor/editor/utils/editorUtils.js +8 -6
- package/dist/MarkdownEditor/editor/utils/isMarkdown.js +4 -4
- package/dist/MarkdownEditor/editor/utils/keyboard.js +3 -2
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +11 -42
- package/dist/MarkdownInputField/QuickActions/index.js +2 -2
- package/dist/MarkdownInputField/RefinePromptButton/env.d.ts +4 -0
- package/dist/MarkdownInputField/RefinePromptButton/env.js +5 -0
- package/dist/MarkdownInputField/RefinePromptButton/index.js +2 -1
- package/dist/Plugins/chart/BarChart/index.js +6 -6
- package/dist/Plugins/chart/ChartMark/Area.js +2 -1
- package/dist/Plugins/chart/ChartMark/Bar.js +2 -1
- package/dist/Plugins/chart/ChartMark/Column.js +2 -1
- package/dist/Plugins/chart/ChartMark/Line.js +2 -1
- package/dist/Plugins/chart/ChartMark/Pie.js +2 -1
- package/dist/Plugins/chart/ChartRender.js +9 -1
- package/dist/Plugins/chart/DonutChart/index.js +2 -1
- package/dist/Plugins/chart/env.d.ts +4 -0
- package/dist/Plugins/chart/env.js +5 -0
- package/dist/Plugins/code/components/AceEditor.js +2 -0
- package/dist/Plugins/code/index.d.ts +1 -0
- package/dist/Plugins/code/index.js +1 -1
- package/dist/Plugins/mermaid/Mermaid.js +2 -2
- package/dist/Plugins/mermaid/env.d.ts +4 -0
- package/dist/Plugins/mermaid/env.js +5 -0
- package/dist/ToolUseBar/BarItem/Content.js +13 -13
- package/dist/ToolUseBar/BarItem/index.js +7 -7
- package/dist/WelcomeMessage/index.js +4 -4
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
49
49
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
50
50
|
}
|
|
51
51
|
import isHotkey from "is-hotkey";
|
|
52
|
-
import { useMemo } from "react";
|
|
52
|
+
import { useRef, useMemo } from "react";
|
|
53
53
|
import { Editor, Element, Node, Path, Range, Transforms } from "slate";
|
|
54
54
|
import { EditorUtils } from "../utils/editorUtils";
|
|
55
55
|
import { BackspaceKey } from "./hotKeyCommands/backspace";
|
|
@@ -98,17 +98,21 @@ import { useEditorStore } from "../store";
|
|
|
98
98
|
* - 与编辑器状态深度集成,实现上下文相关的行为
|
|
99
99
|
* - 提供良好的用户体验和 Markdown 编辑效率
|
|
100
100
|
*/ export var useKeyboard = function useKeyboard(store, markdownEditorRef, props) {
|
|
101
|
+
var _props_markdown;
|
|
101
102
|
var _useEditorStore = useEditorStore(), openInsertCompletion = _useEditorStore.openInsertCompletion, insertCompletionText$ = _useEditorStore.insertCompletionText$, setOpenInsertCompletion = _useEditorStore.setOpenInsertCompletion, openJinjaTemplate = _useEditorStore.openJinjaTemplate, setOpenJinjaTemplate = _useEditorStore.setOpenJinjaTemplate, setJinjaAnchorPath = _useEditorStore.setJinjaAnchorPath, jinjaTemplatePanelEnabled = _useEditorStore.jinjaTemplatePanelEnabled, editorProps = _useEditorStore.editorProps;
|
|
102
103
|
// 从 editorProps.jinja 读取(BaseMarkdownEditor 已写入 effectiveJinja),支持插件配置的 trigger
|
|
103
104
|
var effectiveJinja = editorProps === null || editorProps === void 0 ? void 0 : editorProps.jinja;
|
|
104
105
|
var jinjaTrigger = (effectiveJinja === null || effectiveJinja === void 0 ? void 0 : effectiveJinja.templatePanel) && _type_of(effectiveJinja.templatePanel) === 'object' && effectiveJinja.templatePanel.trigger || '{}';
|
|
106
|
+
var matchKeyRef = useRef(null);
|
|
107
|
+
if (matchKeyRef.current === null) {
|
|
108
|
+
matchKeyRef.current = new MatchKey(markdownEditorRef);
|
|
109
|
+
}
|
|
105
110
|
return useMemo(function() {
|
|
106
111
|
var tab = new TabKey(markdownEditorRef.current);
|
|
107
112
|
var backspace = new BackspaceKey(markdownEditorRef.current);
|
|
108
113
|
var enter = new EnterKey(store, backspace);
|
|
109
|
-
var match = new MatchKey(markdownEditorRef.current);
|
|
110
114
|
return function(e) {
|
|
111
|
-
var _props_markdown, _node_;
|
|
115
|
+
var _props_markdown, _e_nativeEvent, _node_;
|
|
112
116
|
// 只读模式下跳过所有键盘处理,提升性能
|
|
113
117
|
if (props.readonly) return;
|
|
114
118
|
// 处理表格键盘事件
|
|
@@ -156,8 +160,10 @@ import { useEditorStore } from "../store";
|
|
|
156
160
|
if (isHotkey('mod+shift+s', e)) {
|
|
157
161
|
e.preventDefault();
|
|
158
162
|
}
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
// 仅当显式开启 matchInputToNode 时才执行输入转节点(如 "- " 转列表),默认关闭
|
|
164
|
+
// IME 输入法组合期间不触发,避免输入「-」后按空格选字时误转为列表
|
|
165
|
+
if ((props === null || props === void 0 ? void 0 : (_props_markdown = props.markdown) === null || _props_markdown === void 0 ? void 0 : _props_markdown.matchInputToNode) === true && !((_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.isComposing)) {
|
|
166
|
+
if (matchKeyRef.current.run(e)) return;
|
|
161
167
|
}
|
|
162
168
|
if (e.key.toLowerCase().startsWith('arrow')) {
|
|
163
169
|
if ([
|
|
@@ -273,6 +279,7 @@ import { useEditorStore } from "../store";
|
|
|
273
279
|
}, [
|
|
274
280
|
markdownEditorRef.current,
|
|
275
281
|
props === null || props === void 0 ? void 0 : props.readonly,
|
|
282
|
+
props === null || props === void 0 ? void 0 : (_props_markdown = props.markdown) === null || _props_markdown === void 0 ? void 0 : _props_markdown.matchInputToNode,
|
|
276
283
|
openInsertCompletion,
|
|
277
284
|
insertCompletionText$,
|
|
278
285
|
setOpenInsertCompletion,
|
|
@@ -151,10 +151,12 @@ import { Editor, Element, Node, Transforms } from "slate";
|
|
|
151
151
|
var child1 = node.children[i];
|
|
152
152
|
if (Element.isElement(child1)) {
|
|
153
153
|
if (!isListType(child1)) {
|
|
154
|
-
// 如果不是列表类型,且不是第一个块级元素,需要处理
|
|
155
|
-
// 如果它是块级元素,应该移到前面或转换为列表
|
|
156
154
|
if (Editor.isBlock(editor, child1)) {
|
|
157
|
-
//
|
|
155
|
+
// paragraph 不处理,直接返回,避免 "-" 等被误转为嵌套列表
|
|
156
|
+
if (child1.type === 'paragraph') return;
|
|
157
|
+
var childPath1 = _to_consumable_array(path).concat([
|
|
158
|
+
i
|
|
159
|
+
]);
|
|
158
160
|
var listType = getListType();
|
|
159
161
|
Transforms.wrapNodes(editor, {
|
|
160
162
|
type: 'list-item',
|
|
@@ -163,17 +165,13 @@ import { Editor, Element, Node, Transforms } from "slate";
|
|
|
163
165
|
id: '',
|
|
164
166
|
children: []
|
|
165
167
|
}, {
|
|
166
|
-
at:
|
|
167
|
-
i
|
|
168
|
-
])
|
|
168
|
+
at: childPath1
|
|
169
169
|
});
|
|
170
170
|
Transforms.wrapNodes(editor, {
|
|
171
171
|
type: listType,
|
|
172
172
|
children: []
|
|
173
173
|
}, {
|
|
174
|
-
at:
|
|
175
|
-
i
|
|
176
|
-
])
|
|
174
|
+
at: childPath1
|
|
177
175
|
});
|
|
178
176
|
return;
|
|
179
177
|
}
|
|
@@ -952,10 +952,11 @@ export var InsertAutocomplete = function InsertAutocomplete(props) {
|
|
|
952
952
|
}
|
|
953
953
|
setupEventListeners();
|
|
954
954
|
setTimeout(function() {
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
955
|
+
if (dom.current && typeof dom.current.scroll === 'function') {
|
|
956
|
+
dom.current.scroll({
|
|
957
|
+
top: 0
|
|
958
|
+
});
|
|
959
|
+
}
|
|
959
960
|
});
|
|
960
961
|
}
|
|
961
962
|
} else {
|
|
@@ -53,7 +53,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
53
53
|
}
|
|
54
54
|
import { Plus } from "@sofa-design/icons";
|
|
55
55
|
import { Divider, Dropdown } from "antd";
|
|
56
|
-
import
|
|
56
|
+
import classNames from "clsx";
|
|
57
57
|
import React, { useContext, useMemo } from "react";
|
|
58
58
|
import { I18nContext } from "../../../../I18n";
|
|
59
59
|
import { useEditorStore } from "../../store";
|
|
@@ -162,7 +162,7 @@ var isNodeInTable = function isNodeInTable(currentNode, markdownEditorRef) {
|
|
|
162
162
|
onClick: function onClick() {
|
|
163
163
|
return handleInsert(option);
|
|
164
164
|
},
|
|
165
|
-
className:
|
|
165
|
+
className: classNames("".concat(baseClassName, "-item"), hashId)
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
168
|
}, [
|
|
@@ -350,7 +350,7 @@ var isNodeInTable = function isNodeInTable(currentNode, markdownEditorRef) {
|
|
|
350
350
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ToolBarItem, {
|
|
351
351
|
title: ((_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.moreActions) || '更多操作',
|
|
352
352
|
icon: /*#__PURE__*/ React.createElement(Plus, null),
|
|
353
|
-
className:
|
|
353
|
+
className: classNames("".concat(baseClassName, "-item"), "".concat(baseClassName, "-item--more"), hashId),
|
|
354
354
|
tabIndex: -1
|
|
355
355
|
}, /*#__PURE__*/ React.createElement(Dropdown, {
|
|
356
356
|
menu: {
|
|
@@ -425,14 +425,14 @@ var isNodeInTable = function isNodeInTable(currentNode, markdownEditorRef) {
|
|
|
425
425
|
var key = "extra-".concat(index);
|
|
426
426
|
if (/*#__PURE__*/ React.isValidElement(item)) {
|
|
427
427
|
return item.type === 'span' ? /*#__PURE__*/ React.createElement("div", {
|
|
428
|
-
className:
|
|
428
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
429
429
|
key: "".concat(key, "-span")
|
|
430
430
|
}, item) : /*#__PURE__*/ React.cloneElement(item, {
|
|
431
431
|
key: key
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
return /*#__PURE__*/ React.createElement("div", {
|
|
435
|
-
className:
|
|
435
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
436
436
|
key: "".concat(key, "-div")
|
|
437
437
|
}, item);
|
|
438
438
|
}));
|
|
@@ -153,7 +153,9 @@ var fileMap = new Map();
|
|
|
153
153
|
return function() {
|
|
154
154
|
return window.removeEventListener('resize', change);
|
|
155
155
|
};
|
|
156
|
-
}, [
|
|
156
|
+
}, [
|
|
157
|
+
isOpen
|
|
158
|
+
]);
|
|
157
159
|
var context = useContext(ConfigProvider.ConfigContext);
|
|
158
160
|
var baseClassName = context === null || context === void 0 ? void 0 : context.getPrefixCls("agentic-md-editor-float-bar");
|
|
159
161
|
var _useStyle = useStyle(baseClassName), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
@@ -174,7 +174,7 @@ function _ts_generator(thisArg, body) {
|
|
|
174
174
|
}
|
|
175
175
|
import { CommentOutlined, CopyFilled, HighlightFilled } from "@ant-design/icons";
|
|
176
176
|
import { Input, message, Modal } from "antd";
|
|
177
|
-
import
|
|
177
|
+
import classNames from "clsx";
|
|
178
178
|
import copy from "copy-to-clipboard";
|
|
179
179
|
import React, { useContext, useEffect, useMemo } from "react";
|
|
180
180
|
import { Editor, Element, Node, Point, Transforms } from "slate";
|
|
@@ -212,7 +212,7 @@ import { getPointStrOffset, getSelectionFromDomSelection } from "../../utils/edi
|
|
|
212
212
|
list.push(/*#__PURE__*/ React.createElement("div", {
|
|
213
213
|
role: "button",
|
|
214
214
|
key: "highlight",
|
|
215
|
-
className:
|
|
215
|
+
className: classNames("".concat(baseClassName, "-item")),
|
|
216
216
|
onClick: function onClick() {
|
|
217
217
|
return _async_to_generator(function() {
|
|
218
218
|
var _editorProps_comment_onSubmit, _editorProps_comment, domSelection, editor, selection, texts, title, fragments, i, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, str, focus, anchor, _ref, start, end, anchorOffset, focusOffset, comment;
|
|
@@ -308,7 +308,7 @@ import { getPointStrOffset, getSelectionFromDomSelection } from "../../utils/edi
|
|
|
308
308
|
list.push(/*#__PURE__*/ React.createElement("div", {
|
|
309
309
|
role: "button",
|
|
310
310
|
key: "comment",
|
|
311
|
-
className:
|
|
311
|
+
className: classNames("".concat(baseClassName, "-item")),
|
|
312
312
|
onClick: function onClick() {
|
|
313
313
|
var _i18n_locale, _editorProps_comment, _i18n_locale1;
|
|
314
314
|
if (typeof window === 'undefined') return;
|
|
@@ -443,7 +443,7 @@ import { getPointStrOffset, getSelectionFromDomSelection } from "../../utils/edi
|
|
|
443
443
|
list.push(/*#__PURE__*/ React.createElement("div", {
|
|
444
444
|
role: "button",
|
|
445
445
|
key: "insert",
|
|
446
|
-
className:
|
|
446
|
+
className: classNames("".concat(baseClassName, "-item")),
|
|
447
447
|
onClick: function onClick() {
|
|
448
448
|
var domSelection = window.getSelection();
|
|
449
449
|
var editor = markdownEditorRef.current;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classNames from "clsx";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ToolBarItem } from "./ToolBarItem";
|
|
4
4
|
var ClearIcon = /*#__PURE__*/ React.memo(function() {
|
|
@@ -21,7 +21,7 @@ export var ClearFormatButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
21
21
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.clearFormatting) || '清除格式',
|
|
22
22
|
icon: /*#__PURE__*/ React.createElement(ClearIcon, null),
|
|
23
23
|
onClick: onClear,
|
|
24
|
-
className:
|
|
24
|
+
className: classNames("".concat(baseClassName, "-item"), hashId)
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
ClearFormatButton.displayName = 'ClearFormatButton';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HighlightOutlined } from "@ant-design/icons";
|
|
2
2
|
import { ColorPicker } from "antd";
|
|
3
|
-
import
|
|
3
|
+
import classNames from "clsx";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { ToolBarItem } from "./ToolBarItem";
|
|
6
6
|
var colors = [
|
|
@@ -40,7 +40,7 @@ export var ColorPickerButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
40
40
|
return /*#__PURE__*/ React.createElement(ToolBarItem, {
|
|
41
41
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale['font-color']) || '字体颜色',
|
|
42
42
|
icon: /*#__PURE__*/ React.createElement(HighlightOutlined, null),
|
|
43
|
-
className:
|
|
43
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
44
44
|
style: {
|
|
45
45
|
position: 'relative'
|
|
46
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormatPainterOutlined } from "@ant-design/icons";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
export var FormatButton = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -9,7 +9,7 @@ export var FormatButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
9
9
|
title: ((_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.format) || '格式化',
|
|
10
10
|
icon: /*#__PURE__*/ React.createElement(FormatPainterOutlined, null),
|
|
11
11
|
onClick: onFormat,
|
|
12
|
-
className:
|
|
12
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
13
13
|
style: {
|
|
14
14
|
fontSize: '0.9em'
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classNames from "clsx";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ToolBarItem } from "./ToolBarItem";
|
|
4
4
|
export var FormattingTools = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -28,7 +28,7 @@ export var FormattingTools = /*#__PURE__*/ React.memo(function(param) {
|
|
|
28
28
|
onClick: function onClick() {
|
|
29
29
|
return !isCodeNode && onToolClick(tool);
|
|
30
30
|
},
|
|
31
|
-
className:
|
|
31
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
32
32
|
style: {
|
|
33
33
|
color: isActive ? '#1677ff' : undefined
|
|
34
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dropdown } from "antd";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
var HeadingLocaleKeyMap = {
|
|
@@ -58,7 +58,7 @@ export var HeadingDropdown = /*#__PURE__*/ React.memo(function(param) {
|
|
|
58
58
|
}, /*#__PURE__*/ React.createElement(ToolBarItem, {
|
|
59
59
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.heading) || '标题',
|
|
60
60
|
icon: null,
|
|
61
|
-
className:
|
|
61
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
62
62
|
style: {
|
|
63
63
|
minWidth: 36,
|
|
64
64
|
textAlign: 'center',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkOutlined } from "@ant-design/icons";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
export var LinkButton = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -9,7 +9,7 @@ export var LinkButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
9
9
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.insertLink) || '插入链接',
|
|
10
10
|
icon: /*#__PURE__*/ React.createElement(LinkOutlined, null),
|
|
11
11
|
onClick: onInsertLink,
|
|
12
|
-
className:
|
|
12
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
13
13
|
style: {
|
|
14
14
|
color: isLinkActive ? '#1677ff' : undefined
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RedoOutlined, UndoOutlined } from "@ant-design/icons";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
export var UndoRedoButtons = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -9,12 +9,12 @@ export var UndoRedoButtons = /*#__PURE__*/ React.memo(function(param) {
|
|
|
9
9
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.undo) || '撤销',
|
|
10
10
|
icon: /*#__PURE__*/ React.createElement(UndoOutlined, null),
|
|
11
11
|
onClick: onUndo,
|
|
12
|
-
className:
|
|
12
|
+
className: classNames("".concat(baseClassName, "-item"), hashId)
|
|
13
13
|
}), /*#__PURE__*/ React.createElement(ToolBarItem, {
|
|
14
14
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.redo) || '重做',
|
|
15
15
|
icon: /*#__PURE__*/ React.createElement(RedoOutlined, null),
|
|
16
16
|
onClick: onRedo,
|
|
17
|
-
className:
|
|
17
|
+
className: classNames("".concat(baseClassName, "-item"), hashId)
|
|
18
18
|
}));
|
|
19
19
|
});
|
|
20
20
|
UndoRedoButtons.displayName = 'UndoRedoButtons';
|
|
@@ -530,16 +530,17 @@ export var EditorUtils = /*#__PURE__*/ function() {
|
|
|
530
530
|
* @returns 返回指定范围内的文本内容。
|
|
531
531
|
*/ function copyText(editor, start, end) {
|
|
532
532
|
var _leaf_text;
|
|
533
|
-
var
|
|
533
|
+
var _Editor_leaf = _sliced_to_array(Editor.leaf(editor, start), 2), leaf = _Editor_leaf[0], leafPath = _Editor_leaf[1];
|
|
534
534
|
var text = '';
|
|
535
535
|
// Handle first leaf node from start offset
|
|
536
536
|
text += ((_leaf_text = leaf.text) === null || _leaf_text === void 0 ? void 0 : _leaf_text.slice(start.offset)) || '';
|
|
537
537
|
// Get next nodes until we reach the end point
|
|
538
538
|
var next = Editor.next(editor, {
|
|
539
|
-
at:
|
|
539
|
+
at: leafPath
|
|
540
540
|
});
|
|
541
|
+
var endLeafPath = end ? Editor.leaf(editor, end)[1] : null;
|
|
541
542
|
while(next){
|
|
542
|
-
if (
|
|
543
|
+
if (endLeafPath && Path.equals(next[1], endLeafPath)) {
|
|
543
544
|
var _next__text;
|
|
544
545
|
// If we reach the end path, slice until end offset
|
|
545
546
|
text += ((_next__text = next[0].text) === null || _next__text === void 0 ? void 0 : _next__text.slice(0, end.offset)) || '';
|
|
@@ -566,17 +567,18 @@ export var EditorUtils = /*#__PURE__*/ function() {
|
|
|
566
567
|
* @returns 剪切的文本数组,每个元素为一个 CustomLeaf 对象。
|
|
567
568
|
*/ function cutText(editor, start, end) {
|
|
568
569
|
var _leaf_text;
|
|
569
|
-
var
|
|
570
|
+
var _Editor_leaf = _sliced_to_array(Editor.leaf(editor, start), 2), leaf = _Editor_leaf[0], leafPath = _Editor_leaf[1];
|
|
570
571
|
var texts = [
|
|
571
572
|
_object_spread_props(_object_spread({}, leaf), {
|
|
572
573
|
text: ((_leaf_text = leaf.text) === null || _leaf_text === void 0 ? void 0 : _leaf_text.slice(start.offset)) || ''
|
|
573
574
|
})
|
|
574
575
|
];
|
|
576
|
+
var endLeafPath = end ? Editor.leaf(editor, end)[1] : null;
|
|
575
577
|
var next = Editor.next(editor, {
|
|
576
|
-
at:
|
|
578
|
+
at: leafPath
|
|
577
579
|
});
|
|
578
580
|
while(next){
|
|
579
|
-
if (
|
|
581
|
+
if (endLeafPath && Path.equals(next[1], endLeafPath)) {
|
|
580
582
|
var _next__text;
|
|
581
583
|
texts.push(_object_spread_props(_object_spread({}, next[0]), {
|
|
582
584
|
text: ((_next__text = next[0].text) === null || _next__text === void 0 ? void 0 : _next__text.slice(0, end.offset)) || ''
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
if (/\|.+\|[\r\n]+\|[\s-:]+\|/m.test(text)) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
|
-
// Check for Markdown links
|
|
18
|
-
if (
|
|
17
|
+
// Check for Markdown images (before links:  also matches link pattern)
|
|
18
|
+
if (/!\[.+\]\(.+\)/.test(text)) {
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
|
-
// Check for Markdown
|
|
22
|
-
if (
|
|
21
|
+
// Check for Markdown links
|
|
22
|
+
if (/\[.+\]\(.+\)/.test(text)) {
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
// Check for Markdown code blocks
|
|
@@ -220,7 +220,7 @@ import { message } from "antd";
|
|
|
220
220
|
import copy from "copy-to-clipboard";
|
|
221
221
|
import isHotkey from "is-hotkey";
|
|
222
222
|
import { useEffect, useMemo } from "react";
|
|
223
|
-
import { Editor, Element,
|
|
223
|
+
import { Editor, Element, Path, Range, Transforms } from "slate";
|
|
224
224
|
import { ReactEditor } from "slate-react";
|
|
225
225
|
import { useRefFunction } from "../../../Hooks/useRefFunction";
|
|
226
226
|
import { useSubject } from "../../hooks/subscribe";
|
|
@@ -314,7 +314,8 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
314
314
|
value: function selectWord() {
|
|
315
315
|
var sel = this.editor.selection;
|
|
316
316
|
if (sel && Range.isCollapsed(sel)) {
|
|
317
|
-
var
|
|
317
|
+
var _Editor_leaf = _sliced_to_array(Editor.leaf(this.editor, sel.anchor), 1), leaf = _Editor_leaf[0];
|
|
318
|
+
var text = (leaf === null || leaf === void 0 ? void 0 : leaf.text) || '';
|
|
318
319
|
var start = sel.anchor.offset;
|
|
319
320
|
var end = start;
|
|
320
321
|
var next = text.slice(start);
|
package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
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_without_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
-
}
|
|
9
|
-
function _iterable_to_array(iter) {
|
|
10
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
11
|
-
}
|
|
12
|
-
function _non_iterable_spread() {
|
|
13
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14
|
-
}
|
|
15
|
-
function _to_consumable_array(arr) {
|
|
16
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
17
|
-
}
|
|
18
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
19
|
-
if (!o) return;
|
|
20
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
21
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
23
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
24
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
25
|
-
}
|
|
26
1
|
import { FileFailed, FileUploadingSpin, X } from "@sofa-design/icons";
|
|
27
2
|
import { Tooltip } from "antd";
|
|
28
3
|
import classNames from "clsx";
|
|
@@ -37,39 +12,33 @@ var getFileNameWithoutExtension = function getFileNameWithoutExtension(fileName)
|
|
|
37
12
|
var getFileExtension = function getFileExtension(fileName) {
|
|
38
13
|
return fileName.split('.').slice(-1)[0];
|
|
39
14
|
};
|
|
40
|
-
var buildClassName = function buildClassName() {
|
|
41
|
-
for(var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++){
|
|
42
|
-
classes[_key] = arguments[_key];
|
|
43
|
-
}
|
|
44
|
-
return classNames.apply(void 0, _to_consumable_array(classes));
|
|
45
|
-
};
|
|
46
15
|
var FileIcon = function FileIcon(param) {
|
|
47
16
|
var file = param.file, prefixCls = param.prefixCls, hashId = param.hashId;
|
|
48
17
|
var status = file.status || 'done';
|
|
49
18
|
var iconMap = {
|
|
50
19
|
uploading: /*#__PURE__*/ React.createElement("div", {
|
|
51
|
-
className:
|
|
20
|
+
className: classNames("".concat(prefixCls, "-uploading-icon"), hashId)
|
|
52
21
|
}, /*#__PURE__*/ React.createElement(FileUploadingSpin, null)),
|
|
53
22
|
error: /*#__PURE__*/ React.createElement("div", {
|
|
54
|
-
className:
|
|
23
|
+
className: classNames("".concat(prefixCls, "-error-icon"), hashId)
|
|
55
24
|
}, /*#__PURE__*/ React.createElement(FileFailed, null)),
|
|
56
25
|
done: /*#__PURE__*/ React.createElement(AttachmentFileIcon, {
|
|
57
26
|
file: file,
|
|
58
|
-
className:
|
|
27
|
+
className: classNames("".concat(prefixCls, "-file-icon-img"), hashId)
|
|
59
28
|
})
|
|
60
29
|
};
|
|
61
30
|
return /*#__PURE__*/ React.createElement("div", {
|
|
62
|
-
className:
|
|
31
|
+
className: classNames("".concat(prefixCls, "-file-icon"), hashId)
|
|
63
32
|
}, iconMap[status]);
|
|
64
33
|
};
|
|
65
34
|
var FileSizeInfo = function FileSizeInfo(param) {
|
|
66
35
|
var file = param.file, prefixCls = param.prefixCls, hashId = param.hashId, locale = param.locale;
|
|
67
36
|
var status = file.status || 'done';
|
|
68
|
-
var baseClassName =
|
|
37
|
+
var baseClassName = classNames("".concat(prefixCls, "-file-size"), hashId);
|
|
69
38
|
var statusContentMap = {
|
|
70
39
|
uploading: (locale === null || locale === void 0 ? void 0 : locale.uploading) || '上传中...',
|
|
71
40
|
error: /*#__PURE__*/ React.createElement("div", {
|
|
72
|
-
className:
|
|
41
|
+
className: classNames(baseClassName, "".concat(prefixCls, "-file-size-error"))
|
|
73
42
|
}, (locale === null || locale === void 0 ? void 0 : locale.uploadFailed) || '上传失败'),
|
|
74
43
|
done: function() {
|
|
75
44
|
var fileExtension = getFileExtension(file.name);
|
|
@@ -81,7 +50,7 @@ var FileSizeInfo = function FileSizeInfo(param) {
|
|
|
81
50
|
return sizeItems.map(function(item) {
|
|
82
51
|
return /*#__PURE__*/ React.createElement("span", {
|
|
83
52
|
key: item,
|
|
84
|
-
className:
|
|
53
|
+
className: classNames("".concat(prefixCls, "-file-size-item"), hashId)
|
|
85
54
|
}, item);
|
|
86
55
|
});
|
|
87
56
|
}()
|
|
@@ -98,7 +67,7 @@ var DeleteButton = function DeleteButton(param) {
|
|
|
98
67
|
if (!isVisible) return null;
|
|
99
68
|
return /*#__PURE__*/ React.createElement("div", {
|
|
100
69
|
onClick: onClick,
|
|
101
|
-
className:
|
|
70
|
+
className: classNames("".concat(prefixCls, "-close-icon"), hashId)
|
|
102
71
|
}, /*#__PURE__*/ React.createElement(X, {
|
|
103
72
|
role: "img",
|
|
104
73
|
"aria-label": "X"
|
|
@@ -149,12 +118,12 @@ export var AttachmentFileListItem = function AttachmentFileListItem(param) {
|
|
|
149
118
|
prefixCls: prefixCls,
|
|
150
119
|
hashId: hashId
|
|
151
120
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
152
|
-
className:
|
|
121
|
+
className: classNames("".concat(prefixCls, "-file-info"), hashId)
|
|
153
122
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
154
123
|
onClick: handleRetryClick,
|
|
155
|
-
className:
|
|
124
|
+
className: classNames("".concat(prefixCls, "-file-name"), hashId)
|
|
156
125
|
}, /*#__PURE__*/ React.createElement("span", {
|
|
157
|
-
className:
|
|
126
|
+
className: classNames("".concat(prefixCls, "-file-name-text"), hashId)
|
|
158
127
|
}, getFileNameWithoutExtension(file.name))), /*#__PURE__*/ React.createElement(FileSizeInfo, {
|
|
159
128
|
file: file,
|
|
160
129
|
prefixCls: prefixCls,
|
|
@@ -322,8 +322,8 @@ import { RefinePromptButton } from "../RefinePromptButton";
|
|
|
322
322
|
isHover: isHover,
|
|
323
323
|
isLoading: isLoading,
|
|
324
324
|
fileUploadStatus: fileUploadStatus
|
|
325
|
-
}) : []), //
|
|
326
|
-
_to_consumable_array(
|
|
325
|
+
}) : []), // 提示词优化按钮(有 refinePrompt 即渲染,enable 由 handleRefine 内校验)
|
|
326
|
+
_to_consumable_array(refinePrompt ? [
|
|
327
327
|
/*#__PURE__*/ React.createElement(RefinePromptButton, {
|
|
328
328
|
key: "refine-prompt",
|
|
329
329
|
isHover: isHover,
|
|
@@ -4,6 +4,7 @@ import { ConfigProvider, Tooltip } from "antd";
|
|
|
4
4
|
import React, { useContext } from "react";
|
|
5
5
|
import { ErrorBoundary } from "react-error-boundary";
|
|
6
6
|
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
7
|
+
import { isBrowserEnv } from "./env";
|
|
7
8
|
import { useStyle } from "./style";
|
|
8
9
|
export var RefinePromptButton = function RefinePromptButton(props) {
|
|
9
10
|
var disabled = props.disabled, status = props.status, onRefine = props.onRefine;
|
|
@@ -19,7 +20,7 @@ export var RefinePromptButton = function RefinePromptButton(props) {
|
|
|
19
20
|
if (status === 'loading') return /*#__PURE__*/ React.createElement(LoadingOutlined, null);
|
|
20
21
|
return /*#__PURE__*/ React.createElement(TextOptimize, null);
|
|
21
22
|
};
|
|
22
|
-
if (
|
|
23
|
+
if (!isBrowserEnv()) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
26
|
return wrapSSR(/*#__PURE__*/ React.createElement(Tooltip, {
|
|
@@ -115,7 +115,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
115
115
|
import { ConfigProvider } from "antd";
|
|
116
116
|
import { BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Tooltip } from "chart.js";
|
|
117
117
|
import ChartDataLabels from "chartjs-plugin-datalabels";
|
|
118
|
-
import
|
|
118
|
+
import clsx from "clsx";
|
|
119
119
|
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
120
120
|
import { Bar } from "react-chartjs-2";
|
|
121
121
|
import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
|
|
@@ -829,18 +829,18 @@ var BarChart = function BarChart(param) {
|
|
|
829
829
|
var handleDownload = function handleDownload() {
|
|
830
830
|
downloadChart(chartRef.current, 'bar-chart');
|
|
831
831
|
};
|
|
832
|
-
var rootClassName =
|
|
832
|
+
var rootClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.root, className);
|
|
833
833
|
var rootStyle = _object_spread({
|
|
834
834
|
width: responsiveWidth,
|
|
835
835
|
height: responsiveHeight
|
|
836
836
|
}, style, styles === null || styles === void 0 ? void 0 : styles.root);
|
|
837
|
-
var toolbarClassName =
|
|
837
|
+
var toolbarClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.toolbar);
|
|
838
838
|
var toolbarStyle = styles === null || styles === void 0 ? void 0 : styles.toolbar;
|
|
839
|
-
var statisticContainerClassName =
|
|
839
|
+
var statisticContainerClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.statisticContainer, "".concat(baseClassName, "-statistic-container"));
|
|
840
840
|
var statisticContainerStyle = styles === null || styles === void 0 ? void 0 : styles.statisticContainer;
|
|
841
|
-
var filterClassName =
|
|
841
|
+
var filterClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.filter);
|
|
842
842
|
var filterStyle = styles === null || styles === void 0 ? void 0 : styles.filter;
|
|
843
|
-
var wrapperClassName =
|
|
843
|
+
var wrapperClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.wrapper, "".concat(baseClassName, "-wrapper"));
|
|
844
844
|
var wrapperStyle = _object_spread({
|
|
845
845
|
marginTop: '20px',
|
|
846
846
|
height: responsiveHeight
|