@ant-design/agentic-ui 2.29.56 → 2.29.58

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.
Files changed (35) hide show
  1. package/dist/Bubble/AIBubble.js +2 -1
  2. package/dist/Bubble/BubbleConfigProvide.d.ts +5 -0
  3. package/dist/Bubble/List/index.d.ts +5 -0
  4. package/dist/Bubble/List/index.js +22 -5
  5. package/dist/Bubble/MessagesContent/MarkdownPreview.js +49 -25
  6. package/dist/Bubble/PureBubble.js +2 -1
  7. package/dist/Bubble/UserBubble.js +2 -1
  8. package/dist/MarkdownEditor/editor/elements/Table/Table.js +1 -1
  9. package/dist/MarkdownEditor/editor/elements/Table/utils/getTableColWidths.js +1 -1
  10. package/dist/MarkdownEditor/editor/elements/index.js +1 -1
  11. package/dist/MarkdownEditor/editor/parser/constants.d.ts +7 -0
  12. package/dist/MarkdownEditor/editor/parser/constants.js +16 -0
  13. package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +10 -3
  14. package/dist/MarkdownEditor/editor/parser/parse/parseText.js +20 -0
  15. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +3 -1
  16. package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +1 -1
  17. package/dist/MarkdownEditor/editor/plugins/handlePaste.js +1 -6
  18. package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +3 -12
  19. package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +1 -1
  20. package/dist/MarkdownEditor/editor/plugins/withLinkAndMediaPlugin.js +1 -2
  21. package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +1 -3
  22. package/dist/MarkdownEditor/editor/utils/docx/module.js +1 -3
  23. package/dist/MarkdownEditor/editor/utils/keyboard.js +1 -7
  24. package/dist/MarkdownEditor/editor/utils/markdownToHtml.d.ts +19 -0
  25. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +46 -1
  26. package/dist/MarkdownInputField/AttachmentButton/index.js +2 -22
  27. package/dist/MarkdownInputField/FileUploadManager/index.js +4 -26
  28. package/dist/MarkdownInputField/RefinePromptButton/index.js +1 -1
  29. package/dist/Plugins/chart/DonutChart/index.js +2 -2
  30. package/dist/Plugins/code/components/CodeToolbar.js +1 -4
  31. package/dist/Plugins/mermaid/index.js +0 -3
  32. package/dist/Schema/SchemaEditor/index.js +5 -12
  33. package/dist/ToolUseBarThink/index.js +2 -2
  34. package/dist/Workspace/File/FileComponent.js +6 -23
  35. package/package.json +1 -2
