@ant-design/agentic-ui 2.16.0 → 2.16.1

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 (53) hide show
  1. package/dist/MarkdownEditor/editor/elements/Code.js +11 -6
  2. package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +15 -3
  3. package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +17 -2
  4. package/dist/MarkdownEditor/editor/elements/Table/Table.js +131 -5
  5. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.d.ts +100 -1
  6. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +781 -240
  7. package/dist/MarkdownEditor/editor/types/Table.d.ts +1 -0
  8. package/dist/MarkdownEditor/editor/utils/findMatchingClose.d.ts +36 -0
  9. package/dist/MarkdownEditor/editor/utils/findMatchingClose.js +158 -0
  10. package/dist/MarkdownEditor/editor/utils/markdownToHtml.d.ts +41 -2
  11. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +159 -7
  12. package/dist/Plugins/chart/AreaChart/index.d.ts +12 -0
  13. package/dist/Plugins/chart/AreaChart/index.js +14 -188
  14. package/dist/Plugins/chart/BarChart/index.d.ts +2 -0
  15. package/dist/Plugins/chart/BarChart/index.js +3 -12
  16. package/dist/Plugins/chart/ChartMark/Container.js +5 -2
  17. package/dist/Plugins/chart/ChartRender.d.ts +1 -0
  18. package/dist/Plugins/chart/ChartRender.js +104 -43
  19. package/dist/Plugins/chart/DonutChart/index.js +4 -2
  20. package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
  21. package/dist/Plugins/chart/FunnelChart/index.d.ts +2 -0
  22. package/dist/Plugins/chart/FunnelChart/index.js +4 -2
  23. package/dist/Plugins/chart/LineChart/index.d.ts +2 -0
  24. package/dist/Plugins/chart/LineChart/index.js +17 -162
  25. package/dist/Plugins/chart/RadarChart/index.d.ts +2 -0
  26. package/dist/Plugins/chart/RadarChart/index.js +8 -4
  27. package/dist/Plugins/chart/ScatterChart/index.d.ts +2 -0
  28. package/dist/Plugins/chart/ScatterChart/index.js +8 -4
  29. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +1 -0
  30. package/dist/Plugins/chart/components/ChartFilter/ChartFilter.d.ts +1 -1
  31. package/dist/Plugins/chart/components/ChartFilter/ChartFilter.js +210 -16
  32. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +2 -0
  33. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +9 -2
  34. package/dist/Plugins/chart/components/ChartToolBar/style.js +3 -1
  35. package/dist/Plugins/chart/hooks/index.d.ts +10 -0
  36. package/dist/Plugins/chart/hooks/index.js +8 -0
  37. package/dist/Plugins/chart/hooks/useChartDataFilter.d.ts +46 -0
  38. package/dist/Plugins/chart/hooks/useChartDataFilter.js +182 -0
  39. package/dist/Plugins/chart/hooks/useChartStatistics.d.ts +17 -0
  40. package/dist/Plugins/chart/hooks/useChartStatistics.js +25 -0
  41. package/dist/Plugins/chart/hooks/useChartTheme.d.ts +20 -0
  42. package/dist/Plugins/chart/hooks/useChartTheme.js +30 -0
  43. package/dist/Plugins/chart/hooks/useResponsiveSize.d.ts +23 -0
  44. package/dist/Plugins/chart/hooks/useResponsiveSize.js +94 -0
  45. package/dist/Plugins/chart/index.js +92 -8
  46. package/dist/Plugins/chart/utils/registerChart.d.ts +35 -0
  47. package/dist/Plugins/chart/utils/registerChart.js +54 -0
  48. package/dist/Plugins/chart/utils.d.ts +19 -0
  49. package/dist/Plugins/chart/utils.js +27 -0
  50. package/dist/Plugins/code/components/CodeRenderer.js +53 -2
  51. package/dist/Plugins/code/components/CodeToolbar.js +22 -3
  52. package/dist/Plugins/mermaid/Mermaid.js +66 -66
  53. package/package.json +1 -1
@@ -54,18 +54,22 @@ import DOMPurify from "dompurify";
54
54
  import React from "react";
