@ecomcx/ecomweb-content 0.0.0-stage → 1.15.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +178 -2
  3. package/dist/bindings.d.ts +19 -0
  4. package/dist/bindings.js +44 -0
  5. package/dist/block.d.ts +58 -0
  6. package/dist/block.js +60 -0
  7. package/dist/embed.d.ts +23 -0
  8. package/dist/embed.js +63 -0
  9. package/dist/index.d.ts +11 -0
  10. package/dist/index.js +11 -0
  11. package/dist/migrate.d.ts +2 -0
  12. package/dist/migrate.js +19 -0
  13. package/dist/normalize.d.ts +25 -0
  14. package/dist/normalize.js +147 -0
  15. package/dist/schema.d.ts +31 -0
  16. package/dist/schema.js +173 -0
  17. package/dist/style.d.ts +132 -0
  18. package/dist/style.js +523 -0
  19. package/dist/text.d.ts +9 -0
  20. package/dist/text.js +30 -0
  21. package/dist/types.d.ts +36 -0
  22. package/dist/types.js +6 -0
  23. package/dist/url.d.ts +7 -0
  24. package/dist/url.js +21 -0
  25. package/fixtures/all-core-nodes.json +782 -0
  26. package/fixtures/attr-coercion.json +219 -0
  27. package/fixtures/basic-blocks.json +414 -0
  28. package/fixtures/bindings-lock.json +33 -0
  29. package/fixtures/block-extras.json +131 -0
  30. package/fixtures/block-styles.json +316 -0
  31. package/fixtures/dynamic-blocks.json +316 -0
  32. package/fixtures/editor-output-nulls.json +112 -0
  33. package/fixtures/empty-and-newer.json +12 -0
  34. package/fixtures/invalid-structure.json +145 -0
  35. package/fixtures/layout-blocks.json +238 -0
  36. package/fixtures/legacy-html-string.json +17 -0
  37. package/fixtures/legacy-tiptap-doc.json +41 -0
  38. package/fixtures/plugin-blocks-preserved.json +155 -0
  39. package/fixtures/style-layout-effects.json +47 -0
  40. package/fixtures/synced-pattern.json +80 -0
  41. package/package.json +44 -4
  42. package/style.css +169 -0
