@ant-design/agentic-ui 2.27.10 → 2.28.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.
- package/dist/MarkdownEditor/editor/elements/Blockquote/index.js +11 -1
- package/dist/MarkdownEditor/editor/elements/Break/index.js +2 -0
- package/dist/MarkdownEditor/editor/elements/Card/index.js +11 -0
- package/dist/MarkdownEditor/editor/elements/Code/index.js +22 -7
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/index.js +15 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/index.js +11 -1
- package/dist/MarkdownEditor/editor/elements/Head/index.d.ts +1 -1
- package/dist/MarkdownEditor/editor/elements/Head/index.js +17 -1
- package/dist/MarkdownEditor/editor/elements/Hr/index.js +2 -0
- package/dist/MarkdownEditor/editor/elements/Image/index.js +75 -34
- package/dist/MarkdownEditor/editor/elements/InlineKatex/index.js +5 -0
- package/dist/MarkdownEditor/editor/elements/Katex/index.js +5 -0
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +13 -1
- package/dist/MarkdownEditor/editor/elements/List/List.js +16 -1
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +16 -4
- package/dist/MarkdownEditor/editor/elements/Mermaid/index.js +7 -2
- package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +14 -2
- package/dist/MarkdownEditor/editor/elements/Schema/index.js +13 -0
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +43 -88
- package/dist/MarkdownEditor/editor/elements/index.js +131 -16
- package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +84 -17
- package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +39 -2
- package/dist/MarkdownEditor/editor/parser/parse/parseElements.js +27 -2
- package/dist/MarkdownEditor/editor/parser/parse/parseFootnote.js +11 -1
- package/dist/MarkdownEditor/editor/parser/parse/parseMath.js +31 -4
- package/dist/MarkdownEditor/editor/parser/parse/parseMedia.js +41 -6
- package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +9 -2
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +141 -24
- package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +127 -6
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +109 -2
- package/dist/Plugins/chart/AreaChart/index.js +3 -0
- package/dist/Plugins/chart/BarChart/index.js +3 -0
- package/dist/Plugins/chart/DonutChart/index.js +1 -1
- package/dist/Plugins/chart/FunnelChart/index.js +3 -0
- package/dist/Plugins/chart/LineChart/index.js +3 -0
- package/dist/Plugins/chart/RadarChart/index.js +3 -0
- package/dist/Plugins/chart/ScatterChart/index.js +3 -0
- package/dist/Plugins/code/components/ThinkBlock.js +66 -5
- package/package.json +1 -1
|
@@ -50,6 +50,7 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
53
54
|
import { EditorUtils } from "../../utils";
|
|
54
55
|
import { createMediaNodeFromElement, decodeURIComponentUrl, findImageElement } from "./parseHtml";
|
|
55
56
|
import { handleAttachmentLink, handleLinkCard } from "./parseMedia";
|
|
@@ -57,21 +58,36 @@ import { handleTextAndInlineElementsPure, setFinishedProp } from "./parseText";
|
|
|
57
58
|
/**
|
|
58
59
|
* 处理标题节点
|
|
59
60
|
*/ export var handleHeading = function(currentElement, parseNodes) {
|
|
60
|
-
var _currentElement_children;
|
|
61
|
-
|
|
61
|
+
var _currentElement_children, _currentElement_children1, _result_children;
|
|
62
|
+
debugInfo('handleHeading - 处理标题', {
|
|
63
|
+
depth: currentElement.depth,
|
|
64
|
+
childrenCount: (_currentElement_children = currentElement.children) === null || _currentElement_children === void 0 ? void 0 : _currentElement_children.length
|
|
65
|
+
});
|
|
66
|
+
var result = {
|
|
62
67
|
type: 'head',
|
|
63
68
|
level: currentElement.depth,
|
|
64
|
-
children: ((
|
|
69
|
+
children: ((_currentElement_children1 = currentElement.children) === null || _currentElement_children1 === void 0 ? void 0 : _currentElement_children1.length) ? parseNodes(currentElement.children, false, currentElement) : [
|
|
65
70
|
{
|
|
66
71
|
text: ''
|
|
67
72
|
}
|
|
68
73
|
]
|
|
69
74
|
};
|
|
75
|
+
debugInfo('handleHeading - 标题处理完成', {
|
|
76
|
+
level: result.level,
|
|
77
|
+
childrenCount: (_result_children = result.children) === null || _result_children === void 0 ? void 0 : _result_children.length
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
70
80
|
};
|
|
71
81
|
/**
|
|
72
82
|
* 处理列表节点
|
|
73
83
|
*/ export var handleList = function(currentElement, parseNodes) {
|
|
74
|
-
var _el_children;
|
|
84
|
+
var _currentElement_children, _el_children, _el_children1;
|
|
85
|
+
debugInfo('handleList - 处理列表', {
|
|
86
|
+
ordered: currentElement.ordered,
|
|
87
|
+
start: currentElement.start,
|
|
88
|
+
finished: currentElement.finished,
|
|
89
|
+
childrenCount: (_currentElement_children = currentElement.children) === null || _currentElement_children === void 0 ? void 0 : _currentElement_children.length
|
|
90
|
+
});
|
|
75
91
|
var el = {
|
|
76
92
|
type: 'list',
|
|
77
93
|
order: currentElement.ordered,
|
|
@@ -82,6 +98,13 @@ import { handleTextAndInlineElementsPure, setFinishedProp } from "./parseText";
|
|
|
82
98
|
el.task = (_el_children = el.children) === null || _el_children === void 0 ? void 0 : _el_children.some(function(s) {
|
|
83
99
|
return typeof s.checked === 'boolean';
|
|
84
100
|
});
|
|
101
|
+
debugInfo('handleList - 列表处理完成', {
|
|
102
|
+
type: el.type,
|
|
103
|
+
order: el.order,
|
|
104
|
+
start: el.start,
|
|
105
|
+
task: el.task,
|
|
106
|
+
childrenCount: (_el_children1 = el.children) === null || _el_children1 === void 0 ? void 0 : _el_children1.length
|
|
107
|
+
});
|
|
85
108
|
return el;
|
|
86
109
|
};
|
|
87
110
|
/**
|
|
@@ -103,8 +126,12 @@ import { handleTextAndInlineElementsPure, setFinishedProp } from "./parseText";
|
|
|
103
126
|
/**
|
|
104
127
|
* 处理列表项节点
|
|
105
128
|
*/ export var handleListItem = function(currentElement, parseNodes) {
|
|
106
|
-
var _currentElement_children, _currentElement_children__children_, _currentElement_children__children, _currentElement_children_,
|
|
107
|
-
|
|
129
|
+
var _currentElement_children, _currentElement_children1, _currentElement_children__children_, _currentElement_children__children, _currentElement_children_, _currentElement_children2, _currentElement_children__children1, _currentElement_children_1, _currentElement_children3, _result_children;
|
|
130
|
+
debugInfo('handleListItem - 处理列表项', {
|
|
131
|
+
checked: currentElement.checked,
|
|
132
|
+
childrenCount: (_currentElement_children = currentElement.children) === null || _currentElement_children === void 0 ? void 0 : _currentElement_children.length
|
|
133
|
+
});
|
|
134
|
+
var children = ((_currentElement_children1 = currentElement.children) === null || _currentElement_children1 === void 0 ? void 0 : _currentElement_children1.length) ? parseNodes(currentElement.children, false, currentElement) : [
|
|
108
135
|
{
|
|
109
136
|
type: 'paragraph',
|
|
110
137
|
children: [
|
|
@@ -115,7 +142,7 @@ import { handleTextAndInlineElementsPure, setFinishedProp } from "./parseText";
|
|
|
115
142
|
}
|
|
116
143
|
];
|
|
117
144
|
var mentions = undefined;
|
|
118
|
-
if (((
|
|
145
|
+
if (((_currentElement_children2 = currentElement.children) === null || _currentElement_children2 === void 0 ? void 0 : (_currentElement_children_ = _currentElement_children2[0]) === null || _currentElement_children_ === void 0 ? void 0 : (_currentElement_children__children = _currentElement_children_.children) === null || _currentElement_children__children === void 0 ? void 0 : (_currentElement_children__children_ = _currentElement_children__children[0]) === null || _currentElement_children__children_ === void 0 ? void 0 : _currentElement_children__children_.type) === 'link' && ((_currentElement_children3 = currentElement.children) === null || _currentElement_children3 === void 0 ? void 0 : (_currentElement_children_1 = _currentElement_children3[0]) === null || _currentElement_children_1 === void 0 ? void 0 : (_currentElement_children__children1 = _currentElement_children_1.children) === null || _currentElement_children__children1 === void 0 ? void 0 : _currentElement_children__children1.length) > 1) {
|
|
119
146
|
var _children__children, _children_;
|
|
120
147
|
var item = children === null || children === void 0 ? void 0 : (_children_ = children[0]) === null || _children_ === void 0 ? void 0 : (_children__children = _children_.children) === null || _children__children === void 0 ? void 0 : _children__children[0];
|
|
121
148
|
var label = item === null || item === void 0 ? void 0 : item.text;
|
|
@@ -129,14 +156,24 @@ import { handleTextAndInlineElementsPure, setFinishedProp } from "./parseText";
|
|
|
129
156
|
}
|
|
130
157
|
];
|
|
131
158
|
children === null || children === void 0 ? true : (_children_1 = children[0]) === null || _children_1 === void 0 ? true : (_children__children1 = _children_1.children) === null || _children__children1 === void 0 ? true : delete _children__children1[0];
|
|
159
|
+
debugInfo('handleListItem - 提取 mentions', {
|
|
160
|
+
mentions: mentions
|
|
161
|
+
});
|
|
132
162
|
}
|
|
133
163
|
}
|
|
134
|
-
|
|
164
|
+
var result = {
|
|
135
165
|
type: 'list-item',
|
|
136
166
|
checked: currentElement.checked,
|
|
137
167
|
children: children,
|
|
138
168
|
mentions: mentions
|
|
139
169
|
};
|
|
170
|
+
debugInfo('handleListItem - 列表项处理完成', {
|
|
171
|
+
type: result.type,
|
|
172
|
+
checked: result.checked,
|
|
173
|
+
childrenCount: (_result_children = result.children) === null || _result_children === void 0 ? void 0 : _result_children.length,
|
|
174
|
+
hasMentions: !!result.mentions
|
|
175
|
+
});
|
|
176
|
+
return result;
|
|
140
177
|
};
|
|
141
178
|
/**
|
|
142
179
|
* 处理段落子节点
|
|
@@ -208,26 +245,51 @@ import { handleTextAndInlineElementsPure, setFinishedProp } from "./parseText";
|
|
|
208
245
|
/**
|
|
209
246
|
* 处理段落节点
|
|
210
247
|
*/ export var handleParagraph = function(currentElement, config, parseNodes) {
|
|
211
|
-
var _currentElement_children, _currentElement_children_at,
|
|
248
|
+
var _currentElement_children, _currentElement_children_, _currentElement_children1, _currentElement_children2, _currentElement_children_at, _currentElement_children3;
|
|
249
|
+
debugInfo('handleParagraph - 处理段落', {
|
|
250
|
+
childrenCount: (_currentElement_children = currentElement.children) === null || _currentElement_children === void 0 ? void 0 : _currentElement_children.length,
|
|
251
|
+
firstChildType: (_currentElement_children1 = currentElement.children) === null || _currentElement_children1 === void 0 ? void 0 : (_currentElement_children_ = _currentElement_children1[0]) === null || _currentElement_children_ === void 0 ? void 0 : _currentElement_children_.type,
|
|
252
|
+
configType: config === null || config === void 0 ? void 0 : config.type
|
|
253
|
+
});
|
|
212
254
|
// 检查是否是附件链接
|
|
213
|
-
if (((
|
|
255
|
+
if (((_currentElement_children2 = currentElement.children) === null || _currentElement_children2 === void 0 ? void 0 : _currentElement_children2[0].type) === 'html' && currentElement.children[0].value.startsWith('<a')) {
|
|
256
|
+
debugInfo('handleParagraph - 检测到附件链接');
|
|
214
257
|
var attachNode = handleAttachmentLink(currentElement);
|
|
215
|
-
if (attachNode)
|
|
258
|
+
if (attachNode) {
|
|
259
|
+
debugInfo('handleParagraph - 返回附件节点', {
|
|
260
|
+
type: attachNode === null || attachNode === void 0 ? void 0 : attachNode.type
|
|
261
|
+
});
|
|
262
|
+
return attachNode;
|
|
263
|
+
}
|
|
216
264
|
}
|
|
217
265
|
// 检查是否是链接卡片
|
|
218
|
-
if ((currentElement === null || currentElement === void 0 ? void 0 : (
|
|
219
|
-
|
|
266
|
+
if ((currentElement === null || currentElement === void 0 ? void 0 : (_currentElement_children3 = currentElement.children) === null || _currentElement_children3 === void 0 ? void 0 : (_currentElement_children_at = _currentElement_children3.at(0)) === null || _currentElement_children_at === void 0 ? void 0 : _currentElement_children_at.type) === 'link' && config.type === 'card') {
|
|
267
|
+
debugInfo('handleParagraph - 检测到链接卡片');
|
|
268
|
+
var linkCard = handleLinkCard(currentElement, config);
|
|
269
|
+
debugInfo('handleParagraph - 返回链接卡片', {
|
|
270
|
+
type: linkCard === null || linkCard === void 0 ? void 0 : linkCard.type
|
|
271
|
+
});
|
|
272
|
+
return linkCard;
|
|
220
273
|
}
|
|
221
274
|
// 处理混合内容段落
|
|
222
|
-
|
|
275
|
+
debugInfo('handleParagraph - 处理混合内容段落');
|
|
276
|
+
var result = processParagraphChildren(currentElement, parseNodes);
|
|
277
|
+
debugInfo('handleParagraph - 段落处理完成', {
|
|
278
|
+
resultType: Array.isArray(result) ? 'array' : result === null || result === void 0 ? void 0 : result.type,
|
|
279
|
+
resultLength: Array.isArray(result) ? result.length : 1
|
|
280
|
+
});
|
|
281
|
+
return result;
|
|
223
282
|
};
|
|
224
283
|
/**
|
|
225
284
|
* 处理引用块节点
|
|
226
285
|
*/ export var handleBlockquote = function(currentElement, parseNodes) {
|
|
227
|
-
var _currentElement_children;
|
|
228
|
-
|
|
286
|
+
var _currentElement_children, _currentElement_children1, _result_children;
|
|
287
|
+
debugInfo('handleBlockquote - 处理引用块', {
|
|
288
|
+
childrenCount: (_currentElement_children = currentElement.children) === null || _currentElement_children === void 0 ? void 0 : _currentElement_children.length
|
|
289
|
+
});
|
|
290
|
+
var result = {
|
|
229
291
|
type: 'blockquote',
|
|
230
|
-
children: ((
|
|
292
|
+
children: ((_currentElement_children1 = currentElement.children) === null || _currentElement_children1 === void 0 ? void 0 : _currentElement_children1.length) ? parseNodes(currentElement.children, false, currentElement) : [
|
|
231
293
|
{
|
|
232
294
|
type: 'paragraph',
|
|
233
295
|
children: [
|
|
@@ -238,6 +300,11 @@ import { handleTextAndInlineElementsPure, setFinishedProp } from "./parseText";
|
|
|
238
300
|
}
|
|
239
301
|
]
|
|
240
302
|
};
|
|
303
|
+
debugInfo('handleBlockquote - 引用块处理完成', {
|
|
304
|
+
type: result.type,
|
|
305
|
+
childrenCount: (_result_children = result.children) === null || _result_children === void 0 ? void 0 : _result_children.length
|
|
306
|
+
});
|
|
307
|
+
return result;
|
|
241
308
|
};
|
|
242
309
|
/**
|
|
243
310
|
* 应用内联格式到叶子节点
|
|
@@ -50,6 +50,7 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
53
54
|
import json5 from "json5";
|
|
54
55
|
import { isCodeBlockLikelyComplete } from "../../utils/findMatchingClose";
|
|
55
56
|
import partialJsonParse from "../json-parse";
|
|
@@ -104,13 +105,23 @@ var ENDING_NEWLINE = /\n$/;
|
|
|
104
105
|
* @param config - 可选的配置对象,可能包含从 HTML 注释中解析的属性
|
|
105
106
|
* @returns 返回格式化的代码块节点对象,根据语言类型进行特殊处理
|
|
106
107
|
*/ export var handleCode = function(currentElement, config) {
|
|
107
|
-
var _effectiveLang_match, _currentElement_otherProps, _currentElement_value_trim;
|
|
108
|
+
var _currentElement_value, _effectiveLang_match, _currentElement_otherProps, _currentElement_value_trim, _resultWithProps_value;
|
|
109
|
+
debugInfo('handleCode - 处理代码块', {
|
|
110
|
+
rawValueLength: (_currentElement_value = currentElement.value) === null || _currentElement_value === void 0 ? void 0 : _currentElement_value.length,
|
|
111
|
+
lang: currentElement.lang,
|
|
112
|
+
configLanguage: config === null || config === void 0 ? void 0 : config['data-language'],
|
|
113
|
+
meta: currentElement.meta
|
|
114
|
+
});
|
|
108
115
|
var rawValue = currentElement.value || '';
|
|
109
116
|
// 如果 config 中包含 data-language,优先使用它来恢复语言类型
|
|
110
117
|
var configLanguage = config === null || config === void 0 ? void 0 : config['data-language'];
|
|
111
118
|
// 保持原有的行为:如果没有语言,应该使用 null 而不是空字符串
|
|
112
119
|
var effectiveLang = configLanguage || currentElement.lang || null;
|
|
113
120
|
var langString = effectiveLang ? ((_effectiveLang_match = effectiveLang.match(NOT_SPACE_START)) === null || _effectiveLang_match === void 0 ? void 0 : _effectiveLang_match[0]) || '' : '';
|
|
121
|
+
debugInfo('handleCode - 语言处理', {
|
|
122
|
+
effectiveLang: effectiveLang,
|
|
123
|
+
langString: langString
|
|
124
|
+
});
|
|
114
125
|
var code = "".concat(rawValue.replace(ENDING_NEWLINE, ''), "\n");
|
|
115
126
|
// 检查代码块是否完整
|
|
116
127
|
// 如果是缩进代码块,认为是完整的(因为没有结束标记)
|
|
@@ -162,6 +173,13 @@ var ENDING_NEWLINE = /\n$/;
|
|
|
162
173
|
otherProps: otherProps
|
|
163
174
|
};
|
|
164
175
|
var handler = LANGUAGE_HANDLERS[effectiveLang];
|
|
176
|
+
debugInfo('handleCode - 语言处理器', {
|
|
177
|
+
effectiveLang: effectiveLang,
|
|
178
|
+
hasHandler: !!handler,
|
|
179
|
+
handlerName: handler ? Object.keys(LANGUAGE_HANDLERS).find(function(k) {
|
|
180
|
+
return LANGUAGE_HANDLERS[k] === handler;
|
|
181
|
+
}) : undefined
|
|
182
|
+
});
|
|
165
183
|
var result = handler ? handler(baseCodeElement, currentElement.value) : baseCodeElement;
|
|
166
184
|
// 确保 otherProps 被保留,并合并 config 中的属性
|
|
167
185
|
var resultWithProps = result;
|
|
@@ -172,6 +190,15 @@ var ENDING_NEWLINE = /\n$/;
|
|
|
172
190
|
} else if (config && Object.keys(config).length > 0) {
|
|
173
191
|
resultWithProps.otherProps = _object_spread({}, resultWithProps.otherProps || {}, config);
|
|
174
192
|
}
|
|
193
|
+
debugInfo('handleCode - 代码块处理完成', {
|
|
194
|
+
type: resultWithProps.type,
|
|
195
|
+
language: resultWithProps.language,
|
|
196
|
+
render: resultWithProps.render,
|
|
197
|
+
isConfig: resultWithProps.isConfig,
|
|
198
|
+
valueLength: (_resultWithProps_value = resultWithProps.value) === null || _resultWithProps_value === void 0 ? void 0 : _resultWithProps_value.length,
|
|
199
|
+
hasOtherProps: !!resultWithProps.otherProps,
|
|
200
|
+
otherPropsKeys: resultWithProps.otherProps ? Object.keys(resultWithProps.otherProps) : []
|
|
201
|
+
});
|
|
175
202
|
return resultWithProps;
|
|
176
203
|
};
|
|
177
204
|
/**
|
|
@@ -179,7 +206,11 @@ var ENDING_NEWLINE = /\n$/;
|
|
|
179
206
|
* @param currentElement - 当前处理的YAML元素
|
|
180
207
|
* @returns 返回格式化的YAML代码块节点对象
|
|
181
208
|
*/ export var handleYaml = function(currentElement) {
|
|
182
|
-
|
|
209
|
+
var _currentElement_value;
|
|
210
|
+
debugInfo('handleYaml - 处理 YAML', {
|
|
211
|
+
valueLength: (_currentElement_value = currentElement.value) === null || _currentElement_value === void 0 ? void 0 : _currentElement_value.length
|
|
212
|
+
});
|
|
213
|
+
var result = {
|
|
183
214
|
type: 'code',
|
|
184
215
|
language: 'yaml',
|
|
185
216
|
value: currentElement.value,
|
|
@@ -190,4 +221,10 @@ var ENDING_NEWLINE = /\n$/;
|
|
|
190
221
|
}
|
|
191
222
|
]
|
|
192
223
|
};
|
|
224
|
+
debugInfo('handleYaml - YAML 处理完成', {
|
|
225
|
+
type: result.type,
|
|
226
|
+
language: result.language,
|
|
227
|
+
frontmatter: result.frontmatter
|
|
228
|
+
});
|
|
229
|
+
return result;
|
|
193
230
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
1
2
|
/**
|
|
2
3
|
* 处理内联代码节点
|
|
3
4
|
* @param currentElement - 当前处理的内联代码元素
|
|
4
5
|
* @returns 返回格式化的内联代码节点对象,支持占位符和初始值
|
|
5
6
|
*/ export var handleInlineCode = function(currentElement) {
|
|
6
7
|
var _currentElement_value, _currentElement_value1;
|
|
8
|
+
debugInfo('handleInlineCode - 处理内联代码', {
|
|
9
|
+
value: currentElement.value
|
|
10
|
+
});
|
|
7
11
|
var hasPlaceHolder = (_currentElement_value = currentElement.value) === null || _currentElement_value === void 0 ? void 0 : _currentElement_value.match(/\$\{(.*?)\}/);
|
|
8
12
|
var values = undefined;
|
|
9
13
|
if (hasPlaceHolder) {
|
|
@@ -52,13 +56,21 @@
|
|
|
52
56
|
result.placeholder = undefined;
|
|
53
57
|
result.initialValue = undefined;
|
|
54
58
|
}
|
|
59
|
+
debugInfo('handleInlineCode - 内联代码处理完成', {
|
|
60
|
+
code: result.code,
|
|
61
|
+
tag: result.tag,
|
|
62
|
+
text: result.text,
|
|
63
|
+
placeholder: result.placeholder,
|
|
64
|
+
initialValue: result.initialValue
|
|
65
|
+
});
|
|
55
66
|
return result;
|
|
56
67
|
};
|
|
57
68
|
/**
|
|
58
69
|
* 处理分割线节点
|
|
59
70
|
* @returns 返回格式化的分割线节点对象
|
|
60
71
|
*/ export var handleThematicBreak = function() {
|
|
61
|
-
|
|
72
|
+
debugInfo('handleThematicBreak - 处理分割线');
|
|
73
|
+
var result = {
|
|
62
74
|
type: 'hr',
|
|
63
75
|
children: [
|
|
64
76
|
{
|
|
@@ -66,13 +78,21 @@
|
|
|
66
78
|
}
|
|
67
79
|
]
|
|
68
80
|
};
|
|
81
|
+
debugInfo('handleThematicBreak - 分割线处理完成', {
|
|
82
|
+
type: result.type
|
|
83
|
+
});
|
|
84
|
+
return result;
|
|
69
85
|
};
|
|
70
86
|
/**
|
|
71
87
|
* 处理定义节点
|
|
72
88
|
* @param currentElement - 当前处理的定义元素,包含标签和URL
|
|
73
89
|
* @returns 返回格式化的定义段落节点对象
|
|
74
90
|
*/ export var handleDefinition = function(currentElement) {
|
|
75
|
-
|
|
91
|
+
debugInfo('handleDefinition - 处理定义', {
|
|
92
|
+
label: currentElement.label,
|
|
93
|
+
url: currentElement.url
|
|
94
|
+
});
|
|
95
|
+
var result = {
|
|
76
96
|
type: 'paragraph',
|
|
77
97
|
children: [
|
|
78
98
|
{
|
|
@@ -80,4 +100,9 @@
|
|
|
80
100
|
}
|
|
81
101
|
]
|
|
82
102
|
};
|
|
103
|
+
debugInfo('handleDefinition - 定义处理完成', {
|
|
104
|
+
type: result.type,
|
|
105
|
+
text: result.children[0].text
|
|
106
|
+
});
|
|
107
|
+
return result;
|
|
83
108
|
};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
1
2
|
/**
|
|
2
3
|
* 处理脚注引用
|
|
3
4
|
* @param currentElement - 当前处理的脚注引用元素
|
|
4
5
|
* @returns 返回格式化的脚注引用节点对象
|
|
5
6
|
*/ export var handleFootnoteReference = function(currentElement) {
|
|
6
7
|
var _currentElement_identifier;
|
|
7
|
-
|
|
8
|
+
debugInfo('handleFootnoteReference - 处理脚注引用', {
|
|
9
|
+
identifier: currentElement.identifier
|
|
10
|
+
});
|
|
11
|
+
var result = {
|
|
8
12
|
text: "".concat((_currentElement_identifier = currentElement.identifier) === null || _currentElement_identifier === void 0 ? void 0 : _currentElement_identifier.toUpperCase()),
|
|
9
13
|
identifier: currentElement.identifier,
|
|
10
14
|
type: 'footnoteReference'
|
|
11
15
|
};
|
|
16
|
+
debugInfo('handleFootnoteReference - 脚注引用处理完成', {
|
|
17
|
+
type: result.type,
|
|
18
|
+
text: result.text,
|
|
19
|
+
identifier: result.identifier
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
12
22
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
1
2
|
// 常量定义
|
|
2
3
|
var INLINE_MATH_SUFFIX_PATTERN = '(?:%|[kKmMbB]|千|万|亿|兆|万亿|百万|亿万)?';
|
|
3
4
|
var INLINE_MATH_CURRENCY_PATTERN = new RegExp("^[+-]?\\d{1,3}(?:,\\d{3})*(?:\\.\\d+)?".concat(INLINE_MATH_SUFFIX_PATTERN, "$"));
|
|
@@ -19,9 +20,17 @@ var INLINE_MATH_SIMPLE_NUMBER_PATTERN = new RegExp("^[+-]?\\d+(?:\\.\\d+)?".conc
|
|
|
19
20
|
* @param currentElement - 当前处理的内联数学公式元素
|
|
20
21
|
* @returns 返回格式化的内联KaTeX节点对象
|
|
21
22
|
*/ export var handleInlineMath = function(currentElement) {
|
|
23
|
+
debugInfo('handleInlineMath - 处理内联数学公式', {
|
|
24
|
+
value: currentElement === null || currentElement === void 0 ? void 0 : currentElement.value
|
|
25
|
+
});
|
|
22
26
|
var inlineMathValue = typeof (currentElement === null || currentElement === void 0 ? void 0 : currentElement.value) === 'string' ? currentElement.value : '';
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
var treatAsText = shouldTreatInlineMathAsText(inlineMathValue);
|
|
28
|
+
debugInfo('handleInlineMath - 判断结果', {
|
|
29
|
+
treatAsText: treatAsText,
|
|
30
|
+
value: inlineMathValue
|
|
31
|
+
});
|
|
32
|
+
if (treatAsText) {
|
|
33
|
+
var result = {
|
|
25
34
|
type: 'paragraph',
|
|
26
35
|
children: [
|
|
27
36
|
{
|
|
@@ -29,8 +38,12 @@ var INLINE_MATH_SIMPLE_NUMBER_PATTERN = new RegExp("^[+-]?\\d+(?:\\.\\d+)?".conc
|
|
|
29
38
|
}
|
|
30
39
|
]
|
|
31
40
|
};
|
|
41
|
+
debugInfo('handleInlineMath - 作为文本处理', {
|
|
42
|
+
type: result.type
|
|
43
|
+
});
|
|
44
|
+
return result;
|
|
32
45
|
}
|
|
33
|
-
|
|
46
|
+
var result1 = {
|
|
34
47
|
type: 'inline-katex',
|
|
35
48
|
children: [
|
|
36
49
|
{
|
|
@@ -38,13 +51,21 @@ var INLINE_MATH_SIMPLE_NUMBER_PATTERN = new RegExp("^[+-]?\\d+(?:\\.\\d+)?".conc
|
|
|
38
51
|
}
|
|
39
52
|
]
|
|
40
53
|
};
|
|
54
|
+
debugInfo('handleInlineMath - 作为内联公式处理', {
|
|
55
|
+
type: result1.type
|
|
56
|
+
});
|
|
57
|
+
return result1;
|
|
41
58
|
};
|
|
42
59
|
/**
|
|
43
60
|
* 处理数学公式块
|
|
44
61
|
* @param currentElement - 当前处理的数学公式块元素
|
|
45
62
|
* @returns 返回格式化的KaTeX块节点对象
|
|
46
63
|
*/ export var handleMath = function(currentElement) {
|
|
47
|
-
|
|
64
|
+
var _currentElement_value;
|
|
65
|
+
debugInfo('handleMath - 处理数学公式块', {
|
|
66
|
+
valueLength: (_currentElement_value = currentElement.value) === null || _currentElement_value === void 0 ? void 0 : _currentElement_value.length
|
|
67
|
+
});
|
|
68
|
+
var result = {
|
|
48
69
|
type: 'katex',
|
|
49
70
|
language: 'latex',
|
|
50
71
|
katex: true,
|
|
@@ -55,4 +76,10 @@ var INLINE_MATH_SIMPLE_NUMBER_PATTERN = new RegExp("^[+-]?\\d+(?:\\.\\d+)?".conc
|
|
|
55
76
|
}
|
|
56
77
|
]
|
|
57
78
|
};
|
|
79
|
+
debugInfo('handleMath - 数学公式块处理完成', {
|
|
80
|
+
type: result.type,
|
|
81
|
+
language: result.language,
|
|
82
|
+
katex: result.katex
|
|
83
|
+
});
|
|
84
|
+
return result;
|
|
58
85
|
};
|
|
@@ -50,6 +50,7 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
53
54
|
import { EditorUtils } from "../../utils";
|
|
54
55
|
import { decodeURIComponentUrl, findAttachment } from "./parseHtml";
|
|
55
56
|
/**
|
|
@@ -57,21 +58,38 @@ import { decodeURIComponentUrl, findAttachment } from "./parseHtml";
|
|
|
57
58
|
* @param currentElement - 当前处理的图片元素,包含url和alt属性
|
|
58
59
|
* @returns 返回格式化的图片节点对象
|
|
59
60
|
*/ export var handleImage = function(currentElement) {
|
|
60
|
-
|
|
61
|
+
debugInfo('handleImage - 处理图片', {
|
|
62
|
+
url: currentElement === null || currentElement === void 0 ? void 0 : currentElement.url,
|
|
63
|
+
alt: currentElement === null || currentElement === void 0 ? void 0 : currentElement.alt,
|
|
64
|
+
finished: currentElement === null || currentElement === void 0 ? void 0 : currentElement.finished
|
|
65
|
+
});
|
|
66
|
+
var result = EditorUtils.createMediaNode(decodeURIComponentUrl(currentElement === null || currentElement === void 0 ? void 0 : currentElement.url), 'image', {
|
|
61
67
|
alt: currentElement.alt,
|
|
62
68
|
finished: currentElement.finished
|
|
63
69
|
});
|
|
70
|
+
debugInfo('handleImage - 图片处理完成', {
|
|
71
|
+
type: currentElement === null || currentElement === void 0 ? void 0 : currentElement.type,
|
|
72
|
+
url: currentElement === null || currentElement === void 0 ? void 0 : currentElement.url
|
|
73
|
+
});
|
|
74
|
+
return result;
|
|
64
75
|
};
|
|
65
76
|
/**
|
|
66
77
|
* 处理附件链接
|
|
67
78
|
*/ export var handleAttachmentLink = function(currentElement) {
|
|
79
|
+
var _currentElement_children;
|
|
80
|
+
debugInfo('handleAttachmentLink - 处理附件链接', {
|
|
81
|
+
childrenCount: (_currentElement_children = currentElement.children) === null || _currentElement_children === void 0 ? void 0 : _currentElement_children.length
|
|
82
|
+
});
|
|
68
83
|
var text = currentElement.children.map(function(n) {
|
|
69
84
|
return n.value || '';
|
|
70
85
|
}).join('');
|
|
71
86
|
var attach = findAttachment(text);
|
|
72
|
-
if (!attach)
|
|
87
|
+
if (!attach) {
|
|
88
|
+
debugInfo('handleAttachmentLink - 未找到附件');
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
73
91
|
var name = text.match(/>(.*)<\/a>/);
|
|
74
|
-
|
|
92
|
+
var result = {
|
|
75
93
|
type: 'attach',
|
|
76
94
|
url: decodeURIComponentUrl(attach === null || attach === void 0 ? void 0 : attach.url),
|
|
77
95
|
size: attach.size,
|
|
@@ -95,13 +113,24 @@ import { decodeURIComponentUrl, findAttachment } from "./parseHtml";
|
|
|
95
113
|
],
|
|
96
114
|
name: name ? name[1] : attach === null || attach === void 0 ? void 0 : attach.url
|
|
97
115
|
};
|
|
116
|
+
debugInfo('handleAttachmentLink - 附件链接处理完成', {
|
|
117
|
+
type: result.type,
|
|
118
|
+
url: result.url,
|
|
119
|
+
size: result.size,
|
|
120
|
+
name: result.name
|
|
121
|
+
});
|
|
122
|
+
return result;
|
|
98
123
|
};
|
|
99
124
|
/**
|
|
100
125
|
* 处理链接卡片
|
|
101
126
|
*/ export var handleLinkCard = function(currentElement, config) {
|
|
102
|
-
var _currentElement_children;
|
|
103
|
-
|
|
104
|
-
|
|
127
|
+
var _currentElement_children, _currentElement_children1;
|
|
128
|
+
debugInfo('handleLinkCard - 处理链接卡片', {
|
|
129
|
+
childrenCount: currentElement === null || currentElement === void 0 ? void 0 : (_currentElement_children = currentElement.children) === null || _currentElement_children === void 0 ? void 0 : _currentElement_children.length,
|
|
130
|
+
configType: config === null || config === void 0 ? void 0 : config.type
|
|
131
|
+
});
|
|
132
|
+
var link = currentElement === null || currentElement === void 0 ? void 0 : (_currentElement_children1 = currentElement.children) === null || _currentElement_children1 === void 0 ? void 0 : _currentElement_children1.at(0);
|
|
133
|
+
var result = _object_spread_props(_object_spread({}, config), {
|
|
105
134
|
type: 'link-card',
|
|
106
135
|
url: decodeURIComponentUrl(link === null || link === void 0 ? void 0 : link.url),
|
|
107
136
|
children: [
|
|
@@ -124,4 +153,10 @@ import { decodeURIComponentUrl, findAttachment } from "./parseHtml";
|
|
|
124
153
|
],
|
|
125
154
|
name: link.title
|
|
126
155
|
});
|
|
156
|
+
debugInfo('handleLinkCard - 链接卡片处理完成', {
|
|
157
|
+
type: result.type,
|
|
158
|
+
url: result.url,
|
|
159
|
+
name: result.name
|
|
160
|
+
});
|
|
161
|
+
return result;
|
|
127
162
|
};
|
|
@@ -148,7 +148,7 @@ var myRemark = {
|
|
|
148
148
|
* @param parserConfig - 解析配置
|
|
149
149
|
* @returns 返回表格或图表节点
|
|
150
150
|
*/ export var parseTableOrChart = function(table, preNode, plugins, parseNodes, parserConfig) {
|
|
151
|
-
var _table_children, _tableHeader_children, _table_children_slice, _table_children1, _table_align
|
|
151
|
+
var _table_children, _tableHeader_children, _table_children_slice, _table_children1, _table_align;
|
|
152
152
|
var keyMap = new Map();
|
|
153
153
|
var config = (preNode === null || preNode === void 0 ? void 0 : preNode.type) === 'code' && (preNode === null || preNode === void 0 ? void 0 : preNode.language) === 'html' && (preNode === null || preNode === void 0 ? void 0 : preNode.otherProps) ? preNode === null || preNode === void 0 ? void 0 : preNode.otherProps : parserConfig || {};
|
|
154
154
|
var tableHeader = table === null || table === void 0 ? void 0 : (_table_children = table.children) === null || _table_children === void 0 ? void 0 : _table_children.at(0);
|
|
@@ -233,7 +233,14 @@ var myRemark = {
|
|
|
233
233
|
var chartConfig = Array.isArray(config === null || config === void 0 ? void 0 : config.config) ? config.config : (config === null || config === void 0 ? void 0 : config.config) || config;
|
|
234
234
|
// 如果 chartConfig 是对象且键都是数字(如 {0: {...}}),转换为数组
|
|
235
235
|
chartConfig = convertObjectToArray(chartConfig);
|
|
236
|
-
|
|
236
|
+
// 获取 chartType,支持多种配置格式
|
|
237
|
+
var getChartType = function() {
|
|
238
|
+
var _chartConfig_, _config_at, _config_at1;
|
|
239
|
+
return (chartConfig === null || chartConfig === void 0 ? void 0 : chartConfig.chartType) || Array.isArray(chartConfig) && (chartConfig === null || chartConfig === void 0 ? void 0 : (_chartConfig_ = chartConfig[0]) === null || _chartConfig_ === void 0 ? void 0 : _chartConfig_.chartType) || (config === null || config === void 0 ? void 0 : config.chartType) || (config === null || config === void 0 ? void 0 : (_config_at1 = config.at) === null || _config_at1 === void 0 ? void 0 : (_config_at = _config_at1.call(config, 0)) === null || _config_at === void 0 ? void 0 : _config_at.chartType);
|
|
240
|
+
};
|
|
241
|
+
var chartType = getChartType();
|
|
242
|
+
// 如果 chartType 为 "table",将其视为不存在,按普通表格处理
|
|
243
|
+
var isChart = chartType && chartType !== 'table';
|
|
237
244
|
// 计算合并单元格信息
|
|
238
245
|
var mergeCells = (config === null || config === void 0 ? void 0 : config.mergeCells) || [];
|
|
239
246
|
// 创建合并单元格映射,用于快速查找
|