@ant-design/agentic-ui 2.0.6 → 2.0.10

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 (27) hide show
  1. package/dist/Bubble/style.js +4 -2
  2. package/dist/MarkdownEditor/editor/Editor.js +3 -2
  3. package/dist/MarkdownEditor/editor/components/LazyElement/index.d.ts +32 -0
  4. package/dist/MarkdownEditor/editor/components/LazyElement/index.js +15 -4
  5. package/dist/MarkdownEditor/types.d.ts +34 -0
  6. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.d.ts +0 -33
  7. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.js +15 -16
  8. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.d.ts +4 -45
  9. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +107 -146
  10. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +100 -67
  11. package/dist/MarkdownInputField/AttachmentButton/index.d.ts +25 -1
  12. package/dist/MarkdownInputField/AttachmentButton/index.js +28 -11
  13. package/dist/MarkdownInputField/AttachmentButton/types.d.ts +15 -0
  14. package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +265 -199
  15. package/dist/MarkdownInputField/FileMapView/style.js +1 -0
  16. package/dist/MarkdownInputField/FileUploadManager/index.js +19 -6
  17. package/dist/MarkdownInputField/MarkdownInputField.js +4 -0
  18. package/dist/plugins/chart/AreaChart/index.d.ts +95 -0
  19. package/dist/plugins/chart/AreaChart/index.js +10 -0
  20. package/dist/plugins/chart/BarChart/index.d.ts +47 -0
  21. package/dist/plugins/chart/DonutChart/index.d.ts +28 -0
  22. package/dist/plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +58 -0
  23. package/dist/plugins/chart/const.d.ts +25 -0
  24. package/dist/plugins/chart/const.js +10 -0
  25. package/dist/plugins/chart/index.d.ts +14 -0
  26. package/dist/plugins/chart/utils.d.ts +197 -32
  27. package/package.json +1 -1