55
55
  export var Code = function(param) {
56
56
  var attributes = param.attributes, children = param.children, element = param.element;
57
- var _element_otherProps, _element_value;
57
+ var _element_otherProps, _element_otherProps1, _element_value;
58
58
  if ((element === null || element === void 0 ? void 0 : element.language) === 'html') {
59
- var _element_otherProps1, _element_otherProps2, _element_value1;
59
+ var _element_otherProps2, _element_otherProps3, _element_value1;
60
60
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
61
61
  style: {
62
- display: (element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.isConfig) ? 'none' : 'block'
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'
63
63
  }
64
- }), (element === null || element === void 0 ? void 0 : (_element_otherProps2 = element.otherProps) === null || _element_otherProps2 === void 0 ? void 0 : _element_otherProps2.isConfig) ? '' : DOMPurify.sanitize(element === null || element === void 0 ? void 0 : (_element_value1 = element.value) === null || _element_value1 === void 0 ? void 0 : _element_value1.trim()));
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
+ // 检查代码块是否未闭合
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;
66
68
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
69
+ "data-is-unclosed": isUnclosed,
70
+ "data-language": element === null || element === void 0 ? void 0 : element.language,
67
71
  style: (element === null || element === void 0 ? void 0 : element.language) === 'html' ? {
68
- display: (element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.isConfig) ? 'none' : 'block'
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'
69
73
  } : {
70
74
  height: '240px',
71
75
  minWidth: '398px',
@@ -88,7 +92,8 @@ export var Code = function(param) {
88
92
  wordWrap: 'break-word',
89
93
  borderRadius: '12px',
90
94
  background: '#FFFFFF',
91
- boxShadow: 'var(--shadow-control-base)'
95
+ boxShadow: 'var(--shadow-control-base)',
96
+ position: 'relative'
92
97
  }
93
98
  }), (element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.trim()) || children);
94
99
  };
@@ -64,6 +64,7 @@ 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";
67
68
  import { I18nContext } from "../../../../I18n";
68
69
  import { useEditorStore } from "../../store";
69
70
  import { parserSlateNodeToMarkdown } from "../../utils";
@@ -72,7 +73,7 @@ import { parserSlateNodeToMarkdown } from "../../utils";
72
73
  * 移除了不必要的滚动监听和复杂的宽度计算
73
74
  */ export var ReadonlyTableComponent = /*#__PURE__*/ React.memo(function(param) {
74
75
  var hashId = param.hashId, children = param.children, element = param.element, baseCls = param.baseCls;
75
- var _element_children__children, _element_children_, _element_children, _editorProps_tableConfig;
76
+ var _element_otherProps, _element_children__children, _element_children_, _element_children, _editorProps_tableConfig;
76
77
  var editorProps = useEditorStore().editorProps;
77
78
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
78
79
  var _ref = (editorProps === null || editorProps === void 0 ? void 0 : editorProps.tableConfig) || {}, _ref_actions = _ref.actions, actions = _ref_actions === void 0 ? {
@@ -84,6 +85,8 @@ import { parserSlateNodeToMarkdown } from "../../utils";
84
85
  var modelTargetRef = useRef(null);
85
86
  var _useState = _sliced_to_array(useState(false), 2), previewOpen = _useState[0], setPreviewOpen = _useState[1];
86
87
  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;
87
90
  // 简化的列宽计算 - 只为 readonly 模式设计
88
91
  var colWidths = useMemo(function() {
89
92
  var _element_children__children, _element_children_, _element_children;
@@ -190,9 +193,18 @@ import { parserSlateNodeToMarkdown } from "../../utils";
190
193
  className: classNames(baseCls, hashId),
191
194
  style: {
192
195
  flex: 1,
193
- minWidth: 0
196
+ minWidth: 0,
197
+ 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
194
206
  }
195
- }, tableDom, popoverContent), previewOpen && /*#__PURE__*/ React.createElement(Modal, {
207
+ }, /*#__PURE__*/ React.createElement(Loading, null)), tableDom, popoverContent), previewOpen && /*#__PURE__*/ React.createElement(Modal, {
196
208
  title: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_tableConfig = editorProps.tableConfig) === null || _editorProps_tableConfig === void 0 ? void 0 : _editorProps_tableConfig.previewTitle) || '预览表格',
197
209
  open: previewOpen,
198
210
  closable: true,
@@ -54,6 +54,7 @@ import { ConfigProvider } from "antd";
54
54
  import classNames from "classnames";
55
55
  import React, { useContext, useMemo } from "react";
56
56
  import { ReactEditor, useSlate } from "slate-react";
57
+ import { Loading } from "../../../../Components/Loading";
57
58
  import { useTableStyle } from "./style";
58
59
  import { SlateTable } from "./Table";
59
60
  import { TablePropsProvider } from "./TableContext";
@@ -61,6 +62,7 @@ import { TablePropsProvider } from "./TableContext";
61
62
  * 简单表格组件 - 仅支持只读显示
62
63
  * 用于替代复杂的 Handsontable 实现,提供基础的表格功能
63
64
  */ export var SimpleTable = function(props) {
65
+ var _props_element_otherProps, _props_element;
64
66
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
65
67
  var baseCls = getPrefixCls('agentic-md-editor-content-table');
66
68
  var editor = useSlate();
@@ -70,14 +72,27 @@ import { TablePropsProvider } from "./TableContext";
70
72
  }, [
71
73
  props.element
72
74
  ]);
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;
73
77
  return wrapSSR(/*#__PURE__*/ React.createElement(TablePropsProvider, {
74
78
  tablePath: tablePath,
75
79
  tableNode: props.element
76
80
  }, /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
77
81
  "data-be": 'table',
82
+ "data-is-unclosed": isUnclosed,
78
83
  draggable: false,
79
- className: classNames("".concat(baseCls, "-container"), hashId)
80
- }), /*#__PURE__*/ React.createElement(SlateTable, _object_spread_props(_object_spread({}, props), {
84
+ className: classNames("".concat(baseCls, "-container"), hashId),
85
+ style: {
86
+ position: 'relative'
87
+ }
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), {
81
96
  hashId: hashId
82
97
  }), props.children))));
