@ant-design/agentic-ui 2.27.9 → 2.28.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 (39) hide show
  1. package/dist/AgenticLayout/index.d.ts +0 -46
  2. package/dist/AgenticLayout/index.js +149 -8
  3. package/dist/AgenticLayout/style.js +31 -3
  4. package/dist/Bubble/AIBubble.js +1 -11
  5. package/dist/ChatLayout/index.js +17 -7
  6. package/dist/ChatLayout/style.js +5 -4
  7. package/dist/ChatLayout/types.d.ts +5 -0
  8. package/dist/Hooks/useAutoScroll.d.ts +13 -1
  9. package/dist/Hooks/useAutoScroll.js +19 -6
  10. package/dist/MarkdownEditor/editor/elements/Blockquote/index.js +11 -1
  11. package/dist/MarkdownEditor/editor/elements/Break/index.js +2 -0
  12. package/dist/MarkdownEditor/editor/elements/Card/index.js +11 -0
  13. package/dist/MarkdownEditor/editor/elements/Code/index.js +22 -7
  14. package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/index.js +15 -1
  15. package/dist/MarkdownEditor/editor/elements/FootnoteReference/index.js +11 -1
  16. package/dist/MarkdownEditor/editor/elements/Head/index.d.ts +1 -1
  17. package/dist/MarkdownEditor/editor/elements/Head/index.js +17 -1
  18. package/dist/MarkdownEditor/editor/elements/Hr/index.js +2 -0
  19. package/dist/MarkdownEditor/editor/elements/Image/index.js +75 -34
  20. package/dist/MarkdownEditor/editor/elements/InlineKatex/index.js +5 -0
  21. package/dist/MarkdownEditor/editor/elements/Katex/index.js +5 -0
  22. package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +13 -1
  23. package/dist/MarkdownEditor/editor/elements/List/List.js +16 -1
  24. package/dist/MarkdownEditor/editor/elements/List/ListItem.js +16 -4
  25. package/dist/MarkdownEditor/editor/elements/Mermaid/index.js +7 -2
  26. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +14 -2
  27. package/dist/MarkdownEditor/editor/elements/Schema/index.js +13 -0
  28. package/dist/MarkdownEditor/editor/elements/index.js +131 -16
  29. package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +84 -17
  30. package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +39 -2
  31. package/dist/MarkdownEditor/editor/parser/parse/parseElements.js +27 -2
  32. package/dist/MarkdownEditor/editor/parser/parse/parseFootnote.js +11 -1
  33. package/dist/MarkdownEditor/editor/parser/parse/parseMath.js +31 -4
  34. package/dist/MarkdownEditor/editor/parser/parse/parseMedia.js +41 -6
  35. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +141 -24
  36. package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +127 -6
  37. package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +109 -2
  38. package/dist/Plugins/code/components/ThinkBlock.js +1 -1
  39. package/package.json +1 -1
@@ -52,24 +52,39 @@ function _object_spread_props(target, source) {
52
52
  }
53
53
  import DOMPurify from "dompurify";
54
54
  import React from "react";
55
+ import { debugInfo } from "../../../../Utils/debugUtils";
55
56
  export var Code = function(param) {
56
57
  var attributes = param.attributes, children = param.children, element = param.element;
57
- var _element_otherProps, _element_otherProps1, _element_value;
58
+ var _element_value, _element_otherProps, _element_otherProps1, _element_otherProps2, _element_value1, _element_otherProps3, _element_value2;
59
+ debugInfo('Code - 渲染代码块', {
60
+ language: element === null || element === void 0 ? void 0 : element.language,
61
+ valueLength: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.length,
62
+ isConfig: element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.isConfig,
63
+ finished: element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.finished
64
+ });
58
65
  if ((element === null || element === void 0 ? void 0 : element.language) === 'html') {
59
- var _element_otherProps2, _element_otherProps3, _element_value1;
66
+ var _element_otherProps4, _element_otherProps5, _element_otherProps6, _element_value3;
67
+ debugInfo('Code - HTML 代码块', {
68
+ isConfig: element === null || element === void 0 ? void 0 : (_element_otherProps4 = element.otherProps) === null || _element_otherProps4 === void 0 ? void 0 : _element_otherProps4.isConfig
69
+ });
60
70
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
61
71
  style: {
62
- display: (element === null || element === void 0 ? void 0 : (_element_otherProps2 = element.otherProps) === null || _element_otherProps2 === void 0 ? void 0 : _element_otherProps2.isConfig) ? 'none' : 'block'
72
+ display: (element === null || element === void 0 ? void 0 : (_element_otherProps5 = element.otherProps) === null || _element_otherProps5 === void 0 ? void 0 : _element_otherProps5.isConfig) ? 'none' : 'block'
63
73
  }
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()));
74
+ }), (element === null || element === void 0 ? void 0 : (_element_otherProps6 = element.otherProps) === null || _element_otherProps6 === void 0 ? void 0 : _element_otherProps6.isConfig) ? '' : DOMPurify.sanitize(element === null || element === void 0 ? void 0 : (_element_value3 = element.value) === null || _element_value3 === void 0 ? void 0 : _element_value3.trim()));
65
75
  }
