-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo-node.ts
83 lines (79 loc) · 1.55 KB
/
demo-node.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var QuillDeltaToHtmlConverter = require('./src/QuillDeltaToHtmlConverter')
.QuillDeltaToHtmlConverter;
var ops = [
{
insert: '对接啊三',
},
{
attributes: {
bold: true,
},
insert: '六九等卢卡',
},
{
insert: '斯的撒对接卢卡斯\n',
},
{
insert: {
mention: {
index: '0',
denotationChar: '@',
id: '1',
value: 'John Doe',
},
},
},
{
insert: ' djksaldj',
},
{
insert: {
mention: {
index: '1',
denotationChar: '#',
id: '4',
value: 'Patrik Sjölin 2',
},
},
},
{
insert: ' \n的撒对接啊上课的',
},
{
attributes: {
header: 1,
},
insert: '\n',
},
{
insert: 'ddjsakldj\n\n',
},
{
insert: {
image:
'https://s.xiaopeng.com/bbs/uploaded/20230315/media_202303151446_575_file_w_1242@h_621.png',
},
},
{
insert: '\n',
},
{
insert: {
video:
'https://xps02.xiaopeng.com/cms/material/video/2023/01-06/video_20230106135720_85074.mp4',
},
},
{
insert: '\n',
},
];
var converter = new QuillDeltaToHtmlConverter(ops);
converter.renderCustomWith((op: any) => {
const data = op.insert.value;
if (data.denotationChar === '#') {
return data.denotationChar + data.value + '#';
}
return data.denotationChar + data.value;
});
var html = converter.convert();
console.log(html);