@ant-design/agentic-ui 2.24.3 → 2.24.4
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.
|
@@ -501,7 +501,10 @@ import partialJsonParse from "../json-parse";
|
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
if (isComment || isStandardHtmlElement(commentValue)) {
|
|
504
|
-
|
|
504
|
+
if (commentValue.match(/<\/?(table|div|ul|li|ol|p|strong|h1|h2|h3|h4|h5|h6)[^\n>]*?>/)) {
|
|
505
|
+
return htmlToFragmentList(commentValue, '');
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
505
508
|
type: 'code',
|
|
506
509
|
language: 'html',
|
|
507
510
|
render: true,
|
|
@@ -120,9 +120,12 @@ import mdastParser from "./remarkParse";
|
|
|
120
120
|
var schema = this.parseNodes(markdownRoot, true, undefined);
|
|
121
121
|
return {
|
|
122
122
|
schema: schema === null || schema === void 0 ? void 0 : schema.filter(function(item) {
|
|
123
|
-
var _item_children;
|
|
124
|
-
if (item.type === 'paragraph' && ((_item_children = item.children) === null || _item_children === void 0 ? void 0 : _item_children.length)
|
|
125
|
-
|
|
123
|
+
var _item_children, _item_children1;
|
|
124
|
+
if (item.type === 'paragraph' && !((_item_children = item.children) === null || _item_children === void 0 ? void 0 : _item_children.length)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
if (item.type === 'paragraph' && ((_item_children1 = item.children) === null || _item_children1 === void 0 ? void 0 : _item_children1.length) === 1) {
|
|
128
|
+
if (item.children[0].text === '\n' || item.children[0].text === undefined) {
|
|
126
129
|
return false;
|
|
127
130
|
}
|
|
128
131
|
return true;
|
|
@@ -263,39 +263,63 @@ var genStyle = function(token) {
|
|
|
263
263
|
fontSize: '30px',
|
|
264
264
|
lineHeight: '38px',
|
|
265
265
|
fontWeight: '600',
|
|
266
|
-
margin: 'var(--margin-8x) 0'
|
|
266
|
+
margin: 'var(--margin-8x) 0',
|
|
267
|
+
'a,span[data-url="url"]': {
|
|
268
|
+
fontSize: '30px',
|
|
269
|
+
fontWeight: '600'
|
|
270
|
+
}
|
|
267
271
|
},
|
|
268
272
|
h2: {
|
|
269
273
|
fontSize: '24px',
|
|
270
274
|
lineHeight: '32px',
|
|
271
275
|
fontWeight: '600',
|
|
272
276
|
marginTop: 'var(--margin-8x)',
|
|
273
|
-
marginBottom: 'var(--margin-4x)'
|
|
277
|
+
marginBottom: 'var(--margin-4x)',
|
|
278
|
+
'a,span[data-url="url"]': {
|
|
279
|
+
fontSize: '24x',
|
|
280
|
+
fontWeight: '600'
|
|
281
|
+
}
|
|
274
282
|
},
|
|
275
283
|
h3: {
|
|
276
284
|
fontSize: '18px',
|
|
277
285
|
lineHeight: '26px',
|
|
278
286
|
fontWeight: '600',
|
|
279
287
|
marginTop: 'var(--margin-4x)',
|
|
280
|
-
marginBottom: 'var(--margin-2x)'
|
|
288
|
+
marginBottom: 'var(--margin-2x)',
|
|
289
|
+
'a,span[data-url="url"]': {
|
|
290
|
+
fontSize: '18x',
|
|
291
|
+
fontWeight: '600'
|
|
292
|
+
}
|
|
281
293
|
},
|
|
282
294
|
h4: {
|
|
283
295
|
fontSize: '15px',
|
|
284
296
|
lineHeight: '24px',
|
|
285
297
|
fontWeight: '600',
|
|
286
|
-
marginTop: 'var(--margin-2x)'
|
|
298
|
+
marginTop: 'var(--margin-2x)',
|
|
299
|
+
'a,span[data-url="url"]': {
|
|
300
|
+
fontSize: '15x',
|
|
301
|
+
fontWeight: '600'
|
|
302
|
+
}
|
|
287
303
|
},
|
|
288
304
|
h5: {
|
|
289
305
|
fontSize: '15px',
|
|
290
306
|
lineHeight: '24px',
|
|
291
307
|
fontWeight: '600',
|
|
292
|
-
marginTop: 'var(--margin-2x)'
|
|
308
|
+
marginTop: 'var(--margin-2x)',
|
|
309
|
+
'a,span[data-url="url"]': {
|
|
310
|
+
fontSize: '15x',
|
|
311
|
+
fontWeight: '600'
|
|
312
|
+
}
|
|
293
313
|
},
|
|
294
314
|
h6: {
|
|
295
315
|
fontSize: '15px',
|
|
296
316
|
lineHeight: '24px',
|
|
297
317
|
fontWeight: '600',
|
|
298
|
-
marginTop: 'var(--margin-2x)'
|
|
318
|
+
marginTop: 'var(--margin-2x)',
|
|
319
|
+
'a,span[data-url="url"]': {
|
|
320
|
+
fontSize: '15x',
|
|
321
|
+
fontWeight: '600'
|
|
322
|
+
}
|
|
299
323
|
},
|
|
300
324
|
'a,span[data-url="url"]': {
|
|
301
325
|
lineHeight: '24px',
|
|
@@ -3,14 +3,18 @@ import { makeDeserializer } from "./module";
|
|
|
3
3
|
import { imagePastingListener } from "./utils";
|
|
4
4
|
/* eslint-disable no-param-reassign */ import { Node } from "slate";
|
|
5
5
|
import { EditorUtils } from "..";
|
|
6
|
+
var isMarkdownLink = function(text) {
|
|
7
|
+
var markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/;
|
|
8
|
+
return markdownLinkRegex.test(text);
|
|
9
|
+
};
|
|
6
10
|
export var docxDeserializer = function(rtf, html) {
|
|
7
11
|
var deserialize = makeDeserializer(jsx);
|
|
8
12
|
// image tags have to be cleaned out and converted
|
|
9
13
|
var imageTags = imagePastingListener(rtf, html);
|
|
10
14
|
if (html) {
|
|
11
15
|
var parsed_html = new DOMParser().parseFromString(html, 'text/html');
|
|
12
|
-
var
|
|
13
|
-
return
|
|
16
|
+
var fragmentList = deserialize(parsed_html.body, imageTags || []);
|
|
17
|
+
return fragmentList.filter(function(item) {
|
|
14
18
|
var _item_children_at, _item_children;
|
|
15
19
|
if (item.type === 'paragraph' && !Node.string(item).trim() && !(item === null || item === void 0 ? void 0 : (_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_at = _item_children.at(0)) === null || _item_children_at === void 0 ? void 0 : _item_children_at.type)) {
|
|
16
20
|
return false;
|
|
@@ -26,6 +30,17 @@ export var docxDeserializer = function(rtf, html) {
|
|
|
26
30
|
children: fragment.children
|
|
27
31
|
};
|
|
28
32
|
}
|
|
33
|
+
if (fragment.type === 'head') {
|
|
34
|
+
var _fragment_children;
|
|
35
|
+
if ((fragment === null || fragment === void 0 ? void 0 : (_fragment_children = fragment.children) === null || _fragment_children === void 0 ? void 0 : _fragment_children.at(0).text) && isMarkdownLink(fragment.children.at(0).text)) {
|
|
36
|
+
var linkText = fragment.children.at(0).text;
|
|
37
|
+
fragment.children[0] = {
|
|
38
|
+
text: linkText === null || linkText === void 0 ? void 0 : linkText.replace(/\[([^\]]+)\]\(([^)]+)\)/, '$1'),
|
|
39
|
+
url: linkText === null || linkText === void 0 ? void 0 : linkText.replace(/\[([^\]]+)\]\(([^)]+)\)/, '$2'),
|
|
40
|
+
originalText: linkText
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
29
44
|
return fragment;
|
|
30
45
|
});
|
|
31
46
|
}
|