@ant-design/agentic-ui 2.27.10 → 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 (29) hide show
  1. package/dist/MarkdownEditor/editor/elements/Blockquote/index.js +11 -1
  2. package/dist/MarkdownEditor/editor/elements/Break/index.js +2 -0
  3. package/dist/MarkdownEditor/editor/elements/Card/index.js +11 -0
  4. package/dist/MarkdownEditor/editor/elements/Code/index.js +22 -7
  5. package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/index.js +15 -1
  6. package/dist/MarkdownEditor/editor/elements/FootnoteReference/index.js +11 -1
  7. package/dist/MarkdownEditor/editor/elements/Head/index.d.ts +1 -1
  8. package/dist/MarkdownEditor/editor/elements/Head/index.js +17 -1
  9. package/dist/MarkdownEditor/editor/elements/Hr/index.js +2 -0
  10. package/dist/MarkdownEditor/editor/elements/Image/index.js +75 -34
  11. package/dist/MarkdownEditor/editor/elements/InlineKatex/index.js +5 -0
  12. package/dist/MarkdownEditor/editor/elements/Katex/index.js +5 -0
  13. package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +13 -1
  14. package/dist/MarkdownEditor/editor/elements/List/List.js +16 -1
  15. package/dist/MarkdownEditor/editor/elements/List/ListItem.js +16 -4
  16. package/dist/MarkdownEditor/editor/elements/Mermaid/index.js +7 -2
  17. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +14 -2
  18. package/dist/MarkdownEditor/editor/elements/Schema/index.js +13 -0
  19. package/dist/MarkdownEditor/editor/elements/index.js +131 -16
  20. package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +84 -17
  21. package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +39 -2
  22. package/dist/MarkdownEditor/editor/parser/parse/parseElements.js +27 -2
  23. package/dist/MarkdownEditor/editor/parser/parse/parseFootnote.js +11 -1
  24. package/dist/MarkdownEditor/editor/parser/parse/parseMath.js +31 -4
  25. package/dist/MarkdownEditor/editor/parser/parse/parseMedia.js +41 -6
  26. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +141 -24
  27. package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +127 -6
  28. package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +109 -2
  29. package/package.json +1 -1
@@ -81,6 +81,7 @@ function _unsupported_iterable_to_array(o, minLen) {
81
81
  }
82
82
  import { Node } from "slate";
83
83
  import stringWidth from "string-width";
84
+ import { debugInfo } from "../../../Utils/debugUtils";
84
85
  import { getMediaType } from "../utils/dom";
