quill-table-up 3.0.1 → 3.0.2
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/dist/index.d.ts +3 -2
- package/dist/index.js +29 -29
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +26 -26
- package/dist/index.umd.js.map +1 -1
- package/package.json +18 -18
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +2 -2
- package/src/__tests__/e2e/table-menu.test.ts +4 -5
- package/src/__tests__/unit/table-clipboard.test.ts +39 -39
- package/src/__tests__/unit/table-hack.test.ts +2 -2
- package/src/__tests__/unit/table-insert.test.ts +50 -0
- package/src/__tests__/unit/table-redo-undo.test.ts +217 -25
- package/src/__tests__/unit/table-remove.test.ts +3 -1
- package/src/__tests__/unit/utils.ts +2 -1
- package/src/formats/overrides/block-embed.ts +1 -2
- package/src/formats/overrides/block.ts +7 -2
- package/src/formats/table-cell-inner-format.ts +20 -4
- package/src/formats/table-col-format.ts +26 -30
- package/src/formats/table-wrapper-format.ts +9 -1
- package/src/modules/table-selection.ts +4 -1
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/table-up.ts +6 -5
- package/src/utils/blot-helper.ts +1 -1
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quill-table-up",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "3.0.2",
|
|
5
|
+
"packageManager": "pnpm@10.15.0",
|
|
6
6
|
"description": "A table module for quill2.x",
|
|
7
7
|
"author": "zzxming",
|
|
8
8
|
"license": "MIT",
|
|
@@ -44,24 +44,24 @@
|
|
|
44
44
|
"quill": "^2.0.3"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@floating-ui/dom": "^1.7.
|
|
47
|
+
"@floating-ui/dom": "^1.7.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/preset-env": "^7.
|
|
51
|
-
"@oxc-project/runtime": "^0.
|
|
52
|
-
"@playwright/test": "^1.
|
|
50
|
+
"@babel/preset-env": "^7.28.3",
|
|
51
|
+
"@oxc-project/runtime": "^0.84.0",
|
|
52
|
+
"@playwright/test": "^1.55.0",
|
|
53
53
|
"@prettier/plugin-xml": "^3.4.2",
|
|
54
54
|
"@rollup/plugin-babel": "^6.0.4",
|
|
55
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
55
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
56
56
|
"@types/gulp": "^4.0.17",
|
|
57
|
-
"@types/node": "^24.0
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
59
|
-
"@typescript-eslint/parser": "^8.
|
|
60
|
-
"@vitest/coverage-v8": "^3.2.
|
|
61
|
-
"@vitest/ui": "^3.2.
|
|
57
|
+
"@types/node": "^24.3.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
59
|
+
"@typescript-eslint/parser": "^8.41.0",
|
|
60
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
61
|
+
"@vitest/ui": "^3.2.4",
|
|
62
62
|
"@zzxming/eslint-config": "0.5.3",
|
|
63
63
|
"autoprefixer": "^10.4.21",
|
|
64
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.34.0",
|
|
65
65
|
"gulp": "^5.0.1",
|
|
66
66
|
"gulp-clean-css": "^4.3.0",
|
|
67
67
|
"gulp-less": "^5.0.0",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"parchment": "^3.0.0",
|
|
71
71
|
"postcss-pxtorem": "^6.1.0",
|
|
72
72
|
"resize-observer-polyfill": "^1.5.1",
|
|
73
|
-
"tsdown": "^0.
|
|
73
|
+
"tsdown": "^0.14.2",
|
|
74
74
|
"tslib": "^2.8.1",
|
|
75
|
-
"tsx": "^4.20.
|
|
76
|
-
"typescript": "~5.
|
|
77
|
-
"vitest": "^3.2.
|
|
78
|
-
"ws": "^8.18.
|
|
75
|
+
"tsx": "^4.20.5",
|
|
76
|
+
"typescript": "~5.9.2",
|
|
77
|
+
"vitest": "^3.2.4",
|
|
78
|
+
"ws": "^8.18.3"
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -78,9 +78,9 @@ extendTest.describe('table cell keyboard handler enter', () => {
|
|
|
78
78
|
]);
|
|
79
79
|
await page.waitForTimeout(1000);
|
|
80
80
|
|
|
81
|
-
await editorPage.setSelection(
|
|
81
|
+
await editorPage.setSelection(4, 7);
|
|
82
82
|
await page.keyboard.press('Enter');
|
|
83
|
-
await expect(page.locator('#editor1 .ql-table-wrapper .ql-table-cell-inner p')).toHaveCount(
|
|
83
|
+
await expect(page.locator('#editor1 .ql-table-wrapper .ql-table-cell-inner p')).toHaveCount(2);
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
|
|
@@ -65,13 +65,12 @@ extendTest('test menu color picker should not have two at the same time', async
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
extendTest('test TableMenuSelect should update when text change', async ({ page, editorPage }) => {
|
|
68
|
-
await page.evaluate(() => {
|
|
69
|
-
window.scrollTo(0, 600);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
68
|
editorPage.index = 1;
|
|
73
69
|
await createTableBySelect(page, 'container2', 3, 3);
|
|
74
70
|
|
|
71
|
+
await page.evaluate(() => {
|
|
72
|
+
window.scrollTo(0, 600);
|
|
73
|
+
});
|
|
75
74
|
const lineBound = (await page.locator('#editor2 .ql-editor > p').first().boundingBox())!;
|
|
76
75
|
expect(lineBound).not.toBeNull();
|
|
77
76
|
|
|
@@ -89,7 +88,7 @@ extendTest('test TableMenuSelect should update when text change', async ({ page,
|
|
|
89
88
|
await expect(menuWrapper).toBeVisible();
|
|
90
89
|
const newMenuWrapper = (await menuWrapper.boundingBox())!;
|
|
91
90
|
expect(newMenuWrapper).not.toBeNull();
|
|
92
|
-
|
|
91
|
+
console.log(newMenuWrapper.y, menuBound.y, lineBound.height);
|
|
93
92
|
expect(newMenuWrapper.y - menuBound.y).toBeCloseTo(lineBound.height, 0);
|
|
94
93
|
});
|
|
95
94
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Quill from 'quill';
|
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
3
|
import { TableUp } from '../../table-up';
|
|
4
|
-
import { createQuillWithTableModule, createTableBodyHTML, createTableCaptionHTML, createTableDeltaOps, createTableHTML, createTaleColHTML, expectDelta, simulatePasteHTML } from './utils';
|
|
4
|
+
import { createQuillWithTableModule, createTableBodyHTML, createTableCaptionHTML, createTableDeltaOps, createTableHTML, createTaleColHTML, datasetTag, expectDelta, simulatePasteHTML } from './utils';
|
|
5
5
|
|
|
6
6
|
const Delta = Quill.import('delta');
|
|
7
7
|
|
|
@@ -29,7 +29,7 @@ describe('clipboard cell structure', () => {
|
|
|
29
29
|
${createTableHTML(3, 3, { width: 100, full: false }, undefined, { isEmpty: false })}
|
|
30
30
|
<p><br></p>
|
|
31
31
|
`,
|
|
32
|
-
{ ignoreAttrs: ['
|
|
32
|
+
{ ignoreAttrs: ['class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'contenteditable'] },
|
|
33
33
|
);
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -312,7 +312,7 @@ describe('clipboard cell structure', () => {
|
|
|
312
312
|
${createTableHTML(3, 3, { width: 100, full: false }, undefined, { isEmpty: false })}
|
|
313
313
|
<p>123</p>
|
|
314
314
|
`,
|
|
315
|
-
{ ignoreAttrs: ['
|
|
315
|
+
{ ignoreAttrs: ['class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'contenteditable'] },
|
|
316
316
|
);
|
|
317
317
|
});
|
|
318
318
|
|
|
@@ -595,51 +595,51 @@ describe('clipboard cell structure', () => {
|
|
|
595
595
|
<tbody>
|
|
596
596
|
<tr>
|
|
597
597
|
<th rowspan="1" colspan="1">
|
|
598
|
-
<div
|
|
598
|
+
<div ${datasetTag('th')}>
|
|
599
599
|
<p>q</p>
|
|
600
600
|
</div>
|
|
601
601
|
</th>
|
|
602
602
|
<th rowspan="1" colspan="1">
|
|
603
|
-
<div
|
|
603
|
+
<div ${datasetTag('th')}>
|
|
604
604
|
<p>w</p>
|
|
605
605
|
</div>
|
|
606
606
|
</th>
|
|
607
607
|
<th rowspan="1" colspan="1">
|
|
608
|
-
<div
|
|
608
|
+
<div ${datasetTag('th')}>
|
|
609
609
|
<p>e</p>
|
|
610
610
|
</div>
|
|
611
611
|
</th>
|
|
612
612
|
</tr>
|
|
613
613
|
<tr>
|
|
614
614
|
<th rowspan="1" colspan="1">
|
|
615
|
-
<div
|
|
615
|
+
<div ${datasetTag('th')}>
|
|
616
616
|
<p><br></p>
|
|
617
617
|
</div>
|
|
618
618
|
</th>
|
|
619
619
|
<td rowspan="1" colspan="1">
|
|
620
|
-
<div
|
|
620
|
+
<div ${datasetTag('td')}>
|
|
621
621
|
<p>2</p>
|
|
622
622
|
</div>
|
|
623
623
|
</td>
|
|
624
624
|
<td rowspan="1" colspan="1">
|
|
625
|
-
<div
|
|
625
|
+
<div ${datasetTag('td')}>
|
|
626
626
|
<p>3</p>
|
|
627
627
|
</div>
|
|
628
628
|
</td>
|
|
629
629
|
</tr>
|
|
630
630
|
<tr>
|
|
631
631
|
<th rowspan="1" colspan="1">
|
|
632
|
-
<div
|
|
632
|
+
<div ${datasetTag('th')}>
|
|
633
633
|
<p><br></p>
|
|
634
634
|
</div>
|
|
635
635
|
</th>
|
|
636
636
|
<td rowspan="1" colspan="1">
|
|
637
|
-
<div
|
|
637
|
+
<div ${datasetTag('td')}>
|
|
638
638
|
<p>4</p>
|
|
639
639
|
</div>
|
|
640
640
|
</td>
|
|
641
641
|
<td rowspan="1" colspan="1">
|
|
642
|
-
<div
|
|
642
|
+
<div ${datasetTag('td')}>
|
|
643
643
|
<p>5</p>
|
|
644
644
|
</div>
|
|
645
645
|
</td>
|
|
@@ -844,7 +844,7 @@ describe('clipboard cell structure', () => {
|
|
|
844
844
|
</div>
|
|
845
845
|
<p><br></p>
|
|
846
846
|
`,
|
|
847
|
-
{ ignoreAttrs: ['
|
|
847
|
+
{ ignoreAttrs: ['class', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
848
848
|
);
|
|
849
849
|
expectDelta(
|
|
850
850
|
new Delta([
|
|
@@ -1183,51 +1183,51 @@ describe('clipboard cell structure', () => {
|
|
|
1183
1183
|
<tbody>
|
|
1184
1184
|
<tr>
|
|
1185
1185
|
<th colspan="1" rowspan="1">
|
|
1186
|
-
<div
|
|
1186
|
+
<div ${datasetTag('th')}>
|
|
1187
1187
|
<p>Company</p>
|
|
1188
1188
|
</div>
|
|
1189
1189
|
</th>
|
|
1190
1190
|
<th colspan="1" rowspan="1">
|
|
1191
|
-
<div
|
|
1191
|
+
<div ${datasetTag('th')}>
|
|
1192
1192
|
<p>Contact</p>
|
|
1193
1193
|
</div>
|
|
1194
1194
|
</th>
|
|
1195
1195
|
<th colspan="1" rowspan="1">
|
|
1196
|
-
<div
|
|
1196
|
+
<div ${datasetTag('th')}>
|
|
1197
1197
|
<p>Country</p>
|
|
1198
1198
|
</div>
|
|
1199
1199
|
</th>
|
|
1200
1200
|
</tr>
|
|
1201
1201
|
<tr>
|
|
1202
1202
|
<td colspan="1" rowspan="1">
|
|
1203
|
-
<div
|
|
1203
|
+
<div ${datasetTag('td')}>
|
|
1204
1204
|
<p>Alfreds Futterkiste</p>
|
|
1205
1205
|
</div>
|
|
1206
1206
|
</td>
|
|
1207
1207
|
<td colspan="1" rowspan="1">
|
|
1208
|
-
<div
|
|
1208
|
+
<div ${datasetTag('td')}>
|
|
1209
1209
|
<p>Maria Anders</p>
|
|
1210
1210
|
</div>
|
|
1211
1211
|
</td>
|
|
1212
1212
|
<td colspan="1" rowspan="1">
|
|
1213
|
-
<div
|
|
1213
|
+
<div ${datasetTag('td')}>
|
|
1214
1214
|
<p>Germany</p>
|
|
1215
1215
|
</div>
|
|
1216
1216
|
</td>
|
|
1217
1217
|
</tr>
|
|
1218
1218
|
<tr>
|
|
1219
1219
|
<td colspan="1" rowspan="1">
|
|
1220
|
-
<div
|
|
1220
|
+
<div ${datasetTag('td')}>
|
|
1221
1221
|
<p>Centro comercial Moctezuma</p>
|
|
1222
1222
|
</div>
|
|
1223
1223
|
</td>
|
|
1224
1224
|
<td colspan="1" rowspan="1">
|
|
1225
|
-
<div
|
|
1225
|
+
<div ${datasetTag('td')}>
|
|
1226
1226
|
<p>Francisco Chang</p>
|
|
1227
1227
|
</div>
|
|
1228
1228
|
</td>
|
|
1229
1229
|
<td colspan="1" rowspan="1">
|
|
1230
|
-
<div
|
|
1230
|
+
<div ${datasetTag('td')}>
|
|
1231
1231
|
<p>Mexico</p>
|
|
1232
1232
|
</div>
|
|
1233
1233
|
</td>
|
|
@@ -1286,17 +1286,17 @@ describe('clipboard cell structure', () => {
|
|
|
1286
1286
|
<thead>
|
|
1287
1287
|
<tr data-wrap-tag="thead">
|
|
1288
1288
|
<th colspan="1" rowspan="1" data-wrap-tag="thead">
|
|
1289
|
-
<div
|
|
1289
|
+
<div ${datasetTag('th')} data-wrap-tag="thead">
|
|
1290
1290
|
<p>head1</p>
|
|
1291
1291
|
</div>
|
|
1292
1292
|
</th>
|
|
1293
1293
|
<th colspan="1" rowspan="1" data-wrap-tag="thead">
|
|
1294
|
-
<div
|
|
1294
|
+
<div ${datasetTag('th')} data-wrap-tag="thead">
|
|
1295
1295
|
<p>head2</p>
|
|
1296
1296
|
</div>
|
|
1297
1297
|
</th>
|
|
1298
1298
|
<th colspan="1" rowspan="1" data-wrap-tag="thead">
|
|
1299
|
-
<div
|
|
1299
|
+
<div ${datasetTag('th')} data-wrap-tag="thead">
|
|
1300
1300
|
<p>head3</p>
|
|
1301
1301
|
</div>
|
|
1302
1302
|
</th>
|
|
@@ -1305,34 +1305,34 @@ describe('clipboard cell structure', () => {
|
|
|
1305
1305
|
<tbody>
|
|
1306
1306
|
<tr data-wrap-tag="tbody">
|
|
1307
1307
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1308
|
-
<div
|
|
1308
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1309
1309
|
<p>body1</p>
|
|
1310
1310
|
</div>
|
|
1311
1311
|
</td>
|
|
1312
1312
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1313
|
-
<div
|
|
1313
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1314
1314
|
<p>body2</p>
|
|
1315
1315
|
</div>
|
|
1316
1316
|
</td>
|
|
1317
1317
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1318
|
-
<div
|
|
1318
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1319
1319
|
<p>body3</p>
|
|
1320
1320
|
</div>
|
|
1321
1321
|
</td>
|
|
1322
1322
|
</tr>
|
|
1323
1323
|
<tr data-wrap-tag="tbody">
|
|
1324
1324
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1325
|
-
<div
|
|
1325
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1326
1326
|
<p>body4</p>
|
|
1327
1327
|
</div>
|
|
1328
1328
|
</td>
|
|
1329
1329
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1330
|
-
<div
|
|
1330
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1331
1331
|
<p>body5</p>
|
|
1332
1332
|
</div>
|
|
1333
1333
|
</td>
|
|
1334
1334
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1335
|
-
<div
|
|
1335
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1336
1336
|
<p>body6</p>
|
|
1337
1337
|
</div>
|
|
1338
1338
|
</td>
|
|
@@ -1341,17 +1341,17 @@ describe('clipboard cell structure', () => {
|
|
|
1341
1341
|
<tfoot>
|
|
1342
1342
|
<tr data-wrap-tag="tfoot">
|
|
1343
1343
|
<td colspan="1" rowspan="1" data-wrap-tag="tfoot">
|
|
1344
|
-
<div
|
|
1344
|
+
<div ${datasetTag('td')} data-wrap-tag="tfoot">
|
|
1345
1345
|
<p>foot1</p>
|
|
1346
1346
|
</div>
|
|
1347
1347
|
</td>
|
|
1348
1348
|
<td colspan="1" rowspan="1" data-wrap-tag="tfoot">
|
|
1349
|
-
<div
|
|
1349
|
+
<div ${datasetTag('td')} data-wrap-tag="tfoot">
|
|
1350
1350
|
<p>foot2</p>
|
|
1351
1351
|
</div>
|
|
1352
1352
|
</td>
|
|
1353
1353
|
<td colspan="1" rowspan="1" data-wrap-tag="tfoot">
|
|
1354
|
-
<div
|
|
1354
|
+
<div ${datasetTag('td')} data-wrap-tag="tfoot">
|
|
1355
1355
|
<p>foot3</p>
|
|
1356
1356
|
</div>
|
|
1357
1357
|
</td>
|
|
@@ -1401,7 +1401,7 @@ describe('clipboard cell structure', () => {
|
|
|
1401
1401
|
<thead>
|
|
1402
1402
|
<tr data-wrap-tag="thead">
|
|
1403
1403
|
<td colspan="2" rowspan="1" data-wrap-tag="thead">
|
|
1404
|
-
<div
|
|
1404
|
+
<div ${datasetTag('td')} data-wrap-tag="thead">
|
|
1405
1405
|
<p>123</p>
|
|
1406
1406
|
</div>
|
|
1407
1407
|
</td>
|
|
@@ -1410,24 +1410,24 @@ describe('clipboard cell structure', () => {
|
|
|
1410
1410
|
<tbody>
|
|
1411
1411
|
<tr data-wrap-tag="tbody">
|
|
1412
1412
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1413
|
-
<div
|
|
1413
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1414
1414
|
<p>1</p>
|
|
1415
1415
|
</div>
|
|
1416
1416
|
</td>
|
|
1417
1417
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1418
|
-
<div
|
|
1418
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1419
1419
|
<p>2</p>
|
|
1420
1420
|
</div>
|
|
1421
1421
|
</td>
|
|
1422
1422
|
</tr>
|
|
1423
1423
|
<tr data-wrap-tag="tbody">
|
|
1424
1424
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1425
|
-
<div
|
|
1425
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1426
1426
|
<p>1</p>
|
|
1427
1427
|
</div>
|
|
1428
1428
|
</td>
|
|
1429
1429
|
<td colspan="1" rowspan="1" data-wrap-tag="tbody">
|
|
1430
|
-
<div
|
|
1430
|
+
<div ${datasetTag('td')} data-wrap-tag="tbody">
|
|
1431
1431
|
<p>2</p>
|
|
1432
1432
|
</div>
|
|
1433
1433
|
</td>
|
|
@@ -126,7 +126,7 @@ describe('hack html convert', () => {
|
|
|
126
126
|
</div>
|
|
127
127
|
<p></p>
|
|
128
128
|
`,
|
|
129
|
-
{ ignoreAttrs: ['data-wrap-tag', 'class', 'data-table-id'
|
|
129
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'data-table-id'] },
|
|
130
130
|
);
|
|
131
131
|
});
|
|
132
132
|
|
|
@@ -201,7 +201,7 @@ describe('hack html convert', () => {
|
|
|
201
201
|
</table>
|
|
202
202
|
</div>
|
|
203
203
|
`,
|
|
204
|
-
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'data-table-id'
|
|
204
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'data-table-id'] },
|
|
205
205
|
);
|
|
206
206
|
});
|
|
207
207
|
});
|
|
@@ -273,6 +273,56 @@ describe('insert block embed blot', () => {
|
|
|
273
273
|
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
274
274
|
);
|
|
275
275
|
});
|
|
276
|
+
|
|
277
|
+
it('makesure the text delta order is correct', async () => {
|
|
278
|
+
const quill = createQuillWithTableModule(`<p><br></p>`);
|
|
279
|
+
quill.setContents([
|
|
280
|
+
{ insert: '\n' },
|
|
281
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: 'true', width: 100 } } },
|
|
282
|
+
{ insert: { video: 'https://quilljs.com/' } },
|
|
283
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n\n' },
|
|
284
|
+
{ insert: '\n' },
|
|
285
|
+
]);
|
|
286
|
+
|
|
287
|
+
quill.insertText(4, '123');
|
|
288
|
+
|
|
289
|
+
expect(quill.root).toEqualHTML(
|
|
290
|
+
`
|
|
291
|
+
<p><br></p>
|
|
292
|
+
<div>
|
|
293
|
+
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
294
|
+
<colgroup data-full="true">
|
|
295
|
+
<col width="100%" data-full="true" />
|
|
296
|
+
</colgroup>
|
|
297
|
+
<tbody>
|
|
298
|
+
<tr>
|
|
299
|
+
<td rowspan="1" colspan="1">
|
|
300
|
+
<div>
|
|
301
|
+
<iframe src="https://quilljs.com/" frameborder="0" allowfullscreen="true"></iframe>
|
|
302
|
+
<p>123</p>
|
|
303
|
+
</div>
|
|
304
|
+
</td>
|
|
305
|
+
</tr>
|
|
306
|
+
</tbody>
|
|
307
|
+
</table>
|
|
308
|
+
</div>
|
|
309
|
+
<p><br></p>
|
|
310
|
+
`,
|
|
311
|
+
{ ignoreAttrs: ['data-wrap-tag', 'data-tag', 'class', 'style', 'data-table-id', 'data-row-id', 'data-col-id', 'data-rowspan', 'data-colspan', 'contenteditable'] },
|
|
312
|
+
);
|
|
313
|
+
expectDelta(
|
|
314
|
+
quill.getContents(),
|
|
315
|
+
new Delta([
|
|
316
|
+
{ insert: '\n' },
|
|
317
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: true, width: 100 } } },
|
|
318
|
+
{ insert: { video: 'https://quilljs.com/' } },
|
|
319
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
320
|
+
{ insert: '123' },
|
|
321
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1, tag: 'td', wrapTag: 'tbody' } }, insert: '\n' },
|
|
322
|
+
{ insert: '\n' },
|
|
323
|
+
]),
|
|
324
|
+
);
|
|
325
|
+
});
|
|
276
326
|
});
|
|
277
327
|
|
|
278
328
|
describe('set contents', () => {
|