@@ -0,0 +1,782 @@
1
+ {
2
+ "name": "all-core-nodes",
3
+ "note": "Đủ mọi khối và định dạng lõi (kết hợp được trong trình soạn — mã không đi cùng định dạng khác) — đã chuẩn, chuẩn hoá không đổi gì",
4
+ "input": {
5
+ "version": 1,
6
+ "blocks": [
7
+ {
8
+ "id": "main",
9
+ "type": "richtext",
10
+ "data": {
11
+ "type": "doc",
12
+ "content": [
13
+ {
14
+ "type": "heading",
15
+ "attrs": {
16
+ "level": 2,
17
+ "textAlign": "center"
18
+ },
19
+ "content": [
20
+ {
21
+ "type": "text",
22
+ "text": "Tiêu đề"
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "type": "paragraph",
28
+ "content": [
29
+ {
30
+ "type": "text",
31
+ "text": "Chữ "
32
+ },
33
+ {
34
+ "type": "text",
35
+ "text": "đậm",
36
+ "marks": [
37
+ {
38
+ "type": "bold"
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "type": "text",
44
+ "text": " và "
45
+ },
46
+ {
47
+ "type": "text",
48
+ "text": "liên kết",
49
+ "marks": [
50
+ {
51
+ "type": "link",
52
+ "attrs": {
53
+ "href": "https://example.com",
54
+ "target": "_blank",
55
+ "rel": "nofollow"
56
+ }
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "type": "hardBreak"
62
+ },
63
+ {
64
+ "type": "text",
65
+ "text": "dòng mới",
66
+ "marks": [
67
+ {
68
+ "type": "italic"
69
+ },
70
+ {
71
+ "type": "underline"
72
+ },
73
+ {
74
+ "type": "strike"
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ "type": "text",
80
+ "text": " "
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "mã",
85
+ "marks": [
86
+ {
87
+ "type": "code"
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ "type": "paragraph",
95
+ "content": [
96
+ {
97
+ "type": "text",
98
+ "text": "H"
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "2",
103
+ "marks": [
104
+ {
105
+ "type": "subscript"
106
+ }
107
+ ]
108
+ },
109
+ {
110
+ "type": "text",
111
+ "text": "O "
112
+ },
113
+ {
114
+ "type": "text",
115
+ "text": "x",
116
+ "marks": [
117
+ {
118
+ "type": "superscript"
119
+ }
120
+ ]
121
+ },
122
+ {
123
+ "type": "text",
124
+ "text": " tô",
125
+ "marks": [
126
+ {
127
+ "type": "highlight",
128
+ "attrs": {
129
+ "color": "#ff0"
130
+ }
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ "type": "text",
136
+ "text": " màu",
137
+ "marks": [
138
+ {
139
+ "type": "textStyle",
140
+ "attrs": {
141
+ "color": "#e11d48"
142
+ }
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ "type": "bulletList",
150
+ "content": [
151
+ {
152
+ "type": "listItem",
153
+ "content": [
154
+ {
155
+ "type": "paragraph",
156
+ "content": [
157
+ {
158
+ "type": "text",
159
+ "text": "Một"
160
+ }
161
+ ]
162
+ }
163
+ ]
164
+ },
165
+ {
166
+ "type": "listItem",
167
+ "content": [
168
+ {
169
+ "type": "paragraph",
170
+ "content": [
171
+ {
172
+ "type": "text",
173
+ "text": "Hai"
174
+ }
175
+ ]
176
+ }
177
+ ]
178
+ }
179
+ ]
180
+ },
181
+ {
182
+ "type": "orderedList",
183
+ "attrs": {
184
+ "start": 3
185
+ },
186
+ "content": [
187
+ {
188
+ "type": "listItem",
189
+ "content": [
190
+ {
191
+ "type": "paragraph",
192
+ "content": [
193
+ {
194
+ "type": "text",
195
+ "text": "Ba"
196
+ }
197
+ ]
198
+ }
199
+ ]
200
+ }
201
+ ]
202
+ },
203
+ {
204
+ "type": "taskList",
205
+ "content": [
206
+ {
207
+ "type": "taskItem",
208
+ "attrs": {
209
+ "checked": true
210
+ },
211
+ "content": [
212
+ {
213
+ "type": "paragraph",
214
+ "content": [
215
+ {
216
+ "type": "text",
217
+ "text": "Xong"
218
+ }
219
+ ]
220
+ }
221
+ ]
222
+ }
223
+ ]
224
+ },
225
+ {
226
+ "type": "blockquote",
227
+ "content": [
228
+ {
229
+ "type": "paragraph",
230
+ "content": [
231
+ {
232
+ "type": "text",
233
+ "text": "Trích dẫn"
234
+ }
235
+ ]
236
+ }
237
+ ]
238
+ },
239
+ {
240
+ "type": "codeBlock",
241
+ "attrs": {
242
+ "language": "ts"
243
+ },
244
+ "content": [
245
+ {
246
+ "type": "text",
247
+ "text": "const a = 1;"
248
+ }
249
+ ]
250
+ },
251
+ {
252
+ "type": "horizontalRule"
253
+ },
254
+ {
255
+ "type": "image",
256
+ "attrs": {
257
+ "src": "/uploads/a.jpg",
258
+ "alt": "Ảnh",
259
+ "width": 800,
260
+ "height": 600,
261
+ "srcset": "/uploads/a-400.jpg 400w, /uploads/a.jpg 800w",
262
+ "webpSrcset": "/uploads/a-400.webp 400w, /uploads/a.webp 800w",
263
+ "mediaId": 12,
264
+ "size": "large",
265
+ "caption": "Chú thích",
266
+ "align": "wide"
267
+ }
268
+ },
269
+ {
270
+ "type": "gallery",
271
+ "attrs": {
272
+ "images": [
273
+ {
274
+ "src": "/uploads/1.jpg",
275
+ "alt": "1",
276
+ "full": "/uploads/1-full.jpg"
277
+ },
278
+ {
279
+ "src": "/uploads/2.jpg",
280
+ "alt": "2"
281
+ }
282
+ ],
283
+ "columns": 2,
284
+ "caption": "Bộ ảnh"
285
+ }
286
+ },
287
+ {
288
+ "type": "video",
289
+ "attrs": {
290
+ "src": "/uploads/v.mp4",
291
+ "name": "v.mp4",
292
+ "mime": "video/mp4",
293
+ "mediaId": 3,
294
+ "poster": "/uploads/p.jpg",
295
+ "caption": "Video"
296
+ }
297
+ },
298
+ {
299
+ "type": "audio",
300
+ "attrs": {
301
+ "src": "/uploads/a.mp3",
302
+ "name": "a.mp3",
303
+ "mime": "audio/mpeg"
304
+ }
305
+ },
306
+ {
307
+ "type": "file",
308
+ "attrs": {
309
+ "src": "/uploads/d.pdf",
310
+ "name": "Tài liệu",
311
+ "mime": "application/pdf",
312
+ "size": 1024,
313
+ "embed": true
314
+ }
315
+ },
316
+ {
317
+ "type": "table",
318
+ "content": [
319
+ {
320
+ "type": "tableRow",
321
+ "content": [
322
+ {
323
+ "type": "tableHeader",
324
+ "attrs": {
325
+ "colspan": 1,
326
+ "rowspan": 1
327
+ },
328
+ "content": [
329
+ {
330
+ "type": "paragraph",
331
+ "content": [
332
+ {
333
+ "type": "text",
334
+ "text": "A"
335
+ }
336
+ ]
337
+ }
338
+ ]
339
+ },
340
+ {
341
+ "type": "tableHeader",
342
+ "content": [
343
+ {
344
+ "type": "paragraph",
345
+ "content": [
346
+ {
347
+ "type": "text",
348
+ "text": "B"
349
+ }
350
+ ]
351
+ }
352
+ ]
353
+ }
354
+ ]
355
+ },
356
+ {
357
+ "type": "tableRow",
358
+ "content": [
359
+ {
360
+ "type": "tableCell",
361
+ "attrs": {
362
+ "colspan": 2,
363
+ "rowspan": 1
364
+ },
365
+ "content": [
366
+ {
367
+ "type": "paragraph",
368
+ "content": [
369
+ {
370
+ "type": "text",
371
+ "text": "C"
372
+ }
373
+ ]
374
+ }
375
+ ]
376
+ }
377
+ ]
378
+ }
379
+ ]
380
+ },
381
+ {
382
+ "type": "youtube",
383
+ "attrs": {
384
+ "src": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
385
+ "start": 10
386
+ }
387
+ }
388
+ ]
389
+ }
390
+ }
391
+ ]
392
+ },
393
+ "expected": {
394
+ "version": 1,
395
+ "blocks": [
396
+ {
397
+ "id": "main",
398
+ "type": "richtext",
399
+ "data": {
400
+ "type": "doc",
401
+ "content": [
402
+ {
403
+ "type": "heading",
404
+ "attrs": {
405
+ "level": 2,
406
+ "textAlign": "center"
407
+ },
408
+ "content": [
409
+ {
410
+ "type": "text",
411
+ "text": "Tiêu đề"
412
+ }
413
+ ]
414
+ },
415
+ {
416
+ "type": "paragraph",
417
+ "content": [
418
+ {
419
+ "type": "text",
420
+ "text": "Chữ "
421
+ },
422
+ {
423
+ "type": "text",
424
+ "text": "đậm",
425
+ "marks": [
426
+ {
427
+ "type": "bold"
428
+ }
429
+ ]
430
+ },
431
+ {
432
+ "type": "text",
433
+ "text": " và "
434
+ },
435
+ {
436
+ "type": "text",
437
+ "text": "liên kết",
438
+ "marks": [
439
+ {
440
+ "type": "link",
441
+ "attrs": {
442
+ "href": "https://example.com",
443
+ "target": "_blank",
444
+ "rel": "nofollow"
445
+ }
446
+ }
447
+ ]
448
+ },
449
+ {
450
+ "type": "hardBreak"
451
+ },
452
+ {
453
+ "type": "text",
454
+ "text": "dòng mới",
455
+ "marks": [
456
+ {
457
+ "type": "italic"
458
+ },
459
+ {
460
+ "type": "underline"
461
+ },
462
+ {
463
+ "type": "strike"
464
+ }
465
+ ]
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": " "
470
+ },
471
+ {
472
+ "type": "text",
473
+ "text": "mã",
474
+ "marks": [
475
+ {
476
+ "type": "code"
477
+ }
478
+ ]
479
+ }
480
+ ]
481
+ },
482
+ {
483
+ "type": "paragraph",
484
+ "content": [
485
+ {
486
+ "type": "text",
487
+ "text": "H"
488
+ },
489
+ {
490
+ "type": "text",
491
+ "text": "2",
492
+ "marks": [
493
+ {
494
+ "type": "subscript"
495
+ }
496
+ ]
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "O "
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "x",
505
+ "marks": [
506
+ {
507
+ "type": "superscript"
508
+ }
509
+ ]
510
+ },
511
+ {
512
+ "type": "text",
513
+ "text": " tô",
514
+ "marks": [
515
+ {
516
+ "type": "highlight",
517
+ "attrs": {
518
+ "color": "#ff0"
519
+ }
520
+ }
521
+ ]
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": " màu",
526
+ "marks": [
527
+ {
528
+ "type": "textStyle",
529
+ "attrs": {
530
+ "color": "#e11d48"
531
+ }
532
+ }
533
+ ]
534
+ }
535
+ ]
536
+ },
537
+ {
538
+ "type": "bulletList",
539
+ "content": [
540
+ {
541
+ "type": "listItem",
542
+ "content": [
543
+ {
544
+ "type": "paragraph",
545
+ "content": [
546
+ {
547
+ "type": "text",
548
+ "text": "Một"
549
+ }
550
+ ]
551
+ }
552
+ ]
553
+ },
554
+ {
555
+ "type": "listItem",
556
+ "content": [
557
+ {
558
+ "type": "paragraph",
559
+ "content": [
560
+ {
561
+ "type": "text",
562
+ "text": "Hai"
563
+ }
564
+ ]
565
+ }
566
+ ]
567
+ }
568
+ ]
569
+ },
570
+ {
571
+ "type": "orderedList",
572
+ "attrs": {
573
+ "start": 3
574
+ },
575
+ "content": [
576
+ {
577
+ "type": "listItem",
578
+ "content": [
579
+ {
580
+ "type": "paragraph",
581
+ "content": [
582
+ {
583
+ "type": "text",
584
+ "text": "Ba"
585
+ }
586
+ ]
587
+ }
588
+ ]
589
+ }
590
+ ]
591
+ },
592
+ {
593
+ "type": "taskList",
594
+ "content": [
595
+ {
596
+ "type": "taskItem",
597
+ "attrs": {
598
+ "checked": true
599
+ },
600
+ "content": [
601
+ {
602
+ "type": "paragraph",
603
+ "content": [
604
+ {
605
+ "type": "text",
606
+ "text": "Xong"
607
+ }
608
+ ]
609
+ }
610
+ ]
611
+ }
612
+ ]
613
+ },
614
+ {
615
+ "type": "blockquote",
616
+ "content": [
617
+ {
618
+ "type": "paragraph",
619
+ "content": [
620
+ {
621
+ "type": "text",
622
+ "text": "Trích dẫn"
623
+ }
624
+ ]
625
+ }
626
+ ]
627
+ },
628
+ {
629
+ "type": "codeBlock",
630
+ "attrs": {
631
+ "language": "ts"
632
+ },
633
+ "content": [
634
+ {
635
+ "type": "text",
636
+ "text": "const a = 1;"
637
+ }
638
+ ]
639
+ },
640
+ {
641
+ "type": "horizontalRule"
642
+ },
643
+ {
644
+ "type": "image",
645
+ "attrs": {
646
+ "src": "/uploads/a.jpg",
647
+ "alt": "Ảnh",
648
+ "width": 800,
649
+ "height": 600,
650
+ "srcset": "/uploads/a-400.jpg 400w, /uploads/a.jpg 800w",
651
+ "webpSrcset": "/uploads/a-400.webp 400w, /uploads/a.webp 800w",
652
+ "mediaId": 12,
653
+ "size": "large",
654
+ "caption": "Chú thích",
655
+ "align": "wide"
656
+ }
657
+ },
658
+ {
659
+ "type": "gallery",
660
+ "attrs": {
661
+ "images": [
662
+ {
663
+ "src": "/uploads/1.jpg",
664
+ "alt": "1",
665
+ "full": "/uploads/1-full.jpg"
666
+ },
667
+ {
668
+ "src": "/uploads/2.jpg",
669
+ "alt": "2"
670
+ }
671
+ ],
672
+ "columns": 2,
673
+ "caption": "Bộ ảnh"
674
+ }
675
+ },
676
+ {
677
+ "type": "video",
678
+ "attrs": {
679
+ "src": "/uploads/v.mp4",
680
+ "name": "v.mp4",
681
+ "mime": "video/mp4",
682
+ "mediaId": 3,
683
+ "poster": "/uploads/p.jpg",
684
+ "caption": "Video"
685
+ }
686
+ },
687
+ {
688
+ "type": "audio",
689
+ "attrs": {
690
+ "src": "/uploads/a.mp3",
691
+ "name": "a.mp3",
692
+ "mime": "audio/mpeg"
693
+ }
694
+ },
695
+ {
696
+ "type": "file",
697
+ "attrs": {
698
+ "src": "/uploads/d.pdf",
699
+ "name": "Tài liệu",
700
+ "mime": "application/pdf",
701
+ "size": 1024,
702
+ "embed": true
703
+ }
704
+ },
705
+ {
706
+ "type": "table",
707
+ "content": [
708
+ {
709
+ "type": "tableRow",
710
+ "content": [
711
+ {
712
+ "type": "tableHeader",
713
+ "attrs": {
714
+ "colspan": 1,
715
+ "rowspan": 1
716
+ },
717
+ "content": [
718
+ {
719
+ "type": "paragraph",
720
+ "content": [
721
+ {
722
+ "type": "text",
723
+ "text": "A"
724
+ }
725
+ ]
726
+ }
727
+ ]
728
+ },
729
+ {
730
+ "type": "tableHeader",
731
+ "content": [
732
+ {
733
+ "type": "paragraph",
734
+ "content": [
735
+ {
736
+ "type": "text",
737
+ "text": "B"
738
+ }
739
+ ]
740
+ }
741
+ ]
742
+ }
743
+ ]
744
+ },
745
+ {
746
+ "type": "tableRow",
747
+ "content": [
748
+ {
749
+ "type": "tableCell",
750
+ "attrs": {
751
+ "colspan": 2,
752
+ "rowspan": 1
753
+ },
754
+ "content": [
755
+ {
756
+ "type": "paragraph",
757
+ "content": [
758
+ {
759
+ "type": "text",
760
+ "text": "C"
761
+ }
762
+ ]
763
+ }
764
+ ]
765
+ }
766
+ ]
767
+ }
768
+ ]
769
+ },
770
+ {
771
+ "type": "youtube",
772
+ "attrs": {
773
+ "src": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
774
+ "start": 10
775
+ }
776
+ }
777
+ ]
778
+ }
779
+ }
780
+ ]
781
+ }
782
+ }