@ant-design/agentic-ui 2.20.2 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
  2. package/dist/MarkdownEditor/editor/elements/Code.js +1 -1
  3. package/dist/MarkdownEditor/editor/elements/Image/index.js +37 -9
  4. package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +87 -2
  5. package/dist/MarkdownEditor/editor/elements/List/List.js +10 -2
  6. package/dist/MarkdownEditor/editor/elements/Media.js +75 -23
  7. package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +2 -13
  8. package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +89 -15
  9. package/dist/MarkdownEditor/editor/elements/Table/Table.js +3 -75
  10. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +4 -4
  11. package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +14 -12
  12. package/dist/MarkdownEditor/editor/elements/index.js +1 -32
  13. package/dist/MarkdownEditor/editor/parser/parse/applyContextPropsAndConfig.d.ts +8 -0
  14. package/dist/MarkdownEditor/editor/parser/parse/applyContextPropsAndConfig.js +58 -0
  15. package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.d.ts +67 -0
  16. package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +289 -0
  17. package/dist/MarkdownEditor/editor/parser/parse/parseCode.d.ts +32 -0
  18. package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +186 -0
  19. package/dist/MarkdownEditor/editor/parser/parse/parseElements.d.ts +27 -0
  20. package/dist/MarkdownEditor/editor/parser/parse/parseElements.js +83 -0
  21. package/dist/MarkdownEditor/editor/parser/parse/parseEmptyLines.d.ts +9 -0
  22. package/dist/MarkdownEditor/editor/parser/parse/parseEmptyLines.js +60 -0
  23. package/dist/MarkdownEditor/editor/parser/parse/parseFootnote.d.ts +10 -0
  24. package/dist/MarkdownEditor/editor/parser/parse/parseFootnote.js +12 -0
  25. package/dist/MarkdownEditor/editor/parser/parse/parseHtml.d.ts +63 -0
  26. package/dist/MarkdownEditor/editor/parser/parse/parseHtml.js +759 -0
  27. package/dist/MarkdownEditor/editor/parser/parse/parseMath.d.ts +24 -0
  28. package/dist/MarkdownEditor/editor/parser/parse/parseMath.js +58 -0
  29. package/dist/MarkdownEditor/editor/parser/parse/parseMedia.d.ts +27 -0
  30. package/dist/MarkdownEditor/editor/parser/parse/parseMedia.js +127 -0
  31. package/dist/MarkdownEditor/editor/parser/parse/parseTable.d.ts +39 -0
  32. package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +348 -0
  33. package/dist/MarkdownEditor/editor/parser/parse/parseText.d.ts +26 -0
  34. package/dist/MarkdownEditor/editor/parser/parse/parseText.js +304 -0
  35. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.d.ts +3 -44
  36. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +141 -2282
  37. package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +137 -12
  38. package/dist/MarkdownEditor/editor/parser/remarkParse.d.ts +11 -1
  39. package/dist/MarkdownEditor/editor/parser/remarkParse.js +225 -39
  40. package/dist/MarkdownEditor/editor/plugins/elements.js +1 -1
  41. package/dist/MarkdownEditor/editor/types/Table.d.ts +2 -1
  42. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +2 -1
  43. package/dist/MarkdownEditor/el.d.ts +3 -0
  44. package/dist/MarkdownEditor/style.js +2 -0
  45. package/dist/Plugins/chart/index.js +7 -7
  46. package/dist/Plugins/code/components/CodeRenderer.js +27 -10
  47. package/dist/Plugins/code/components/CodeToolbar.js +3 -16
  48. package/dist/Workspace/Task/index.d.ts +13 -8
  49. package/dist/Workspace/Task/index.js +19 -2
  50. package/dist/Workspace/index.js +3 -2
  51. package/dist/Workspace/types.d.ts +3 -1
  52. package/package.json +1 -1