66
76
  // 检查代码块是否未闭合
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;
77
+ var isUnclosed = (element === null || element === void 0 ? void 0 : (_element_otherProps2 = element.otherProps) === null || _element_otherProps2 === void 0 ? void 0 : _element_otherProps2.finished) === false;
78
+ debugInfo('Code - 普通代码块', {
79
+ language: element === null || element === void 0 ? void 0 : element.language,
80
+ isUnclosed: isUnclosed,
81
+ valueLength: element === null || element === void 0 ? void 0 : (_element_value1 = element.value) === null || _element_value1 === void 0 ? void 0 : _element_value1.length
82
+ });
68
83
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
69
84
  "data-is-unclosed": isUnclosed,
70
85
  "data-language": element === null || element === void 0 ? void 0 : element.language,
71
86
  style: (element === null || element === void 0 ? void 0 : element.language) === 'html' ? {
72
- display: (element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.isConfig) ? 'none' : 'block'
87
+ display: (element === null || element === void 0 ? void 0 : (_element_otherProps3 = element.otherProps) === null || _element_otherProps3 === void 0 ? void 0 : _element_otherProps3.isConfig) ? 'none' : 'block'
73
88
  } : {
74
89
  height: '240px',
75
90
  minWidth: '398px',
@@ -95,5 +110,5 @@ export var Code = function(param) {
95
110
  boxShadow: 'var(--shadow-control-base)',
96
111
  position: 'relative'
97
112
  }
98
- }), (element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.trim()) || children);
113
+ }), (element === null || element === void 0 ? void 0 : (_element_value2 = element.value) === null || _element_value2 === void 0 ? void 0 : _element_value2.trim()) || children);
99
114
  };