83
98
  };
@@ -9,6 +9,19 @@ function _array_with_holes(arr) {
9
9
  function _array_without_holes(arr) {
10
10
  if (Array.isArray(arr)) return _array_like_to_array(arr);
11
11
  }
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _iterable_to_array(iter) {
13
26
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14
27
  }
@@ -42,6 +55,45 @@ function _non_iterable_rest() {
42
55
  function _non_iterable_spread() {
43
56
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
57
  }
58
+ function _object_spread(target) {
59
+ for(var i = 1; i < arguments.length; i++){
60
+ var source = arguments[i] != null ? arguments[i] : {};
61
+ var ownKeys = Object.keys(source);
62
+ if (typeof Object.getOwnPropertySymbols === "function") {
63
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
64
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
65
+ }));
66
+ }
67
+ ownKeys.forEach(function(key) {
68
+ _define_property(target, key, source[key]);
69
+ });
70
+ }
71
+ return target;
72
+ }
73
+ function ownKeys(object, enumerableOnly) {
74
+ var keys = Object.keys(object);
75
+ if (Object.getOwnPropertySymbols) {
76
+ var symbols = Object.getOwnPropertySymbols(object);
77
+ if (enumerableOnly) {
78
+ symbols = symbols.filter(function(sym) {
79
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
80
+ });
81
+ }
82
+ keys.push.apply(keys, symbols);
83
+ }
84
+ return keys;
85
+ }
86
+ function _object_spread_props(target, source) {
87
+ source = source != null ? source : {};
88
+ if (Object.getOwnPropertyDescriptors) {
89
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
90
+ } else {
91
+ ownKeys(Object(source)).forEach(function(key) {
92
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
93
+ });
94
+ }
95
+ return target;
96
+ }
45
97
  function _object_without_properties(source, excluded) {
46
98
  if (source == null) return {};
47
99
  var target = _object_without_properties_loose(source, excluded);
@@ -88,7 +140,9 @@ import classNames from "classnames";
88
140
  import React, { useContext, useEffect, useMemo, useRef } from "react";
89
141
  import { Node } from "slate";
90
142
  import stringWidth from "string-width";
143
+ import { Loading } from "../../../../Components/Loading";
91
144
  import { MOBILE_BREAKPOINT, MOBILE_TABLE_MIN_COLUMN_WIDTH } from "../../../../Constants/mobile";
145
+ import { useMEditor } from "../../../hooks/editor";
92
146
  import { useEditorStore } from "../../store";
93
147
  import { ReadonlyTableComponent } from "./ReadonlyTableComponent";
94
148
  import { TablePropsContext } from "./TableContext";
@@ -124,8 +178,8 @@ import useScrollShadow from "./useScrollShadow";
124
178
  "hashId",
125
179
  "children"
126
180
  ]);
127
- var _props_element_children__children, _props_element_children_, _props_element_children, _props_element, _props_element_otherProps, _props_element1, _props_element_children1, _props_element2;
128
- var _useEditorStore = useEditorStore(), readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef;
181
+ var _props_element_children__children, _props_element_children_, _props_element_children, _props_element, _props_element_otherProps, _props_element1, _props_element_children1, _props_element2, _props_element_otherProps1, _props_element3;
182
+ var _useEditorStore = useEditorStore(), readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef, store = _useEditorStore.store;
129
183
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
130
184
  var tablePath = useContext(TablePropsContext).tablePath;
131
185
  var baseCls = getPrefixCls('agentic-md-editor-content-table');