@@ -408,7 +408,7 @@ var composeEditors = function(editor, plugins) {
408
408
  extra: toolBar.extra,
409
409
  min: toolBar.min
410
410
  })) : readonly ? null : null, /*#__PURE__*/ React.createElement("div", {
411
- className: "".concat(baseClassName, "-content"),
411
+ className: "".concat(baseClassName, "-container"),
412
412
  style: _object_spread({
413
413
  overflow: 'auto',
414
414
  display: 'flex',
@@ -64,7 +64,7 @@ export var Code = function(param) {
64
64
  }), (element === null || element === void 0 ? void 0 : (_element_otherProps3 = element.otherProps) === null || _element_otherProps3 === void 0 ? void 0 : _element_otherProps3.isConfig) ? '' : DOMPurify.sanitize(element === null || element === void 0 ? void 0 : (_element_value1 = element.value) === null || _element_value1 === void 0 ? void 0 : _element_value1.trim()));
65
65
  }
66
66
  // 检查代码块是否未闭合
67
- var isUnclosed = (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.finish) === false;
67
+ var isUnclosed = (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.finished) === false;
68
68
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
69
69
  "data-is-unclosed": isUnclosed,
70
70
  "data-language": element === null || element === void 0 ? void 0 : element.language,
@@ -249,7 +249,7 @@ function _ts_generator(thisArg, body) {
249
249
  }
250
250
  import { BlockOutlined, DeleteFilled, ExclamationCircleOutlined, LoadingOutlined } from "@ant-design/icons";
251
251
  import { Image, Modal, Popover, Skeleton, Space } from "antd";
252
- import React, { useCallback, useContext, useLayoutEffect, useMemo, useRef } from "react";
252
+ import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
253
253
  import { useDebounceFn } from "@ant-design/pro-components";
254
254
  import { Rnd } from "react-rnd";
255
255
  import { Path, Transforms } from "slate";
@@ -478,11 +478,12 @@ import { getMediaType } from "../../utils/dom";
478
478
  };
479
479
  export function EditorImage(param) {
480
480
  var element = param.element, attributes = param.attributes, children = param.children;
481
- var _state, _element_otherProps;
481
+ var _state;
482
482
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
483
483
  var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), _ = _useSelStatus[0], path = _useSelStatus[1];
484
484
  var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly;
485
485
  var htmlRef = React.useRef(null);
