quill-table-up 2.4.2 → 3.0.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/README.md +96 -40
- package/dist/index.css +1 -1
- package/dist/index.d.ts +173 -110
- package/dist/index.js +29 -28
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +29 -28
- package/dist/index.umd.js.map +1 -1
- package/dist/table-creator.css +1 -1
- package/package.json +1 -1
- package/src/__tests__/e2e/table-align.test.ts +1 -2
- package/src/__tests__/e2e/table-blots.test.ts +45 -35
- package/src/__tests__/e2e/table-clipboard.test.ts +20 -0
- package/src/__tests__/e2e/table-hack.test.ts +5 -5
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +6 -6
- package/src/__tests__/e2e/table-menu.test.ts +38 -0
- package/src/__tests__/e2e/table-selection.test.ts +3 -3
- package/src/__tests__/unit/table-blots.test.ts +26 -26
- package/src/__tests__/unit/table-caption.test.ts +33 -36
- package/src/__tests__/unit/table-cell-merge.test.ts +114 -114
- package/src/__tests__/unit/table-clipboard.test.ts +383 -19
- package/src/__tests__/unit/table-hack.test.ts +202 -144
- package/src/__tests__/unit/table-insert.test.ts +79 -79
- package/src/__tests__/unit/table-redo-undo.test.ts +666 -64
- package/src/__tests__/unit/table-remove.test.ts +8 -11
- package/src/__tests__/unit/utils.test.ts +4 -4
- package/src/__tests__/unit/utils.ts +4 -3
- package/src/formats/container-format.ts +25 -2
- package/src/formats/index.ts +54 -8
- package/src/formats/overrides/block-embed.ts +20 -1
- package/src/formats/overrides/block.ts +29 -39
- package/src/formats/table-body-format.ts +18 -58
- package/src/formats/table-cell-format.ts +296 -286
- package/src/formats/table-cell-inner-format.ts +382 -358
- package/src/formats/table-foot-format.ts +7 -0
- package/src/formats/table-head-format.ts +7 -0
- package/src/formats/table-main-format.ts +84 -5
- package/src/formats/table-row-format.ts +44 -14
- package/src/formats/utils.ts +3 -0
- package/src/modules/index.ts +1 -0
- package/src/modules/table-align.ts +59 -53
- package/src/modules/table-clipboard.ts +60 -39
- package/src/modules/table-dom-selector.ts +33 -0
- package/src/modules/table-menu/constants.ts +21 -31
- package/src/modules/table-menu/table-menu-common.ts +72 -51
- package/src/modules/table-menu/table-menu-contextmenu.ts +22 -6
- package/src/modules/table-menu/table-menu-select.ts +75 -12
- package/src/modules/table-resize/table-resize-box.ts +148 -128
- package/src/modules/table-resize/table-resize-common.ts +37 -32
- package/src/modules/table-resize/table-resize-line.ts +53 -36
- package/src/modules/table-resize/table-resize-scale.ts +32 -27
- package/src/modules/table-scrollbar.ts +58 -32
- package/src/modules/table-selection.ts +104 -80
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/style/index.less +0 -1
- package/src/style/select-box.less +1 -0
- package/src/style/table-menu.less +4 -4
- package/src/style/table-resize.less +1 -0
- package/src/style/table-scrollbar.less +2 -2
- package/src/table-up.ts +160 -194
- package/src/utils/components/table/creator.ts +4 -1
- package/src/utils/components/tooltip.ts +6 -1
- package/src/utils/constants.ts +8 -2
- package/src/utils/index.ts +2 -1
- package/src/utils/scroll.ts +47 -0
- package/src/utils/style-helper.ts +47 -0
- package/src/utils/transformer.ts +0 -25
- package/src/utils/types.ts +15 -15
- package/src/utils/scroll-event-helper.ts +0 -22
|
@@ -160,7 +160,7 @@ describe('table undo', () => {
|
|
|
160
160
|
</div>
|
|
161
161
|
<p><br></p>
|
|
162
162
|
`,
|
|
163
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
163
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
164
164
|
);
|
|
165
165
|
});
|
|
166
166
|
|
|
@@ -234,7 +234,7 @@ describe('table undo', () => {
|
|
|
234
234
|
</div>
|
|
235
235
|
<p><br></p>
|
|
236
236
|
`,
|
|
237
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
237
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
238
238
|
);
|
|
239
239
|
});
|
|
240
240
|
|
|
@@ -374,7 +374,7 @@ describe('table undo', () => {
|
|
|
374
374
|
</div>
|
|
375
375
|
<p><br></p>
|
|
376
376
|
`,
|
|
377
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
377
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
378
378
|
);
|
|
379
379
|
quill.history.undo();
|
|
380
380
|
await vi.runAllTimersAsync();
|
|
@@ -384,7 +384,7 @@ describe('table undo', () => {
|
|
|
384
384
|
${createTableHTML(4, 4)}
|
|
385
385
|
<p><br></p>
|
|
386
386
|
`,
|
|
387
|
-
{ ignoreAttrs: ['
|
|
387
|
+
{ ignoreAttrs: ['class', 'style', 'data-table-id', 'contenteditable'] },
|
|
388
388
|
);
|
|
389
389
|
});
|
|
390
390
|
|
|
@@ -467,7 +467,7 @@ describe('table undo', () => {
|
|
|
467
467
|
</div>
|
|
468
468
|
<p><br></p>
|
|
469
469
|
`,
|
|
470
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
470
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
471
471
|
);
|
|
472
472
|
quill.history.undo();
|
|
473
473
|
await vi.runAllTimersAsync();
|
|
@@ -477,7 +477,7 @@ describe('table undo', () => {
|
|
|
477
477
|
${createTableHTML(5, 5)}
|
|
478
478
|
<p><br></p>
|
|
479
479
|
`,
|
|
480
|
-
{ ignoreAttrs: ['
|
|
480
|
+
{ ignoreAttrs: ['class', 'style', 'data-table-id', 'contenteditable'] },
|
|
481
481
|
);
|
|
482
482
|
});
|
|
483
483
|
|
|
@@ -564,7 +564,7 @@ describe('table undo', () => {
|
|
|
564
564
|
</div>
|
|
565
565
|
<p><br></p>
|
|
566
566
|
`,
|
|
567
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
567
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'contenteditable'] },
|
|
568
568
|
);
|
|
569
569
|
quill.history.undo();
|
|
570
570
|
await vi.runAllTimersAsync();
|
|
@@ -574,7 +574,7 @@ describe('table undo', () => {
|
|
|
574
574
|
${createTableHTML(5, 5)}
|
|
575
575
|
<p><br></p>
|
|
576
576
|
`,
|
|
577
|
-
{ ignoreAttrs: ['
|
|
577
|
+
{ ignoreAttrs: ['class', 'style', 'data-table-id', 'contenteditable'] },
|
|
578
578
|
);
|
|
579
579
|
});
|
|
580
580
|
|
|
@@ -654,7 +654,7 @@ describe('table undo', () => {
|
|
|
654
654
|
</div>
|
|
655
655
|
<p><br></p>
|
|
656
656
|
`,
|
|
657
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'contenteditable'] },
|
|
657
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'contenteditable'] },
|
|
658
658
|
);
|
|
659
659
|
quill.history.undo();
|
|
660
660
|
await vi.runAllTimersAsync();
|
|
@@ -664,7 +664,7 @@ describe('table undo', () => {
|
|
|
664
664
|
${createTableHTML(5, 5)}
|
|
665
665
|
<p><br></p>
|
|
666
666
|
`,
|
|
667
|
-
{ ignoreAttrs: ['
|
|
667
|
+
{ ignoreAttrs: ['class', 'style', 'data-table-id', 'contenteditable'] },
|
|
668
668
|
);
|
|
669
669
|
});
|
|
670
670
|
|
|
@@ -717,7 +717,7 @@ describe('table undo', () => {
|
|
|
717
717
|
`;
|
|
718
718
|
expect(quill.root).toEqualHTML(
|
|
719
719
|
afterColHtml,
|
|
720
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-full', 'data-table-id', 'data-row-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
720
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-full', 'data-table-id', 'data-row-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
721
721
|
);
|
|
722
722
|
quill.history.undo();
|
|
723
723
|
await vi.runAllTimersAsync();
|
|
@@ -733,7 +733,7 @@ describe('table undo', () => {
|
|
|
733
733
|
await vi.runAllTimersAsync();
|
|
734
734
|
expect(quill.root).toEqualHTML(
|
|
735
735
|
afterColHtml,
|
|
736
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-full', 'data-table-id', 'data-row-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
736
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-full', 'data-table-id', 'data-row-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
737
737
|
);
|
|
738
738
|
});
|
|
739
739
|
|
|
@@ -745,23 +745,23 @@ describe('table undo', () => {
|
|
|
745
745
|
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
746
746
|
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
747
747
|
{ insert: '1' },
|
|
748
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
748
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
749
749
|
{ insert: '2' },
|
|
750
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
750
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
751
751
|
{ insert: '3' },
|
|
752
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
752
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
753
753
|
{ insert: '4' },
|
|
754
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
754
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
755
755
|
{ insert: '5' },
|
|
756
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
756
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
757
757
|
{ insert: '6' },
|
|
758
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
758
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
759
759
|
{ insert: '7' },
|
|
760
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
760
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
761
761
|
{ insert: '8' },
|
|
762
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
762
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
763
763
|
{ insert: '9' },
|
|
764
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
764
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
765
765
|
{ insert: '\n' },
|
|
766
766
|
];
|
|
767
767
|
const thDelta = [
|
|
@@ -770,23 +770,23 @@ describe('table undo', () => {
|
|
|
770
770
|
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
771
771
|
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
772
772
|
{ insert: '1' },
|
|
773
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
773
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
774
774
|
{ insert: '2' },
|
|
775
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
775
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
776
776
|
{ insert: '3' },
|
|
777
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
777
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
778
778
|
{ insert: '4' },
|
|
779
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
779
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
780
780
|
{ insert: '5' },
|
|
781
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
781
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
782
782
|
{ insert: '6' },
|
|
783
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
783
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
784
784
|
{ insert: '7' },
|
|
785
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
785
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
786
786
|
{ insert: '8' },
|
|
787
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
787
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
788
788
|
{ insert: '9' },
|
|
789
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'th' } }, insert: '\n' },
|
|
789
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'th', wrapTag: 'tbody' } }, insert: '\n' },
|
|
790
790
|
{ insert: '\n' },
|
|
791
791
|
];
|
|
792
792
|
quill.setContents(originDelta);
|
|
@@ -796,22 +796,497 @@ describe('table undo', () => {
|
|
|
796
796
|
}
|
|
797
797
|
await vi.runAllTimersAsync();
|
|
798
798
|
expectDelta(
|
|
799
|
-
new Delta(thDelta),
|
|
800
799
|
quill.getContents(),
|
|
800
|
+
new Delta(thDelta),
|
|
801
801
|
);
|
|
802
802
|
|
|
803
803
|
quill.history.undo();
|
|
804
804
|
await vi.runAllTimersAsync();
|
|
805
805
|
expectDelta(
|
|
806
|
-
new Delta(originDelta),
|
|
807
806
|
quill.getContents(),
|
|
807
|
+
new Delta(originDelta),
|
|
808
808
|
);
|
|
809
809
|
|
|
810
810
|
quill.history.redo();
|
|
811
811
|
await vi.runAllTimersAsync();
|
|
812
812
|
expectDelta(
|
|
813
|
+
quill.getContents(),
|
|
813
814
|
new Delta(thDelta),
|
|
815
|
+
);
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
it('undo and redo merge cell span 2 bodys', async () => {
|
|
819
|
+
const quill = createQuillWithTableModule('<p><br></p>');
|
|
820
|
+
const tableModule = quill.getModule('table-up') as TableUp;
|
|
821
|
+
const ops = [
|
|
822
|
+
{ insert: '\n' },
|
|
823
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
824
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
825
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
826
|
+
{ insert: '1' },
|
|
827
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
828
|
+
{ insert: '2' },
|
|
829
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
830
|
+
{ insert: '3' },
|
|
831
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
832
|
+
{ insert: '4' },
|
|
833
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
834
|
+
{ insert: '5' },
|
|
835
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
836
|
+
{ insert: '6' },
|
|
837
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
838
|
+
{ insert: '\n' },
|
|
839
|
+
];
|
|
840
|
+
quill.setContents(ops);
|
|
841
|
+
|
|
842
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
843
|
+
tableModule.mergeCells([tds[0], tds[1], tds[3], tds[4]]);
|
|
844
|
+
await vi.runAllTimersAsync();
|
|
845
|
+
const mergedOps = [
|
|
846
|
+
{ insert: '\n' },
|
|
847
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 200 } } },
|
|
848
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
849
|
+
{ insert: '1' },
|
|
850
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
851
|
+
{ insert: '2' },
|
|
852
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
853
|
+
{ insert: '4' },
|
|
854
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
855
|
+
{ insert: '5' },
|
|
856
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
857
|
+
{ insert: '3' },
|
|
858
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
859
|
+
{ insert: '6' },
|
|
860
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
861
|
+
{ insert: '\n' },
|
|
862
|
+
];
|
|
863
|
+
expectDelta(
|
|
864
|
+
quill.getContents(),
|
|
865
|
+
new Delta(mergedOps),
|
|
866
|
+
);
|
|
867
|
+
|
|
868
|
+
quill.history.undo();
|
|
869
|
+
await vi.runAllTimersAsync();
|
|
870
|
+
expectDelta(
|
|
871
|
+
quill.getContents(),
|
|
872
|
+
new Delta(ops),
|
|
873
|
+
);
|
|
874
|
+
|
|
875
|
+
quill.history.redo();
|
|
876
|
+
await vi.runAllTimersAsync();
|
|
877
|
+
expectDelta(
|
|
878
|
+
quill.getContents(),
|
|
879
|
+
new Delta(mergedOps),
|
|
880
|
+
);
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
it('undo and redo merge cell span 3 bodys', async () => {
|
|
884
|
+
const quill = createQuillWithTableModule('<p><br></p>');
|
|
885
|
+
const tableModule = quill.getModule('table-up') as TableUp;
|
|
886
|
+
const ops = [
|
|
887
|
+
{ insert: '\n' },
|
|
888
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
889
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
890
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
891
|
+
{ insert: '1' },
|
|
892
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
893
|
+
{ insert: '2' },
|
|
894
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
895
|
+
{ insert: '3' },
|
|
896
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
897
|
+
{ insert: '4' },
|
|
898
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
899
|
+
{ insert: '5' },
|
|
900
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
901
|
+
{ insert: '6' },
|
|
902
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
903
|
+
{ insert: '7' },
|
|
904
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
905
|
+
{ insert: '8' },
|
|
906
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
907
|
+
{ insert: '9' },
|
|
908
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
909
|
+
{ insert: '\n' },
|
|
910
|
+
];
|
|
911
|
+
quill.setContents(ops);
|
|
912
|
+
|
|
913
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
914
|
+
tableModule.mergeCells([tds[0], tds[3], tds[6]]);
|
|
915
|
+
await vi.runAllTimersAsync();
|
|
916
|
+
const mergedOps = [
|
|
917
|
+
{ insert: '\n' },
|
|
918
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
919
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
920
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
921
|
+
{ insert: '1' },
|
|
922
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 3, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
923
|
+
{ insert: '4' },
|
|
924
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 3, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
925
|
+
{ insert: '7' },
|
|
926
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 3, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
927
|
+
{ insert: '2' },
|
|
928
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
929
|
+
{ insert: '3' },
|
|
930
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
931
|
+
{ insert: '5' },
|
|
932
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
933
|
+
{ insert: '6' },
|
|
934
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
935
|
+
{ insert: '8' },
|
|
936
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
937
|
+
{ insert: '9' },
|
|
938
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
939
|
+
{ insert: '\n' },
|
|
940
|
+
];
|
|
941
|
+
expectDelta(
|
|
942
|
+
quill.getContents(),
|
|
943
|
+
new Delta(mergedOps),
|
|
944
|
+
);
|
|
945
|
+
|
|
946
|
+
quill.history.undo();
|
|
947
|
+
await vi.runAllTimersAsync();
|
|
948
|
+
expectDelta(
|
|
949
|
+
quill.getContents(),
|
|
950
|
+
new Delta(ops),
|
|
951
|
+
);
|
|
952
|
+
|
|
953
|
+
quill.history.redo();
|
|
954
|
+
await vi.runAllTimersAsync();
|
|
955
|
+
expectDelta(
|
|
956
|
+
quill.getContents(),
|
|
957
|
+
new Delta(mergedOps),
|
|
958
|
+
);
|
|
959
|
+
});
|
|
960
|
+
|
|
961
|
+
it('undo and redo split cell span 2 bodys', async () => {
|
|
962
|
+
const quill = createQuillWithTableModule('<p><br></p>');
|
|
963
|
+
const tableModule = quill.getModule('table-up') as TableUp;
|
|
964
|
+
const ops = [
|
|
965
|
+
{ insert: '\n' },
|
|
966
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
967
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
968
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
969
|
+
{ insert: '1' },
|
|
970
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 2, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
971
|
+
{ insert: '2' },
|
|
972
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 2, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
973
|
+
{ insert: '4' },
|
|
974
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 2, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
975
|
+
{ insert: '5' },
|
|
976
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 2, colspan: 2, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
977
|
+
{ insert: '3' },
|
|
978
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
979
|
+
{ insert: '6' },
|
|
980
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
981
|
+
{ insert: '7' },
|
|
982
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
983
|
+
{ insert: '8' },
|
|
984
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
985
|
+
{ insert: '9' },
|
|
986
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
987
|
+
{ insert: '\n' },
|
|
988
|
+
];
|
|
989
|
+
quill.setContents(ops);
|
|
990
|
+
|
|
991
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
992
|
+
tableModule.splitCell([tds[0]]);
|
|
993
|
+
await vi.runAllTimersAsync();
|
|
994
|
+
const splitOps = [
|
|
995
|
+
{ insert: '\n' },
|
|
996
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
997
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
998
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
999
|
+
{ insert: '1' },
|
|
1000
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1001
|
+
{ insert: '2' },
|
|
1002
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1003
|
+
{ insert: '4' },
|
|
1004
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1005
|
+
{ insert: '5' },
|
|
1006
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1007
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1008
|
+
{ insert: '3' },
|
|
1009
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1010
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1011
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1012
|
+
{ insert: '6' },
|
|
1013
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1014
|
+
{ insert: '7' },
|
|
1015
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
1016
|
+
{ insert: '8' },
|
|
1017
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
1018
|
+
{ insert: '9' },
|
|
1019
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tfoot' } }, insert: '\n' },
|
|
1020
|
+
{ insert: '\n' },
|
|
1021
|
+
];
|
|
1022
|
+
expectDelta(
|
|
1023
|
+
quill.getContents(),
|
|
1024
|
+
new Delta(splitOps),
|
|
1025
|
+
);
|
|
1026
|
+
|
|
1027
|
+
quill.history.undo();
|
|
1028
|
+
await vi.runAllTimersAsync();
|
|
1029
|
+
expectDelta(
|
|
1030
|
+
quill.getContents(),
|
|
1031
|
+
new Delta(ops),
|
|
1032
|
+
);
|
|
1033
|
+
|
|
1034
|
+
quill.history.redo();
|
|
1035
|
+
await vi.runAllTimersAsync();
|
|
1036
|
+
expectDelta(
|
|
1037
|
+
quill.getContents(),
|
|
1038
|
+
new Delta(splitOps),
|
|
1039
|
+
);
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
it('undo and redo split cell span 3 bodys', async () => {
|
|
1043
|
+
const quill = createQuillWithTableModule('<p><br></p>');
|
|
1044
|
+
const tableModule = quill.getModule('table-up') as TableUp;
|
|
1045
|
+
const ops = [
|
|
1046
|
+
{ insert: '\n' },
|
|
1047
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1048
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1049
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
1050
|
+
{ insert: '1' },
|
|
1051
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 3, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1052
|
+
{ insert: '4' },
|
|
1053
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 3, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1054
|
+
{ insert: '7' },
|
|
1055
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 3, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1056
|
+
{ insert: '2' },
|
|
1057
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1058
|
+
{ insert: '3' },
|
|
1059
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1060
|
+
{ insert: '5' },
|
|
1061
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1062
|
+
{ insert: '6' },
|
|
1063
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1064
|
+
{ insert: '8' },
|
|
1065
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1066
|
+
{ insert: '9' },
|
|
1067
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1068
|
+
{ insert: '\n' },
|
|
1069
|
+
];
|
|
1070
|
+
quill.setContents(ops);
|
|
1071
|
+
|
|
1072
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
1073
|
+
tableModule.splitCell([tds[0]]);
|
|
1074
|
+
await vi.runAllTimersAsync();
|
|
1075
|
+
const splitOps = [
|
|
1076
|
+
{ insert: '\n' },
|
|
1077
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1078
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1079
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
1080
|
+
{ insert: '1' },
|
|
1081
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1082
|
+
{ insert: '4' },
|
|
1083
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1084
|
+
{ insert: '7' },
|
|
1085
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1086
|
+
{ insert: '2' },
|
|
1087
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1088
|
+
{ insert: '3' },
|
|
1089
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1090
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1091
|
+
{ insert: '5' },
|
|
1092
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1093
|
+
{ insert: '6' },
|
|
1094
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1095
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1096
|
+
{ insert: '8' },
|
|
1097
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1098
|
+
{ insert: '9' },
|
|
1099
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'thead' } }, insert: '\n' },
|
|
1100
|
+
{ insert: '\n' },
|
|
1101
|
+
];
|
|
1102
|
+
expectDelta(
|
|
1103
|
+
quill.getContents(),
|
|
1104
|
+
new Delta(splitOps),
|
|
1105
|
+
);
|
|
1106
|
+
|
|
1107
|
+
quill.history.undo();
|
|
1108
|
+
await vi.runAllTimersAsync();
|
|
1109
|
+
expectDelta(
|
|
1110
|
+
quill.getContents(),
|
|
1111
|
+
new Delta(ops),
|
|
1112
|
+
);
|
|
1113
|
+
|
|
1114
|
+
quill.history.redo();
|
|
1115
|
+
await vi.runAllTimersAsync();
|
|
1116
|
+
expectDelta(
|
|
1117
|
+
quill.getContents(),
|
|
1118
|
+
new Delta(splitOps),
|
|
1119
|
+
);
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
it('undo merge cell with Container', async () => {
|
|
1123
|
+
const quill = createQuillWithTableModule('<p><br></p>');
|
|
1124
|
+
const tableModule = quill.getModule('table-up') as TableUp;
|
|
1125
|
+
quill.setContents([
|
|
1126
|
+
{ insert: '\n' },
|
|
1127
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1128
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1129
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
1130
|
+
{ insert: '1' },
|
|
1131
|
+
{ attributes: { 'list': 'ordered', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1132
|
+
{ insert: '2' },
|
|
1133
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1134
|
+
{ insert: '3' },
|
|
1135
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1136
|
+
{ insert: '4' },
|
|
1137
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1138
|
+
{ insert: '5' },
|
|
1139
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1140
|
+
{ insert: '6' },
|
|
1141
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1142
|
+
{ insert: '7' },
|
|
1143
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1144
|
+
{ insert: '8' },
|
|
1145
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1146
|
+
{ insert: '9' },
|
|
1147
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1148
|
+
{ insert: '\n' },
|
|
1149
|
+
]);
|
|
1150
|
+
|
|
1151
|
+
const mergedOps = [
|
|
1152
|
+
{ insert: '\n' },
|
|
1153
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1154
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1155
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
1156
|
+
{ insert: '1' },
|
|
1157
|
+
{ attributes: { 'list': 'ordered', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 2, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1158
|
+
{ insert: '2' },
|
|
1159
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 2, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1160
|
+
{ insert: '3' },
|
|
1161
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1162
|
+
{ insert: '4' },
|
|
1163
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1164
|
+
{ insert: '5' },
|
|
1165
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1166
|
+
{ insert: '6' },
|
|
1167
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1168
|
+
{ insert: '7' },
|
|
1169
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1170
|
+
{ insert: '8' },
|
|
1171
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1172
|
+
{ insert: '9' },
|
|
1173
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1174
|
+
{ insert: '\n' },
|
|
1175
|
+
];
|
|
1176
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
1177
|
+
tableModule.mergeCells([tds[0], tds[1]]);
|
|
1178
|
+
await vi.runAllTimersAsync();
|
|
1179
|
+
expectDelta(
|
|
1180
|
+
quill.getContents(),
|
|
1181
|
+
new Delta(mergedOps),
|
|
1182
|
+
);
|
|
1183
|
+
|
|
1184
|
+
quill.history.undo();
|
|
1185
|
+
await vi.runAllTimersAsync();
|
|
1186
|
+
expectDelta(
|
|
1187
|
+
quill.getContents(),
|
|
1188
|
+
new Delta([
|
|
1189
|
+
{ insert: '\n' },
|
|
1190
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1191
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1192
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
1193
|
+
{ insert: '1' },
|
|
1194
|
+
{ attributes: { 'list': 'ordered', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1195
|
+
{ insert: '2' },
|
|
1196
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1197
|
+
{ insert: '3' },
|
|
1198
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1199
|
+
{ insert: '4' },
|
|
1200
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1201
|
+
{ insert: '5' },
|
|
1202
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1203
|
+
{ insert: '6' },
|
|
1204
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1205
|
+
{ insert: '7' },
|
|
1206
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1207
|
+
{ insert: '8' },
|
|
1208
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1209
|
+
{ insert: '9' },
|
|
1210
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1211
|
+
{ insert: '\n' },
|
|
1212
|
+
]),
|
|
1213
|
+
);
|
|
1214
|
+
|
|
1215
|
+
quill.history.redo();
|
|
1216
|
+
await vi.runAllTimersAsync();
|
|
1217
|
+
expectDelta(
|
|
1218
|
+
quill.getContents(),
|
|
1219
|
+
new Delta(mergedOps),
|
|
1220
|
+
);
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
it('undo merge cell with BlockEmbed', async () => {
|
|
1224
|
+
const quill = createQuillWithTableModule('<p><br></p>');
|
|
1225
|
+
const tableModule = quill.getModule('table-up') as TableUp;
|
|
1226
|
+
const originDelta = [
|
|
1227
|
+
{ insert: '\n' },
|
|
1228
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1229
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1230
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
1231
|
+
{ insert: '1' },
|
|
1232
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1233
|
+
{ insert: { video: 'some.com' } },
|
|
1234
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n\n' },
|
|
1235
|
+
{ insert: '3' },
|
|
1236
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1237
|
+
{ insert: '4' },
|
|
1238
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1239
|
+
{ insert: '5' },
|
|
1240
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1241
|
+
{ insert: '6' },
|
|
1242
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1243
|
+
{ insert: '7' },
|
|
1244
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1245
|
+
{ insert: '8' },
|
|
1246
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1247
|
+
{ insert: '9' },
|
|
1248
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1249
|
+
{ insert: '\n' },
|
|
1250
|
+
];
|
|
1251
|
+
quill.setContents(originDelta);
|
|
1252
|
+
|
|
1253
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
1254
|
+
tableModule.mergeCells([tds[0], tds[1]]);
|
|
1255
|
+
await vi.runAllTimersAsync();
|
|
1256
|
+
expectDelta(
|
|
1257
|
+
quill.getContents(),
|
|
1258
|
+
new Delta([
|
|
1259
|
+
{ insert: '\n' },
|
|
1260
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1261
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1262
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 100 } } },
|
|
1263
|
+
{ insert: '1' },
|
|
1264
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 2, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1265
|
+
{ insert: { video: 'some.com' } },
|
|
1266
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 2, tag: 'td', wrapTag: 'tbody' } }, insert: '\n\n' },
|
|
1267
|
+
{ insert: '3' },
|
|
1268
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1269
|
+
{ insert: '4' },
|
|
1270
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1271
|
+
{ insert: '5' },
|
|
1272
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1273
|
+
{ insert: '6' },
|
|
1274
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1275
|
+
{ insert: '7' },
|
|
1276
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1277
|
+
{ insert: '8' },
|
|
1278
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1279
|
+
{ insert: '9' },
|
|
1280
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '3', colId: '3', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1281
|
+
{ insert: '\n' },
|
|
1282
|
+
]),
|
|
1283
|
+
);
|
|
1284
|
+
|
|
1285
|
+
quill.history.undo();
|
|
1286
|
+
await vi.runAllTimersAsync();
|
|
1287
|
+
expectDelta(
|
|
814
1288
|
quill.getContents(),
|
|
1289
|
+
new Delta(originDelta),
|
|
815
1290
|
);
|
|
816
1291
|
});
|
|
817
1292
|
});
|
|
@@ -877,7 +1352,7 @@ describe('undo cell attribute', () => {
|
|
|
877
1352
|
</div>
|
|
878
1353
|
<p><br></p>
|
|
879
1354
|
`,
|
|
880
|
-
{ ignoreAttrs: ['data-tag', 'class', 'data-table-id', 'contenteditable'] },
|
|
1355
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'data-table-id', 'contenteditable'] },
|
|
881
1356
|
);
|
|
882
1357
|
quill.history.undo();
|
|
883
1358
|
await vi.runAllTimersAsync();
|
|
@@ -887,7 +1362,7 @@ describe('undo cell attribute', () => {
|
|
|
887
1362
|
${createTableHTML(2, 2)}
|
|
888
1363
|
<p><br></p>
|
|
889
1364
|
`,
|
|
890
|
-
{ ignoreAttrs: ['
|
|
1365
|
+
{ ignoreAttrs: ['class', 'data-table-id', 'contenteditable'] },
|
|
891
1366
|
);
|
|
892
1367
|
});
|
|
893
1368
|
|
|
@@ -975,7 +1450,7 @@ describe('undo cell attribute', () => {
|
|
|
975
1450
|
});
|
|
976
1451
|
|
|
977
1452
|
it('undo and redo table style and format clean by selection', async () => {
|
|
978
|
-
const quill = createQuillWithTableModule('<p></p>'
|
|
1453
|
+
const quill = createQuillWithTableModule('<p></p>');
|
|
979
1454
|
quill.setContents([
|
|
980
1455
|
{ insert: '\n' },
|
|
981
1456
|
{ insert: { 'table-up-col': { tableId: 'jb784n9k6x', colId: '22nxu0uo4pa', full: false, width: 121 } } },
|
|
@@ -1031,7 +1506,7 @@ describe('undo cell attribute', () => {
|
|
|
1031
1506
|
</div>
|
|
1032
1507
|
<p><br></p>
|
|
1033
1508
|
`,
|
|
1034
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1509
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1035
1510
|
);
|
|
1036
1511
|
|
|
1037
1512
|
quill.history.undo();
|
|
@@ -1074,7 +1549,7 @@ describe('undo cell attribute', () => {
|
|
|
1074
1549
|
</div>
|
|
1075
1550
|
<p><br></p>
|
|
1076
1551
|
`,
|
|
1077
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1552
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1078
1553
|
);
|
|
1079
1554
|
|
|
1080
1555
|
quill.history.redo();
|
|
@@ -1115,12 +1590,12 @@ describe('undo cell attribute', () => {
|
|
|
1115
1590
|
</div>
|
|
1116
1591
|
<p><br></p>
|
|
1117
1592
|
`,
|
|
1118
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1593
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1119
1594
|
);
|
|
1120
1595
|
});
|
|
1121
1596
|
|
|
1122
1597
|
it('undo and redo table style and format clean by TableSelection', async () => {
|
|
1123
|
-
const quill = createQuillWithTableModule('<p></p>', {
|
|
1598
|
+
const quill = createQuillWithTableModule('<p></p>', { modules: [{ module: TableSelection }] });
|
|
1124
1599
|
quill.setContents([
|
|
1125
1600
|
{ insert: '\n' },
|
|
1126
1601
|
{ insert: { 'table-up-col': { tableId: 'jb784n9k6x', colId: '22nxu0uo4pa', full: false, width: 121 } } },
|
|
@@ -1140,8 +1615,9 @@ describe('undo cell attribute', () => {
|
|
|
1140
1615
|
|
|
1141
1616
|
const tableUp = quill.getModule(TableUp.moduleName) as TableUp;
|
|
1142
1617
|
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
1143
|
-
|
|
1144
|
-
|
|
1618
|
+
const tableSelection = tableUp.getModule<TableSelection>('table-selection');
|
|
1619
|
+
tableSelection!.table = quill.root.querySelector('table')!;
|
|
1620
|
+
tableSelection!.setSelectedTds(tds);
|
|
1145
1621
|
quill.theme.modules.toolbar!.handlers!.clean.call(quill.theme.modules.toolbar as any, true);
|
|
1146
1622
|
expect(quill.root).toEqualHTML(
|
|
1147
1623
|
`
|
|
@@ -1179,7 +1655,7 @@ describe('undo cell attribute', () => {
|
|
|
1179
1655
|
</div>
|
|
1180
1656
|
<p><br></p>
|
|
1181
1657
|
`,
|
|
1182
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1658
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1183
1659
|
);
|
|
1184
1660
|
|
|
1185
1661
|
quill.history.undo();
|
|
@@ -1222,7 +1698,7 @@ describe('undo cell attribute', () => {
|
|
|
1222
1698
|
</div>
|
|
1223
1699
|
<p><br></p>
|
|
1224
1700
|
`,
|
|
1225
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1701
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1226
1702
|
);
|
|
1227
1703
|
|
|
1228
1704
|
quill.history.redo();
|
|
@@ -1263,7 +1739,7 @@ describe('undo cell attribute', () => {
|
|
|
1263
1739
|
</div>
|
|
1264
1740
|
<p><br></p>
|
|
1265
1741
|
`,
|
|
1266
|
-
{ ignoreAttrs: ['data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1742
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
1267
1743
|
);
|
|
1268
1744
|
});
|
|
1269
1745
|
|
|
@@ -1287,52 +1763,181 @@ describe('undo cell attribute', () => {
|
|
|
1287
1763
|
tableModule.setCellAttrs([tds[0]], 'background-color', 'rgb(0, 163, 245)', true);
|
|
1288
1764
|
await vi.runAllTimersAsync();
|
|
1289
1765
|
expectDelta(
|
|
1766
|
+
quill.getContents(),
|
|
1290
1767
|
new Delta([
|
|
1291
1768
|
{ insert: '\n' },
|
|
1292
1769
|
{ insert: { 'table-up-col': { tableId: 'wm7stgtxmn', colId: 'vm3doxdsmq', full: false, width: 100 } } },
|
|
1293
1770
|
{ insert: { 'table-up-col': { tableId: 'wm7stgtxmn', colId: 'k4ele1u8u4n', full: false, width: 100 } } },
|
|
1294
1771
|
{ insert: '1' },
|
|
1295
|
-
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, style: 'background-color: rgb(0, 163, 245);' } }, insert: '\n\n' },
|
|
1296
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1297
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1298
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1772
|
+
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody', style: 'background-color: rgb(0, 163, 245);' } }, insert: '\n\n' },
|
|
1773
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1774
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1775
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1299
1776
|
{ insert: '\n' },
|
|
1300
1777
|
]),
|
|
1301
|
-
quill.getContents(),
|
|
1302
1778
|
);
|
|
1303
1779
|
|
|
1304
1780
|
quill.history.undo();
|
|
1305
1781
|
await vi.runAllTimersAsync();
|
|
1306
1782
|
expectDelta(
|
|
1783
|
+
quill.getContents(),
|
|
1307
1784
|
new Delta([
|
|
1308
1785
|
{ insert: '\n' },
|
|
1309
1786
|
{ insert: { 'table-up-col': { tableId: 'wm7stgtxmn', colId: 'vm3doxdsmq', full: false, width: 100 } } },
|
|
1310
1787
|
{ insert: { 'table-up-col': { tableId: 'wm7stgtxmn', colId: 'k4ele1u8u4n', full: false, width: 100 } } },
|
|
1311
1788
|
{ insert: '1' },
|
|
1312
|
-
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1 } }, insert: '\n\n' },
|
|
1313
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1314
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1315
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1789
|
+
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n\n' },
|
|
1790
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1791
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1792
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1316
1793
|
{ insert: '\n' },
|
|
1317
1794
|
]),
|
|
1318
|
-
quill.getContents(),
|
|
1319
1795
|
);
|
|
1320
1796
|
|
|
1321
1797
|
quill.history.redo();
|
|
1322
1798
|
await vi.runAllTimersAsync();
|
|
1323
1799
|
expectDelta(
|
|
1800
|
+
quill.getContents(),
|
|
1324
1801
|
new Delta([
|
|
1325
1802
|
{ insert: '\n' },
|
|
1326
1803
|
{ insert: { 'table-up-col': { tableId: 'wm7stgtxmn', colId: 'vm3doxdsmq', full: false, width: 100 } } },
|
|
1327
1804
|
{ insert: { 'table-up-col': { tableId: 'wm7stgtxmn', colId: 'k4ele1u8u4n', full: false, width: 100 } } },
|
|
1328
1805
|
{ insert: '1' },
|
|
1329
|
-
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, style: 'background-color: rgb(0, 163, 245);' } }, insert: '\n\n' },
|
|
1330
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1331
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1332
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1806
|
+
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody', style: 'background-color: rgb(0, 163, 245);' } }, insert: '\n\n' },
|
|
1807
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'xn7r03opjc', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1808
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'vm3doxdsmq', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1809
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'wm7stgtxmn', rowId: 'nqpe206omjn', colId: 'k4ele1u8u4n', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1810
|
+
{ insert: '\n' },
|
|
1811
|
+
]),
|
|
1812
|
+
);
|
|
1813
|
+
});
|
|
1814
|
+
|
|
1815
|
+
it('undo table style and list in cell', async () => {
|
|
1816
|
+
const quill = await createTable(3, 3);
|
|
1817
|
+
quill.setContents([
|
|
1818
|
+
{ insert: '\n' },
|
|
1819
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1820
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1821
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1822
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1823
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1824
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
1825
|
+
{ insert: '\n' },
|
|
1826
|
+
]);
|
|
1827
|
+
await vi.runAllTimersAsync();
|
|
1828
|
+
|
|
1829
|
+
quill.updateContents([{ retain: 3 }, { retain: 1, attributes: { list: 'unchecked' } }]);
|
|
1830
|
+
quill.updateContents([{ retain: 3 }, { insert: '123' }]);
|
|
1831
|
+
quill.updateContents([{ retain: 6 }, { retain: 1, attributes: { list: 'checked' } }]);
|
|
1832
|
+
quill.updateContents(
|
|
1833
|
+
[
|
|
1834
|
+
{ retain: 7 },
|
|
1835
|
+
{ retain: 1, attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td' } } },
|
|
1836
|
+
{ retain: 1, attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td' } } },
|
|
1837
|
+
{ retain: 1, attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td' } } },
|
|
1838
|
+
{ retain: 1, attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td' } } },
|
|
1839
|
+
{ insert: '\n' },
|
|
1840
|
+
],
|
|
1841
|
+
);
|
|
1842
|
+
|
|
1843
|
+
const tableModule = quill.getModule(TableUp.moduleName) as TableUp;
|
|
1844
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
1845
|
+
tableModule.setCellAttrs([tds[0]], 'border-color', 'red', true);
|
|
1846
|
+
await vi.runAllTimersAsync();
|
|
1847
|
+
|
|
1848
|
+
expectDelta(
|
|
1849
|
+
quill.getContents(),
|
|
1850
|
+
new Delta([
|
|
1851
|
+
{ insert: '\n' },
|
|
1852
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1853
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1854
|
+
{ insert: '123' },
|
|
1855
|
+
{ attributes: { 'list': 'checked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody', style: 'border-color: red;' } }, insert: '\n' },
|
|
1856
|
+
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody', style: 'border-color: red;' } }, insert: '\n' },
|
|
1857
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1858
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1859
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1860
|
+
{ insert: '\n' },
|
|
1861
|
+
]),
|
|
1862
|
+
);
|
|
1863
|
+
|
|
1864
|
+
quill.history.undo();
|
|
1865
|
+
expectDelta(
|
|
1866
|
+
quill.getContents(),
|
|
1867
|
+
new Delta([
|
|
1868
|
+
{ insert: '\n' },
|
|
1869
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1870
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1871
|
+
{ insert: '123' },
|
|
1872
|
+
{ attributes: { 'list': 'checked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1873
|
+
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1874
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1875
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1876
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1877
|
+
{ insert: '\n' },
|
|
1878
|
+
]),
|
|
1879
|
+
);
|
|
1880
|
+
|
|
1881
|
+
quill.history.undo();
|
|
1882
|
+
expectDelta(
|
|
1883
|
+
quill.getContents(),
|
|
1884
|
+
new Delta([
|
|
1885
|
+
{ insert: '\n' },
|
|
1886
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1887
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1888
|
+
{ insert: '123' },
|
|
1889
|
+
{ attributes: { 'list': 'checked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1890
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1891
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1892
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1893
|
+
{ insert: '\n' },
|
|
1894
|
+
]),
|
|
1895
|
+
);
|
|
1896
|
+
|
|
1897
|
+
quill.history.undo();
|
|
1898
|
+
expectDelta(
|
|
1899
|
+
quill.getContents(),
|
|
1900
|
+
new Delta([
|
|
1901
|
+
{ insert: '\n' },
|
|
1902
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1903
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1904
|
+
{ insert: '123' },
|
|
1905
|
+
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1906
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1907
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1908
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1909
|
+
{ insert: '\n' },
|
|
1910
|
+
]),
|
|
1911
|
+
);
|
|
1912
|
+
|
|
1913
|
+
quill.history.undo();
|
|
1914
|
+
expectDelta(
|
|
1915
|
+
quill.getContents(),
|
|
1916
|
+
new Delta([
|
|
1917
|
+
{ insert: '\n' },
|
|
1918
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1919
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1920
|
+
{ attributes: { 'list': 'unchecked', 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1921
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1922
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1923
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1333
1924
|
{ insert: '\n' },
|
|
1334
1925
|
]),
|
|
1926
|
+
);
|
|
1927
|
+
|
|
1928
|
+
quill.history.undo();
|
|
1929
|
+
expectDelta(
|
|
1335
1930
|
quill.getContents(),
|
|
1931
|
+
new Delta([
|
|
1932
|
+
{ insert: '\n' },
|
|
1933
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
1934
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
1935
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1936
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1937
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1938
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
1939
|
+
{ insert: '\n' },
|
|
1940
|
+
]),
|
|
1336
1941
|
);
|
|
1337
1942
|
});
|
|
1338
1943
|
});
|
|
@@ -1343,8 +1948,7 @@ describe('table caption', () => {
|
|
|
1343
1948
|
const tableModule = quill.getModule(TableUp.moduleName) as TableUp;
|
|
1344
1949
|
await vi.runAllTimersAsync();
|
|
1345
1950
|
const table = quill.root.querySelector('table')!;
|
|
1346
|
-
|
|
1347
|
-
(tableMenuTools.InsertCaption as ToolOption).handle(tableModule, [], null);
|
|
1951
|
+
(tableMenuTools.InsertCaption as ToolOption).handle.call({ quill, table } as any, tableModule, [], null);
|
|
1348
1952
|
await vi.runAllTimersAsync();
|
|
1349
1953
|
const tableCaptionDelta = new Delta([
|
|
1350
1954
|
{ insert: '\nTable Caption' },
|
|
@@ -1421,8 +2025,7 @@ describe('table caption', () => {
|
|
|
1421
2025
|
const tableModule = quill.getModule(TableUp.moduleName) as TableUp;
|
|
1422
2026
|
await vi.runAllTimersAsync();
|
|
1423
2027
|
const table = quill.root.querySelector('table')!;
|
|
1424
|
-
|
|
1425
|
-
(tableMenuTools.InsertCaption as ToolOption).handle(tableModule, [], null);
|
|
2028
|
+
(tableMenuTools.InsertCaption as ToolOption).handle.call({ quill, table } as any, tableModule, [], null);
|
|
1426
2029
|
await vi.runAllTimersAsync();
|
|
1427
2030
|
quill.deleteText({ index: 2, length: 4 });
|
|
1428
2031
|
await vi.runAllTimersAsync();
|
|
@@ -1502,8 +2105,7 @@ describe('table caption', () => {
|
|
|
1502
2105
|
const tableModule = quill.getModule(TableUp.moduleName) as TableUp;
|
|
1503
2106
|
await vi.runAllTimersAsync();
|
|
1504
2107
|
const table = quill.root.querySelector('table')!;
|
|
1505
|
-
|
|
1506
|
-
(tableMenuTools.InsertCaption as ToolOption).handle(tableModule, [], null);
|
|
2108
|
+
(tableMenuTools.InsertCaption as ToolOption).handle.call({ quill, table } as any, tableModule, [], null);
|
|
1507
2109
|
await vi.runAllTimersAsync();
|
|
1508
2110
|
|
|
1509
2111
|
const tableCaption = Quill.find(table.querySelector('caption')!)! as TableCaptionFormat;
|