@@ -288,7 +342,69 @@ import useScrollShadow from "./useScrollShadow";
288
342
  scrollState,
289
343
  readonly
290
344
  ]);
291
- // readonly 模式渲染 - 使用优化的组件
345
+ // 检查表格是否未闭合
346
+ var isUnclosed = ((_props_element3 = props.element) === null || _props_element3 === void 0 ? void 0 : (_props_element_otherProps1 = _props_element3.otherProps) === null || _props_element_otherProps1 === void 0 ? void 0 : _props_element_otherProps1.finish) === false;
347
+ // 获取编辑器更新函数 - 必须在早期返回之前调用 hooks
348
+ var _useMEditor = _sliced_to_array(useMEditor(props.element), 2), update = _useMEditor[1];
349
+ // 判断是否是最后一个节点 - 必须在早期返回之前调用 hooks
350
+ var isLastNode = useMemo(function() {
351
+ try {
352
+ return store.isLatestNode(props.element);
353
+ } catch (e) {
354
+ return false;
355
+ }
356
+ }, [
357
+ store,
358
+ props.element
359
+ ]);
360
+ // 如果不是最后一个节点,且未闭合,立即设置为完成 - 必须在早期返回之前调用 hooks
361
+ useEffect(function() {
362
+ if (isUnclosed && !readonly && !isLastNode) {
363
+ var _props_element_otherProps, _props_element;
364
+ // 检查 finish 是否仍然是 false(可能已经被其他逻辑更新)
365
+ if (((_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) {
366
+ var _props_element1;
367
+ update({
368
+ otherProps: _object_spread_props(_object_spread({}, (_props_element1 = props.element) === null || _props_element1 === void 0 ? void 0 : _props_element1.otherProps), {
369
+ finish: true
370
+ })
371
+ }, props.element);
372
+ }
373
+ }
374
+ }, [
375
+ isUnclosed,
376
+ readonly,
377
+ isLastNode,
378
+ props.element,
379
+ update
380
+ ]);
381
+ // 5 秒超时机制:如果是最后一个节点且未闭合,5 秒后自动设置为完成 - 必须在早期返回之前调用 hooks
382
+ useEffect(function() {
383
+ if (isUnclosed && !readonly && isLastNode) {
384
+ var timer = setTimeout(function() {
385
+ var _props_element_otherProps, _props_element;
386
+ // 检查 finish 是否仍然是 false(可能已经被其他逻辑更新)
387
+ if (((_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) {
388
+ var _props_element1;
389
+ update({
390
+ otherProps: _object_spread_props(_object_spread({}, (_props_element1 = props.element) === null || _props_element1 === void 0 ? void 0 : _props_element1.otherProps), {
391
+ finish: true
392
+ })
393
+ }, props.element);
394
+ }
395
+ }, 5000); // 5 秒超时
396
+ return function() {
397
+ clearTimeout(timer);
398
+ };
399
+ }
400
+ }, [
401
+ isUnclosed,
402
+ readonly,
403
+ isLastNode,
404
+ props.element,
405
+ update
406
+ ]);
407
+ // readonly 模式渲染 - 使用优化的组件(早期返回)
292
408
  if (readonly) {
293
409
  return /*#__PURE__*/ React.createElement(ReadonlyTableComponent, {
294
410
  hashId: hashId,
@@ -300,7 +416,10 @@ import useScrollShadow from "./useScrollShadow";
300
416
  return /*#__PURE__*/ React.createElement("div", {
301
417
  className: classNames(baseCls, hashId),
302
418
  ref: tableRef,
303
- style: boxShadowStyle,
419
+ style: _object_spread_props(_object_spread({}, boxShadowStyle), {
420
+ position: 'relative'
421
+ }),
422
+ "data-is-unclosed": isUnclosed,
304
423
  onDragStart: function(e) {
305
424
  // 阻止拖拽开始时的文字选择
306
425
  e.preventDefault();
@@ -309,5 +428,12 @@ import useScrollShadow from "./useScrollShadow";
309
428
  // 阻止双击选择文字
310
429
  e.preventDefault();
311
430
  }
312
- }, tableDom);
431
+ }, isUnclosed && /*#__PURE__*/ React.createElement("div", {
432
+ style: {
433
+ position: 'absolute',
434
+ top: '8px',
435
+ right: '8px',
436
+ zIndex: 10
437
+ }
438
+ }, /*#__PURE__*/ React.createElement(Loading, null)), tableDom);
313
439
  };
@@ -5,17 +5,116 @@
5
5
  import { Elements } from '../../el';
6
6
  import { MarkdownEditorPlugin } from '../../plugin';
7
7
  export declare const decodeURIComponentUrl: (url: string) => string;
8
+ /**
9
+ * 解析Markdown字符串的配置选项
10
+ */
11
+ export interface ParserMarkdownToSlateNodeConfig {
12
+ /** 是否在新标签页打开链接 */
13
+ openLinksInNewTab?: boolean;
14
+ /** 自定义段落标签(在 Slate 中可能不适用,保留用于兼容性) */
15
+ paragraphTag?: string;
16
+ /** 是否正在输入中(打字机模式) */
17
+ typing?: boolean;
18
+ }
19
+ /**
20
+ * Markdown 到 Slate 节点解析器类
21
+ *
22
+ * 将 Markdown 字符串解析为 Slate 编辑器节点,支持配置选项和插件。
23
+ * 使用类形式可以避免在函数调用链中传递配置参数和插件。
24
+ */
25
+ export declare class MarkdownToSlateParser {
26
+ private readonly config;
27
+ private readonly plugins;
28
+ constructor(config?: ParserMarkdownToSlateNodeConfig, plugins?: MarkdownEditorPlugin[]);
29
+ /**
30
+ * 解析 Markdown 字符串并返回解析后的结构和链接信息
31
+ *
32
+ * @param md - 要解析的 Markdown 字符串
33
+ * @returns 一个包含解析后的元素数组和链接信息的对象
34
+ */
35
+ parse(md: string): {
36
+ schema: Elements[];
37
+ links: {
38
+ path: number[];
39
+ target: string;
40
+ }[];
41
+ };
42
+ /**
43
+ * 解析 Markdown AST 节点为 Slate 节点(类方法版本)
44
+ * - 当有插件时,优先使用插件处理
45
+ * - 插件未处理时,使用默认处理逻辑
46
+ */
47
+ private parseNodes;
48
+ /**
49
+ * 处理单个元素(类方法版本)
50
+ */
51
+ private handleSingleElement;
52
+ /**
53
+ * 处理标题节点(类方法版本)
54
+ */
55
+ private handleHeading;
56
+ /**
57
+ * 处理列表节点(类方法版本)
58
+ */
59
+ private handleList;
60
+ /**
61
+ * 处理脚注定义节点(类方法版本)
62
+ */
63
+ private handleFootnoteDefinition;
64
+ /**
65
+ * 处理列表项节点(类方法版本)
66
+ */
67
+ private handleListItem;
68
+ /**
69
+ * 处理段落子节点(类方法版本)
70
+ */
71
+ private processParagraphChildren;
72
+ /**
73
+ * 处理段落节点(类方法版本)
74
+ */
75
+ private handleParagraph;
76
+ /**
77
+ * 处理引用块节点(类方法版本)
78
+ */
79
+ private handleBlockquote;
80
+ /**
81
+ * 处理文本和内联元素节点(类方法版本)
82
+ */
83
+ private handleTextAndInlineElements;
84
+ /**
85
+ * 应用内联格式到叶子节点(类方法版本)
86
+ */
87
+ private applyInlineFormatting;
88
+ /**
89
+ * 解析表格或图表(类方法版本)
90
+ */
91
+ private parseTableOrChart;
92
+ }
8
93
  /**
9
94
  * 解析Markdown字符串并返回解析后的结构和链接信息。
10
95
  *
11
96
  * @param md - 要解析的Markdown字符串。
12
97
  * @param plugins - 可选的Markdown编辑器插件数组,用于扩展解析功能。
98
+ * @param config - 可选的解析配置选项。
13
99
  * @returns 一个包含解析后的元素数组和链接信息的对象。
14
100
  *
15
101
  * @property schema - 解析后的元素数组。
16
102
  * @property links - 包含路径和目标链接的对象数组。
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * // 使用函数形式(向后兼容)
107
+ * const result = parserMarkdownToSlateNode(markdown, plugins, { openLinksInNewTab: true });
108
+ *
109
+ * // 使用类形式(推荐,避免配置传递问题)
110
+ * const parser = new MarkdownToSlateParser(
111
+ * { openLinksInNewTab: true },
112
+ * plugins
113
+ * );
114
+ * const result = parser.parse(markdown);
115
+ * ```
17
116
  */
18
- export declare const parserMarkdownToSlateNode: (md: string, plugins?: MarkdownEditorPlugin[]) => {
117
+ export declare const parserMarkdownToSlateNode: (md: string, plugins?: MarkdownEditorPlugin[], config?: ParserMarkdownToSlateNodeConfig) => {
19
118
  schema: Elements[];
20
119
  links: {
21
120
  path: number[];