quill-table-up 2.4.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -40
- package/dist/index.css +1 -1
- package/dist/index.d.ts +172 -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 +23 -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 +495 -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.ts +35 -30
- 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 +384 -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/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 +102 -79
- 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 +161 -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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { EmitterSource, Parchment as TypeParchment, Range as TypeRange } from 'quill';
|
|
2
2
|
import type { TableMainFormat, TableWrapperFormat } from '../formats';
|
|
3
3
|
import type { TableUp } from '../table-up';
|
|
4
|
-
import type {
|
|
4
|
+
import type { RelactiveRect, TableSelectionOptions } from '../utils';
|
|
5
5
|
import Quill from 'quill';
|
|
6
|
-
import { getTableMainRect,
|
|
7
|
-
import { addScrollEvent, blotName, clearScrollEvent, createBEM, createResizeObserver, findAllParentBlot, findParentBlot,
|
|
6
|
+
import { getTableMainRect, TableCellFormat, TableCellInnerFormat } from '../formats';
|
|
7
|
+
import { addScrollEvent, blotName, clearScrollEvent, createBEM, createResizeObserver, findAllParentBlot, findParentBlot, getElementScrollPosition, getRelativeRect, isRectanglesIntersect, tableUpEvent } from '../utils';
|
|
8
|
+
import { TableDomSelector } from './table-dom-selector';
|
|
8
9
|
|
|
9
10
|
const ERROR_LIMIT = 0;
|
|
10
11
|
|
|
@@ -15,7 +16,9 @@ export interface SelectionData {
|
|
|
15
16
|
focusOffset: number;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export class TableSelection {
|
|
19
|
+
export class TableSelection extends TableDomSelector {
|
|
20
|
+
static moduleName: string = 'table-selection';
|
|
21
|
+
|
|
19
22
|
options: TableSelectionOptions;
|
|
20
23
|
boundary: RelactiveRect | null = null;
|
|
21
24
|
scrollRecordEls: HTMLElement[] = [];
|
|
@@ -27,11 +30,8 @@ export class TableSelection {
|
|
|
27
30
|
selectedTds: TableCellInnerFormat[] = [];
|
|
28
31
|
cellSelectWrap: HTMLElement;
|
|
29
32
|
cellSelect: HTMLElement;
|
|
30
|
-
dragging: boolean = false;
|
|
31
33
|
scrollHandler: [HTMLElement, (...args: any[]) => void][] = [];
|
|
32
|
-
tableMenu?: InternalTableMenuModule;
|
|
33
34
|
resizeObserver: ResizeObserver;
|
|
34
|
-
table?: HTMLTableElement;
|
|
35
35
|
isDisplaySelection = false;
|
|
36
36
|
bem = createBEM('selection');
|
|
37
37
|
lastSelection: SelectionData = {
|
|
@@ -41,31 +41,87 @@ export class TableSelection {
|
|
|
41
41
|
focusOffset: 0,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
_dragging: boolean = false;
|
|
45
|
+
set dragging(val: boolean) {
|
|
46
|
+
if (this._dragging === val) return;
|
|
47
|
+
this._dragging = val;
|
|
48
|
+
this.quill.emitter.emit(val ? tableUpEvent.TABLE_SELECTION_DRAG_START : tableUpEvent.TABLE_SELECTION_DRAG_END, this);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get dragging() {
|
|
52
|
+
return this._dragging;
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
constructor(public tableModule: TableUp, public quill: Quill, options: Partial<TableSelectionOptions> = {}) {
|
|
56
|
+
super(tableModule, quill);
|
|
45
57
|
this.options = this.resolveOptions(options);
|
|
46
58
|
this.scrollRecordEls = [this.quill.root, document.documentElement];
|
|
47
59
|
|
|
48
60
|
this.cellSelectWrap = tableModule.addContainer(this.bem.b());
|
|
49
61
|
this.cellSelect = this.helpLinesInitial();
|
|
50
62
|
|
|
51
|
-
this.resizeObserver = createResizeObserver(
|
|
63
|
+
this.resizeObserver = createResizeObserver(this.updateAfterEvent, { ignoreFirstBind: true });
|
|
52
64
|
this.resizeObserver.observe(this.quill.root);
|
|
53
65
|
|
|
54
|
-
this.quill.
|
|
55
|
-
document.addEventListener('selectionchange', this.selectionChangeHandler, { passive: false });
|
|
66
|
+
this.quill.emitter.listenDOM('selectionchange', document, this.selectionChangeHandler.bind(this));
|
|
56
67
|
this.quill.on(tableUpEvent.AFTER_TABLE_RESIZE, this.updateAfterEvent);
|
|
57
68
|
this.quill.on(Quill.events.SELECTION_CHANGE, this.quillSelectionChangeHandler);
|
|
58
|
-
this.quill.on(Quill.events.
|
|
59
|
-
if (this.options.tableMenu) {
|
|
60
|
-
this.tableMenu = new this.options.tableMenu(tableModule, quill, this.options.tableMenuOptions);
|
|
61
|
-
}
|
|
69
|
+
this.quill.on(Quill.events.EDITOR_CHANGE, this.updateWhenTextChange);
|
|
62
70
|
this.hide();
|
|
63
71
|
}
|
|
64
72
|
|
|
73
|
+
updateWhenTextChange = (eventName: string) => {
|
|
74
|
+
if (eventName === Quill.events.TEXT_CHANGE) {
|
|
75
|
+
if (this.table && !this.quill.root.contains(this.table)) {
|
|
76
|
+
this.setSelectionTable(undefined);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.updateAfterEvent();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
65
84
|
updateAfterEvent = () => {
|
|
85
|
+
// if cell already remove from the editor. need remove it
|
|
86
|
+
const existCells: TableCellInnerFormat[] = [];
|
|
87
|
+
for (let i = 0; i < this.selectedTds.length; i++) {
|
|
88
|
+
const td = this.selectedTds[i];
|
|
89
|
+
if (this.quill.root.contains(td.domNode)) {
|
|
90
|
+
existCells.push(td);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
this.selectedTds = existCells;
|
|
66
94
|
this.updateWithSelectedTds();
|
|
67
95
|
};
|
|
68
96
|
|
|
97
|
+
removeCell = (e: KeyboardEvent) => {
|
|
98
|
+
const range = this.quill.getSelection();
|
|
99
|
+
const activeElement = document.activeElement;
|
|
100
|
+
if (range || (e.key !== 'Backspace' && e.key !== 'Delete') || !this.quill.root.contains(activeElement)) return;
|
|
101
|
+
|
|
102
|
+
if (this.table) {
|
|
103
|
+
const tableMain = Quill.find(this.table) as TableMainFormat;
|
|
104
|
+
const cells = tableMain.descendants(TableCellInnerFormat);
|
|
105
|
+
if (this.selectedTds.length === cells.length) {
|
|
106
|
+
tableMain.remove();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
for (const td of this.selectedTds) {
|
|
111
|
+
td.deleteAt(0, td.length() - 1);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
setSelectedTds(tds: TableCellInnerFormat[]) {
|
|
116
|
+
const currentSelectedTds = new Set(this.selectedTds);
|
|
117
|
+
const isSame = this.selectedTds.length === tds.length && tds.every(td => currentSelectedTds.has(td));
|
|
118
|
+
|
|
119
|
+
this.selectedTds = tds;
|
|
120
|
+
if (!isSame) {
|
|
121
|
+
this.quill.emitter.emit(tableUpEvent.TABLE_SELECTION_CHANGE, this, this.selectedTds);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
69
125
|
getFirstTextNode(dom: HTMLElement | Node): Node {
|
|
70
126
|
for (const node of Array.from(dom.childNodes)) {
|
|
71
127
|
if (node.nodeType === Node.TEXT_NODE) {
|
|
@@ -103,7 +159,7 @@ export class TableSelection {
|
|
|
103
159
|
if (isInCell && !containsLine) {
|
|
104
160
|
try {
|
|
105
161
|
const cellInner = findParentBlot(line!, blotName.tableCellInner) as TableCellInnerFormat;
|
|
106
|
-
this.
|
|
162
|
+
this.setSelectedTds([cellInner]);
|
|
107
163
|
this.updateWithSelectedTds();
|
|
108
164
|
}
|
|
109
165
|
catch {
|
|
@@ -203,11 +259,10 @@ export class TableSelection {
|
|
|
203
259
|
resolveOptions(options: Partial<TableSelectionOptions>): TableSelectionOptions {
|
|
204
260
|
return Object.assign({
|
|
205
261
|
selectColor: '#0589f340',
|
|
206
|
-
tableMenuOptions: {},
|
|
207
262
|
} as TableSelectionOptions, options);
|
|
208
263
|
}
|
|
209
264
|
|
|
210
|
-
selectionChangeHandler
|
|
265
|
+
selectionChangeHandler() {
|
|
211
266
|
const selection = window.getSelection();
|
|
212
267
|
if (!selection) return;
|
|
213
268
|
const { anchorNode, focusNode, anchorOffset, focusOffset } = selection;
|
|
@@ -281,7 +336,7 @@ export class TableSelection {
|
|
|
281
336
|
focusNode,
|
|
282
337
|
focusOffset,
|
|
283
338
|
};
|
|
284
|
-
}
|
|
339
|
+
}
|
|
285
340
|
|
|
286
341
|
helpLinesInitial() {
|
|
287
342
|
this.cellSelectWrap.style.setProperty('--select-color', this.options.selectColor);
|
|
@@ -297,15 +352,13 @@ export class TableSelection {
|
|
|
297
352
|
|
|
298
353
|
const tableMainBlot = Quill.find(this.table) as TableMainFormat;
|
|
299
354
|
if (!tableMainBlot) return [];
|
|
300
|
-
const tableBodyBlot = tableMainBlot.descendants(TableBodyFormat)[0];
|
|
301
|
-
if (!tableBodyBlot) return [];
|
|
302
355
|
// Use TableCell to calculation selected range, because TableCellInner is scrollable, the width will effect calculate
|
|
303
356
|
const tableCells = new Set(
|
|
304
357
|
// reverse cell. search from bottom.
|
|
305
358
|
// when mouse click on the cell border. the selection will be in the lower cell.
|
|
306
359
|
// but `isRectanglesIntersect` judge intersect include border. the upper cell bottom border will intersect with boundary
|
|
307
360
|
// so need to search the cell from bottom
|
|
308
|
-
(
|
|
361
|
+
(tableMainBlot.descendants(TableCellFormat) as TempSortedTableCellFormat[]).map((cell, i) => {
|
|
309
362
|
cell.index = i;
|
|
310
363
|
return cell;
|
|
311
364
|
}),
|
|
@@ -377,14 +430,14 @@ export class TableSelection {
|
|
|
377
430
|
|
|
378
431
|
getScrollPositionDiff() {
|
|
379
432
|
const { x: tableScrollX, y: tableScrollY } = this.getTableViewScroll();
|
|
380
|
-
const { x: editorScrollX, y: editorScrollY } =
|
|
433
|
+
const { x: editorScrollX, y: editorScrollY } = getElementScrollPosition(this.quill.root);
|
|
381
434
|
this.selectedTableScrollX = tableScrollX;
|
|
382
435
|
this.selectedTableScrollY = tableScrollY;
|
|
383
436
|
this.selectedEditorScrollX = editorScrollX;
|
|
384
437
|
this.selectedEditorScrollY = editorScrollY;
|
|
385
438
|
|
|
386
439
|
return this.startScrollRecordPosition.reduce((pre, { x, y }, i) => {
|
|
387
|
-
const { x: currentX, y: currentY } =
|
|
440
|
+
const { x: currentX, y: currentY } = getElementScrollPosition(this.scrollRecordEls[i]);
|
|
388
441
|
pre.x += x - currentX;
|
|
389
442
|
pre.y += y - currentY;
|
|
390
443
|
return pre;
|
|
@@ -394,7 +447,7 @@ export class TableSelection {
|
|
|
394
447
|
recordScrollPosition() {
|
|
395
448
|
this.clearRecordScrollPosition();
|
|
396
449
|
for (const el of this.scrollRecordEls) {
|
|
397
|
-
this.startScrollRecordPosition.push(
|
|
450
|
+
this.startScrollRecordPosition.push(getElementScrollPosition(el));
|
|
398
451
|
}
|
|
399
452
|
}
|
|
400
453
|
|
|
@@ -402,9 +455,9 @@ export class TableSelection {
|
|
|
402
455
|
this.startScrollRecordPosition = [];
|
|
403
456
|
}
|
|
404
457
|
|
|
405
|
-
|
|
458
|
+
tableSelectHandler(mousedownEvent: MouseEvent) {
|
|
406
459
|
const { button, target, clientX, clientY } = mousedownEvent;
|
|
407
|
-
const closestTable = (target as HTMLElement).closest<HTMLTableElement>('
|
|
460
|
+
const closestTable = (target as HTMLElement).closest<HTMLTableElement>('table');
|
|
408
461
|
const closestTableCaption = (target as HTMLElement).closest('caption');
|
|
409
462
|
if (button !== 0 || !closestTable || closestTableCaption) return;
|
|
410
463
|
|
|
@@ -413,17 +466,11 @@ export class TableSelection {
|
|
|
413
466
|
const startPoint = { x: clientX, y: clientY };
|
|
414
467
|
|
|
415
468
|
this.recordScrollPosition();
|
|
416
|
-
this.
|
|
417
|
-
this.dragging = true;
|
|
469
|
+
this.setSelectedTds(this.computeSelectedTds(startPoint, startPoint));
|
|
418
470
|
this.show();
|
|
419
471
|
|
|
420
472
|
const mouseMoveHandler = (mousemoveEvent: MouseEvent) => {
|
|
421
|
-
|
|
422
|
-
this.tableMenu.hide();
|
|
423
|
-
}
|
|
424
|
-
if (this.tableModule.tableResize) {
|
|
425
|
-
this.tableModule.tableResize.hide();
|
|
426
|
-
}
|
|
473
|
+
this.dragging = true;
|
|
427
474
|
const { button, target, clientX, clientY } = mousemoveEvent;
|
|
428
475
|
const closestTable = (target as HTMLElement).closest<HTMLTableElement>('.ql-table');
|
|
429
476
|
const closestTableCaption = (target as HTMLElement).closest('caption');
|
|
@@ -436,7 +483,7 @@ export class TableSelection {
|
|
|
436
483
|
}
|
|
437
484
|
|
|
438
485
|
const movePoint = { x: clientX, y: clientY };
|
|
439
|
-
this.
|
|
486
|
+
this.setSelectedTds(this.computeSelectedTds(startPoint, movePoint));
|
|
440
487
|
if (this.selectedTds.length > 1) {
|
|
441
488
|
this.quill.blur();
|
|
442
489
|
}
|
|
@@ -447,17 +494,17 @@ export class TableSelection {
|
|
|
447
494
|
document.body.removeEventListener('mouseup', mouseUpHandler, false);
|
|
448
495
|
this.dragging = false;
|
|
449
496
|
this.clearRecordScrollPosition();
|
|
450
|
-
if (this.tableMenu && this.selectedTds.length > 0) {
|
|
451
|
-
this.tableMenu.show();
|
|
452
|
-
}
|
|
453
497
|
};
|
|
454
498
|
|
|
455
499
|
document.body.addEventListener('mousemove', mouseMoveHandler, false);
|
|
456
500
|
document.body.addEventListener('mouseup', mouseUpHandler, false);
|
|
457
|
-
}
|
|
501
|
+
}
|
|
458
502
|
|
|
459
503
|
updateWithSelectedTds() {
|
|
460
|
-
if (this.selectedTds.length <= 0)
|
|
504
|
+
if (this.selectedTds.length <= 0) {
|
|
505
|
+
this.hide();
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
461
508
|
const startPoint = { x: Infinity, y: Infinity };
|
|
462
509
|
const endPoint = { x: -Infinity, y: -Infinity };
|
|
463
510
|
for (const td of this.selectedTds) {
|
|
@@ -467,7 +514,7 @@ export class TableSelection {
|
|
|
467
514
|
endPoint.x = Math.max(endPoint.x, rect.right);
|
|
468
515
|
endPoint.y = Math.max(endPoint.y, rect.bottom);
|
|
469
516
|
}
|
|
470
|
-
this.
|
|
517
|
+
this.setSelectedTds(this.computeSelectedTds(startPoint, endPoint));
|
|
471
518
|
if (this.selectedTds.length > 0) {
|
|
472
519
|
this.update();
|
|
473
520
|
}
|
|
@@ -477,8 +524,12 @@ export class TableSelection {
|
|
|
477
524
|
}
|
|
478
525
|
|
|
479
526
|
update() {
|
|
480
|
-
if (
|
|
481
|
-
|
|
527
|
+
if (!this.table) {
|
|
528
|
+
this.hide();
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (this.selectedTds.length === 0 || !this.boundary) return;
|
|
532
|
+
const { x: editorScrollX, y: editorScrollY } = getElementScrollPosition(this.quill.root);
|
|
482
533
|
const { x: tableScrollX, y: tableScrollY } = this.getTableViewScroll();
|
|
483
534
|
const tableWrapperRect = this.table.parentElement!.getBoundingClientRect();
|
|
484
535
|
const rootRect = this.quill.root.getBoundingClientRect();
|
|
@@ -497,9 +548,7 @@ export class TableSelection {
|
|
|
497
548
|
width: `${tableWrapperRect.width}px`,
|
|
498
549
|
height: `${tableWrapperRect.height}px`,
|
|
499
550
|
});
|
|
500
|
-
|
|
501
|
-
this.tableMenu.update();
|
|
502
|
-
}
|
|
551
|
+
this.quill.emitter.emit(tableUpEvent.TABLE_SELECTION_DISPLAY_CHANGE, this);
|
|
503
552
|
}
|
|
504
553
|
|
|
505
554
|
getTableViewScroll() {
|
|
@@ -509,7 +558,7 @@ export class TableSelection {
|
|
|
509
558
|
y: 0,
|
|
510
559
|
};
|
|
511
560
|
}
|
|
512
|
-
return
|
|
561
|
+
return getElementScrollPosition(this.table.parentElement!);
|
|
513
562
|
}
|
|
514
563
|
|
|
515
564
|
setSelectionTable(table: HTMLTableElement | undefined) {
|
|
@@ -523,24 +572,6 @@ export class TableSelection {
|
|
|
523
572
|
}
|
|
524
573
|
}
|
|
525
574
|
|
|
526
|
-
removeCell = (e: KeyboardEvent) => {
|
|
527
|
-
const range = this.quill.getSelection();
|
|
528
|
-
const activeElement = document.activeElement;
|
|
529
|
-
if (range || (e.key !== 'Backspace' && e.key !== 'Delete') || !this.quill.root.contains(activeElement)) return;
|
|
530
|
-
|
|
531
|
-
if (this.table) {
|
|
532
|
-
const tableMain = Quill.find(this.table) as TableMainFormat;
|
|
533
|
-
const cells = tableMain.descendants(TableCellInnerFormat);
|
|
534
|
-
if (this.selectedTds.length === cells.length) {
|
|
535
|
-
tableMain.remove();
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
for (const td of this.selectedTds) {
|
|
540
|
-
td.deleteAt(0, td.length() - 1);
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
|
|
544
575
|
showDisplay() {
|
|
545
576
|
Object.assign(this.cellSelectWrap.style, { display: 'block' });
|
|
546
577
|
this.isDisplaySelection = true;
|
|
@@ -552,9 +583,9 @@ export class TableSelection {
|
|
|
552
583
|
if (!this.table) return;
|
|
553
584
|
clearScrollEvent.call(this);
|
|
554
585
|
|
|
555
|
-
this.update();
|
|
556
586
|
this.showDisplay();
|
|
557
|
-
|
|
587
|
+
this.update();
|
|
588
|
+
this.quill.root.addEventListener('keydown', this.removeCell);
|
|
558
589
|
addScrollEvent.call(this, this.quill.root, () => {
|
|
559
590
|
this.update();
|
|
560
591
|
});
|
|
@@ -572,14 +603,11 @@ export class TableSelection {
|
|
|
572
603
|
|
|
573
604
|
hide() {
|
|
574
605
|
clearScrollEvent.call(this);
|
|
575
|
-
|
|
606
|
+
this.quill.root.removeEventListener('keydown', this.removeCell);
|
|
576
607
|
this.hideDisplay();
|
|
577
608
|
this.boundary = null;
|
|
578
|
-
this.
|
|
609
|
+
this.setSelectedTds([]);
|
|
579
610
|
this.setSelectionTable(undefined);
|
|
580
|
-
if (this.tableMenu) {
|
|
581
|
-
this.tableMenu.hide();
|
|
582
|
-
}
|
|
583
611
|
}
|
|
584
612
|
|
|
585
613
|
destroy() {
|
|
@@ -587,15 +615,10 @@ export class TableSelection {
|
|
|
587
615
|
|
|
588
616
|
this.hide();
|
|
589
617
|
this.cellSelectWrap.remove();
|
|
590
|
-
if (this.tableMenu) {
|
|
591
|
-
this.tableMenu.destroy();
|
|
592
|
-
}
|
|
593
618
|
clearScrollEvent.call(this);
|
|
594
619
|
|
|
595
|
-
this.quill.
|
|
596
|
-
|
|
620
|
+
this.quill.off(tableUpEvent.AFTER_TABLE_RESIZE, this.updateAfterEvent);
|
|
621
|
+
this.quill.off(Quill.events.EDITOR_CHANGE, this.updateWhenTextChange);
|
|
597
622
|
this.quill.off(Quill.events.SELECTION_CHANGE, this.quillSelectionChangeHandler);
|
|
598
|
-
this.quill.off(Quill.events.TEXT_CHANGE, this.updateAfterEvent);
|
|
599
|
-
this.quill.on(tableUpEvent.AFTER_TABLE_RESIZE, this.updateAfterEvent);
|
|
600
623
|
}
|
|
601
624
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"3.2.3","results":[[":__tests__/unit/utils.test-d.ts",{"duration":0,"failed":false}],[":__tests__/unit/table-clipboard.test.ts",{"duration":
|
|
1
|
+
{"version":"3.2.3","results":[[":__tests__/unit/utils.test-d.ts",{"duration":0,"failed":false}],[":__tests__/unit/table-clipboard.test.ts",{"duration":242.66079999999783,"failed":false}],[":__tests__/unit/table-redo-undo.test.ts",{"duration":7058.3453,"failed":false}],[":__tests__/unit/table-hack.test.ts",{"duration":2378.3323,"failed":false}],[":__tests__/unit/table-cell-merge.test.ts",{"duration":2717.3857000000003,"failed":false}],[":__tests__/unit/table-insert.test.ts",{"duration":2047.901899999939,"failed":false}],[":__tests__/unit/table-blots.test.ts",{"duration":1673.0519000000004,"failed":false}],[":__tests__/unit/utils.test.ts",{"duration":658.0781999999999,"failed":false}],[":__tests__/unit/table-remove.test.ts",{"duration":2390.7156,"failed":false}],[":__tests__/unit/table-caption.test.ts",{"duration":991.8278,"failed":false}]]}
|
package/src/style/index.less
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
&-align {
|
|
6
6
|
position: absolute;
|
|
7
7
|
z-index: 1;
|
|
8
|
-
display:
|
|
8
|
+
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
padding: 4px;
|
|
11
11
|
border-radius: 6px;
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
cursor: default;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
&.is-hidden {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
35
38
|
.icon {
|
|
36
39
|
display: flex;
|
|
37
40
|
flex-shrink: 0;
|
|
@@ -65,9 +68,6 @@
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
&-align {
|
|
68
|
-
&--active {
|
|
69
|
-
display: flex;
|
|
70
|
-
}
|
|
71
71
|
.icon {
|
|
72
72
|
width: 20px;
|
|
73
73
|
height: 20px;
|