@@ -53,18 +53,31 @@ function _object_spread_props(target, source) {
53
53
  import { ExportOutlined } from "@ant-design/icons";
54
54
  import React, { useMemo } from "react";
55
55
  import { Node } from "slate";
56
+ import { debugInfo } from "../../../../Utils/debugUtils";
56
57
  import { useEditorStore } from "../../store";
57
58
  import { DragHandle } from "../../tools/DragHandle";
58
59
  export var FootnoteDefinition = function(props) {
60
+ debugInfo('FootnoteDefinition - 渲染脚注定义', {
61
+ identifier: props.element.identifier,
62
+ url: props.element.url
63
+ });
59
64
  var _useEditorStore = useEditorStore(), store = _useEditorStore.store, readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef;
60
65
  var element = props.element;
61
66
  useMemo(function() {
67
+ debugInfo('FootnoteDefinition - 更新脚注定义映射', {
68
+ identifier: element.identifier
69
+ });
62
70
  store.footnoteDefinitionMap = store.footnoteDefinitionMap.set(element.identifier, element);
63
71
  }, [
64
72
  element
65
73
  ]);
66
74
  return React.useMemo(function() {
67
75
  var str = Node.string(props.element);
76
+ debugInfo('FootnoteDefinition - useMemo 渲染', {
77
+ identifier: element.identifier,
78
+ strLength: str.length,
79
+ readonly: readonly
80
+ });
68
81
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
69
82
  style: {
70
83
  fontSize: '12px',
@@ -76,7 +89,8 @@ export var FootnoteDefinition = function(props) {
76
89
  "data-drag-el": true,
77
90
  className: !str ? 'empty' : undefined,
78
91
  onDragStart: function(e) {
79
- return store.dragStart(e, markdownContainerRef.current);
92
+ debugInfo('FootnoteDefinition - 拖拽开始');
93
+ store.dragStart(e, markdownContainerRef.current);
80
94
  }
81
95
  }), /*#__PURE__*/ React.createElement(DragHandle, null), element.identifier, ".", /*#__PURE__*/ React.createElement("span", {
82
96
  style: {
@@ -98,21 +98,31 @@ function _unsupported_iterable_to_array(o, minLen) {
98
98
  }
99
99
  import React from "react";
100
100
  import { Node } from "slate";
101
+ import { debugInfo } from "../../../../Utils/debugUtils";
101
102
  import { useSelStatus } from "../../../hooks/editor";
102
103
  import { useEditorStore } from "../../store";
103
104
  import { DragHandle } from "../../tools/DragHandle";
104
105
  export var FootnoteReference = function(props) {
106
+ debugInfo('FootnoteReference - 渲染脚注引用', {
107
+ identifier: props.element.identifier
108
+ });
105
109
  var _useEditorStore = useEditorStore(), store = _useEditorStore.store, markdownContainerRef = _useEditorStore.markdownContainerRef;
106
110
  var _useSelStatus = _sliced_to_array(useSelStatus(props.element), 1), selected = _useSelStatus[0];
107
111
  return React.useMemo(function() {
108
112
  var str = Node.string(props.element);
113
+ debugInfo('FootnoteReference - useMemo 渲染', {
114
+ identifier: props.element.identifier,
115
+ strLength: str.length,
116
+ selected: selected
117
+ });
109
118
  return /*#__PURE__*/ React.createElement("p", _object_spread_props(_object_spread({}, props.attributes), {
110
119
  "data-be": 'paragraph',
111
120
  "data-testid": "footnote-reference",
112
121
  "data-drag-el": true,
113
122
  className: !str ? 'empty' : undefined,
114
123
  onDragStart: function(e) {
115
- return store.dragStart(e, markdownContainerRef.current);
124
+ debugInfo('FootnoteReference - 拖拽开始');
125
+ store.dragStart(e, markdownContainerRef.current);
116
126
  },
117
127
  "data-empty": !str && selected ? 'true' : undefined
118
128
  }), /*#__PURE__*/ React.createElement(DragHandle, null), props.children);
@@ -5,7 +5,7 @@ export declare function Head({ element, attributes, children, }: ElementProps<He
5
5
  "data-be": string;
6
6
  "data-head": string;
7
7
  "data-title": boolean;
8
- onDragStart: (e: React.DragEvent<Element>) => any;
8
+ onDragStart: (e: React.DragEvent<Element>) => void;
9
9
  "data-empty": string | undefined;
10
10
  "data-align": ("center" | "left" | "right") | undefined;
11
11
  "data-drag-el": boolean;
@@ -99,21 +99,37 @@ function _unsupported_iterable_to_array(o, minLen) {
99
99
  import classNames from "classnames";
100
100
  import React, { createElement } from "react";
101
101
  import { Node } from "slate";
102
+ import { debugInfo } from "../../../../Utils/debugUtils";
102
103
  import { useSelStatus } from "../../../hooks/editor";
103
104
  import { useEditorStore } from "../../store";
104
105
  import { DragHandle } from "../../tools/DragHandle";
105
106
  import { slugify } from "../../utils/dom";
106
107
  export function Head(param) {
107
108
  var element = param.element, attributes = param.attributes, children = param.children;
109
+ var _Node_string;
110
+ debugInfo('Head - 渲染标题', {
111
+ level: element.level,
112
+ text: (_Node_string = Node.string(element)) === null || _Node_string === void 0 ? void 0 : _Node_string.substring(0, 50),
113
+ align: element.align
114
+ });
108
115
  var _useEditorStore = useEditorStore(), _useEditorStore_store = _useEditorStore.store, store = _useEditorStore_store === void 0 ? {} : _useEditorStore_store, markdownContainerRef = _useEditorStore.markdownContainerRef;
109
116
  var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), selected = _useSelStatus[0], path = _useSelStatus[1];
110
117
  var str = Node.string(element);
111
118
  return React.useMemo(function() {
119
+ debugInfo('Head - useMemo 渲染', {
120
+ level: element.level,
121
+ selected: selected,
122
+ path: path,
123
+ str: str === null || str === void 0 ? void 0 : str.substring(0, 50)
124
+ });
112
125
  var _obj;
113
126
  return /*#__PURE__*/ createElement("h".concat(element.level), _object_spread_props(_object_spread({}, attributes), (_obj = {
114
127
  id: slugify(str)
115
128
  }, _define_property(_obj, 'data-be', 'head'), _define_property(_obj, 'data-head', slugify(Node.string(element) || '')), _define_property(_obj, 'data-title', (path === null || path === void 0 ? void 0 : path[0]) === 0), _define_property(_obj, "onDragStart", function(e) {
116
- return store.dragStart(e, markdownContainerRef.current);
129
+ debugInfo('Head - 拖拽开始', {
130
+ level: element.level
131
+ });
132
+ store.dragStart(e, markdownContainerRef.current);
117
133
  }), _define_property(_obj, 'data-empty', !str && selected ? 'true' : undefined), _define_property(_obj, 'data-align', element.align), _define_property(_obj, 'data-drag-el', true), _define_property(_obj, "className", classNames({
118
134
  empty: !str
119
135
  })), _obj)), /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(DragHandle, null), children));
@@ -51,8 +51,10 @@ function _object_spread_props(target, source) {
51
51
  return target;
52
52
  }
53
53
  import React from "react";
54
+ import { debugInfo } from "../../../../Utils/debugUtils";
54
55
  export var Hr = function(param) {
55
56
  var attributes = param.attributes, children = param.children;
57
+ debugInfo('Hr - 渲染分割线');
56
58
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
57
59
  contentEditable: false,
58
60
  className: 'select-none',
@@ -251,6 +251,7 @@ import { BlockOutlined, DeleteFilled, LoadingOutlined } from "@ant-design/icons"
251
251
  import { Image, Modal, Popover, Skeleton, Space } from "antd";
252
252
  import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
253
253
  import { useRefFunction } from "../../../../Hooks/useRefFunction";
254
+ import { debugInfo } from "../../../../Utils/debugUtils";
254
255
  import { useDebounceFn } from "@ant-design/pro-components";
255
256
  import { Rnd } from "react-rnd";
256
257
  import { Path, Transforms } from "slate";
@@ -442,7 +443,14 @@ export var ReadonlyImage = function(param) {
442
443
  };
443
444
  export function EditorImage(param) {
444
445
  var element = param.element, attributes = param.attributes, children = param.children;
445
- var _state;
446
+ var _element_url, _state;
447
+ debugInfo('EditorImage - 渲染图片', {
448
+ url: element === null || element === void 0 ? void 0 : (_element_url = element.url) === null || _element_url === void 0 ? void 0 : _element_url.substring(0, 100),
449
+ alt: element === null || element === void 0 ? void 0 : element.alt,
450
+ width: element === null || element === void 0 ? void 0 : element.width,
451
+ height: element === null || element === void 0 ? void 0 : element.height,
452
+ finished: element === null || element === void 0 ? void 0 : element.finished
453
+ });
446
454
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
447
455
  var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), _ = _useSelStatus[0], path = _useSelStatus[1];
448
456
  var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly;
@@ -464,8 +472,12 @@ export function EditorImage(param) {
464
472
  });
465
473
  var locale = useContext(I18nContext).locale;
466
474
  var initial = useRefFunction(/*#__PURE__*/ _async_to_generator(function() {
467
- var type, realUrl, img;
475
+ var _element_url, type, realUrl, img;
468
476
  return _ts_generator(this, function(_state) {
477
+ debugInfo('EditorImage - 初始化图片', {
478
+ url: element === null || element === void 0 ? void 0 : (_element_url = element.url) === null || _element_url === void 0 ? void 0 : _element_url.substring(0, 100),
479
+ alt: element === null || element === void 0 ? void 0 : element.alt
480
+ });
469
481
  type = getMediaType(element === null || element === void 0 ? void 0 : element.url, element.alt);
470
482
  type = !type ? 'image' : type;
471
483
  setState({
@@ -480,18 +492,24 @@ export function EditorImage(param) {
480
492
  setState({
481
493
  url: realUrl
482
494
  });
495
+ debugInfo('EditorImage - 设置图片类型和URL', {
496
+ type: state().type,
497
+ url: realUrl === null || realUrl === void 0 ? void 0 : realUrl.substring(0, 100)
498
+ });
483
499
  if (state().type === 'image' || state().type === 'other') {
484
500
  img = document.createElement('img');
485
501
  img.referrerPolicy = 'no-referrer';
486
502
  img.crossOrigin = 'anonymous';
487
503
  img.src = realUrl;
488
504
  img.onerror = function() {
505
+ debugInfo('EditorImage - 图片加载失败');
489
506
  setState({
490
507
  loadSuccess: false
491
508
  });
492
509
  };
493
510
  img.onload = function() {
494
- return setState({
511
+ debugInfo('EditorImage - 图片加载成功');
512
+ setState({
495
513
  loadSuccess: true
496
514
  });
497
515
  };
@@ -528,11 +546,17 @@ export function EditorImage(param) {
528
546
  element.finished
529
547
  ]);
530
548
  var imageDom = useMemo(function() {
531
- var _state, _state1;
549
+ debugInfo('EditorImage - 生成图片 DOM', {
550
+ finished: element.finished,
551
+ showAsText: showAsText,
552
+ loadSuccess: state().loadSuccess,
553
+ readonly: readonly
554
+ });
532
555
  // 检查是否为不完整的图片(finished 状态)
533
556
  if (element.finished === false) {
534
557
  // 如果 5 秒后仍未完成,显示为文本
535
558
  if (showAsText) {
559
+ debugInfo('EditorImage - 显示为文本(超时)');
536
560
  return /*#__PURE__*/ React.createElement("div", {
537
561
  style: {
538
562
  padding: '8px 12px',
@@ -544,50 +568,67 @@ export function EditorImage(param) {
544
568
  }, element.alt || element.url || '图片链接');
545
569
  }
546
570
  // 5 秒内显示 loading 状态的占位符
571
+ debugInfo('EditorImage - 显示加载占位符');
547
572
  return /*#__PURE__*/ React.createElement(Skeleton.Image, {
548
573
  active: true
549
574
  });
550
575
  }
551
576
  // 如果图片加载失败,显示为链接
552
577
  if (!state().loadSuccess) {
553
- var _state2, _state3;
578
+ var _state, _state1;
579
+ debugInfo('EditorImage - 显示错误链接');
554
580
  return /*#__PURE__*/ React.createElement(MediaErrorLink, {
555
- url: (_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url,
581
+ url: (_state = state()) === null || _state === void 0 ? void 0 : _state.url,
556
582
  fallbackUrl: element === null || element === void 0 ? void 0 : element.url,
557
- displayText: (element === null || element === void 0 ? void 0 : element.alt) || ((_state3 = state()) === null || _state3 === void 0 ? void 0 : _state3.url) || (element === null || element === void 0 ? void 0 : element.url) || '图片链接',
583
+ displayText: (element === null || element === void 0 ? void 0 : element.alt) || ((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url) || '图片链接',
558
584
  style: {
559
585
  fontSize: '13px',
560
586
  lineHeight: '1.5'
561
587
  }
562
588
  });
563
589
  }
564
- return !readonly ? /*#__PURE__*/ React.createElement(ResizeImage, {
565
- defaultSize: {
566
- width: Number(element.width) || element.width || 400,
567
- height: Number(element.height) || 400
568
- },
569
- selected: state().selected,
570
- src: (_state = state()) === null || _state === void 0 ? void 0 : _state.url,
571
- onResizeStart: function() {
572
- setState({
573
- selected: true
574
- });
575
- },
576
- onResizeStop: function(size) {
577
- if (!(markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : markdownEditorRef.current)) return;
578
- Transforms.setNodes(markdownEditorRef.current, size, {
579
- at: path
580
- });
581
- setState({
582
- selected: false
583
- });
584
- }
585
- }) : /*#__PURE__*/ React.createElement(ReadonlyImage, {
586
- src: ((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url),
587
- alt: (element === null || element === void 0 ? void 0 : element.alt) || 'image',
588
- width: element.width,
589
- height: element.height
590
- });
590
+ return !readonly ? function() {
591
+ var _state;
592
+ debugInfo('EditorImage - 使用可调整大小的图片', {
593
+ width: element.width,
594
+ height: element.height
595
+ });
596
+ return /*#__PURE__*/ React.createElement(ResizeImage, {
597
+ defaultSize: {
598
+ width: Number(element.width) || element.width || 400,
599
+ height: Number(element.height) || 400
600
+ },
601
+ selected: state().selected,
602
+ src: (_state = state()) === null || _state === void 0 ? void 0 : _state.url,
603
+ onResizeStart: function() {
604
+ debugInfo('EditorImage - 开始调整大小');
605
+ setState({
606
+ selected: true
607
+ });
608
+ },
609
+ onResizeStop: function(size) {
610
+ debugInfo('EditorImage - 调整大小完成', {
611
+ size: size
612
+ });
613
+ if (!(markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : markdownEditorRef.current)) return;
614
+ Transforms.setNodes(markdownEditorRef.current, size, {
615
+ at: path
616
+ });
617
+ setState({
618
+ selected: false
619
+ });
620
+ }
621
+ });
622
+ }() : function() {
623
+ var _state;
624
+ debugInfo('EditorImage - 使用只读图片');
625
+ return /*#__PURE__*/ React.createElement(ReadonlyImage, {
626
+ src: ((_state = state()) === null || _state === void 0 ? void 0 : _state.url) || (element === null || element === void 0 ? void 0 : element.url),
627
+ alt: (element === null || element === void 0 ? void 0 : element.alt) || 'image',
628
+ width: element.width,
629
+ height: element.height
630
+ });
631
+ }();
591
632
  }, [
592
633
  state().type,
593
634
  (_state = state()) === null || _state === void 0 ? void 0 : _state.url,
@@ -51,8 +51,13 @@ function _object_spread_props(target, source) {
51
51
  return target;
52
52
  }
53
53
  import React from "react";
54
+ import { debugInfo } from "../../../../Utils/debugUtils";
54
55
  export var InlineKatex = function(param) {
55
56
  var attributes = param.attributes, children = param.children, element = param.element;
57
+ var _element_value;
58
+ debugInfo('InlineKatex - 渲染内联数学公式', {
59
+ value: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.substring(0, 50)
60
+ });
56
61
  return /*#__PURE__*/ React.createElement("code", _object_spread_props(_object_spread({}, attributes), {
57
62
  style: {
58
63
  display: 'inline-block'
@@ -51,8 +51,13 @@ function _object_spread_props(target, source) {
51
51
  return target;
52
52
  }
53
53
  import React from "react";
54
+ import { debugInfo } from "../../../../Utils/debugUtils";
54
55
  export var Katex = function(param) {
55
56
  var attributes = param.attributes, children = param.children, element = param.element;
57
+ var _element_value;
58
+ debugInfo('Katex - 渲染数学公式块', {
59
+ valueLength: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.length
60
+ });
56
61
  return /*#__PURE__*/ React.createElement("pre", _object_spread_props(_object_spread({}, attributes), {
57
62
  style: {
58
63
  background: 'rgb(242, 241, 241)',
@@ -47,12 +47,19 @@ function _unsupported_iterable_to_array(o, minLen) {
47
47
  import { ConfigProvider, Skeleton } from "antd";
48
48
  import classNames from "classnames";
49
49
  import React, { useContext, useEffect, useState } from "react";
50
+ import { debugInfo } from "../../../../Utils/debugUtils";
50
51
  import { AvatarList } from "../../components/ContributorAvatar";
51
52
  import { DragHandle } from "../../tools/DragHandle";
52
53
  import { useStyle } from "./style";
53
54
  export function LinkCard(param) {
54
55
  var element = param.element, attributes = param.attributes, children = param.children;
55
- var _element_otherProps, _element_otherProps_collaborators, _element_otherProps1, _element_otherProps2;
56
+ var _element_url, _element_otherProps, _element_otherProps_collaborators, _element_otherProps1, _element_otherProps2;
57
+ debugInfo('LinkCard - 渲染链接卡片', {
58
+ url: element === null || element === void 0 ? void 0 : (_element_url = element.url) === null || _element_url === void 0 ? void 0 : _element_url.substring(0, 100),
59
+ title: element === null || element === void 0 ? void 0 : element.title,
60
+ name: element === null || element === void 0 ? void 0 : element.name,
61
+ finished: element === null || element === void 0 ? void 0 : element.finished
62
+ });
56
63
  var context = useContext(ConfigProvider.ConfigContext);
57
64
  var baseCls = context === null || context === void 0 ? void 0 : context.getPrefixCls('agentic-md-editor-link-card');
58
65
  var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
@@ -61,8 +68,10 @@ export function LinkCard(param) {
61
68
  // 如果 finished 为 false,设置 5 秒超时,超时后显示为文本
62
69
  useEffect(function() {
63
70
  if (element.finished === false) {
71
+ debugInfo('LinkCard - 设置超时显示文本');
64
72
  setShowAsText(false);
65
73
  var timer = setTimeout(function() {
74
+ debugInfo('LinkCard - 超时,显示为文本');
66
75
  setShowAsText(true);
67
76
  }, 5000);
68
77
  return function() {
@@ -78,6 +87,7 @@ export function LinkCard(param) {
78
87
  if (element.finished === false) {
79
88
  // 如果 5 秒后仍未完成,显示为文本
80
89
  if (showAsText) {
90
+ debugInfo('LinkCard - 显示为文本');
81
91
  return /*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement("div", {
82
92
  style: {
83
93
  padding: '8px 12px',
@@ -89,6 +99,7 @@ export function LinkCard(param) {
89
99
  }, element.url || element.title || element.name || '链接卡片'), children);
90
100
  }
91
101
  // 5 秒内显示加载骨架屏
102
+ debugInfo('LinkCard - 显示加载骨架屏');
92
103
  return /*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement(Skeleton, {
93
104
  active: true,
94
105
  paragraph: {
@@ -96,6 +107,7 @@ export function LinkCard(param) {
96
107
  }
97
108
  }), children);
98
109
  }
110
+ debugInfo('LinkCard - 渲染完整链接卡片');
99
111
  return wrapSSR(/*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement("div", {
100
112
  className: classNames(baseCls, hashId),
101
113
  "data-be": "link-card",
@@ -53,6 +53,7 @@ function _object_spread_props(target, source) {
53
53
  import { ConfigProvider } from "antd";
54
54
  import classNames from "classnames";
55
55
  import React, { createElement, useContext } from "react";
56
+ import { debugInfo } from "../../../../Utils/debugUtils";
56
57
  import { useEditorStore } from "../../store";
57
58
  import { useStyle } from "./style";
58
59
  export var ListContext = /*#__PURE__*/ React.createContext(null);
@@ -73,12 +74,25 @@ export var ListContext = /*#__PURE__*/ React.createContext(null);
73
74
  * ```
74
75
  */ export var List = function(param) {
75
76
  var element = param.element, attributes = param.attributes, children = param.children;
77
+ var _element_children;
78
+ debugInfo('List - 渲染列表', {
79
+ order: element.order,
80
+ task: element.task,
81
+ start: element.start,
82
+ childrenCount: (_element_children = element.children) === null || _element_children === void 0 ? void 0 : _element_children.length
83
+ });
76
84
  var _useEditorStore = useEditorStore(), store = _useEditorStore.store, markdownContainerRef = _useEditorStore.markdownContainerRef;
77
85
  var context = useContext(ConfigProvider.ConfigContext);
78
86
  var baseCls = context.getPrefixCls('agentic-md-editor-list');
79
87
  var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
80
88
  var listContent = React.useMemo(function() {
81
89
  var tag = element.order ? 'ol' : 'ul';
90
+ debugInfo('List - useMemo 渲染', {
91
+ tag: tag,
92
+ order: element.order,
93
+ start: element.start,
94
+ task: element.task
95
+ });
82
96
  return wrapSSR(/*#__PURE__*/ React.createElement(ListContext.Provider, {
83
97
  value: {
84
98
  hashId: hashId
@@ -88,7 +102,8 @@ export var ListContext = /*#__PURE__*/ React.createContext(null);
88
102
  "data-be": 'list'
89
103
  }, attributes), {
90
104
  onDragStart: function(e) {
91
- return store.dragStart(e, markdownContainerRef.current);
105
+ debugInfo('List - 拖拽开始');
106
+ store.dragStart(e, markdownContainerRef.current);
92
107
  }
93
108
  }), /*#__PURE__*/ createElement(tag, _define_property({
94
109
  className: classNames(baseCls, hashId, element.order ? 'ol' : 'ul'),
@@ -201,6 +201,7 @@ import { useMountMergeState } from "@ant-design/pro-components";
201
201
  import { Checkbox, ConfigProvider, Dropdown, Space } from "antd";
202
202
  import classNames from "classnames";
203
203
  import React, { useContext, useEffect, useMemo } from "react";
204
+ import { debugInfo } from "../../../../Utils/debugUtils";
204
205
  import { useMEditor } from "../../../hooks/editor";
205
206
  import { useEditorStore } from "../../store";
206
207
  import { ListContext } from "./List";
@@ -369,7 +370,13 @@ var MentionsUser = function(props) {
369
370
  * - 如果是任务列表项,会渲染一个不可编辑的复选框。
370
371
  */ export var ListItem = function(param) {
371
372
  var element = param.element, children = param.children, attributes = param.attributes;
372
- var _editorProps_comment;
373
+ var _element_mentions, _element_children, _editorProps_comment;
374
+ debugInfo('ListItem - 渲染列表项', {
375
+ checked: element.checked,
376
+ isTask: typeof element.checked === 'boolean',
377
+ mentionsCount: (_element_mentions = element.mentions) === null || _element_mentions === void 0 ? void 0 : _element_mentions.length,
378
+ childrenCount: (_element_children = element.children) === null || _element_children === void 0 ? void 0 : _element_children.length
379
+ });
373
380
  var _useMEditor = _sliced_to_array(useMEditor(element), 2), update = _useMEditor[1];
374
381
  var _useEditorStore = useEditorStore(), store = _useEditorStore.store, editorProps = _useEditorStore.editorProps, markdownContainerRef = _useEditorStore.markdownContainerRef;
375
382
  var isTask = typeof element.checked === 'boolean';
@@ -386,7 +393,10 @@ var MentionsUser = function(props) {
386
393
  }, /*#__PURE__*/ React.createElement(Checkbox, {
387
394
  checked: element.checked,
388
395
  onChange: function(e) {
389
- return update({
396
+ debugInfo('ListItem - 复选框状态改变', {
397
+ checked: e.target.checked
398
+ });
399
+ update({
390
400
  checked: e.target.checked
391
401
  });
392
402
  }
@@ -419,7 +429,8 @@ var MentionsUser = function(props) {
419
429
  className: classNames("".concat(baseCls, "-item"), hashId, _define_property({}, "".concat(baseCls, "-task"), isTask)),
420
430
  "data-be": 'list-item',
421
431
  onDragStart: function(e) {
422
- return store.dragStart(e, markdownContainerRef.current);
432
+ debugInfo('ListItem - 拖拽开始');
433
+ store.dragStart(e, markdownContainerRef.current);
423
434
  }
424
435
  }, attributes), listItemRender(props, {
425
436
  element: element,
@@ -431,7 +442,8 @@ var MentionsUser = function(props) {
431
442
  className: classNames("".concat(baseCls, "-item"), hashId, _define_property({}, "".concat(baseCls, "-task"), isTask)),
432
443
  "data-be": 'list-item',
433
444
  onDragStart: function(e) {
434
- return store.dragStart(e, markdownContainerRef.current);
445
+ debugInfo('ListItem - 拖拽开始');
446
+ store.dragStart(e, markdownContainerRef.current);
435
447
  }
436
448
  }, attributes), checkbox, mentionsUser, children);
437
449
  }, [
@@ -53,14 +53,19 @@ function _object_spread_props(target, source) {
53
53
  import { ConfigProvider } from "antd";
54
54
  import classNames from "classnames";
55
55
  import React, { useContext } from "react";
56
+ import { debugInfo } from "../../../../Utils/debugUtils";
56
57
  import { useStyle } from "./style";
57
58
  export var Mermaid = function(param) {
58
59
  var attributes = param.attributes, children = param.children, element = param.element;
59
- var _element_otherProps;
60
+ var _element_otherProps, _element_value, _element_otherProps1;
61
+ debugInfo('Mermaid - 渲染 Mermaid 图表', {
62
+ hasError: (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.error) === true,
63
+ valueLength: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.length
64
+ });
60
65
  var context = useContext(ConfigProvider.ConfigContext);
61
66
  var baseCls = context === null || context === void 0 ? void 0 : context.getPrefixCls('agentic-md-editor-mermaid');
62
67
  var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
63
- var hasError = (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.error) === true;
68
+ var hasError = (element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.error) === true;
64
69
  return wrapSSR(/*#__PURE__*/ React.createElement("pre", _object_spread_props(_object_spread({}, attributes), {
65
70
  className: classNames(baseCls, hashId, _define_property({}, "".concat(baseCls, "-error"), hasError))
66
71
  }), /*#__PURE__*/ React.createElement("code", null, children)));
@@ -100,17 +100,28 @@ import classNames from "classnames";
100
100
  import React, { useContext } from "react";
101
101
  import { Node } from "slate";
102
102
  import { I18nContext } from "../../../../I18n";
103
+ import { debugInfo } from "../../../../Utils/debugUtils";
103
104
  import { useSelStatus } from "../../../hooks/editor";
104
105
  import { useEditorStore } from "../../store";
105
106
  import { DragHandle } from "../../tools/DragHandle";
106
107
  export var Paragraph = function(props) {
107
- var _markdownEditorRef_current;
108
+ var _props_element_children, _markdownEditorRef_current;
109
+ debugInfo('Paragraph - 渲染段落', {
110
+ align: props.element.align,
111
+ childrenCount: (_props_element_children = props.element.children) === null || _props_element_children === void 0 ? void 0 : _props_element_children.length
112
+ });
108
113
  var _useEditorStore = useEditorStore(), store = _useEditorStore.store, markdownEditorRef = _useEditorStore.markdownEditorRef, markdownContainerRef = _useEditorStore.markdownContainerRef, readonly = _useEditorStore.readonly, editorProps = _useEditorStore.editorProps;
109
114
  var locale = useContext(I18nContext).locale;
110
115
  var _useSelStatus = _sliced_to_array(useSelStatus(props.element), 1), selected = _useSelStatus[0];
111
116
  return React.useMemo(function() {
112
117
  var _markdownEditorRef_current, _props_element_children_every, _props_element_children, _props_element, _props_children;
113
118
  var str = Node.string(props.element).trim();
119
+ debugInfo('Paragraph - useMemo 渲染', {
120
+ strLength: str.length,
121
+ selected: selected,
122
+ readonly: readonly,
123
+ align: props.element.align
124
+ });
114
125
  var isEmpty = !str && ((_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length) === 1 && ((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_children = _props_element.children) === null || _props_element_children === void 0 ? void 0 : (_props_element_children_every = _props_element_children.every) === null || _props_element_children_every === void 0 ? void 0 : _props_element_children_every.call(_props_element_children, function(child) {
115
126
  return !child.type && !child.code && !child.tag;
116
127
  })) ? true : undefined;
@@ -123,7 +134,8 @@ export var Paragraph = function(props) {
123
134
  "data-align": props.element.align,
124
135
  "data-slate-placeholder": isEmpty ? editorProps.titlePlaceholderContent || (locale === null || locale === void 0 ? void 0 : locale.inputPlaceholder) || '请输入内容...' : undefined,
125
136
  onDragStart: function(e) {
126
- return store.dragStart(e, markdownContainerRef.current);
137
+ debugInfo('Paragraph - 拖拽开始');
138
+ store.dragStart(e, markdownContainerRef.current);
127
139
  },
128
140
  "data-empty": isEmpty,
129
141
  style: {