@@ -19,8 +19,85 @@ var __spreadValues = (a, b) => {
19
19
  import { GripVertical, Menu } from "@sofa-design/icons";
20
20
  import { ConfigProvider, Popover } from "antd";
21
21
  import classNames from "classnames";
22
- import React, { useContext, useEffect, useRef, useState } from "react";
22
+ import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
23
23
  import { useStyle } from "../../components/ActionItemBox";
24
+ import { useRefFunction } from "../../hooks/useRefFunction";
25
+ var INTERACTIVE_SELECTOR = 'button, a, input, textarea, select, [role="button"], [contenteditable="true"], [data-no-pan]';
26
+ var PAN_THRESHOLD = 6;
27
+ var SCROLL_STYLE = {
28
+ display: "flex",
29
+ alignItems: "center",
30
+ width: "100%",
31
+ gap: 8,
32
+ overflowX: "auto",
33
+ overflowY: "hidden",
34
+ WebkitOverflowScrolling: "touch",
35
+ overscrollBehavior: "contain",
36
+ touchAction: "pan-x"
37
+ };
38
+ var POPOVER_OVERLAY_STYLE = { padding: 0 };
39
+ var DraggablePopupItem = React.memo((props) => {
40
+ const {
41
+ entry,
42
+ index,
43
+ basePrefixCls,
44
+ hashId,
45
+ draggingIndex,
46
+ overIndex,
47
+ isHandlePressRef,
48
+ onDragStart,
49
+ onDragOver,
50
+ onDrop,
51
+ onDragEnd,
52
+ isHandleTarget,
53
+ setDraggingIndex
54
+ } = props;
55
+ const handleMouseDown = useRefFunction((evt) => {
56
+ const isHandle = isHandleTarget(evt.target);
57
+ isHandlePressRef.current = isHandle;
58
+ setDraggingIndex(isHandle ? index : null);
59
+ });
60
+ const handleMouseUp = useRefFunction(() => {
61
+ if (draggingIndex === null) {
62
+ isHandlePressRef.current = false;
63
+ }
64
+ });
65
+ const handleGripMouseDown = useRefFunction((evt) => {
66
+ isHandlePressRef.current = true;
67
+ setDraggingIndex(index);
68
+ evt.stopPropagation();
69
+ });
70
+ return /* @__PURE__ */ React.createElement(
71
+ "div",
72
+ {
73
+ key: entry.key,
74
+ className: classNames(
75
+ `${basePrefixCls}-overflow-container-popup-item`,
76
+ hashId,
77
+ {
78
+ [`${basePrefixCls}-dragging`]: draggingIndex === index,
79
+ [`${basePrefixCls}-drag-over`]: overIndex === index
80
+ }
81
+ ),
82
+ draggable: true,
83
+ onMouseDown: handleMouseDown,
84
+ onMouseUp: handleMouseUp,
85
+ onDragStart: (evt) => onDragStart(evt, index),
86
+ onDragOver: (evt) => onDragOver(evt, index),
87
+ onDrop: (evt) => onDrop(evt, index),
88
+ onDragEnd
89
+ },
90
+ /* @__PURE__ */ React.createElement(
91
+ GripVertical,
92
+ {
93
+ className: classNames(`${basePrefixCls}-drag-handle`, hashId),
94
+ onMouseDown: handleGripMouseDown
95
+ }
96
+ ),
97
+ /* @__PURE__ */ React.createElement("div", { draggable: false }, entry.node)
98
+ );
99
+ });
100
+ DraggablePopupItem.displayName = "DraggablePopupItem";
24
101
  var ActionItemContainer = (props) => {
25
102
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
26
103
  const basePrefixCls = getPrefixCls("agent-chat-action-item-box");
@@ -37,23 +114,24 @@ var ActionItemContainer = (props) => {
37
114
  const panStartScrollLeftRef = useRef(0);
38
115
  const hasPanMovedRef = useRef(false);
39
116
  const panIntentRef = useRef(false);
40
- const isInteractiveTarget = (target) => {
117
+ const isInteractiveTarget = useRefFunction((target) => {
41
118
  if (!(target instanceof HTMLElement))
42
119
  return false;
43
- if (target.closest(
44
- 'button, a, input, textarea, select, [role="button"], [contenteditable="true"], [data-no-pan]'
45
- )) {
46
- return true;
47
- }
48
- return false;
49
- };
50
- const toEntries = (nodes) => {
120
+ return !!target.closest(INTERACTIVE_SELECTOR);
121
+ });
122
+ const isHandleTarget = useRefFunction((target) => {
123
+ if (!(target instanceof HTMLElement))
124
+ return false;
125
+ const handle = target.closest(`.${basePrefixCls}-drag-handle`);
126
+ return !!handle;
127
+ });
128
+ const toEntries = useRefFunction((nodes) => {
51
129
  const array = React.Children.toArray(nodes);
52
130
  return array.map((node) => {
53
131
  var _a;
54
132
  return { key: (_a = node == null ? void 0 : node.key) != null ? _a : null, node };
55
133
  });
56
- };
134
+ });
57
135
  const [ordered, setOrdered] = useState(
58
136
  () => toEntries(props.children)
59
137
  );
@@ -91,154 +169,175 @@ var ActionItemContainer = (props) => {
91
169
  }
92
170
  setOrdered(merged.length === incoming.length ? merged : incoming);
93
171
  }, [props.children]);
94
- const handleDragStart = (e, index) => {
95
- e.stopPropagation();
96
- e.dataTransfer.effectAllowed = "move";
97
- try {
98
- e.dataTransfer.setData("text/plain", String(index));
99
- } catch (e2) {
100
- console.error(e);
172
+ const reorder = useRefFunction(
173
+ (list, from, to) => {
174
+ const next = list.slice();
175
+ const [moved] = next.splice(from, 1);
176
+ next.splice(to, 0, moved);
177
+ return next;
101
178
  }
102
- setDraggingIndex(index);
103
- };
104
- const handleDragOver = (e, index) => {
105
- e.preventDefault();
106
- e.dataTransfer.dropEffect = "move";
107
- if (overIndex !== index)
108
- setOverIndex(index);
109
- };
110
- const reorder = (list, from, to) => {
111
- const next = list.slice();
112
- const [moved] = next.splice(from, 1);
113
- next.splice(to, 0, moved);
114
- return next;
115
- };
116
- const handleDrop = (e, index) => {
117
- e.preventDefault();
118
- e.stopPropagation();
119
- const from = draggingIndex;
120
- if (from === null)
121
- return;
122
- const to = index;
123
- if (from === to)
124
- return;
125
- setOrdered((prev) => reorder(prev, from, to));
126
- setDraggingIndex(null);
127
- setOverIndex(null);
128
- isHandlePressRef.current = false;
129
- };
130
- const handleDragEnd = () => {
179
+ );
180
+ const handleDragStart = useRefFunction(
181
+ (e, index) => {
182
+ e.stopPropagation();
183
+ e.dataTransfer.effectAllowed = "move";
184
+ try {
185
+ e.dataTransfer.setData("text/plain", String(index));
186
+ } catch (e2) {
187
+ console.error(e);
188
+ }
189
+ setDraggingIndex(index);
190
+ }
191
+ );
192
+ const handleDragOver = useRefFunction(
193
+ (e, index) => {
194
+ e.preventDefault();
195
+ e.dataTransfer.dropEffect = "move";
196
+ if (overIndex !== index)
197
+ setOverIndex(index);
198
+ }
199
+ );
200
+ const handleDrop = useRefFunction(
201
+ (e, index) => {
202
+ e.preventDefault();
203
+ e.stopPropagation();
204
+ if (draggingIndex === null)
205
+ return;
206
+ if (draggingIndex === index)
207
+ return;
208
+ setOrdered((prev) => reorder(prev, draggingIndex, index));
209
+ setDraggingIndex(null);
210
+ setOverIndex(null);
211
+ isHandlePressRef.current = false;
212
+ }
213
+ );
214
+ const handleDragEnd = useRefFunction(() => {
131
215
  setDraggingIndex(null);
132
216
  setOverIndex(null);
133
217
  isHandlePressRef.current = false;
134
- };
135
- const isHandleTarget = (target) => {
136
- if (!(target instanceof HTMLElement))
137
- return false;
138
- const handle = target.closest(`.${basePrefixCls}-drag-handle`);
139
- return !!handle;
140
- };
218
+ });
219
+ const handlePointerDown = useRefFunction(
220
+ (e) => {
221
+ const el = scrollRef.current;
222
+ if (!el || e.button !== 0 || isInteractiveTarget(e.target))
223
+ return;
224
+ panIntentRef.current = true;
225
+ hasPanMovedRef.current = false;
226
+ panStartXRef.current = e.clientX;
227
+ panStartScrollLeftRef.current = el.scrollLeft;
228
+ }
229
+ );
230
+ const handlePointerMove = useRefFunction(
231
+ (e) => {
232
+ const el = scrollRef.current;
233
+ if (!el)
234
+ return;
235
+ if (!isPanningRef.current && panIntentRef.current) {
236
+ const dx = e.clientX - panStartXRef.current;
237
+ if (Math.abs(dx) > PAN_THRESHOLD) {
238
+ isPanningRef.current = true;
239
+ hasPanMovedRef.current = true;
240
+ try {
241
+ el.setPointerCapture(e.pointerId);
242
+ } catch (e2) {
243
+ }
244
+ }
245
+ }
246
+ if (isPanningRef.current) {
247
+ const dx = e.clientX - panStartXRef.current;
248
+ el.scrollLeft = panStartScrollLeftRef.current - dx;
249
+ if (e.cancelable)
250
+ e.preventDefault();
251
+ e.stopPropagation();
252
+ }
253
+ }
254
+ );
255
+ const handlePointerUp = useRefFunction(
256
+ (e) => {
257
+ const el = scrollRef.current;
258
+ if (!el)
259
+ return;
260
+ panIntentRef.current = false;
261
+ if (isPanningRef.current) {
262
+ isPanningRef.current = false;
263
+ try {
264
+ el.releasePointerCapture(e.pointerId);
265
+ } catch (e2) {
266
+ }
267
+ }
268
+ }
269
+ );
270
+ const handlePointerCancel = useRefFunction(() => {
271
+ isPanningRef.current = false;
272
+ panIntentRef.current = false;
273
+ });
274
+ const handleWheel = useRefFunction((e) => {
275
+ const el = scrollRef.current;
276
+ if (!el)
277
+ return;
278
+ const horizontalDelta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
279
+ if (horizontalDelta !== 0) {
280
+ el.scrollLeft += horizontalDelta;
281
+ }
282
+ e.stopPropagation();
283
+ });
284
+ const handleClick = useRefFunction((e) => {
285
+ if (hasPanMovedRef.current) {
286
+ e.preventDefault();
287
+ e.stopPropagation();
288
+ hasPanMovedRef.current = false;
289
+ }
290
+ });
291
+ const handlePopoverChange = useRefFunction((visible) => {
292
+ if (!props.menuDisabled) {
293
+ setShowOverflowPopup(visible);
294
+ }
295
+ });
296
+ const handleMenuMouseEnter = useRefFunction(() => {
297
+ if (!props.menuDisabled) {
298
+ setIsIndicatorHover(true);
299
+ }
300
+ });
301
+ const handleMenuMouseLeave = useRefFunction(() => {
302
+ if (!props.menuDisabled) {
303
+ setIsIndicatorHover(false);
304
+ }
305
+ });
306
+ const handlePopupWheel = useRefFunction((e) => {
307
+ e.stopPropagation();
308
+ });
309
+ const containerStyle = useMemo(() => __spreadValues({}, props.style), [props.style]);
310
+ const containerClassName = useMemo(
311
+ () => classNames(
312
+ `${basePrefixCls}-container`,
313
+ {
314
+ [`${basePrefixCls}-container-${props.size}`]: props.size,
315
+ [`${basePrefixCls}-container-no-hover`]: isIndicatorHover
316
+ },
317
+ hashId
318
+ ),
319
+ [basePrefixCls, props.size, isIndicatorHover, hashId]
320
+ );
141
321
  return wrapSSR(
142
322
  /* @__PURE__ */ React.createElement(
143
323
  "div",
144
324
  {
145
325
  ref: containerRef,
146
- style: __spreadValues({}, props.style),
147
- className: classNames(
148
- `${basePrefixCls}-container`,
149
- {
150
- [`${basePrefixCls}-container-${props.size}`]: props.size,
151
- [`${basePrefixCls}-container-no-hover`]: isIndicatorHover
152
- },
153
- hashId
154
- ),
155
- onPointerDown: (e) => {
156
- const el = scrollRef.current;
157
- if (!el)
158
- return;
159
- if (e.button !== 0)
160
- return;
161
- if (isInteractiveTarget(e.target))
162
- return;
163
- panIntentRef.current = true;
164
- hasPanMovedRef.current = false;
165
- panStartXRef.current = e.clientX;
166
- panStartScrollLeftRef.current = el.scrollLeft;
167
- },
168
- onPointerMove: (e) => {
169
- const el = scrollRef.current;
170
- if (!el)
171
- return;
172
- if (!isPanningRef.current && panIntentRef.current) {
173
- const dx = e.clientX - panStartXRef.current;
174
- if (Math.abs(dx) > 6) {
175
- isPanningRef.current = true;
176
- hasPanMovedRef.current = true;
177
- try {
178
- el.setPointerCapture(e.pointerId);
179
- } catch (e2) {
180
- }
181
- }
182
- }
183
- if (isPanningRef.current) {
184
- const dx = e.clientX - panStartXRef.current;
185
- el.scrollLeft = panStartScrollLeftRef.current - dx;
186
- if (e.cancelable)
187
- e.preventDefault();
188
- e.stopPropagation();
189
- }
190
- },
191
- onPointerUp: (e) => {
192
- const el = scrollRef.current;
193
- if (!el)
194
- return;
195
- panIntentRef.current = false;
196
- if (isPanningRef.current) {
197
- isPanningRef.current = false;
198
- try {
199
- el.releasePointerCapture(e.pointerId);
200
- } catch (e2) {
201
- }
202
- }
203
- },
204
- onPointerCancel: () => {
205
- isPanningRef.current = false;
206
- panIntentRef.current = false;
207
- },
208
- onWheel: (e) => {
209
- const el = scrollRef.current;
210
- if (!el)
211
- return;
212
- const horizontalDelta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
213
- if (horizontalDelta !== 0) {
214
- el.scrollLeft += horizontalDelta;
215
- }
216
- e.stopPropagation();
217
- },
218
- onClick: (e) => {
219
- if (hasPanMovedRef.current) {
220
- e.preventDefault();
221
- e.stopPropagation();
222
- hasPanMovedRef.current = false;
223
- }
224
- }
326
+ style: containerStyle,
327
+ className: containerClassName,
328
+ onPointerDown: handlePointerDown,
329
+ onPointerMove: handlePointerMove,
330
+ onPointerUp: handlePointerUp,
331
+ onPointerCancel: handlePointerCancel,
332
+ onWheel: handleWheel,
333
+ onClick: handleClick
225
334
  },
226
335
  /* @__PURE__ */ React.createElement(
227
336
  "div",
228
337
  {
229
338
  ref: scrollRef,
230
339
  className: classNames(`${basePrefixCls}-scroll`, hashId),
231
- style: {
232
- display: "flex",
233
- alignItems: "center",
234
- width: "100%",
235
- gap: 8,
236
- overflowX: "auto",
237
- overflowY: "hidden",
238
- WebkitOverflowScrolling: "touch",
239
- overscrollBehavior: "contain",
240
- touchAction: "pan-x"
241
- }
340
+ style: SCROLL_STYLE
242
341
  },
243
342
  ordered.map((entry) => /* @__PURE__ */ React.createElement(React.Fragment, { key: entry.key }, entry.node))
244
343
  ),
@@ -269,11 +368,11 @@ var ActionItemContainer = (props) => {
269
368
  Popover,
270
369
  {
271
370
  open: showOverflowPopup,
272
- onOpenChange: (visible) => !props.menuDisabled && setShowOverflowPopup(visible),
371
+ onOpenChange: handlePopoverChange,
273
372
  trigger: "click",
274
373
  placement: "topRight",
275
374
  arrow: false,
276
- overlayInnerStyle: { padding: 0 },
375
+ overlayInnerStyle: POPOVER_OVERLAY_STYLE,
277
376
  overlayClassName: classNames(
278
377
  `${basePrefixCls}-overflow-popover`,
279
378
  hashId
@@ -285,60 +384,27 @@ var ActionItemContainer = (props) => {
285
384
  `${basePrefixCls}-overflow-container-popup`,
286
385
  hashId
287
386
  ),
288
- onWheel: (e) => {
289
- e.stopPropagation();
290
- }
387
+ onWheel: handlePopupWheel
291
388
  },
292
- ordered.length > 0 ? ordered.map((entry, index) => /* @__PURE__ */ React.createElement(
293
- "div",
389
+ ordered.map((entry, index) => /* @__PURE__ */ React.createElement(
390
+ DraggablePopupItem,
294
391
  {
295
392
  key: entry.key,
296
- className: classNames(
297
- `${basePrefixCls}-overflow-container-popup-item`,
298
- hashId,
299
- {
300
- [`${basePrefixCls}-dragging`]: draggingIndex === index,
301
- [`${basePrefixCls}-drag-over`]: overIndex === index
302
- }
303
- ),
304
- draggable: true,
305
- onMouseDown: (evt) => {
306
- const isHandle = isHandleTarget(evt.target);
307
- isHandlePressRef.current = isHandle;
308
- if (isHandle) {
309
- setDraggingIndex(index);
310
- } else {
311
- setDraggingIndex(null);
312
- }
313
- },
314
- onMouseUp: () => {
315
- if (draggingIndex === null) {
316
- isHandlePressRef.current = false;
317
- }
318
- },
319
- onDragStart: (evt) => {
320
- handleDragStart(evt, index);
321
- },
322
- onDragOver: (evt) => handleDragOver(evt, index),
323
- onDrop: (evt) => handleDrop(evt, index),
324
- onDragEnd: handleDragEnd
325
- },
326
- /* @__PURE__ */ React.createElement(
327
- GripVertical,
328
- {
329
- className: classNames(
330
- `${basePrefixCls}-drag-handle`,
331
- hashId
332
- ),
333
- onMouseDown: (evt) => {
334
- isHandlePressRef.current = true;
335
- setDraggingIndex(index);
336
- evt.stopPropagation();
337
- }
338
- }
339
- ),
340
- /* @__PURE__ */ React.createElement("div", { draggable: false }, entry.node)
341
- )) : null
393
+ entry,
394
+ index,
395
+ basePrefixCls,
396
+ hashId,
397
+ draggingIndex,
398
+ overIndex,
399
+ isHandlePressRef,
400
+ onDragStart: handleDragStart,
401
+ onDragOver: handleDragOver,
402
+ onDrop: handleDrop,
403
+ onDragEnd: handleDragEnd,
404
+ isHandleTarget,
405
+ setDraggingIndex
406
+ }
407
+ ))
342
408
  )
343
409
  },
344
410
  /* @__PURE__ */ React.createElement(
@@ -351,8 +417,8 @@ var ActionItemContainer = (props) => {
351
417
  [`${basePrefixCls}-overflow-container-menu-disabled`]: props.menuDisabled
352
418
  }
353
419
  ),
354
- onMouseEnter: () => !props.menuDisabled && setIsIndicatorHover(true),
355
- onMouseLeave: () => !props.menuDisabled && setIsIndicatorHover(false)
420
+ onMouseEnter: handleMenuMouseEnter,
421
+ onMouseLeave: handleMenuMouseLeave
356
422
  },
357
423
  /* @__PURE__ */ React.createElement(Menu, null)
358
424
  )
@@ -28,6 +28,7 @@ var genStyle = (token) => {
28
28
  [`${token.componentCls}`]: {
29
29
  maxWidth: "100%",
30
30
  display: "flex",
31
+ minWidth: "0px",
31
32
  flexDirection: "column",
32
33
  flexWrap: "nowrap",
33
34
  overflow: "auto",
@@ -76,7 +76,7 @@ var useFileUploadManager = ({
76
76
  input.id = "uploadImage_" + Math.random();
77
77
  input.type = "file";
78
78
  input.accept = ((_a = supportedFormat == null ? void 0 : supportedFormat.extensions) == null ? void 0 : _a.join(",")) || "image/*";
79
- input.multiple = true;
79
+ input.multiple = false;
80
80
  input.style.display = "none";
81
81
  input.onchange = (e) => __async(void 0, null, function* () {
82
82
  if (input.dataset.readonly) {
@@ -116,14 +116,25 @@ var useFileUploadManager = ({
116
116
  }
117
117
  }));
118
118
  const handleFileRetry = useRefFunction((file) => __async(void 0, null, function* () {
119
- var _a;
120
119
  try {
121
120
  file.status = "uploading";
122
121
  const map = new Map(fileMap);
123
122
  map.set(file.uuid || "", file);
124
123
  updateAttachmentFiles(map);
125
- const url = yield (_a = attachment == null ? void 0 : attachment.upload) == null ? void 0 : _a.call(attachment, file);
126
- if (url) {
124
+ let url;
125
+ let isSuccess = false;
126
+ let errorMsg = null;
127
+ if (attachment == null ? void 0 : attachment.uploadWithResponse) {
128
+ const uploadResult = yield attachment.uploadWithResponse(file, 0);
129
+ url = uploadResult.fileUrl;
130
+ isSuccess = uploadResult.uploadStatus === "SUCCESS";
131
+ errorMsg = uploadResult.errorMessage || null;
132
+ file.uploadResponse = uploadResult;
133
+ } else if (attachment == null ? void 0 : attachment.upload) {
134
+ url = yield attachment.upload(file);
135
+ isSuccess = !!url;
136
+ }
137
+ if (isSuccess && url) {
127
138
  file.status = "done";
128
139
  file.url = url;
129
140
  map.set(file.uuid || "", file);
@@ -133,7 +144,8 @@ var useFileUploadManager = ({
133
144
  file.status = "error";
134
145
  map.set(file.uuid || "", file);
135
146
  updateAttachmentFiles(map);
136
- message.error((locale == null ? void 0 : locale.uploadFailed) || "Upload failed");
147
+ const failedMsg = errorMsg || (locale == null ? void 0 : locale.uploadFailed) || "Upload failed";
148
+ message.error(failedMsg);
137
149
  }
138
150
  } catch (error) {
139
151
  console.error("Error retrying file upload:", error);
@@ -141,7 +153,8 @@ var useFileUploadManager = ({
141
153
  const map = new Map(fileMap);
142
154
  map.set(file.uuid || "", file);
143
155
  updateAttachmentFiles(map);
144
- message.error((locale == null ? void 0 : locale.uploadFailed) || "Upload failed");
156
+ const errorMessage = error instanceof Error ? error.message : (locale == null ? void 0 : locale.uploadFailed) || "Upload failed";
157
+ message.error(errorMessage);
145
158
  }
146
159
  }));
147
160
  return {
@@ -285,7 +285,11 @@ var MarkdownInputField = (_a) => {
285
285
  onMouseEnter: () => setHover(true),
286
286
  onMouseLeave: () => setHover(false),
287
287
  onKeyDown: (e) => {
288
+ var _a3;
288
289
  const { triggerSendKey = "Enter" } = props;
290
+ if ((_a3 = markdownEditorRef == null ? void 0 : markdownEditorRef.current) == null ? void 0 : _a3.store.inputComposition) {
291
+ return;
292
+ }
289
293
  if (triggerSendKey === "Enter" && e.key === "Enter" && !(e.ctrlKey || e.metaKey)) {
290
294
  e.stopPropagation();
291
295
  e.preventDefault();