@@ -275,7 +275,7 @@ var getTaskList = function getTaskList(originData) {
275
275
  var _React_useState = _sliced_to_array(React.useState(false), 2), hidePadding = _React_useState[0], setHidePadding = _React_useState[1];
276
276
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
277
277
  var context = useContext(BubbleConfigContext);
278
- var _ref = context || {}, compact = _ref.compact, standalone = _ref.standalone;
278
+ var _ref = context || {}, compact = _ref.compact, standalone = _ref.standalone, extraShowOnHover = _ref.extraShowOnHover;
279
279
  var prefixClass = getPrefixCls('agentic');
280
280
  var _useStyle = useStyle(prefixClass), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
281
281
  var preMessageSameRole = isSameRoleAsPrevious(preMessage, originData);
@@ -356,6 +356,7 @@ var getTaskList = function getTaskList(originData) {
356
356
  value: {
357
357
  compact: compact,
358
358
  standalone: !!standalone,
359
+ extraShowOnHover: extraShowOnHover,
359
360
  bubble: props
360
361
  }
361
362
  }, /*#__PURE__*/ React.createElement(Flex, {
@@ -28,5 +28,10 @@ export type ChatConfigType = {
28
28
  uuid: number;
29
29
  }>;
30
30
  compact?: boolean;
31
+ /**
32
+ * extra(点赞、踩、复制等)是否仅在 hover 时展示
33
+ * @default false 默认常驻展示
34
+ */
35
+ extraShowOnHover?: boolean;
31
36
  };
32
37
  export declare const BubbleConfigContext: React.Context<ChatConfigType | undefined>;
@@ -35,6 +35,11 @@ export type BubbleListProps = {
35
35
  * 组件的样式
36
36
  */
37
37
  style?: React.CSSProperties;
38
+ /**
39
+ * extra(点赞、踩、复制等)是否仅在 hover 时展示
40
+ * @default false 默认常驻展示
41
+ */
42
+ extraShowOnHover?: boolean;
38
43
  /**
39
44
  * 用户元数据
40
45
  */
@@ -125,7 +125,20 @@ import { useStyle } from "./style";
125
125
  // 兼容旧属性
126
126
  var loading = isLoading !== null && isLoading !== void 0 ? isLoading : legacyLoading;
127
127
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
128
- var compact = (useContext(BubbleConfigContext) || {}).compact;
128
+ var parentContext = useContext(BubbleConfigContext);
129
+ var compact = (parentContext || {}).compact;
130
+ var mergedContext = useMemo(function() {
131
+ var _props_extraShowOnHover;
132
+ return parentContext ? _object_spread_props(_object_spread({}, parentContext), {
133
+ extraShowOnHover: (_props_extraShowOnHover = props.extraShowOnHover) !== null && _props_extraShowOnHover !== void 0 ? _props_extraShowOnHover : parentContext.extraShowOnHover
134
+ }) : {
135
+ standalone: false,
136
+ extraShowOnHover: props.extraShowOnHover
137
+ };
138
+ }, [
139
+ parentContext,
140
+ props.extraShowOnHover
141
+ ]);
129
142
  var prefixClass = getPrefixCls('agentic-bubble-list');
130
143
  var _useStyle = useStyle(prefixClass), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
131
144
  var deps = useMemo(function() {
@@ -230,15 +243,19 @@ import { useStyle } from "./style";
230
243
  props.style,
231
244
  props.lazy
232
245
  ]);
233
- if (loading) return wrapSSR(/*#__PURE__*/ React.createElement("div", {
246
+ if (loading) return wrapSSR(/*#__PURE__*/ React.createElement(BubbleConfigContext.Provider, {
247
+ value: mergedContext
248
+ }, /*#__PURE__*/ React.createElement("div", {
234
249
  className: clsx(prefixClass, "".concat(prefixClass, "-loading"), className, hashId),
235
250
  ref: bubbleListRef,
236
251
  style: {
237
252
  padding: 24
238
253
  }
239
- }, /*#__PURE__*/ React.createElement(SkeletonList, null)));
254
+ }, /*#__PURE__*/ React.createElement(SkeletonList, null))));
240
255
  var _obj;
241
- return wrapSSR(/*#__PURE__*/ React.createElement("div", {
256
+ return wrapSSR(/*#__PURE__*/ React.createElement(BubbleConfigContext.Provider, {
257
+ value: mergedContext
258
+ }, /*#__PURE__*/ React.createElement("div", {
242
259
  className: clsx("".concat(prefixClass), className, hashId, (_obj = {}, _define_property(_obj, "".concat(prefixClass, "-readonly"), props.readonly), _define_property(_obj, "".concat(prefixClass, "-compact"), compact), _obj)),
243
260
  "data-chat-list": bubbleList.length,
244
261
  style: style,
@@ -250,6 +267,6 @@ import { useStyle } from "./style";
250
267
  onTouchMove: function onTouchMove1(e) {
251
268
  return onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(e, (bubbleListRef === null || bubbleListRef === void 0 ? void 0 : bubbleListRef.current) || null);
252
269
  }
253
- }, bubbleListDom));
270
+ }, bubbleListDom)));
254
271
  };
255
272
  export default BubbleList;
@@ -100,6 +100,7 @@ import { MessagesContext } from "./BubbleContext";
100
100
  var config = useContext(BubbleConfigContext);
101
101
  var locale = useLocale();
102
102
  var standalone = config === null || config === void 0 ? void 0 : config.standalone;
103
+ var extraShowOnHover = config === null || config === void 0 ? void 0 : config.extraShowOnHover;
103
104
  var token = theme.useToken().token;
104
105
  var isPaddingHidden = useMemo(function() {
105
106
  return !!extra;
@@ -167,34 +168,57 @@ import { MessagesContext } from "./BubbleContext";
167
168
  marginRight: props.placement === 'right' ? 24 : 0
168
169
  }
169
170
  }, (locale === null || locale === void 0 ? void 0 : locale['error.unexpected']) || '出现点意外情况,请重新发送');
170
- var contentWrapper = /*#__PURE__*/ React.createElement("div", {
171
- style: {
172
- display: 'flex',
173
- flexDirection: 'column',
174
- minWidth: 0,
175
- maxWidth: '100%'
176
- }
177
- }, /*#__PURE__*/ React.createElement(ErrorBoundary, {
178
- fallback: errorDom
179
- }, beforeContent, markdown, docListNode, afterContent), props.placement === 'right' ? null : extra);
180
- if (props.placement !== 'right') {
181
- return contentWrapper;
171
+ // 未开启 extraShowOnHover 时,extra 常驻展示(左右均作为兄弟节点渲染)
172
+ if (!extraShowOnHover) {
173
+ return /*#__PURE__*/ React.createElement("div", {
174
+ style: {
175
+ display: 'flex',
176
+ flexDirection: 'column',
177
+ minWidth: 0,
178
+ maxWidth: '100%'
179
+ }
180
+ }, /*#__PURE__*/ React.createElement(ErrorBoundary, {
181
+ fallback: errorDom
182
+ }, beforeContent, markdown, docListNode, afterContent), extra);
182
183
  }
183
- // 仅当 extra 有内容时才用 Popover,避免 shouldShowCopy={false} 时 hover 出现空浮层小点
184
+ // extraShowOnHover 开启时,无 extra 直接返回内容,避免 hover 出现空浮层
184
185
  if (!extra) {
185
- return contentWrapper;
186
+ return /*#__PURE__*/ React.createElement("div", {
187
+ style: {
188
+ display: 'flex',
189
+ flexDirection: 'column',
190
+ minWidth: 0,
191
+ maxWidth: '100%'
192
+ }
193
+ }, /*#__PURE__*/ React.createElement(ErrorBoundary, {
194
+ fallback: errorDom
195
+ }, beforeContent, markdown, docListNode, afterContent));
186
196
  }
197
+ // extraShowOnHover 开启时,左右两侧均通过 Popover 在 hover 时展示 extra
198
+ var isLeft = props.placement === 'left';
199
+ var popoverAlign = isLeft ? {
200
+ points: [
201
+ 'tl',
202
+ 'bl'
203
+ ],
204
+ offset: [
205
+ 0,
206
+ -12
207
+ ]
208
+ } : {
209
+ points: [
210
+ 'tr',
211
+ 'br'
212
+ ],
213
+ offset: [
214
+ 0,
215
+ -12
216
+ ]
217
+ };
218
+ var popoverPlacement = isLeft ? 'bottomLeft' : 'bottomRight';
187
219
  return /*#__PURE__*/ React.createElement(Popover, {
188
- align: {
189
- points: [
190
- 'tr',
191
- 'br'
192
- ],
193
- offset: [
194
- 0,
195
- -12
196
- ]
197
- },
220
+ trigger: "hover",
221
+ align: popoverAlign,
198
222
  content: extra,
199
223
  styles: {
200
224
  root: {
@@ -211,7 +235,7 @@ import { MessagesContext } from "./BubbleContext";
211
235
  }
212
236
  },
213
237
  arrow: false,
214
- placement: "bottomRight"
238
+ placement: popoverPlacement
215
239
  }, /*#__PURE__*/ React.createElement("div", {
216
240
  style: {
217
241
  display: 'flex',
@@ -279,7 +279,7 @@ export var PureBubble = /*#__PURE__*/ memo(function(props) {
279
279
  var _React_useState = _sliced_to_array(React.useState(false), 2), hidePadding = _React_useState[0], setHidePadding = _React_useState[1];
280
280
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
281
281
  var context = useContext(BubbleConfigContext);
282
- var _ref1 = context || {}, compact = _ref1.compact, standalone = _ref1.standalone;
282
+ var _ref1 = context || {}, compact = _ref1.compact, standalone = _ref1.standalone, extraShowOnHover = _ref1.extraShowOnHover;
283
283
  var prefixClass = getPrefixCls('agentic');
284
284
  var _useStyle = useStyle(prefixClass), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
285
285
  var placement = (_props_placement = props.placement) !== null && _props_placement !== void 0 ? _props_placement : 'left';
@@ -452,6 +452,7 @@ export var PureBubble = /*#__PURE__*/ memo(function(props) {
452
452
  value: {
453
453
  compact: compact,
454
454
  standalone: !!standalone,
455
+ extraShowOnHover: extraShowOnHover,
455
456
  bubble: props
456
457
  }
457
458
  }, /*#__PURE__*/ React.createElement(Flex, {
@@ -128,7 +128,7 @@ var getContentStyle = function getContentStyle(standalone, customStyle) {
128
128
  var _React_useState = _sliced_to_array(React.useState(false), 2), hidePadding = _React_useState[0], setHidePadding = _React_useState[1];
129
129
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
130
130
  var context = useContext(BubbleConfigContext);
131
- var _ref = context || {}, compact = _ref.compact, standalone = _ref.standalone;
131
+ var _ref = context || {}, compact = _ref.compact, standalone = _ref.standalone, extraShowOnHover = _ref.extraShowOnHover;
132
132
  var prefixClass = getPrefixCls('agentic');
133
133
  var _useStyle = useStyle(prefixClass, classNames), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
134
134
  var time = (originData === null || originData === void 0 ? void 0 : originData.createAt) || props.time;
@@ -180,6 +180,7 @@ var getContentStyle = function getContentStyle(standalone, customStyle) {
180
180
  value: {
181
181
  compact: compact,
182
182
  standalone: !!standalone,
183
+ extraShowOnHover: extraShowOnHover,
183
184
  bubble: props
184
185
  }
185
186
  }, /*#__PURE__*/ React.createElement(Flex, {
@@ -150,9 +150,9 @@ import React, { useContext, useEffect, useMemo, useRef } from "react";
150
150
  import { Node } from "slate";
151
151
  import stringWidth from "string-width";
152
152
  import { MOBILE_BREAKPOINT, MOBILE_TABLE_MIN_COLUMN_WIDTH, TABLE_EDIT_COL_WIDTH_MIN_COLUMNS } from "../../../../Constants/mobile";
153
- import { TableColgroup, TABLE_ROW_INDEX_COL_WIDTH } from "./TableColgroup";
154
153
  import { useEditorStore } from "../../store";
155
154
  import { ReadonlyTableComponent } from "./ReadonlyTableComponent";
155
+ import { TABLE_ROW_INDEX_COL_WIDTH, TableColgroup } from "./TableColgroup";
156
156
  import { TablePropsContext } from "./TableContext";
157
157
  import { TableRowIndex } from "./TableRowIndex";
158
158
  import useScrollShadow from "./useScrollShadow";
@@ -29,7 +29,7 @@ function _unsupported_iterable_to_array(o, minLen) {
29
29
  }
30
30
  import { Node } from "slate";
31
31
  import stringWidth from "string-width";
32
- import { TABLE_DEFAULT_COL_WIDTH, TABLE_COL_WIDTH_MIN_COLUMNS } from "../../../../../Constants/mobile";
32
+ import { TABLE_COL_WIDTH_MIN_COLUMNS, TABLE_DEFAULT_COL_WIDTH } from "../../../../../Constants/mobile";
33
33
  var SMART_SAMPLE_ROWS = 5;
34
34
  var SMART_CELL_PADDING = 28; // 20 基础内边距 + 8 数字等字符宽度补偿
35
35
  var SMART_FONT = '14px sans-serif';
@@ -93,6 +93,7 @@ import { Editor, Path, Transforms } from "slate";
93
93
  import { ReactEditor } from "slate-react";
94
94
  import { I18nContext } from "../../../I18n";
95
95
  import { debugInfo } from "../../../Utils/debugUtils";
96
+ import { JINJA_DOLLAR_PLACEHOLDER } from "../parser/constants";
96
97
  import { useEditorStore } from "../store";
97
98
  import { EditorUtils } from "../utils/editorUtils";
98
99
  import { Blockquote } from "./Blockquote";
@@ -132,7 +133,6 @@ import { Paragraph } from "./Paragraph";
132
133
  import { ReadonlyParagraph } from "./Paragraph/ReadonlyParagraph";
133
134
  import { Schema } from "./Schema";
134
135
  import { ReadonlySchema } from "./Schema/ReadonlySchema";
135
- import { JINJA_DOLLAR_PLACEHOLDER } from "../parser/constants";
136
136
  import { tableRenderElement } from "./Table";
137
137
  import { ReadonlyTableComponent } from "./Table/ReadonlyTableComponent";
138
138
  import { TagPopup } from "./TagPopup";
@@ -3,3 +3,10 @@
3
3
  * 在 markdown 解析前替换,渲染与序列化时还原为 $。
4
4
  */
5
5
  export declare const JINJA_DOLLAR_PLACEHOLDER = "\uE01A";
6
+ /**
7
+ * 保护时间格式(如 02:20:31)不被 remark-directive 误解析为 textDirective。
8
+ * remark-directive 会将 ":20"、":31" 等解析为指令,导致 "Cannot handle unknown node textDirective"。
9
+ * 在数字与冒号间插入零宽空格 \u200B 以阻断误解析。
10
+ * 须在 remark-directive 解析前执行。
11
+ */
12
+ export declare function preprocessProtectTimeFromDirective(markdown: string): string;
@@ -2,3 +2,19 @@
2
2
  * 占位符:保护 Jinja 块内 $ 不被 remark-math 解析为数学公式。
3
3
  * 在 markdown 解析前替换,渲染与序列化时还原为 $。
4
4
  */ export var JINJA_DOLLAR_PLACEHOLDER = '\uE01A';
5
+ /** URL 协议占位符,用于保护时间格式预处理时不影响 https:// 等 */ var URL_PROTOCOL_PLACEHOLDER = '\uE01B\uE01B';
6
+ /**
7
+ * 保护时间格式(如 02:20:31)不被 remark-directive 误解析为 textDirective。
8
+ * remark-directive 会将 ":20"、":31" 等解析为指令,导致 "Cannot handle unknown node textDirective"。
9
+ * 在数字与冒号间插入零宽空格 \u200B 以阻断误解析。
10
+ * 须在 remark-directive 解析前执行。
11
+ */ export function preprocessProtectTimeFromDirective(markdown) {
12
+ if (!markdown || markdown.length === 0) return markdown;
13
+ var withProtocolProtected = markdown.replace(/:\/\//g, URL_PROTOCOL_PLACEHOLDER);
14
+ // 使用反斜杠转义冒号,阻止 ":20"、":31" 等被 remark-directive 解析为 textDirective
15
+ // remark-directive 官方推荐:\:port 可防止 :port 被解析为指令
16
+ var withTimeProtected = withProtocolProtected.replace(/:(\d)/g, function(_, d) {
17
+ return "\\:".concat(d);
18
+ });
19
+ return withTimeProtected.replace(/\uE01B\uE01B/g, '://');
20
+ }
@@ -65,6 +65,7 @@ import { convertParagraphToImage, fixStrongWithSpecialChars } from "../remarkPar
65
65
  import rehypeKatex from "rehype-katex";
66
66
  import remarkFrontmatter from "remark-frontmatter";
67
67
  import { EditorUtils } from "../../utils";
68
+ import { REMARK_REHYPE_DIRECTIVE_HANDLERS } from "../../utils/markdownToHtml";
68
69
  // 表格相关常量
69
70
  export var MIN_TABLE_CELL_LENGTH = 5; // 表格单元格最小长度
70
71
  export var tableRegex = /^\|.*\|\s*\n\|[-:| ]+\|/m;
@@ -72,7 +73,8 @@ export var tableRegex = /^\|.*\|\s*\n\|[-:| ]+\|/m;
72
73
  var stringifyObj = remark().use(remarkParse).use(fixStrongWithSpecialChars).use(convertParagraphToImage).use(remarkMath, {
73
74
  singleDollarTextMath: false
74
75
  }).use(remarkRehype, {
75
- allowDangerousHtml: true
76
+ allowDangerousHtml: true,
77
+ handlers: REMARK_REHYPE_DIRECTIVE_HANDLERS
76
78
  }).use(rehypeRaw).use(rehypeKatex).use(remarkGfm, {
77
79
  singleTilde: false
78
80
  }) // 禁用单波浪线删除线
@@ -81,8 +83,13 @@ var stringifyObj = remark().use(remarkParse).use(fixStrongWithSpecialChars).use(
81
83
  ]);
82
84
  var myRemark = {
83
85
  stringify: function stringify(obj) {
84
- var mdStr = stringifyObj.stringify(obj);
85
- return mdStr;
86
+ try {
87
+ var mdStr = stringifyObj.stringify(obj);
88
+ return mdStr;
89
+ } catch (error) {
90
+ console.error('myRemark.stringify error', obj);
91
+ return '';
92
+ }
86
93
  }
87
94
  };
88
95
  /**
@@ -167,6 +167,17 @@ import { shouldTreatInlineMathAsText } from "./parseMath";
167
167
  }
168
168
  continue;
169
169
  }
170
+ // remark-directive 的 textDirective/leafDirective,提取其 children 的文本内容
171
+ if (n.type === 'textDirective' || n.type === 'leafDirective') {
172
+ var directiveResult = parseText(n.children || [], leaf);
173
+ leafs = leafs.concat(directiveResult);
174
+ if (directiveResult.length === 0 && hasFormattingProps(leaf)) {
175
+ leafs.push(_object_spread_props(_object_spread({}, leaf), {
176
+ text: ''
177
+ }));
178
+ }
179
+ continue;
180
+ }
170
181
  // @ts-ignore
171
182
  leafs.push(_object_spread_props(_object_spread({}, leaf), {
172
183
  text: n.value || ''
@@ -269,6 +280,15 @@ import { shouldTreatInlineMathAsText } from "./parseMath";
269
280
  var inlineCodeResult = handleInlineCode(currentElement);
270
281
  return _object_spread({}, leafWithHtmlTags, inlineCodeResult);
271
282
  }
283
+ // remark-directive 的 textDirective/leafDirective,递归解析其 children
284
+ if (elementType === 'textDirective' || elementType === 'leafDirective') {
285
+ var _ref;
286
+ var children = currentElement.children || [];
287
+ var parsed = parseNodesFn(children, false, currentElement);
288
+ return (_ref = parsed === null || parsed === void 0 ? void 0 : parsed.at(0)) !== null && _ref !== void 0 ? _ref : {
289
+ text: ''
290
+ };
291
+ }
272
292
  // 处理内联元素(strong, link, emphasis, delete)
273
293
  var inlineElementTypes = [
274
294
  'strong',
@@ -103,6 +103,7 @@ import { handleBlockquote, handleContainerDirective, handleFootnoteDefinition, h
103
103
  import { handleCode, handleYaml } from "./parse/parseCode";
104
104
  import { handleDefinition, handleInlineCode, handleThematicBreak } from "./parse/parseElements";
105
105
  import { addEmptyLinesIfNeeded } from "./parse/parseEmptyLines";
106
+ import { preprocessProtectTimeFromDirective } from "./constants";
106
107
  import { handleFootnoteReference } from "./parse/parseFootnote";
107
108
  import { handleHtml, preprocessNonStandardHtmlTags, preprocessThinkTags } from "./parse/parseHtml";
108
109
  import { handleInlineMath, handleMath } from "./parse/parseMath";
@@ -235,7 +236,8 @@ var removeAnswerTags = function removeAnswerTags(text) {
235
236
  {
236
237
  key: "preprocessMarkdown",
237
238
  value: function preprocessMarkdown(md) {
238
- var thinkProcessed = removeAnswerTags(preprocessThinkTags(md || ''));
239
+ var timeProtected = preprocessProtectTimeFromDirective(md || '');
240
+ var thinkProcessed = removeAnswerTags(preprocessThinkTags(timeProtected));
239
241
  var nonStandardProcessed = removeAnswerTags(preprocessNonStandardHtmlTags(thinkProcessed));
240
242
  return preprocessMarkdownTableNewlines(nonStandardProcessed);
241
243
  }
@@ -82,8 +82,8 @@ function _unsupported_iterable_to_array(o, minLen) {
82
82
  /* eslint-disable @typescript-eslint/no-loop-func */ /* eslint-disable no-case-declarations */ /* eslint-disable no-param-reassign */ /* eslint-disable @typescript-eslint/no-use-before-define */ import { Node } from "slate";
83
83
  import stringWidth from "string-width";
84
84
  import { debugInfo } from "../../../Utils/debugUtils";
85
- import { JINJA_DOLLAR_PLACEHOLDER } from "./constants";
86
85
  import { getMediaType } from "../utils/dom";
86
+ import { JINJA_DOLLAR_PLACEHOLDER } from "./constants";
87
87
  var inlineNode = new Set([
88
88
  'break'
89
89
  ]);
@@ -244,7 +244,6 @@ function _ts_generator(thisArg, body) {
244
244
  };
245
245
  }
246
246
  }
247
- import { message } from "antd";
248
247
  import { Editor, Node, Path, Transforms } from "slate";
249
248
  import { isMarkdown } from "../utils";
250
249
  import { getMediaType } from "../utils/dom";
@@ -365,7 +364,7 @@ import { parseMarkdownToNodesAndInsert } from "./parseMarkdownToNodesAndInsert";
365
364
  * 处理粘贴的文件
366
365
  */ export var handleFilesPaste = function handleFilesPaste(editor, clipboardData, editorProps) {
367
366
  return _async_to_generator(function() {
368
- var _editorProps_image, fileList, hideLoading, _editor_selection_focus, _editor_selection, url, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, file, _editorProps_image1, serverUrl, err, selection, node, at, error, error1;
367
+ var _editorProps_image, fileList, _editor_selection_focus, _editor_selection, url, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, file, _editorProps_image1, serverUrl, err, selection, node, at, error, error1;
369
368
  return _ts_generator(this, function(_state) {
370
369
  switch(_state.label){
371
370
  case 0:
@@ -380,7 +379,6 @@ import { parseMarkdownToNodesAndInsert } from "./parseMarkdownToNodesAndInsert";
380
379
  3,
381
380
  16
382
381
  ];
383
- hideLoading = message.loading('上传中...');
384
382
  _state.label = 1;
385
383
  case 1:
386
384
  _state.trys.push([
@@ -494,8 +492,6 @@ import { parseMarkdownToNodesAndInsert } from "./parseMarkdownToNodesAndInsert";
494
492
  ])
495
493
  });
496
494
  });
497
- message.success('上传成功');
498
- hideLoading();
499
495
  return [
500
496
  2,
501
497
  true
@@ -503,7 +499,6 @@ import { parseMarkdownToNodesAndInsert } from "./parseMarkdownToNodesAndInsert";
503
499
  case 15:
504
500
  error = _state.sent();
505
501
  console.log('error', error);
506
- hideLoading();
507
502
  return [
508
503
  2,
509
504
  false
@@ -236,8 +236,7 @@ function _ts_generator(thisArg, body) {
236
236
  };
237
237
  }
238
238
  }
239
- /* eslint-disable @typescript-eslint/no-use-before-define */ /* eslint-disable no-param-reassign */ import { message } from "antd";
240
- import { Editor, Element, Node, Path, Range, Transforms } from "slate";
239
+ /* eslint-disable @typescript-eslint/no-use-before-define */ /* eslint-disable no-param-reassign */ import { Editor, Element, Node, Path, Range, Transforms } from "slate";
241
240
  import { jsx } from "slate-hyperscript";
242
241
  import { debugInfo } from "../../../Utils/debugUtils";
243
242
  import { EditorUtils } from "../utils";
@@ -676,7 +675,7 @@ var blobToFile = function blobToFile(blobUrl, fileName) {
676
675
  * 分段处理文件上传,避免阻塞主线程
677
676
  */ var upLoadFileBatch = function upLoadFileBatch(fragmentList, editorProps) {
678
677
  return _async_to_generator(function() {
679
- var _editorProps_image, mediaFragments, collectMediaFragments, hideLoading, i, batch, progress, error;
678
+ var _editorProps_image, mediaFragments, collectMediaFragments, hideLoading, i, batch, error;
680
679
  return _ts_generator(this, function(_state) {
681
680
  switch(_state.label){
682
681
  case 0:
@@ -722,8 +721,7 @@ var blobToFile = function blobToFile(blobUrl, fileName) {
722
721
  2
723
722
  ];
724
723
  }
725
- // 显示上传进度
726
- hideLoading = message.loading("Uploading ".concat(mediaFragments.length, " files..."), 0);
724
+ hideLoading = function hideLoading() {};
727
725
  _state.label = 1;
728
726
  case 1:
729
727
  _state.trys.push([
@@ -810,10 +808,6 @@ var blobToFile = function blobToFile(blobUrl, fileName) {
810
808
  ];
811
809
  case 3:
812
810
  _state.sent();
813
- // 更新进度
814
- progress = Math.min((i + BATCH_SIZE) / mediaFragments.length * 100, 100);
815
- hideLoading();
816
- message.loading("Uploading ".concat(mediaFragments.length, " files... ").concat(Math.round(progress), "%"), 0);
817
811
  if (!(i + BATCH_SIZE < mediaFragments.length)) return [
818
812
  3,
819
813
  5
@@ -834,7 +828,6 @@ var blobToFile = function blobToFile(blobUrl, fileName) {
834
828
  2
835
829
  ];
836
830
  case 6:
837
- message.success('Upload completed');
838
831
  return [
839
832
  3,
840
833
  9
@@ -842,7 +835,6 @@ var blobToFile = function blobToFile(blobUrl, fileName) {
842
835
  case 7:
843
836
  error = _state.sent();
844
837
  console.error('文件上传失败:', error);
845
- message.error('Some files failed to upload');
846
838
  return [
847
839
  3,
848
840
  9
@@ -1407,7 +1399,6 @@ export var insertParsedHtmlNodes = function insertParsedHtmlNodes(editor, html,
1407
1399
  case 17:
1408
1400
  error = _state.sent();
1409
1401
  console.error('插入HTML节点失败:', error);
1410
- message.error('Content parsing failed, please try again');
1411
1402
  return [
1412
1403
  2,
1413
1404
  false
@@ -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 { useRef, useMemo } from "react";
52
+ import { useMemo, useRef } 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";
@@ -1,5 +1,4 @@
1
- import { Node, Path, Transforms } from "slate";
2
- import { Text } from "slate";
1
+ import { Node, Path, Text, Transforms } from "slate";
3
2
  /**
4
3
  * 连续空格跳出链接的阈值(输入第二个空格时跳出 data-url)
5
4
  */ var SPACES_TO_EXIT_LINK = 2;
@@ -173,7 +173,7 @@ function _ts_generator(thisArg, body) {
173
173
  }
174
174
  }
175
175
  import { CommentOutlined, CopyFilled, HighlightFilled } from "@ant-design/icons";
176
- import { Input, message, Modal } from "antd";
176
+ import { Input, Modal } from "antd";
177
177
  import classNames from "clsx";
178
178
  import copy from "copy-to-clipboard";
179
179
  import React, { useContext, useEffect, useMemo } from "react";
@@ -483,9 +483,7 @@ import { getPointStrOffset, getSelectionFromDomSelection } from "../../utils/edi
483
483
  }
484
484
  }
485
485
  try {
486
- var _i18n_locale;
487
486
  copy(title);
488
- message.success(((_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.copySuccess) || '复制成功');
489
487
  } catch (error) {}
490
488
  }
491
489
  }, /*#__PURE__*/ React.createElement("span", null, /*#__PURE__*/ React.createElement(CopyFilled, null))));
@@ -1,4 +1,4 @@
1
- function _define_property(obj, key, value) {
1
+ /* eslint-disable @typescript-eslint/no-use-before-define */ function _define_property(obj, key, value) {
2
2
  if (key in obj) {
3
3
  Object.defineProperty(obj, key, {
4
4
  value: value,
@@ -26,7 +26,6 @@ function _object_spread(target) {
26
26
  }
27
27
  return target;
28
28
  }
29
- /* eslint-disable @typescript-eslint/no-use-before-define */ import { message } from "antd";
30
29
  import { ELEMENT_TAGS } from "../../plugins/insertParsedHtmlNodes";
31
30
  export var TEXT_TAGS = {
32
31
  CODE: function CODE() {
@@ -183,7 +182,6 @@ export var makeDeserializer = function makeDeserializer(jsx) {
183
182
  try {
184
183
  return deserializeElement(c, imageTags);
185
184
  } catch (error) {
186
- message.error('Error deserializing list item:' + c.innerHTML);
187
185
  console.error(error);
188
186
  }
189
187
  return jsx('element', {
@@ -216,7 +216,6 @@ function _ts_generator(thisArg, body) {
216
216
  };
217
217
  }
218
218
  }
219
- import { message } from "antd";
220
219
  import copy from "copy-to-clipboard";
221
220
  import isHotkey from "is-hotkey";
222
221
  import { useEffect, useMemo } from "react";
@@ -445,7 +444,7 @@ export var KeyboardTask = /*#__PURE__*/ function() {
445
444
  };
446
445
  input.onchange = function(e) {
447
446
  return _async_to_generator(function() {
448
- var hideLoading, _this_props_image, _this_props, url, error;
447
+ var _this_props_image, _this_props, url, error;
449
448
  return _ts_generator(this, function(_state) {
450
449
  switch(_state.label){
451
450
  case 0:
@@ -455,7 +454,6 @@ export var KeyboardTask = /*#__PURE__*/ function() {
455
454
  ];
456
455
  }
457
456
  input.dataset.readonly = 'true';
458
- hideLoading = message.loading('上传中...');
459
457
  _state.label = 1;
460
458
  case 1:
461
459
  _state.trys.push([
@@ -465,7 +463,6 @@ export var KeyboardTask = /*#__PURE__*/ function() {
465
463
  5
466
464
  ]);
467
465
  if (!((_this_props = this.props) === null || _this_props === void 0 ? void 0 : (_this_props_image = _this_props.image) === null || _this_props_image === void 0 ? void 0 : _this_props_image.upload)) {
468
- message.error('图片上传功能未配置');
469
466
  return [
470
467
  2
471
468
  ];
@@ -483,7 +480,6 @@ export var KeyboardTask = /*#__PURE__*/ function() {
483
480
  insertMedia(u);
484
481
  }
485
482
  });
486
- message.success('上传成功');
487
483
  return [
488
484
  3,
489
485
  5
@@ -491,13 +487,11 @@ export var KeyboardTask = /*#__PURE__*/ function() {
491
487
  case 3:
492
488
  error = _state.sent();
493
489
  console.error('图片上传失败:', error);
494
- message.error('图片上传失败');
495
490
  return [
496
491
  3,
497
492
  5
498
493
  ];
499
494
  case 4:
500
- hideLoading();
501
495
  input.value = '';
502
496
  return [
503
497
  7
@@ -19,6 +19,24 @@ export interface MarkdownToHtmlConfig {
19
19
  * @returns 转义后的字符串
20
20
  */
21
21
  export declare function escapeHtml(html: string, encode?: boolean): string;
22
+ /**
23
+ * mdast-util-to-hast 自定义 handler:将 remark-directive 的 textDirective 转为 span 元素
24
+ * 避免 "Cannot handle unknown node textDirective" 错误
25
+ */
26
+ declare function textDirectiveHandler(state: any, node: any): any;
27
+ /**
28
+ * mdast-util-to-hast 自定义 handler:将 remark-directive 的 leafDirective 转为 span 元素
29
+ * 避免 "Cannot handle unknown node leafDirective" 错误
30
+ */
31
+ declare function leafDirectiveHandler(state: any, node: any): any;
32
+ /**
33
+ * remark-rehype 的 directive 节点 handlers,用于避免 "Cannot handle unknown node textDirective" 等错误
34
+ * 可复用于 parseTable 等其他使用 remark-rehype 的场景
35
+ */
36
+ export declare const REMARK_REHYPE_DIRECTIVE_HANDLERS: {
37
+ textDirective: typeof textDirectiveHandler;
38
+ leafDirective: typeof leafDirectiveHandler;
39
+ };
22
40
  export declare const DEFAULT_MARKDOWN_REMARK_PLUGINS: readonly MarkdownRemarkPlugin[];
23
41
  /**
24
42
  * 将 Markdown 内容转换为 HTML(异步版本)
@@ -85,3 +103,4 @@ export declare const markdownToHtml: (markdown: string, plugins?: MarkdownToHtml
85
103
  * - 同步版本可能影响用户界面响应性
86
104
  */
87
105
  export declare const markdownToHtmlSync: (markdown: string, plugins?: MarkdownToHtmlOptions, config?: MarkdownToHtmlConfig) => string;
106
+ export {};
@@ -218,6 +218,50 @@ var FRONTMATTER_LANGUAGES = [
218
218
  'yaml'
219
219
  ];
220
220
  var remarkRehypePlugin = remarkRehype;
221
+ /**
222
+ * mdast-util-to-hast 自定义 handler:将 remark-directive 的 textDirective 转为 span 元素
223
+ * 避免 "Cannot handle unknown node textDirective" 错误
224
+ */ function textDirectiveHandler(state, node) {
225
+ var result = {
226
+ type: 'element',
227
+ tagName: 'span',
228
+ properties: {
229
+ className: [
230
+ 'directive',
231
+ "directive-".concat(String(node.name || 'unknown'))
232
+ ]
233
+ },
234
+ children: state.all(node)
235
+ };
236
+ state.patch(node, result);
237
+ return state.applyData(node, result);
238
+ }
239
+ /**
240
+ * mdast-util-to-hast 自定义 handler:将 remark-directive 的 leafDirective 转为 span 元素
241
+ * 避免 "Cannot handle unknown node leafDirective" 错误
242
+ */ function leafDirectiveHandler(state, node) {
243
+ var result = {
244
+ type: 'element',
245
+ tagName: 'span',
246
+ properties: {
247
+ className: [
248
+ 'directive',
249
+ 'leaf',
250
+ "directive-".concat(String(node.name || 'unknown'))
251
+ ]
252
+ },
253
+ children: state.all(node)
254
+ };
255
+ state.patch(node, result);
256
+ return state.applyData(node, result);
257
+ }
258
+ /**
259
+ * remark-rehype 的 directive 节点 handlers,用于避免 "Cannot handle unknown node textDirective" 等错误
260
+ * 可复用于 parseTable 等其他使用 remark-rehype 的场景
261
+ */ export var REMARK_REHYPE_DIRECTIVE_HANDLERS = {
262
+ textDirective: textDirectiveHandler,
263
+ leafDirective: leafDirectiveHandler
264
+ };
221
265
  /**
222
266
  * 配置链接渲染器,在新标签页打开链接
223
267
  */ function rehypeLinkTarget() {
@@ -337,7 +381,8 @@ export var DEFAULT_MARKDOWN_REMARK_PLUGINS = [
337
381
  [
338
382
  remarkRehypePlugin,
339
383
  {
340
- allowDangerousHtml: true
384
+ allowDangerousHtml: true,
385
+ handlers: REMARK_REHYPE_DIRECTIVE_HANDLERS
341
386
  }
342
387
  ]
343
388
  ];
@@ -147,16 +147,14 @@ function _ts_generator(thisArg, body) {
147
147
  }
148
148
  }
149
149
  import { Paperclip } from "@sofa-design/icons";
150
- import { ConfigProvider, message } from "antd";
150
+ import { ConfigProvider } from "antd";
151
151
  import classNames from "clsx";
152
152
  import React, { useContext } from "react";
153
- import { compileTemplate } from "../../I18n";
154
153
  import AttachmentButtonPopover, { SupportedFileFormats } from "./AttachmentButtonPopover";
155
154
  import { useStyle } from "./style";
156
155
  import { isImageFile } from "./utils";
157
156
  export * from "./AttachmentButtonPopover";
158
157
  var WAIT_TIME_MS = 16;
159
- var KB_SIZE = 1024;
160
158
  var DEFAULT_MESSAGES = {
161
159
  uploading: 'Uploading...',
162
160
  uploadSuccess: 'Upload success',
@@ -192,29 +190,15 @@ var getLocaleMessage = function getLocaleMessage(locale, key, defaultMsg) {
192
190
  var validateFileCount = function validateFileCount(newFileCount, existingFileCount, props) {
193
191
  var totalFileCount = newFileCount + existingFileCount;
194
192
  if (props.maxFileCount && totalFileCount > props.maxFileCount) {
195
- var _props_locale;
196
- var msg = ((_props_locale = props.locale) === null || _props_locale === void 0 ? void 0 : _props_locale['markdownInput.maxFileCountExceeded']) ? compileTemplate(props.locale['markdownInput.maxFileCountExceeded'], {
197
- maxFileCount: String(props.maxFileCount)
198
- }) : DEFAULT_MESSAGES.maxFileCountExceeded(props.maxFileCount);
199
- message.error(msg);
200
193
  return false;
201
194
  }
202
195
  if (props.minFileCount && totalFileCount < props.minFileCount) {
203
- var _props_locale1;
204
- var msg1 = ((_props_locale1 = props.locale) === null || _props_locale1 === void 0 ? void 0 : _props_locale1['markdownInput.minFileCountRequired']) ? compileTemplate(props.locale['markdownInput.minFileCountRequired'], {
205
- minFileCount: String(props.minFileCount)
206
- }) : DEFAULT_MESSAGES.minFileCountRequired(props.minFileCount);
207
- message.error(msg1);
208
196
  return false;
209
197
  }
210
198
  return true;
211
199
  };
212
200
  var validateFileSize = function validateFileSize(file, props) {
213
- var _props_locale_markdownInputfileSizeExceeded, _props_locale;
214
201
  if (!props.maxFileSize || file.size <= props.maxFileSize) return true;
215
- var maxSizeKB = props.maxFileSize / KB_SIZE;
216
- var msg = ((_props_locale = props.locale) === null || _props_locale === void 0 ? void 0 : (_props_locale_markdownInputfileSizeExceeded = _props_locale['markdownInput.fileSizeExceeded']) === null || _props_locale_markdownInputfileSizeExceeded === void 0 ? void 0 : _props_locale_markdownInputfileSizeExceeded.replace('${maxSize}', "".concat(maxSizeKB))) || DEFAULT_MESSAGES.fileSizeExceeded(maxSizeKB);
217
- message.error(msg);
218
202
  return false;
219
203
  };
220
204
  var updateFileMap = function updateFileMap(map, file, onFileMapChange) {
@@ -284,13 +268,10 @@ var handleUploadSuccess = function handleUploadSuccess(file, url, map, props) {
284
268
  file.status = 'done';
285
269
  file.url = url;
286
270
  updateFileMap(map, file, props.onFileMapChange);
287
- message.success(getLocaleMessage(props.locale, 'uploadSuccess', DEFAULT_MESSAGES.uploadSuccess));
288
271
  };
289
272
  var handleUploadError = function handleUploadError(file, errorMsg, map, props) {
290
273
  file.status = 'error';
291
274
  updateFileMap(map, file, props.onFileMapChange);
292
- var msg = errorMsg || getLocaleMessage(props.locale, 'uploadFailed', DEFAULT_MESSAGES.uploadFailed);
293
- message.error(msg);
294
275
  };
295
276
  var processFile = function processFile(file, index, map, props) {
296
277
  return _async_to_generator(function() {
@@ -371,7 +352,7 @@ var processFile = function processFile(file, index, map, props) {
371
352
  case 0:
372
353
  map = props.fileMap || new Map();
373
354
  existingFileCount = map.size;
374
- hideLoading = message.loading(getLocaleMessage(props.locale, 'uploading', DEFAULT_MESSAGES.uploading));
355
+ hideLoading = function hideLoading() {};
375
356
  fileList = Array.from(files);
376
357
  fileList.forEach(prepareFile);
377
358
  // 在添加到 fileMap 之前先验证文件数量
@@ -424,7 +405,6 @@ var processFile = function processFile(file, index, map, props) {
424
405
  file.status = 'error';
425
406
  updateFileMap(map, file, props.onFileMapChange);
426
407
  });
427
- message.error(getLocaleMessage(props.locale, 'uploadFailed', DEFAULT_MESSAGES.uploadFailed));
428
408
  return [
429
409
  3,
430
410
  8
@@ -40,13 +40,6 @@ function _define_property(obj, key, value) {
40
40
  }
41
41
  return obj;
42
42
  }
43
- function _instanceof(left, right) {
44
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
45
- return !!right[Symbol.hasInstance](left);
46
- } else {
47
- return left instanceof right;
48
- }
49
- }
50
43
  function _object_spread(target) {
51
44
  for(var i = 1; i < arguments.length; i++){
52
45
  var source = arguments[i] != null ? arguments[i] : {};
@@ -185,7 +178,6 @@ function _ts_generator(thisArg, body) {
185
178
  };
186
179
  }
187
180
  }
188
- import { message } from "antd";
189
181
  import { useContext } from "react";
190
182
  import { useRefFunction } from "../../Hooks/useRefFunction";
191
183
  import { I18nContext } from "../../I18n";
@@ -246,7 +238,7 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
246
238
  * 上传图片
247
239
  */ var uploadImage = useRefFunction(function(forGallery) {
248
240
  return _async_to_generator(function() {
249
- var _ref, isUploading, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, file, currentFileCount, errorMsg, accept, input;
241
+ var _ref, isUploading, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, file, currentFileCount, accept, input;
250
242
  return _ts_generator(this, function(_state) {
251
243
  // 检查是否有文件正在上传中
252
244
  isUploading = false;
@@ -281,8 +273,6 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
281
273
  // 检查是否已达到最大文件数量限制
282
274
  currentFileCount = (fileMap === null || fileMap === void 0 ? void 0 : fileMap.size) || 0;
283
275
  if ((attachment === null || attachment === void 0 ? void 0 : attachment.maxFileCount) && currentFileCount >= attachment.maxFileCount) {
284
- errorMsg = (locale === null || locale === void 0 ? void 0 : locale['markdownInput.maxFileCountExceeded']) ? locale['markdownInput.maxFileCountExceeded'].replace('${maxFileCount}', String(attachment.maxFileCount)) : "最多只能上传 ".concat(attachment.maxFileCount, " 个文件");
285
- message.error(errorMsg);
286
276
  return [
287
277
  2
288
278
  ];
@@ -296,7 +286,7 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
296
286
  input.style.display = 'none';
297
287
  input.onchange = function(e) {
298
288
  return _async_to_generator(function() {
299
- var selectedFiles, currentFileCount, errorMsg, totalFileCount, errorMsg1, error;
289
+ var selectedFiles, currentFileCount, totalFileCount, error;
300
290
  return _ts_generator(this, function(_state) {
301
291
  switch(_state.label){
302
292
  case 0:
@@ -325,8 +315,6 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
325
315
  if (attachment === null || attachment === void 0 ? void 0 : attachment.maxFileCount) {
326
316
  // 如果一次选择的文件数量超过最大限制,完全拒绝
327
317
  if (selectedFiles.length > attachment.maxFileCount) {
328
- errorMsg = (locale === null || locale === void 0 ? void 0 : locale['markdownInput.maxFileCountExceeded']) ? locale['markdownInput.maxFileCountExceeded'].replace('${maxFileCount}', String(attachment.maxFileCount)) : "最多只能上传 ".concat(attachment.maxFileCount, " 个文件");
329
- message.error(errorMsg);
330
318
  return [
331
319
  2
332
320
  ];
@@ -334,8 +322,6 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
334
322
  // 如果选择的文件数量加上已有文件数量超过限制,完全拒绝
335
323
  totalFileCount = selectedFiles.length + currentFileCount;
336
324
  if (totalFileCount > attachment.maxFileCount) {
337
- errorMsg1 = (locale === null || locale === void 0 ? void 0 : locale['markdownInput.maxFileCountExceeded']) ? locale['markdownInput.maxFileCountExceeded'].replace('${maxFileCount}', String(attachment.maxFileCount)) : "最多只能上传 ".concat(attachment.maxFileCount, " 个文件");
338
- message.error(errorMsg1);
339
325
  return [
340
326
  2
341
327
  ];
@@ -438,7 +424,7 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
438
424
  * 处理文件重试
439
425
  */ var handleFileRetry = useRefFunction(function(file) {
440
426
  return _async_to_generator(function() {
441
- var map, url, isSuccess, errorMsg, uploadResult, failedMsg, error, map1, errorMessage;
427
+ var map, url, isSuccess, uploadResult, unused, map1;
442
428
  return _ts_generator(this, function(_state) {
443
429
  switch(_state.label){
444
430
  case 0:
@@ -453,7 +439,6 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
453
439
  map.set(file.uuid || '', file);
454
440
  updateAttachmentFiles(map);
455
441
  isSuccess = false;
456
- errorMsg = null;
457
442
  if (!(attachment === null || attachment === void 0 ? void 0 : attachment.uploadWithResponse)) return [
458
443
  3,
459
444
  2
@@ -466,7 +451,6 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
466
451
  uploadResult = _state.sent();
467
452
  url = uploadResult.fileUrl;
468
453
  isSuccess = uploadResult.uploadStatus === 'SUCCESS';
469
- errorMsg = uploadResult.errorMessage || null;
470
454
  // 将完整的响应数据存储到 file 对象中
471
455
  file.uploadResponse = uploadResult;
472
456
  return [
@@ -492,27 +476,21 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
492
476
  file.url = url;
493
477
  map.set(file.uuid || '', file);
494
478
  updateAttachmentFiles(map);
495
- message.success((locale === null || locale === void 0 ? void 0 : locale.uploadSuccess) || 'Upload success');
496
479
  } else {
497
480
  file.status = 'error';
498
481
  map.set(file.uuid || '', file);
499
482
  updateAttachmentFiles(map);
500
- failedMsg = errorMsg || (locale === null || locale === void 0 ? void 0 : locale.uploadFailed) || 'Upload failed';
501
- message.error(failedMsg);
502
483
  }
503
484
  return [
504
485
  3,
505
486
  6
506
487
  ];
507
488
  case 5:
508
- error = _state.sent();
509
- console.error('Error retrying file upload:', error);
489
+ unused = _state.sent();
510
490
  file.status = 'error';
511
491
  map1 = new Map(fileMap);
512
492
  map1.set(file.uuid || '', file);
513
493
  updateAttachmentFiles(map1);
514
- errorMessage = _instanceof(error, Error) ? error.message : (locale === null || locale === void 0 ? void 0 : locale.uploadFailed) || 'Upload failed';
515
- message.error(errorMessage);
516
494
  return [
517
495
  3,
518
496
  6
@@ -2,9 +2,9 @@ import { LoadingOutlined } from "@ant-design/icons";
2
2
  import { TextOptimize } from "@sofa-design/icons";
3
3
  import { ConfigProvider, Tooltip } from "antd";
4
4
  import React, { useContext } from "react";
5
- import { useLocale } from "../../I18n";
6
5
  import { ErrorBoundary } from "react-error-boundary";
7
6
  import { ActionIconBox } from "../../Components/ActionIconBox";
7
+ import { useLocale } from "../../I18n";
8
8
  import { isBrowserEnv } from "./env";
9
9
  import { useStyle } from "./style";
10
10
  export var RefinePromptButton = function RefinePromptButton(props) {
@@ -149,11 +149,11 @@ import { ArcElement, Chart as ChartJS, Legend, Tooltip } from "chart.js";
149
149
  import ChartDataLabels from "chartjs-plugin-datalabels";
150
150
  import classNames from "clsx";
151
151
  import React, { useContext, useMemo, useRef, useState } from "react";
152
- import { useLocale } from "../../../I18n";
153
152
  import { Doughnut } from "react-chartjs-2";
153
+ import { useLocale } from "../../../I18n";
154
154
  import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
155
- import { isWindowDefined } from "../env";
156
155
  import { defaultColorList } from "../const";
156
+ import { isWindowDefined } from "../env";
157
157
  import { resolveCssVariable } from "../utils";
158
158
  import { SINGLE_MODE_DESKTOP_CUTOUT, SINGLE_MODE_MOBILE_CUTOUT } from "./constants";
159
159
  import { useAutoCategory, useFilterLabels, useMobile, useResponsiveDimensions } from "./hooks";
@@ -4,7 +4,7 @@
4
4
  * @author Code Plugin Team
5
5
  */ import { CloseCircleOutlined } from "@ant-design/icons";
6
6
  import { ChevronsUpDown, Copy, Moon } from "@sofa-design/icons";
7
- import { message, Segmented } from "antd";
7
+ import { Segmented } from "antd";
8
8
  import copy from "copy-to-clipboard";
9
9
  import React, { useContext, useMemo } from "react";
10
10
  import { ActionIconBox } from "../../../Components/ActionIconBox";
@@ -203,11 +203,8 @@ import { LoadImage } from "./LoadImage";
203
203
  onClick: function onClick(e) {
204
204
  e.stopPropagation();
205
205
  try {
206
- var _i18n_locale;
207
206
  var code = element.value || '';
208
207
  copy(code);
209
- // 显示成功提示
210
- message.success(((_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.copySuccess) || '复制成功');
211
208
  } catch (error) {
212
209
  // 复制失败时静默处理
213
210
  console.error('复制失败:', error);
@@ -97,7 +97,6 @@ function _unsupported_iterable_to_array(o, minLen) {
97
97
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
98
98
  }
99
99
  import { CloseCircleOutlined } from "@ant-design/icons";
100
- import { message } from "antd";
101
100
  import copy from "copy-to-clipboard";
102
101
  import React, { useContext, useEffect, useRef } from "react";
103
102
  import { useGetSetState } from "react-use";
@@ -247,10 +246,8 @@ import { Mermaid } from "./Mermaid";
247
246
  onClick: function onClick(e) {
248
247
  e.stopPropagation();
249
248
  try {
250
- var _i18n_locale;
251
249
  var code = props.element.value || '';
252
250
  copy(code);
253
- message.success(((_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.copySuccess) || '复制成功');
254
251
  } catch (error) {}
255
252
  }
256
253
  }, /*#__PURE__*/ React.createElement(Copy, null)))), /*#__PURE__*/ React.createElement("div", {
@@ -104,7 +104,7 @@ function _unsupported_iterable_to_array(o, minLen) {
104
104
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
105
105
  }
106
106
  import { CircleDashed, Copy, Play } from "@sofa-design/icons";
107
- import { Button, ConfigProvider, message } from "antd";
107
+ import { Button, ConfigProvider } from "antd";
108
108
  import classNames from "clsx";
109
109
  import copy from "copy-to-clipboard";
110
110
  import React, { forwardRef, memo, useCallback, useContext, useImperativeHandle, useMemo, useState } from "react";
@@ -241,20 +241,13 @@ import { useStyle } from "./style";
241
241
  setIsSchemaRendered(true);
242
242
  }, []);
243
243
  // 复制函数
244
- var handleCopyContent = useCallback(function(content, type) {
244
+ var handleCopyContent = useCallback(function(content) {
245
245
  if (!content || !content.trim()) {
246
- message.warning(locale['schemaEditor.noContentToCopy']);
247
246
  return;
248
247
  }
249
248
  try {
250
- var ok = copy(content);
251
- if (ok) {
252
- message.success("".concat(type === 'html' ? 'HTML' : 'JSON').concat(locale['schemaEditor.copySuccess']));
253
- } else {
254
- message.error(locale['schemaEditor.copyFailed']);
255
- }
249
+ copy(content);
256
250
  } catch (error) {
257
- message.error(locale['schemaEditor.copyFailed']);
258
251
  console.error(locale['schemaEditor.copyFailed'], error);
259
252
  }
260
253
  }, [
@@ -262,14 +255,14 @@ import { useStyle } from "./style";
262
255
  ]);
263
256
  // 处理复制HTML内容
264
257
  var handleCopyHtml = useCallback(function() {
265
- handleCopyContent(htmlContent, 'html');
258
+ handleCopyContent(htmlContent);
266
259
  }, [
267
260
  htmlContent,
268
261
  handleCopyContent
269
262
  ]);
270
263
  // 处理复制JSON内容
271
264
  var handleCopyJson = useCallback(function() {
272
- handleCopyContent(schemaString, 'json');
265
+ handleCopyContent(schemaString);
273
266
  }, [
274
267
  schemaString,
275
268
  handleCopyContent
@@ -89,9 +89,9 @@ import { ConfigProvider } from "antd";
89
89
  import classNames from "clsx";
90
90
  import { AnimatePresence, motion } from "framer-motion";
91
91
  import { useMergedState } from "rc-util";
92
- import React, { memo, useContext, useCallback, useEffect, useMemo, useRef, useState } from "react";
93
- import { useLocale } from "../I18n";
92
+ import React, { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
94
93
  import { useRefFunction } from "../Hooks/useRefFunction";
94
+ import { useLocale } from "../I18n";
95
95
  import { useStyle } from "./style";
96
96
  var getChevronStyle = function getChevronStyle(expanded) {
97
97
  return {
@@ -235,8 +235,8 @@ function _ts_generator(thisArg, body) {
235
235
  };
236
236
  }
237
237
  }
238
- import { ConfigProvider, Image, Input, Spin, Typography, message } from "antd";
239
- import { Check, ChevronDown as DownIcon, Download as DownloadIcon, Eye as EyeIcon, Locate, ChevronRight as RightIcon, Search, SquareArrowOutUpRight as ShareIcon } from "@sofa-design/icons";
238
+ import { ConfigProvider, Image, Input, Spin, Typography } from "antd";
239
+ import { ChevronDown as DownIcon, Download as DownloadIcon, Eye as EyeIcon, Locate, ChevronRight as RightIcon, Search, SquareArrowOutUpRight as ShareIcon } from "@sofa-design/icons";
240
240
  import { Empty } from "antd";
241
241
  import classNames from "clsx";
242
242
  import { AnimatePresence, motion } from "framer-motion";
@@ -293,7 +293,7 @@ var handleFileDownload = function handleFileDownload(file) {
293
293
  }
294
294
  };
295
295
  // 通用的默认分享处理函数
296
- var handleDefaultShare = function handleDefaultShare(file, locale) {
296
+ var handleDefaultShare = function handleDefaultShare(file) {
297
297
  return _async_to_generator(function() {
298
298
  var shareUrl, error;
299
299
  return _ts_generator(this, function(_state) {
@@ -312,29 +312,12 @@ var handleDefaultShare = function handleDefaultShare(file, locale) {
312
312
  ];
313
313
  case 1:
314
314
  _state.sent();
315
- message.success({
316
- icon: /*#__PURE__*/ React.createElement(Check, {
317
- style: {
318
- fontSize: 16,
319
- marginRight: 8,
320
- color: 'var(--color-green-control-fill-primary)'
321
- }
322
- }),
323
- content: /*#__PURE__*/ React.createElement("span", {
324
- style: {
325
- font: 'var(--font-text-body-emphasized-base)',
326
- color: 'var(--color-gray-text-default)'
327
- }
328
- }, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.linkCopied']) || '已复制链接')
329
- });
330
315
  return [
331
316
  3,
332
317
  3
333
318
  ];
334
319
  case 2:
335
320
  error = _state.sent();
336
- // 如果复制失败,显示错误提示
337
- message.error((locale === null || locale === void 0 ? void 0 : locale['workspace.file.copyFailed']) || '复制失败');
338
321
  return [
339
322
  3,
340
323
  3
@@ -444,7 +427,7 @@ var FileItemComponent = function FileItemComponent(param) {
444
427
  return;
445
428
  }
446
429
  // 使用默认分享行为
447
- handleDefaultShare(fileWithId, locale);
430
+ handleDefaultShare(fileWithId);
448
431
  };
449
432
  // 判断是否显示预览按钮:
450
433
  // 1. 如果用户设置了 canPreview,优先使用用户的设置
@@ -897,7 +880,7 @@ export var FileComponent = function FileComponent(param) {
897
880
  // 为保持回调参数签名一致,显式传入第二个参数为 undefined
898
881
  onShare(file, undefined);
899
882
  } else {
900
- handleDefaultShare(file, locale);
883
+ handleDefaultShare(file);
901
884
  }
902
885
  }
903
886
  }) : previewData;
@@ -1033,7 +1016,7 @@ export var FileComponent = function FileComponent(param) {
1033
1016
  origin: 'preview'
1034
1017
  });
1035
1018
  } else {
1036
- handleDefaultShare(file, locale);
1019
+ handleDefaultShare(file);
1037
1020
  }
1038
1021
  },
1039
1022
  onLocate: onLocate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.29.56",
3
+ "version": "2.29.58",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",
@@ -24,7 +24,6 @@
24
24
  "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
25
25
  "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
26
26
  "prepare": "husky install && dumi setup",
27
- "prepublishOnly": "npm run build && npm run test",
28
27
  "prettier": "prettier --write \"{src,docs,test}/**/*.{js,jsx,ts,tsx,css,less,json,md}\"",
29
28
  "preview": "pnpm dumi preview",
30
29
  "report:demo": "node scripts/generateDemoReport.js",