@ecomcx/ecomweb-content 0.0.0-stage → 1.14.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.
- package/LICENSE +21 -0
- package/README.md +157 -2
- package/dist/block.d.ts +58 -0
- package/dist/block.js +60 -0
- package/dist/embed.d.ts +23 -0
- package/dist/embed.js +63 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/migrate.d.ts +2 -0
- package/dist/migrate.js +19 -0
- package/dist/normalize.d.ts +25 -0
- package/dist/normalize.js +146 -0
- package/dist/schema.d.ts +31 -0
- package/dist/schema.js +167 -0
- package/dist/style.d.ts +74 -0
- package/dist/style.js +285 -0
- package/dist/text.d.ts +9 -0
- package/dist/text.js +30 -0
- package/dist/types.d.ts +36 -0
- package/dist/types.js +6 -0
- package/dist/url.d.ts +7 -0
- package/dist/url.js +21 -0
- package/fixtures/all-core-nodes.json +782 -0
- package/fixtures/attr-coercion.json +219 -0
- package/fixtures/basic-blocks.json +414 -0
- package/fixtures/block-extras.json +131 -0
- package/fixtures/block-styles.json +316 -0
- package/fixtures/dynamic-blocks.json +316 -0
- package/fixtures/editor-output-nulls.json +112 -0
- package/fixtures/empty-and-newer.json +12 -0
- package/fixtures/invalid-structure.json +145 -0
- package/fixtures/layout-blocks.json +238 -0
- package/fixtures/legacy-html-string.json +17 -0
- package/fixtures/legacy-tiptap-doc.json +41 -0
- package/fixtures/plugin-blocks-preserved.json +155 -0
- package/fixtures/synced-pattern.json +80 -0
- package/package.json +44 -4
- package/style.css +161 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dynamic-blocks",
|
|
3
|
+
"note": "Khối động (1.6): ép kiểu (\"1\" → 1, \"false\" → false), kẹp perPage ≤ 50 và width ≤ 600, bỏ giá trị ngoài danh sách (orderBy \"random\", orientation \"diagonal\", textAlign \"middle\") và null",
|
|
4
|
+
"input": {
|
|
5
|
+
"version": 1,
|
|
6
|
+
"blocks": [
|
|
7
|
+
{
|
|
8
|
+
"id": "main",
|
|
9
|
+
"type": "richtext",
|
|
10
|
+
"data": {
|
|
11
|
+
"type": "doc",
|
|
12
|
+
"content": [
|
|
13
|
+
{
|
|
14
|
+
"type": "templatePart",
|
|
15
|
+
"attrs": {
|
|
16
|
+
"slug": "header",
|
|
17
|
+
"tagName": "header"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "group",
|
|
22
|
+
"attrs": {
|
|
23
|
+
"padding": "small"
|
|
24
|
+
},
|
|
25
|
+
"content": [
|
|
26
|
+
{
|
|
27
|
+
"type": "siteLogo",
|
|
28
|
+
"attrs": {
|
|
29
|
+
"width": "800",
|
|
30
|
+
"link": "false"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "siteTitle",
|
|
35
|
+
"attrs": {
|
|
36
|
+
"level": "1",
|
|
37
|
+
"textAlign": "middle"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "siteTagline"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"type": "navigation",
|
|
45
|
+
"attrs": {
|
|
46
|
+
"location": "primary",
|
|
47
|
+
"orientation": "diagonal"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"type": "search",
|
|
52
|
+
"attrs": {
|
|
53
|
+
"placeholder": "Tìm…",
|
|
54
|
+
"buttonText": null
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"type": "languageSwitcher"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "postTitle",
|
|
64
|
+
"attrs": {
|
|
65
|
+
"level": 2,
|
|
66
|
+
"link": "true"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"type": "featuredImage",
|
|
71
|
+
"attrs": {
|
|
72
|
+
"aspect": "16/9",
|
|
73
|
+
"size": "medium"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"type": "postDate"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "postAuthor",
|
|
81
|
+
"attrs": {
|
|
82
|
+
"avatar": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"type": "postTerms",
|
|
87
|
+
"attrs": {
|
|
88
|
+
"taxonomy": "post_tag"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "postContent"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "postExcerpt",
|
|
96
|
+
"attrs": {
|
|
97
|
+
"moreText": "Đọc tiếp"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"type": "comments"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "query",
|
|
105
|
+
"attrs": {
|
|
106
|
+
"inherit": "false",
|
|
107
|
+
"perPage": "100",
|
|
108
|
+
"category": "tin-tuc",
|
|
109
|
+
"orderBy": "random",
|
|
110
|
+
"order": "asc"
|
|
111
|
+
},
|
|
112
|
+
"content": [
|
|
113
|
+
{
|
|
114
|
+
"type": "postTemplate",
|
|
115
|
+
"attrs": {
|
|
116
|
+
"layout": "grid",
|
|
117
|
+
"columns": "3"
|
|
118
|
+
},
|
|
119
|
+
"content": [
|
|
120
|
+
{
|
|
121
|
+
"type": "postTitle",
|
|
122
|
+
"attrs": {
|
|
123
|
+
"level": 3,
|
|
124
|
+
"link": true
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"type": "postExcerpt"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "pagination"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"type": "queryEmpty",
|
|
137
|
+
"content": [
|
|
138
|
+
{
|
|
139
|
+
"type": "paragraph",
|
|
140
|
+
"content": [
|
|
141
|
+
{
|
|
142
|
+
"type": "text",
|
|
143
|
+
"text": "Chưa có bài"
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "copyright",
|
|
153
|
+
"attrs": {
|
|
154
|
+
"text": "Bản quyền"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"expected": {
|
|
163
|
+
"version": 1,
|
|
164
|
+
"blocks": [
|
|
165
|
+
{
|
|
166
|
+
"id": "main",
|
|
167
|
+
"type": "richtext",
|
|
168
|
+
"data": {
|
|
169
|
+
"type": "doc",
|
|
170
|
+
"content": [
|
|
171
|
+
{
|
|
172
|
+
"type": "templatePart",
|
|
173
|
+
"attrs": {
|
|
174
|
+
"slug": "header",
|
|
175
|
+
"tagName": "header"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"type": "group",
|
|
180
|
+
"attrs": {
|
|
181
|
+
"padding": "small"
|
|
182
|
+
},
|
|
183
|
+
"content": [
|
|
184
|
+
{
|
|
185
|
+
"type": "siteLogo",
|
|
186
|
+
"attrs": {
|
|
187
|
+
"width": 600,
|
|
188
|
+
"link": false
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"type": "siteTitle",
|
|
193
|
+
"attrs": {
|
|
194
|
+
"level": 1
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"type": "siteTagline"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"type": "navigation",
|
|
202
|
+
"attrs": {
|
|
203
|
+
"location": "primary"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"type": "search",
|
|
208
|
+
"attrs": {
|
|
209
|
+
"placeholder": "Tìm…"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"type": "languageSwitcher"
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"type": "postTitle",
|
|
219
|
+
"attrs": {
|
|
220
|
+
"level": 2,
|
|
221
|
+
"link": true
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"type": "featuredImage",
|
|
226
|
+
"attrs": {
|
|
227
|
+
"aspect": "16/9",
|
|
228
|
+
"size": "medium"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"type": "postDate"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"type": "postAuthor",
|
|
236
|
+
"attrs": {
|
|
237
|
+
"avatar": true
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"type": "postTerms",
|
|
242
|
+
"attrs": {
|
|
243
|
+
"taxonomy": "post_tag"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"type": "postContent"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"type": "postExcerpt",
|
|
251
|
+
"attrs": {
|
|
252
|
+
"moreText": "Đọc tiếp"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"type": "comments"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"type": "query",
|
|
260
|
+
"attrs": {
|
|
261
|
+
"inherit": false,
|
|
262
|
+
"perPage": 50,
|
|
263
|
+
"category": "tin-tuc",
|
|
264
|
+
"order": "asc"
|
|
265
|
+
},
|
|
266
|
+
"content": [
|
|
267
|
+
{
|
|
268
|
+
"type": "postTemplate",
|
|
269
|
+
"attrs": {
|
|
270
|
+
"layout": "grid",
|
|
271
|
+
"columns": 3
|
|
272
|
+
},
|
|
273
|
+
"content": [
|
|
274
|
+
{
|
|
275
|
+
"type": "postTitle",
|
|
276
|
+
"attrs": {
|
|
277
|
+
"level": 3,
|
|
278
|
+
"link": true
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"type": "postExcerpt"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"type": "pagination"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"type": "queryEmpty",
|
|
291
|
+
"content": [
|
|
292
|
+
{
|
|
293
|
+
"type": "paragraph",
|
|
294
|
+
"content": [
|
|
295
|
+
{
|
|
296
|
+
"type": "text",
|
|
297
|
+
"text": "Chưa có bài"
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"type": "copyright",
|
|
307
|
+
"attrs": {
|
|
308
|
+
"text": "Bản quyền"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "editor-output-nulls",
|
|
3
|
+
"note": "Đầu ra của trình soạn có thuộc tính null — null = không có, không lưu",
|
|
4
|
+
"input": {
|
|
5
|
+
"version": 1,
|
|
6
|
+
"blocks": [
|
|
7
|
+
{
|
|
8
|
+
"id": "main",
|
|
9
|
+
"type": "richtext",
|
|
10
|
+
"data": {
|
|
11
|
+
"type": "doc",
|
|
12
|
+
"content": [
|
|
13
|
+
{
|
|
14
|
+
"type": "paragraph",
|
|
15
|
+
"attrs": {
|
|
16
|
+
"textAlign": null
|
|
17
|
+
},
|
|
18
|
+
"content": [
|
|
19
|
+
{
|
|
20
|
+
"type": "text",
|
|
21
|
+
"text": "A"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "heading",
|
|
27
|
+
"attrs": {
|
|
28
|
+
"level": 3,
|
|
29
|
+
"textAlign": null,
|
|
30
|
+
"id": null
|
|
31
|
+
},
|
|
32
|
+
"content": [
|
|
33
|
+
{
|
|
34
|
+
"type": "text",
|
|
35
|
+
"text": "B"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "image",
|
|
41
|
+
"attrs": {
|
|
42
|
+
"src": "/x.jpg",
|
|
43
|
+
"alt": "",
|
|
44
|
+
"title": null,
|
|
45
|
+
"width": null,
|
|
46
|
+
"height": null,
|
|
47
|
+
"srcset": null,
|
|
48
|
+
"webpSrcset": null,
|
|
49
|
+
"mediaId": null,
|
|
50
|
+
"size": "large",
|
|
51
|
+
"caption": null,
|
|
52
|
+
"align": null
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"type": "paragraph",
|
|
57
|
+
"attrs": {
|
|
58
|
+
"textAlign": null
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"expected": {
|
|
67
|
+
"version": 1,
|
|
68
|
+
"blocks": [
|
|
69
|
+
{
|
|
70
|
+
"id": "main",
|
|
71
|
+
"type": "richtext",
|
|
72
|
+
"data": {
|
|
73
|
+
"type": "doc",
|
|
74
|
+
"content": [
|
|
75
|
+
{
|
|
76
|
+
"type": "paragraph",
|
|
77
|
+
"content": [
|
|
78
|
+
{
|
|
79
|
+
"type": "text",
|
|
80
|
+
"text": "A"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "heading",
|
|
86
|
+
"attrs": {
|
|
87
|
+
"level": 3
|
|
88
|
+
},
|
|
89
|
+
"content": [
|
|
90
|
+
{
|
|
91
|
+
"type": "text",
|
|
92
|
+
"text": "B"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"type": "image",
|
|
98
|
+
"attrs": {
|
|
99
|
+
"src": "/x.jpg",
|
|
100
|
+
"alt": "",
|
|
101
|
+
"size": "large"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"type": "paragraph"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "invalid-structure",
|
|
3
|
+
"note": "Cấu trúc hỏng: nút không type, chữ rỗng, mark lặp/sai, attrs không phải object, khối không type — bỏ phần hỏng, giữ phần đúng",
|
|
4
|
+
"input": {
|
|
5
|
+
"version": 1,
|
|
6
|
+
"blocks": [
|
|
7
|
+
{
|
|
8
|
+
"id": "main",
|
|
9
|
+
"type": "richtext",
|
|
10
|
+
"data": {
|
|
11
|
+
"type": "doc",
|
|
12
|
+
"content": [
|
|
13
|
+
{
|
|
14
|
+
"type": "paragraph",
|
|
15
|
+
"content": [
|
|
16
|
+
{
|
|
17
|
+
"type": "text",
|
|
18
|
+
"text": ""
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"text": "không type"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "text",
|
|
25
|
+
"text": "ok",
|
|
26
|
+
"marks": [
|
|
27
|
+
{
|
|
28
|
+
"type": "bold"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "bold"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": ""
|
|
35
|
+
},
|
|
36
|
+
"x"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "text",
|
|
41
|
+
"text": 5
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "paragraph",
|
|
47
|
+
"attrs": [
|
|
48
|
+
"mảng"
|
|
49
|
+
],
|
|
50
|
+
"content": "không phải mảng"
|
|
51
|
+
},
|
|
52
|
+
"chuỗi",
|
|
53
|
+
null,
|
|
54
|
+
{
|
|
55
|
+
"type": "blockquote",
|
|
56
|
+
"content": [
|
|
57
|
+
null,
|
|
58
|
+
{
|
|
59
|
+
"type": "paragraph",
|
|
60
|
+
"content": [
|
|
61
|
+
{
|
|
62
|
+
"type": "text",
|
|
63
|
+
"text": "q"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": ""
|
|
74
|
+
},
|
|
75
|
+
"khối chuỗi",
|
|
76
|
+
{
|
|
77
|
+
"id": 5,
|
|
78
|
+
"type": "html",
|
|
79
|
+
"data": {
|
|
80
|
+
"html": 7
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"type": "html"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"expected": {
|
|
89
|
+
"version": 1,
|
|
90
|
+
"blocks": [
|
|
91
|
+
{
|
|
92
|
+
"id": "main",
|
|
93
|
+
"type": "richtext",
|
|
94
|
+
"data": {
|
|
95
|
+
"type": "doc",
|
|
96
|
+
"content": [
|
|
97
|
+
{
|
|
98
|
+
"type": "paragraph",
|
|
99
|
+
"content": [
|
|
100
|
+
{
|
|
101
|
+
"type": "text",
|
|
102
|
+
"text": "ok",
|
|
103
|
+
"marks": [
|
|
104
|
+
{
|
|
105
|
+
"type": "bold"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"type": "paragraph"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"type": "blockquote",
|
|
116
|
+
"content": [
|
|
117
|
+
{
|
|
118
|
+
"type": "paragraph",
|
|
119
|
+
"content": [
|
|
120
|
+
{
|
|
121
|
+
"type": "text",
|
|
122
|
+
"text": "q"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "html",
|
|
133
|
+
"data": {
|
|
134
|
+
"html": ""
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "html",
|
|
139
|
+
"data": {
|
|
140
|
+
"html": ""
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
}
|