85
86
  var inlineNode = new Set([
86
87
  'break'
@@ -248,11 +249,23 @@ var inlineNode = new Set([
248
249
  * ```
249
250
  */ var parserNode = function(node) {
250
251
  var preString = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '', parent = arguments.length > 2 ? arguments[2] : void 0, plugins = arguments.length > 3 ? arguments[3] : void 0;
252
+ var _parent_;
251
253
  var str = '';
252
- if (!node) return str;
254
+ if (!node) {
255
+ debugInfo('parserSlateNodeToMarkdown.parserNode - 空节点');
256
+ return str;
257
+ }
258
+ debugInfo('parserSlateNodeToMarkdown.parserNode - 开始解析节点', {
259
+ nodeType: node.type,
260
+ preString: preString,
261
+ parentType: (_parent_ = parent[parent.length - 1]) === null || _parent_ === void 0 ? void 0 : _parent_.type
262
+ });
253
263
  // 首先尝试使用插件处理
254
264
  var pluginResult = tryPluginConversion(node, preString, parent, plugins);
255
265
  if (pluginResult !== null) {
266
+ debugInfo('parserSlateNodeToMarkdown.parserNode - 使用插件转换', {
267
+ resultLength: pluginResult.length
268
+ });
256
269
  return pluginResult;
257
270
  }
258
271
  switch(node.type){
@@ -315,6 +328,11 @@ var inlineNode = new Set([
315
328
  str += handleDefault(node, parent);
316
329
  break;
317
330
  }
331
+ debugInfo('parserSlateNodeToMarkdown.parserNode - 节点解析完成', {
332
+ nodeType: node.type,
333
+ resultLength: str.length,
334
+ resultPreview: str.substring(0, 50)
335
+ });
318
336
  return str;
319
337
  };
320
338
  /**
@@ -332,7 +350,16 @@ var inlineNode = new Set([
332
350
  var _loop = function(i) {
333
351
  var _tree_, _tree_1;
334
352
  var node = tree[i];
353
+ debugInfo("parserSlateNodeToMarkdown - 处理节点 ".concat(i, "/").concat(tree.length), {
354
+ nodeType: node === null || node === void 0 ? void 0 : node.type,
355
+ hasOtherProps: !!(node === null || node === void 0 ? void 0 : node.otherProps),
356
+ otherPropsKeys: (node === null || node === void 0 ? void 0 : node.otherProps) ? Object.keys(node.otherProps) : []
357
+ });
335
358
  if (node.otherProps && Object.keys(node.otherProps).length) {
359
+ debugInfo("parserSlateNodeToMarkdown - 处理 otherProps ".concat(i), {
360
+ nodeType: node.type,
361
+ originalOtherProps: node.otherProps
362
+ });
336
363
  var configProps = _object_spread({}, node.otherProps);
337
364
  delete configProps['columns'];
338
365
  delete configProps['dataSource'];
@@ -343,6 +370,9 @@ var inlineNode = new Set([
343
370
  configProps.name = node.name || node.title || configProps.name;
344
371
  configProps.description = node.description || configProps.description;
345
372
  configProps.icon = node.icon || configProps.icon;
373
+ debugInfo("parserSlateNodeToMarkdown - link-card 转换 ".concat(i), {
374
+ configProps: configProps
375
+ });
346
376
  }
347
377
  Object.keys(configProps).forEach(function(key) {
348
378
  if (_type_of(configProps[key]) === 'object' && configProps[key]) {
@@ -386,6 +416,10 @@ var inlineNode = new Set([
386
416
  };
387
417
  // 对于图表类型,配置应该总是以数组形式存储在 config 中
388
418
  if (node.type === 'chart') {
419
+ debugInfo("parserSlateNodeToMarkdown - 处理图表节点 ".concat(i), {
420
+ originalConfig: configProps.config,
421
+ hasChartType: !!configProps.chartType
422
+ });
389
423
  var chartConfig = configProps.config;
390
424
  // 如果 config 不存在,但 configProps 看起来像图表配置(有 chartType),使用 configProps
391
425
  if (!chartConfig && configProps.chartType) {
@@ -393,6 +427,10 @@ var inlineNode = new Set([
393
427
  }
394
428
  // 如果 chartConfig 是对象且键都是数字(如 {0: {...}}),转换为数组
395
429
  chartConfig = convertObjectToArray(chartConfig);
430
+ debugInfo("parserSlateNodeToMarkdown - 图表配置转换后 ".concat(i), {
431
+ chartConfig: chartConfig,
432
+ isArray: Array.isArray(chartConfig)
433
+ });
396
434
  // 如果 chartConfig 还不是数组,将其包装为数组
397
435
  // 这样可以确保即使只有一个配置项,也会被放入数组中
398
436
  if (!Array.isArray(chartConfig)) {
@@ -472,6 +510,13 @@ var inlineNode = new Set([
472
510
  str += '\n' + preString + '> ';
473
511
  }
474
512
  } else if (node.type === 'blockquote') {
513
+ var _node_children, _node_children1;
514
+ debugInfo("parserSlateNodeToMarkdown - 处理引用块 ".concat(i), {
515
+ childrenCount: (_node_children = node.children) === null || _node_children === void 0 ? void 0 : _node_children.length,
516
+ hasNestedBlockquote: (_node_children1 = node.children) === null || _node_children1 === void 0 ? void 0 : _node_children1.some(function(c) {
517
+ return c.type === 'blockquote';
518
+ })
519
+ });
475
520
  // Handle blockquotes
476
521
  var blockquoteContent = node.children.map(function(child) {
477
522
  if (child.type === 'blockquote') {
@@ -495,7 +540,16 @@ var inlineNode = new Set([
495
540
  }
496
541
  }).join('\n');
497
542
  str += blockquoteContent;
543
+ debugInfo("parserSlateNodeToMarkdown - 引用块处理完成 ".concat(i), {
544
+ contentLength: blockquoteContent.length
545
+ });
498
546
  } else if (node.type === 'list') {
547
+ var _node_children2;
548
+ debugInfo("parserSlateNodeToMarkdown - 处理列表 ".concat(i), {
549
+ isOrdered: node.order,
550
+ start: node.start,
551
+ childrenCount: (_node_children2 = node.children) === null || _node_children2 === void 0 ? void 0 : _node_children2.length
552
+ });
499
553
  // Handle lists
500
554
  var listItems = node.children.map(function(item, index) {
501
555
  var prefix = node.order ? "".concat(index + (node.start || 1), ".") : '-';
@@ -510,6 +564,10 @@ var inlineNode = new Set([
510
564
  str += '\n\n';
511
565
  }
512
566
  }
567
+ debugInfo("parserSlateNodeToMarkdown - 列表处理完成 ".concat(i), {
568
+ listItemsLength: listItems.length,
569
+ hasContent: !!listItems.trim()
570
+ });
513
571
  } else if (node.type === 'paragraph' && ((_tree_ = tree[i - 1]) === null || _tree_ === void 0 ? void 0 : _tree_.type) === 'list' && ((_tree_1 = tree[i + 1]) === null || _tree_1 === void 0 ? void 0 : _tree_1.type) === 'list') {
514
572
  var _Node_string;
515
573
  if (!((_Node_string = Node.string(node)) === null || _Node_string === void 0 ? void 0 : _Node_string.replace(/\s|\t/g, ''))) {
@@ -543,20 +601,40 @@ var inlineNode = new Set([
543
601
  root: true
544
602
  }
545
603
  ], plugins = arguments.length > 3 ? arguments[3] : void 0;
604
+ var _parent_;
605
+ debugInfo('parserSlateNodeToMarkdown - 开始转换', {
606
+ treeLength: tree === null || tree === void 0 ? void 0 : tree.length,
607
+ preString: preString,
608
+ parentType: ((_parent_ = parent[parent.length - 1]) === null || _parent_ === void 0 ? void 0 : _parent_.type) || 'root',
609
+ hasPlugins: !!plugins && plugins.length > 0
610
+ });
546
611
  var str = '';
547
612
  for(var i = 0; i < tree.length; i++)_loop(i);
548
613
  // Clean up trailing newlines and handle special cases
549
614
  if (str) {
550
- var _parent_;
615
+ var _parent_1;
616
+ debugInfo('parserSlateNodeToMarkdown - 开始清理换行符', {
617
+ strLength: str.length,
618
+ trailingNewlines: (str.match(/\n+$/) || [
619
+ ''
620
+ ])[0].length
621
+ });
551
622
  // Remove all trailing newlines first
552
623
  str = str.replace(/\n+$/, '');
553
624
  // Only add newlines in specific cases
554
625
  var lastNode = tree[tree.length - 1];
555
626
  var isRoot = parent.length === 1 && parent[0].root;
556
627
  var isConverted = lastNode === null || lastNode === void 0 ? void 0 : lastNode.converted;
557
- var parentType = (_parent_ = parent[parent.length - 1]) === null || _parent_ === void 0 ? void 0 : _parent_.type;
628
+ var parentType = (_parent_1 = parent[parent.length - 1]) === null || _parent_1 === void 0 ? void 0 : _parent_1.type;
558
629
  var nextNode = tree[tree.indexOf(lastNode) + 1];
559
630
  var isLastNodeInParent = !nextNode;
631
+ debugInfo('parserSlateNodeToMarkdown - 换行符处理上下文', {
632
+ lastNodeType: lastNode === null || lastNode === void 0 ? void 0 : lastNode.type,
633
+ isRoot: isRoot,
634
+ isConverted: isConverted,
635
+ parentType: parentType,
636
+ isLastNodeInParent: isLastNodeInParent
637
+ });
560
638
  if (lastNode && lastNode.type && !isConverted) {
561
639
  if (parentType === 'blockquote') {
562
640
  // Only add trailing blockquote marker if this is not the last node in a nested blockquote
@@ -586,11 +664,25 @@ var inlineNode = new Set([
586
664
  }
587
665
  }
588
666
  // Clean up multiple consecutive newlines
667
+ var beforeCleanup = str.length;
589
668
  str = str.replace(/\n{3,}/g, '\n\n');
669
+ debugInfo('parserSlateNodeToMarkdown - 清理连续换行符', {
670
+ beforeLength: beforeCleanup,
671
+ afterLength: str.length
672
+ });
590
673
  // Remove leading newlines for root level content
591
674
  if (parent.length === 1 && parent[0].root) {
675
+ var beforeLeading = str.length;
592
676
  str = str.replace(/^\n+/, '');
677
+ debugInfo('parserSlateNodeToMarkdown - 清理前导换行符', {
678
+ beforeLength: beforeLeading,
679
+ afterLength: str.length
680
+ });
593
681
  }
682
+ debugInfo('parserSlateNodeToMarkdown - 转换完成', {
683
+ finalLength: str.length,
684
+ finalPreview: str.substring(0, 100)
685
+ });
594
686
  return str;
595
687
  };
596
688
  export var isMix = function(t) {
@@ -779,10 +871,26 @@ export var isMix = function(t) {
779
871
  * | 左对齐 | 居中 | 右对齐 |
780
872
  * ```
781
873
  */ var table = function(el, parent, plugins) {
782
- var _children_;
874
+ var _el_children, _children_;
875
+ debugInfo('parserSlateNodeToMarkdown.table - 开始处理表格', {
876
+ elType: el.type,
877
+ childrenCount: (_el_children = el.children) === null || _el_children === void 0 ? void 0 : _el_children.length
878
+ });
783
879
  var children = el.children;
784
880
  var head = (_children_ = children[0]) === null || _children_ === void 0 ? void 0 : _children_.children;
785
- if (!children.length || !head.length) return '';
881
+ if (!children.length || !head.length) {
882
+ debugInfo('parserSlateNodeToMarkdown.table - 空表格,返回空字符串');
883
+ return '';
884
+ }
885
+ debugInfo('parserSlateNodeToMarkdown.table - 表格头部信息', {
886
+ headLength: head.length,
887
+ headCells: head.map(function(h) {
888
+ return {
889
+ type: h.type,
890
+ align: h.align
891
+ };
892
+ })
893
+ });
786
894
  var data = new Array(children.length);
787
895
  var maxColumns = 0;
788
896
  // 使用策略模式处理不同类型的表格
@@ -855,6 +963,13 @@ export var isMix = function(t) {
855
963
  var processor = tableProcessors[el.type] || tableProcessors.default;
856
964
  var rowCount = processor();
857
965
  data.length = rowCount;
966
+ debugInfo('parserSlateNodeToMarkdown.table - 表格数据处理完成', {
967
+ rowCount: rowCount,
968
+ maxColumns: maxColumns,
969
+ dataPreview: data.slice(0, 2).map(function(row) {
970
+ return row.slice(0, 3);
971
+ })
972
+ });
858
973
  // 计算列宽
859
974
  var colLength = new Array(maxColumns).fill(0);
860
975
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -939,7 +1054,13 @@ export var isMix = function(t) {
939
1054
  output.push("| ".concat(separators.join(' | '), " |"));
940
1055
  }
941
1056
  }
942
- return output.join('\n');
1057
+ var result = output.join('\n');
1058
+ debugInfo('parserSlateNodeToMarkdown.table - 表格转换完成', {
1059
+ outputRows: output.length,
1060
+ resultLength: result.length,
1061
+ resultPreview: result.substring(0, 200)
1062
+ });
1063
+ return result;
943
1064
  };
944
1065
  /**
945
1066
  * 处理卡片节点,递归处理其子节点
@@ -235,6 +235,7 @@ function _ts_generator(thisArg, body) {
235
235
  import { message } from "antd";
236
236
  import { Editor, Element, Node, Path, Range, Transforms } from "slate";
237
237
  import { jsx } from "slate-hyperscript";
238
+ import { debugInfo } from "../../../Utils/debugUtils";
238
239
  import { debugLog, EditorUtils } from "../utils";
239
240
  import { docxDeserializer } from "../utils/docx/docxDeserializer";
240
241
  import { BackspaceKey } from "./hotKeyCommands/backspace";
@@ -866,12 +867,25 @@ var blobToFile = /*#__PURE__*/ function() {
866
867
  * 优化的HTML解析函数,支持分段处理
867
868
  */ var parseHtmlOptimized = /*#__PURE__*/ function() {
868
869
  var _ref = _async_to_generator(function(html, rtf) {
870
+ var result;
869
871
  return _ts_generator(this, function(_state) {
872
+ debugInfo('parseHtmlOptimized - 开始解析', {
873
+ htmlLength: html.length,
874
+ rtfLength: rtf.length,
875
+ useSync: html.length < MAX_SYNC_SIZE
876
+ });
870
877
  // 对于小内容,使用同步处理
871
878
  if (html.length < MAX_SYNC_SIZE) {
879
+ result = docxDeserializer(rtf, html.trim());
880
+ debugInfo('parseHtmlOptimized - 同步解析完成', {
881
+ resultLength: result === null || result === void 0 ? void 0 : result.length,
882
+ resultTypes: result === null || result === void 0 ? void 0 : result.map(function(r) {
883
+ return r === null || r === void 0 ? void 0 : r.type;
884
+ })
885
+ });
872
886
  return [
873
887
  2,
874
- docxDeserializer(rtf, html.trim())
888
+ result
875
889
  ];
876
890
  }
877
891
  // 对于大内容,使用异步处理
@@ -881,10 +895,20 @@ var blobToFile = /*#__PURE__*/ function() {
881
895
  // 使用 requestIdleCallback 在空闲时间处理
882
896
  var processInIdle = function() {
883
897
  try {
898
+ debugInfo('parseHtmlOptimized - 异步解析开始');
884
899
  var result = docxDeserializer(rtf, html.trim());
900
+ debugInfo('parseHtmlOptimized - 异步解析完成', {
901
+ resultLength: result === null || result === void 0 ? void 0 : result.length,
902
+ resultTypes: result === null || result === void 0 ? void 0 : result.map(function(r) {
903
+ return r === null || r === void 0 ? void 0 : r.type;
904
+ })
905
+ });
885
906
  resolve(result);
886
907
  } catch (error) {
887
908
  console.error('HTML解析失败:', error);
909
+ debugInfo('parseHtmlOptimized - 解析失败', {
910
+ error: error
911
+ });
888
912
  resolve([]);
889
913
  }
890
914
  };
@@ -910,8 +934,18 @@ var blobToFile = /*#__PURE__*/ function() {
910
934
  * @param html
911
935
  * @returns
912
936
  */ export var htmlToFragmentList = function(html, rtl) {
937
+ debugInfo('htmlToFragmentList - 开始转换', {
938
+ htmlLength: html.length,
939
+ rtlLength: rtl.length
940
+ });
913
941
  var fragmentList = docxDeserializer(rtl, html.trim());
914
- return fragmentList.map(function(fragment) {
942
+ debugInfo('htmlToFragmentList - 反序列化完成', {
943
+ fragmentListLength: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.length,
944
+ fragmentTypes: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(f) {
945
+ return f === null || f === void 0 ? void 0 : f.type;
946
+ })
947
+ });
948
+ var result = fragmentList.map(function(fragment) {
915
949
  if (fragment.type === 'table') {
916
950
  return EditorUtils.wrapperCardNode(fragment);
917
951
  }
@@ -923,6 +957,13 @@ var blobToFile = /*#__PURE__*/ function() {
923
957
  }
924
958
  return fragment;
925
959
  });
960
+ debugInfo('htmlToFragmentList - 转换完成', {
961
+ resultLength: result.length,
962
+ resultTypes: result.map(function(r) {
963
+ return r === null || r === void 0 ? void 0 : r.type;
964
+ })
965
+ });
966
+ return result;
926
967
  };
927
968
  export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
928
969
  var _ref = _async_to_generator(function(editor, html, editorProps, rtl) {
@@ -930,8 +971,15 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
930
971
  return _ts_generator(this, function(_state) {
931
972
  switch(_state.label){
932
973
  case 0:
974
+ debugInfo('insertParsedHtmlNodes - 开始插入 HTML 节点', {
975
+ htmlLength: html === null || html === void 0 ? void 0 : html.length,
976
+ htmlPreview: html === null || html === void 0 ? void 0 : html.substring(0, 200),
977
+ rtlLength: rtl === null || rtl === void 0 ? void 0 : rtl.length,
978
+ hasEditorProps: !!editorProps
979
+ });
933
980
  // 1. 基础检查
934
981
  if (html.startsWith('<html>\r\n<body>\r\n\x3C!--StartFragment--><img src="')) {
982
+ debugInfo('insertParsedHtmlNodes - 跳过特殊格式的 HTML');
935
983
  return [
936
984
  2,
937
985
  false
@@ -947,13 +995,22 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
947
995
  ,
948
996
  18
949
997
  ]);
998
+ // 3. 异步解析 HTML
999
+ debugInfo('insertParsedHtmlNodes - 开始解析 HTML');
950
1000
  return [
951
1001
  4,
952
1002
  parseHtmlOptimized(html, rtl)
953
1003
  ];
954
1004
  case 2:
955
1005
  fragmentList = _state.sent();
1006
+ debugInfo('insertParsedHtmlNodes - HTML 解析完成', {
1007
+ fragmentListLength: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.length,
1008
+ fragmentTypes: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(f) {
1009
+ return f === null || f === void 0 ? void 0 : f.type;
1010
+ })
1011
+ });
956
1012
  if (!(fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.length)) {
1013
+ debugInfo('insertParsedHtmlNodes - 解析结果为空');
957
1014
  hideLoading();
958
1015
  return [
959
1016
  2,
@@ -961,12 +1018,14 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
961
1018
  ];
962
1019
  }
963
1020
  // 4. 异步处理文件上传
1021
+ debugInfo('insertParsedHtmlNodes - 开始处理文件上传');
964
1022
  return [
965
1023
  4,
966
1024
  upLoadFileBatch(fragmentList, editorProps)
967
1025
  ];
968
1026
  case 3:
969
1027
  _state.sent();
1028
+ debugInfo('insertParsedHtmlNodes - 文件上传完成');
970
1029
  debugLog('wordFragmentList', fragmentList);
971
1030
  hideLoading();
972
1031
  // 5. 获取当前节点
@@ -980,6 +1039,7 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
980
1039
  3,
981
1040
  5
982
1041
  ];
1042
+ debugInfo('insertParsedHtmlNodes - 无有效选区,直接插入');
983
1043
  processedNodes = fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(item) {
984
1044
  if (!item.type) {
985
1045
  return {
@@ -991,12 +1051,19 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
991
1051
  }
992
1052
  return item;
993
1053
  });
1054
+ debugInfo('insertParsedHtmlNodes - 处理后的节点', {
1055
+ processedNodesLength: processedNodes === null || processedNodes === void 0 ? void 0 : processedNodes.length,
1056
+ processedTypes: processedNodes === null || processedNodes === void 0 ? void 0 : processedNodes.map(function(n) {
1057
+ return n === null || n === void 0 ? void 0 : n.type;
1058
+ })
1059
+ });
994
1060
  return [
995
1061
  4,
996
1062
  insertNodesBatch(editor, processedNodes)
997
1063
  ];
998
1064
  case 4:
999
1065
  _state.sent();
1066
+ debugInfo('insertParsedHtmlNodes - 节点插入完成');
1000
1067
  return [
1001
1068
  2,
1002
1069
  true
@@ -1004,6 +1071,12 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
1004
1071
  case 5:
1005
1072
  // 7. 处理非折叠选区
1006
1073
  if (!Range.isCollapsed(selection)) {
1074
+ debugInfo('insertParsedHtmlNodes - 处理非折叠选区', {
1075
+ selectionRange: {
1076
+ anchor: selection.anchor,
1077
+ focus: selection.focus
1078
+ }
1079
+ });
1007
1080
  back = new BackspaceKey(editor);
1008
1081
  back.range();
1009
1082
  Transforms.select(editor, Range.start(selection));
@@ -1039,16 +1112,34 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
1039
1112
  // 9. 处理代码块和表格单元格
1040
1113
  parsed = new DOMParser().parseFromString(html, 'text/html').body;
1041
1114
  inner = !!parsed.querySelector('[data-be]');
1115
+ debugInfo('insertParsedHtmlNodes - DOM 解析完成', {
1116
+ hasDataBe: inner,
1117
+ parsedBodyChildren: parsed.children.length
1118
+ });
1042
1119
  // 对于代码块,检查是否包含代码相关的标签
1043
1120
  if ((node === null || node === void 0 ? void 0 : node[0].type) === 'code') {
1121
+ debugInfo('insertParsedHtmlNodes - 当前节点是代码块', {
1122
+ nodeType: node[0].type
1123
+ });
1044
1124
  hasCodeTags = html.includes('<pre>') || html.includes('<code>') || inner;
1125
+ debugInfo('insertParsedHtmlNodes - 代码块检查', {
1126
+ hasPreTag: html.includes('<pre>'),
1127
+ hasCodeTag: html.includes('<code>'),
1128
+ hasDataBe: inner,
1129
+ hasCodeTags: hasCodeTags
1130
+ });
1045
1131
  if (hasCodeTags) {
1046
1132
  // 从 HTML 中提取纯文本内容
1047
1133
  textContent = parsed.textContent || '';
1134
+ debugInfo('insertParsedHtmlNodes - 提取文本内容', {
1135
+ textContentLength: textContent.length,
1136
+ textContentPreview: textContent.substring(0, 100)
1137
+ });
1048
1138
  if (textContent.trim()) {
1049
1139
  Transforms.insertText(editor, textContent.trim(), {
1050
1140
  at: selection
1051
1141
  });
1142
+ debugInfo('insertParsedHtmlNodes - 代码块文本插入完成');
1052
1143
  return [
1053
1144
  2,
1054
1145
  true
@@ -1067,8 +1158,16 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
1067
1158
  3,
1068
1159
  12
1069
1160
  ];
1161
+ debugInfo('insertParsedHtmlNodes - 处理列表项', {
1162
+ currentNodeType: node[0].type,
1163
+ fragmentListType: fragmentList[0].type
1164
+ });
1070
1165
  children = fragmentList[0].children || [];
1166
+ debugInfo('insertParsedHtmlNodes - 列表项子节点', {
1167
+ childrenCount: children.length
1168
+ });
1071
1169
  if (!children.length) {
1170
+ debugInfo('insertParsedHtmlNodes - 列表项无子节点');
1072
1171
  return [
1073
1172
  2,
1074
1173
  false
@@ -1228,6 +1327,7 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
1228
1327
  }
1229
1328
  }
1230
1329
  // 14. 默认情况:替换选中节点
1330
+ debugInfo('insertParsedHtmlNodes - 使用默认处理方式');
1231
1331
  processedNodes1 = fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(item) {
1232
1332
  if (!item.type) {
1233
1333
  return {
@@ -1246,12 +1346,19 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
1246
1346
  }
1247
1347
  return item;
1248
1348
  });
1349
+ debugInfo('insertParsedHtmlNodes - 默认处理节点准备完成', {
1350
+ processedNodesLength: processedNodes1 === null || processedNodes1 === void 0 ? void 0 : processedNodes1.length,
1351
+ processedTypes: processedNodes1 === null || processedNodes1 === void 0 ? void 0 : processedNodes1.map(function(n) {
1352
+ return n === null || n === void 0 ? void 0 : n.type;
1353
+ })
1354
+ });
1249
1355
  return [
1250
1356
  4,
1251
1357
  insertNodesBatch(editor, processedNodes1)
1252
1358
  ];
1253
1359
  case 16:
1254
1360
  _state.sent();
1361
+ debugInfo('insertParsedHtmlNodes - 默认处理完成');
1255
1362
  return [
1256
1363
  2,
1257
1364
  true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.27.10",
3
+ "version": "2.28.0",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",