486
+ var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
486
487
  var _useGetSetState = _sliced_to_array(useGetSetState({
487
488
  height: element.height,
488
489
  dragging: false,
@@ -550,12 +551,39 @@ export function EditorImage(param) {
550
551
  }, [
551
552
  element === null || element === void 0 ? void 0 : element.url
552
553
  ]);
554
+ // 如果 finished 为 false,设置 5 秒超时,超时后显示为文本
555
+ useEffect(function() {
556
+ if (element.finished === false) {
557
+ setShowAsText(false);
558
+ var timer = setTimeout(function() {
559
+ setShowAsText(true);
560
+ }, 5000);
561
+ return function() {
562
+ clearTimeout(timer);
563
+ };
564
+ } else {
565
+ setShowAsText(false);
566
+ }
567
+ }, [
568
+ element.finished
569
+ ]);
553
570
  var imageDom = useMemo(function() {
554
- var _element_otherProps, _state, _state1;
555
- // 检查是否为不完整的图片(loading 状态)
556
- var isLoading = (element === null || element === void 0 ? void 0 : element.loading) || (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.loading);
557
- if (isLoading) {
558
- // 显示 loading 状态的占位符
571
+ var _state, _state1;
572
+ // 检查是否为不完整的图片(finished 状态)
573
+ if (element.finished === false) {
574
+ // 如果 5 秒后仍未完成,显示为文本
575
+ if (showAsText) {
576
+ return /*#__PURE__*/ React.createElement("div", {
577
+ style: {
578
+ padding: '8px 12px',
579
+ border: '1px solid #d9d9d9',
580
+ borderRadius: '4px',
581
+ color: 'rgba(0, 0, 0, 0.65)',
582
+ wordBreak: 'break-all'
583
+ }
584
+ }, element.alt || element.url || '图片链接');
585
+ }
586
+ // 5 秒内显示 loading 状态的占位符
559
587
  return /*#__PURE__*/ React.createElement(Skeleton.Image, {
560
588
  active: true
561
589
  });
@@ -632,8 +660,8 @@ export function EditorImage(param) {
632
660
  readonly,
633
661
  state().selected,
634
662
  state().loadSuccess,
635
- element === null || element === void 0 ? void 0 : element.loading,
636
- element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.loading,
663
+ element.finished,
664
+ showAsText,
637
665
  element === null || element === void 0 ? void 0 : element.rawMarkdown
638
666
  ]);
639
667
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
@@ -1,6 +1,52 @@
1
- import { ConfigProvider } from "antd";
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
47
+ import { ConfigProvider, Skeleton } from "antd";
2
48
  import classNames from "classnames";
3
- import React, { useContext } from "react";
49
+ import React, { useContext, useEffect, useState } from "react";
4
50
  import { AvatarList } from "../../components/ContributorAvatar";
5
51
  import { DragHandle } from "../../tools/DragHandle";
6
52
  import { useStyle } from "./style";
@@ -11,6 +57,45 @@ export function LinkCard(param) {
11
57
  var baseCls = context === null || context === void 0 ? void 0 : context.getPrefixCls('agentic-md-editor-link-card');
12
58
  var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
13
59
  var htmlRef = React.useRef(null);
60
+ var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
61
+ // 如果 finished 为 false,设置 5 秒超时,超时后显示为文本
62
+ useEffect(function() {
63
+ if (element.finished === false) {
64
+ setShowAsText(false);
65
+ var timer = setTimeout(function() {
66
+ setShowAsText(true);
67
+ }, 5000);
68
+ return function() {
69
+ clearTimeout(timer);
70
+ };
71
+ } else {
72
+ setShowAsText(false);
73
+ }
74
+ }, [
75
+ element.finished
76
+ ]);
77
+ // 如果是不完整状态
78
+ if (element.finished === false) {
79
+ // 如果 5 秒后仍未完成,显示为文本
80
+ if (showAsText) {
81
+ return /*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement("div", {
82
+ style: {
83
+ padding: '8px 12px',
84
+ border: '1px solid #d9d9d9',
85
+ borderRadius: '4px',
86
+ color: 'rgba(0, 0, 0, 0.65)',
87
+ wordBreak: 'break-all'
88
+ }
89
+ }, element.url || element.title || element.name || '链接卡片'), children);
90
+ }
91
+ // 5 秒内显示加载骨架屏
92
+ return /*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement(Skeleton, {
93
+ active: true,
94
+ paragraph: {
95
+ rows: 2
96
+ }
97
+ }), children);
98
+ }
14
99
  return wrapSSR(/*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement("div", {
15
100
  className: classNames(baseCls, hashId),
16
101
  "data-be": "link-card",
@@ -77,7 +77,7 @@ export var ListContext = /*#__PURE__*/ React.createContext(null);
77
77
  var context = useContext(ConfigProvider.ConfigContext);
78
78
  var baseCls = context.getPrefixCls('agentic-md-editor-list');
79
79
  var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
80
- return React.useMemo(function() {
80
+ var listContent = React.useMemo(function() {
81
81
  var tag = element.order ? 'ol' : 'ul';
82
82
  return wrapSSR(/*#__PURE__*/ React.createElement(ListContext.Provider, {
83
83
  value: {
@@ -98,6 +98,14 @@ export var ListContext = /*#__PURE__*/ React.createContext(null);
98
98
  element.task,
99
99
  element.order,
100
100
  element.start,
101
- element.children
101
+ element.children,
102
+ baseCls,
103
+ hashId,
104
+ attributes,
105
+ children,
106
+ store,
107
+ markdownContainerRef,
108
+ wrapSSR
102
109
  ]);
110
+ return listContent;
103
111
  };
@@ -225,7 +225,7 @@ function _ts_generator(thisArg, body) {
225
225
  }
226
226
  import { DeleteFilled, ExclamationCircleOutlined, EyeOutlined, LoadingOutlined } from "@ant-design/icons";
227
227
  import { Modal, Popover, Skeleton } from "antd";
228
- import React, { useCallback, useContext, useLayoutEffect, useMemo, useRef } from "react";
228
+ import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
229
229
  import { useDebounceFn } from "@ant-design/pro-components";
230
230
  import { Rnd } from "react-rnd";
231
231
  import { Transforms } from "slate";
@@ -379,12 +379,13 @@ import { ImageAndError } from "./Image";
379
379
  };
380
380
  export function Media(param) {
381
381
  var element = param.element, attributes = param.attributes, children = param.children;
382
- var _state, _element_otherProps, _state1, _element_otherProps1;
382
+ var _state, _state1;
383
383
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
384
384
  var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), _ = _useSelStatus[0], path = _useSelStatus[1];
385
385
  var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly;
386
386
  var locale = useContext(I18nContext).locale;
387
387
  var htmlRef = React.useRef(null);
388
+ var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
388
389
  var _useGetSetState = _sliced_to_array(useGetSetState({
389
390
  height: element.height,
390
391
  dragging: false,
@@ -401,6 +402,22 @@ export function Media(param) {
401
402
  }, [
402
403
  path
403
404
  ]);
405
+ // 如果 finished 为 false,设置 5 秒超时,超时后显示为文本
406
+ useEffect(function() {
407
+ if (element.finished === false) {
408
+ setShowAsText(false);
409
+ var timer = setTimeout(function() {
410
+ setShowAsText(true);
411
+ }, 5000);
412
+ return function() {
413
+ clearTimeout(timer);
414
+ };
415
+ } else {
416
+ setShowAsText(false);
417
+ }
418
+ }, [
419
+ element.finished
420
+ ]);
404
421
  var initial = useCallback(/*#__PURE__*/ _async_to_generator(function() {
405
422
  var type, finalType, realUrl, img, video, audio;
406
423
  return _ts_generator(this, function(_state) {
@@ -483,12 +500,23 @@ export function Media(param) {
483
500
  element === null || element === void 0 ? void 0 : element.url
484
501
  ]);
485
502
  var imageDom = useMemo(function() {
486
- var _element_otherProps, _state, _state1;
503
+ var _state, _state1;
487
504
  if (state().type !== 'image' && state().type !== 'other') return null;
488
- // 检查是否为不完整的图片(loading 状态)
489
- var isLoading = (element === null || element === void 0 ? void 0 : element.loading) || (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.loading);
490
- if (isLoading) {
491
- // 显示 loading 状态的占位符
505
+ // 检查是否为不完整的图片(finished 状态)
506
+ if (element.finished === false) {
507
+ // 如果 5 秒后仍未完成,显示为文本
508
+ if (showAsText) {
509
+ return /*#__PURE__*/ React.createElement("div", {
510
+ style: {
511
+ padding: '8px 12px',
512
+ border: '1px solid #d9d9d9',
513
+ borderRadius: '4px',
514
+ color: 'rgba(0, 0, 0, 0.65)',
515
+ wordBreak: 'break-all'
516
+ }
517
+ }, element.alt || element.url || '图片链接');
518
+ }
519
+ // 5 秒内显示 loading 状态的占位符
492
520
  return /*#__PURE__*/ React.createElement(Skeleton.Image, {
493
521
  active: true
494
522
  });
@@ -537,19 +565,30 @@ export function Media(param) {
537
565
  (_state = state()) === null || _state === void 0 ? void 0 : _state.url,
538
566
  readonly,
539
567
  state().selected,
540
- element === null || element === void 0 ? void 0 : element.loading,
541
- element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.loading,
568
+ element.finished,
569
+ showAsText,
542
570
  element === null || element === void 0 ? void 0 : element.rawMarkdown
543
571
  ]);
544
572
  var mediaElement = useMemo(function() {
545
- var _element_otherProps, _element_otherProps1;
546
- // 检查是否为不完整的媒体(loading 状态)
547
- var isLoading = (element === null || element === void 0 ? void 0 : element.loading) || (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.loading);
548
- var rawMarkdown = (element === null || element === void 0 ? void 0 : element.rawMarkdown) || (element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.rawMarkdown);
573
+ var _element_otherProps;
574
+ var rawMarkdown = (element === null || element === void 0 ? void 0 : element.rawMarkdown) || (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.rawMarkdown);
549
575
  if (state().type === 'video') {
550
576
  var _state;
551
- // 如果是 loading 状态,显示 loading 占位符
552
- if (isLoading) {
577
+ // 如果是不完整状态
578
+ if (element.finished === false) {
579
+ // 如果 5 秒后仍未完成,显示为文本
580
+ if (showAsText) {
581
+ return /*#__PURE__*/ React.createElement("div", {
582
+ style: {
583
+ padding: '8px 12px',
584
+ border: '1px solid #d9d9d9',
585
+ borderRadius: '4px',
586
+ color: 'rgba(0, 0, 0, 0.65)',
587
+ wordBreak: 'break-all'
588
+ }
589
+ }, element.alt || element.url || '视频链接');
590
+ }
591
+ // 5 秒内显示 loading 占位符
553
592
  return /*#__PURE__*/ React.createElement(Skeleton.Image, {
554
593
  active: true
555
594
  });
@@ -607,8 +646,21 @@ export function Media(param) {
607
646
  }
608
647
  if (state().type === 'audio') {
609
648
  var _state3;
610
- // 如果是 loading 状态,显示 loading 占位符
611
- if (isLoading) {
649
+ // 如果是不完整状态
650
+ if (element.finished === false) {
651
+ // 如果 5 秒后仍未完成,显示为文本
652
+ if (showAsText) {
653
+ return /*#__PURE__*/ React.createElement("div", {
654
+ style: {
655
+ padding: '8px 12px',
656
+ border: '1px solid #d9d9d9',
657
+ borderRadius: '4px',
658
+ color: 'rgba(0, 0, 0, 0.65)',
659
+ wordBreak: 'break-all'
660
+ }
661
+ }, element.alt || element.url || '音频链接');
662
+ }
663
+ // 5 秒内显示 loading 占位符
612
664
  return /*#__PURE__*/ React.createElement("div", {
613
665
  style: {
614
666
  display: 'inline-flex',
@@ -678,7 +730,7 @@ export function Media(param) {
678
730
  }, "Your browser does not support the", /*#__PURE__*/ React.createElement("code", null, "audio"), " element.");
679
731
  }
680
732
  if (state().type === 'attachment') {
681
- var _state6, _element_alt, _element_alt1, _element_otherProps2, _element_otherProps_collaborators, _element_otherProps3, _element_otherProps4;
733
+ var _state6, _element_alt, _element_alt1, _element_otherProps1, _element_otherProps_collaborators, _element_otherProps2, _element_otherProps3;
682
734
  return /*#__PURE__*/ React.createElement("div", {
683
735
  style: {
684
736
  padding: 12,
@@ -727,15 +779,15 @@ export function Media(param) {
727
779
  display: 'flex',
728
780
  justifyContent: 'space-between'
729
781
  }
730
- }, ((_element_otherProps2 = element.otherProps) === null || _element_otherProps2 === void 0 ? void 0 : _element_otherProps2.collaborators) ? /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(AvatarList, {
731
- displayList: ((_element_otherProps3 = element.otherProps) === null || _element_otherProps3 === void 0 ? void 0 : (_element_otherProps_collaborators = _element_otherProps3.collaborators) === null || _element_otherProps_collaborators === void 0 ? void 0 : _element_otherProps_collaborators.map(function(item) {
782
+ }, ((_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.collaborators) ? /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(AvatarList, {
783
+ displayList: ((_element_otherProps2 = element.otherProps) === null || _element_otherProps2 === void 0 ? void 0 : (_element_otherProps_collaborators = _element_otherProps2.collaborators) === null || _element_otherProps_collaborators === void 0 ? void 0 : _element_otherProps_collaborators.map(function(item) {
732
784
  var _Object_keys, _Object_values;
733
785
  return {
734
786
  name: (_Object_keys = Object.keys(item)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.at(0),
735
787
  collaboratorNumber: ((_Object_values = Object.values(item)) === null || _Object_values === void 0 ? void 0 : _Object_values.at(0)) || 0
736
788
  };
737
789
  }).slice(0, 5)) || []
738
- })) : /*#__PURE__*/ React.createElement("div", null), ((_element_otherProps4 = element.otherProps) === null || _element_otherProps4 === void 0 ? void 0 : _element_otherProps4.updateTime) ? /*#__PURE__*/ React.createElement("div", {
790
+ })) : /*#__PURE__*/ React.createElement("div", null), ((_element_otherProps3 = element.otherProps) === null || _element_otherProps3 === void 0 ? void 0 : _element_otherProps3.updateTime) ? /*#__PURE__*/ React.createElement("div", {
739
791
  style: {
740
792
  color: 'rgba(0,0,0,0.45)',
741
793
  fontSize: 12
@@ -761,8 +813,8 @@ export function Media(param) {
761
813
  }, [
762
814
  state().type,
763
815
  (_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url,
764
- element === null || element === void 0 ? void 0 : element.loading,
765
- element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.loading,
816
+ element.finished,
817
+ showAsText,
766
818
  element === null || element === void 0 ? void 0 : element.rawMarkdown
767
819
  ]);
768
820
  return /*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement("div", {
@@ -64,7 +64,6 @@ import classNames from "classnames";
64
64
  import copy from "copy-to-clipboard";
65
65
  import React, { useCallback, useContext, useMemo, useRef, useState } from "react";
66
66
  import { ActionIconBox } from "../../../../Components/ActionIconBox";
67
- import { Loading } from "../../../../Components/Loading";
68
67
  import { I18nContext } from "../../../../I18n";
69
68
  import { useEditorStore } from "../../store";
70
69
  import { parserSlateNodeToMarkdown } from "../../utils";
@@ -73,7 +72,7 @@ import { parserSlateNodeToMarkdown } from "../../utils";
73
72
  * 移除了不必要的滚动监听和复杂的宽度计算
74
73
  */ export var ReadonlyTableComponent = /*#__PURE__*/ React.memo(function(param) {
75
74
  var hashId = param.hashId, children = param.children, element = param.element, baseCls = param.baseCls;
76
- var _element_otherProps, _element_children__children, _element_children_, _element_children, _editorProps_tableConfig;
75
+ var _element_children__children, _element_children_, _element_children, _editorProps_tableConfig;
77
76
  var editorProps = useEditorStore().editorProps;
78
77
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
79
78
  var _ref = (editorProps === null || editorProps === void 0 ? void 0 : editorProps.tableConfig) || {}, _ref_actions = _ref.actions, actions = _ref_actions === void 0 ? {
@@ -85,8 +84,6 @@ import { parserSlateNodeToMarkdown } from "../../utils";
85
84
  var modelTargetRef = useRef(null);
86
85
  var _useState = _sliced_to_array(useState(false), 2), previewOpen = _useState[0], setPreviewOpen = _useState[1];
87
86
  var i18n = useContext(I18nContext);
88
- // 检查表格是否未闭合
89
- var isUnclosed = (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.finish) === false;
90
87
  // 简化的列宽计算 - 只为 readonly 模式设计
91
88
  var colWidths = useMemo(function() {
92
89
  var _element_children__children, _element_children_, _element_children;
@@ -195,16 +192,8 @@ import { parserSlateNodeToMarkdown } from "../../utils";
195
192
  flex: 1,
196
193
  minWidth: 0,
197
194
  position: 'relative'
198
- },
199
- "data-is-unclosed": isUnclosed
200
- }, isUnclosed && /*#__PURE__*/ React.createElement("div", {
201
- style: {
202
- position: 'absolute',
203
- top: '8px',
204
- right: '8px',
205
- zIndex: 10
206
195
  }
207
- }, /*#__PURE__*/ React.createElement(Loading, null)), tableDom, popoverContent), previewOpen && /*#__PURE__*/ React.createElement(Modal, {
196
+ }, tableDom, popoverContent), previewOpen && /*#__PURE__*/ React.createElement(Modal, {
208
197
  title: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_tableConfig = editorProps.tableConfig) === null || _editorProps_tableConfig === void 0 ? void 0 : _editorProps_tableConfig.previewTitle) || '预览表格',
209
198
  open: previewOpen,
210
199
  closable: true,
@@ -1,3 +1,11 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
1
9
  function _define_property(obj, key, value) {
2
10
  if (key in obj) {
3
11
  Object.defineProperty(obj, key, {
@@ -11,6 +19,33 @@ function _define_property(obj, key, value) {
11
19
  }
12
20
  return obj;
13
21
  }
22
+ function _iterable_to_array_limit(arr, i) {
23
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24
+ if (_i == null) return;
25
+ var _arr = [];
26
+ var _n = true;
27
+ var _d = false;
28
+ var _s, _e;
29
+ try {
30
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
31
+ _arr.push(_s.value);
32
+ if (i && _arr.length === i) break;
33
+ }
34
+ } catch (err) {
35
+ _d = true;
36
+ _e = err;
37
+ } finally{
38
+ try {
39
+ if (!_n && _i["return"] != null) _i["return"]();
40
+ } finally{
41
+ if (_d) throw _e;
42
+ }
43
+ }
44
+ return _arr;
45
+ }
46
+ function _non_iterable_rest() {
47
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48
+ }
14
49
  function _object_spread(target) {
15
50
  for(var i = 1; i < arguments.length; i++){
16
51
  var source = arguments[i] != null ? arguments[i] : {};
@@ -50,11 +85,21 @@ function _object_spread_props(target, source) {
50
85
  }
51
86
  return target;
52
87
  }
53
- import { ConfigProvider } from "antd";
88
+ function _sliced_to_array(arr, i) {
89
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
90
+ }
91
+ function _unsupported_iterable_to_array(o, minLen) {
92
+ if (!o) return;
93
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
94
+ var n = Object.prototype.toString.call(o).slice(8, -1);
95
+ if (n === "Object" && o.constructor) n = o.constructor.name;
96
+ if (n === "Map" || n === "Set") return Array.from(n);
97
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
98
+ }
99
+ import { ConfigProvider, Skeleton } from "antd";
54
100
  import classNames from "classnames";
55
- import React, { useContext, useMemo } from "react";
101
+ import React, { useContext, useEffect, useMemo, useState } from "react";
56
102
  import { ReactEditor, useSlate } from "slate-react";
57
- import { Loading } from "../../../../Components/Loading";
58
103
  import { useTableStyle } from "./style";
59
104
  import { SlateTable } from "./Table";
60
105
  import { TablePropsProvider } from "./TableContext";
@@ -62,37 +107,66 @@ import { TablePropsProvider } from "./TableContext";
62
107
  * 简单表格组件 - 仅支持只读显示
63
108
  * 用于替代复杂的 Handsontable 实现,提供基础的表格功能
64
109
  */ export var SimpleTable = function(props) {
65
- var _props_element_otherProps, _props_element;
66
110
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
67
111
  var baseCls = getPrefixCls('agentic-md-editor-content-table');
68
112
  var editor = useSlate();
69
113
  var _useTableStyle = useTableStyle(baseCls, {}), wrapSSR = _useTableStyle.wrapSSR, hashId = _useTableStyle.hashId;
114
+ var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
115
+ var tableNode = props.element;
70
116
  var tablePath = useMemo(function() {
71
117
  return ReactEditor.findPath(editor, props.element);
72
118
  }, [
73
119
  props.element
74
120
  ]);
75
- // 检查表格是否未闭合
76
- var isUnclosed = ((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_otherProps = _props_element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.finish) === false;
121
+ // 如果 finished 为 false,设置 5 秒超时,超时后显示为文本
122
+ useEffect(function() {
123
+ if (tableNode.finished === false) {
124
+ setShowAsText(false);
125
+ var timer = setTimeout(function() {
126
+ setShowAsText(true);
127
+ }, 5000);
128
+ return function() {
129
+ clearTimeout(timer);
130
+ };
131
+ } else {
132
+ setShowAsText(false);
133
+ }
134
+ }, [
135
+ tableNode.finished
136
+ ]);
137
+ // 如果是不完整状态
138
+ if (tableNode.finished === false) {
139
+ // 如果 5 秒后仍未完成,显示为文本
140
+ if (showAsText) {
141
+ return /*#__PURE__*/ React.createElement("div", props.attributes, /*#__PURE__*/ React.createElement("div", {
142
+ style: {
143
+ padding: '8px 12px',
144
+ border: '1px solid #d9d9d9',
145
+ borderRadius: '4px',
146
+ color: 'rgba(0, 0, 0, 0.65)',
147
+ wordBreak: 'break-all'
148
+ }
149
+ }, "表格链接"), props.children);
150
+ }
151
+ // 5 秒内显示加载骨架屏
152
+ return /*#__PURE__*/ React.createElement("div", props.attributes, /*#__PURE__*/ React.createElement(Skeleton, {
153
+ active: true,
154
+ paragraph: {
155
+ rows: 3
156
+ }
157
+ }), props.children);
158
+ }
77
159
  return wrapSSR(/*#__PURE__*/ React.createElement(TablePropsProvider, {
78
160
  tablePath: tablePath,
79
161
  tableNode: props.element
80
162
  }, /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
81
163
  "data-be": 'table',
82
- "data-is-unclosed": isUnclosed,
83
164
  draggable: false,
84
165
  className: classNames("".concat(baseCls, "-container"), hashId),
85
166
  style: {
86
167
  position: 'relative'
87
168
  }
88
- }), isUnclosed && /*#__PURE__*/ React.createElement("div", {
89
- style: {
90
- position: 'absolute',
91
- top: '8px',
92
- right: '8px',
93
- zIndex: 10
94
- }
95
- }, /*#__PURE__*/ React.createElement(Loading, null)), /*#__PURE__*/ React.createElement(SlateTable, _object_spread_props(_object_spread({}, props), {
169
+ }), /*#__PURE__*/ React.createElement(SlateTable, _object_spread_props(_object_spread({}, props), {
96
170
  hashId: hashId
97
171
  }), props.children))));
98
172
  };