quill-table-up 3.0.3 → 3.1.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/dist/index.d.ts +70 -18
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +33 -33
- package/dist/index.umd.js.map +1 -1
- package/package.json +16 -12
- package/src/__tests__/e2e/editor-page.ts +3 -2
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +610 -372
- package/src/__tests__/e2e/table-menu.test.ts +0 -24
- package/src/__tests__/e2e/utils.ts +37 -1
- package/src/__tests__/unit/table-cell-merge.test.ts +22 -1
- package/src/__tests__/unit/table-insert.test.ts +4 -4
- package/src/__tests__/unit/table-redo-undo.test.ts +2 -2
- package/src/__tests__/unit/utils.ts +24 -3
- package/src/formats/table-cell-format.ts +11 -3
- package/src/formats/table-row-format.ts +1 -1
- package/src/modules/table-clipboard/index.ts +2 -0
- package/src/modules/table-clipboard/paste-cell-into-cell.ts +329 -0
- package/src/modules/{table-clipboard.ts → table-clipboard/table-clipboard.ts} +375 -375
- package/src/modules/table-menu/constants.ts +14 -17
- package/src/modules/table-resize/table-resize-box.ts +4 -1
- package/src/modules/table-selection.ts +52 -11
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/table-up.ts +7 -3
- package/src/utils/components/table/select-box.ts +1 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as quill0 from "quill";
|
|
2
|
-
import Quill, { EmitterSource, Parchment, Range } from "quill";
|
|
2
|
+
import Quill, { Delta, EmitterSource, Op, Parchment, Range } from "quill";
|
|
3
3
|
import { Context } from "quill/modules/keyboard";
|
|
4
4
|
import TypeScroll from "quill/blots/scroll";
|
|
5
5
|
import TypeBlock, { BlockEmbed } from "quill/blots/block";
|
|
@@ -7,7 +7,7 @@ import TypeInline from "quill/blots/inline";
|
|
|
7
7
|
import TypeText from "quill/blots/text";
|
|
8
8
|
import BaseTheme from "quill/themes/base";
|
|
9
9
|
import Picker from "quill/ui/picker";
|
|
10
|
-
import { Delta } from "quill/core";
|
|
10
|
+
import { Delta as Delta$1 } from "quill/core";
|
|
11
11
|
import TypeClipboard from "quill/modules/clipboard";
|
|
12
12
|
|
|
13
13
|
//#region src/formats/container-format.d.ts
|
|
@@ -362,10 +362,60 @@ declare class TableAlign extends TableDomSelector {
|
|
|
362
362
|
destroy(): void;
|
|
363
363
|
}
|
|
364
364
|
//#endregion
|
|
365
|
-
//#region src/modules/table-clipboard.d.ts
|
|
365
|
+
//#region src/modules/table-clipboard/paste-cell-into-cell.d.ts
|
|
366
|
+
interface ArgumentsModule {
|
|
367
|
+
quill: Quill;
|
|
368
|
+
talbeModule: TableUp;
|
|
369
|
+
}
|
|
370
|
+
interface CellUpdate {
|
|
371
|
+
offset: number;
|
|
372
|
+
length: number;
|
|
373
|
+
insertDelta: Delta;
|
|
374
|
+
cell: TableCellInnerFormat;
|
|
375
|
+
rowspan?: number;
|
|
376
|
+
colspan?: number;
|
|
377
|
+
emptyRow?: string[];
|
|
378
|
+
}
|
|
379
|
+
interface TableCellValueLike {
|
|
380
|
+
rowId: string;
|
|
381
|
+
colId: string;
|
|
382
|
+
colspan: number;
|
|
383
|
+
rowspan: number;
|
|
384
|
+
emptyRow?: string[];
|
|
385
|
+
}
|
|
386
|
+
interface CellRecord extends TableCellValueLike {
|
|
387
|
+
deltaOps: Op[];
|
|
388
|
+
}
|
|
389
|
+
declare function pasteCells(modules: ArgumentsModule, selectedTds: TableCellInnerFormat[], pasteDelta: Op[]): void;
|
|
390
|
+
declare function getTableCellStructure(cells: TableCellInnerFormat[]): {
|
|
391
|
+
rows: number;
|
|
392
|
+
cols: number;
|
|
393
|
+
};
|
|
394
|
+
declare function parsePasteDelta(delta: Op[]): {
|
|
395
|
+
cells: CellRecord[];
|
|
396
|
+
rows: number;
|
|
397
|
+
cols: number;
|
|
398
|
+
};
|
|
399
|
+
declare function getCountByPosition(infos: ReturnType<typeof getCellPositions>): {
|
|
400
|
+
rows: number;
|
|
401
|
+
cols: number;
|
|
402
|
+
};
|
|
403
|
+
declare function pasteWithStructure(selectedTds: TableCellInnerFormat[], pasteCells: CellRecord[], modules: ArgumentsModule): void;
|
|
404
|
+
declare function getCellPositions<T extends TableCellValueLike>(cells: T[]): {
|
|
405
|
+
cell: T;
|
|
406
|
+
rowIndex: number;
|
|
407
|
+
colIndex: number;
|
|
408
|
+
}[];
|
|
409
|
+
declare function groupCellByRow<T extends TableCellValueLike>(cells: T[]): Map<string, T[]>;
|
|
410
|
+
declare function pasteWithLoop(modules: ArgumentsModule, selectedTds: TableCellInnerFormat[], pasteCells: CellRecord[]): void;
|
|
411
|
+
declare function prepareCellUpdate(modules: ArgumentsModule, cell: TableCellInnerFormat, deltaOps: Op[], attrs?: Pick<TableCellValue, 'rowspan' | 'colspan' | 'emptyRow'>): CellUpdate;
|
|
412
|
+
declare function applyCellUpdates(modules: ArgumentsModule, updates: CellUpdate[]): void;
|
|
413
|
+
declare function removeOverlappingCells(modules: ArgumentsModule, updateCell: CellUpdate): void;
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/modules/table-clipboard/table-clipboard.d.ts
|
|
366
416
|
declare const Clipboard: typeof TypeClipboard;
|
|
367
417
|
type Selector = string | Node['TEXT_NODE'] | Node['ELEMENT_NODE'];
|
|
368
|
-
type Matcher = (node: Node, delta: Delta, scroll: Parchment.ScrollBlot) => Delta;
|
|
418
|
+
type Matcher = (node: Node, delta: Delta$1, scroll: Parchment.ScrollBlot) => Delta$1;
|
|
369
419
|
interface ClipboardOptions {
|
|
370
420
|
matchers: [Selector, Matcher][];
|
|
371
421
|
}
|
|
@@ -381,24 +431,24 @@ declare class TableClipboard extends Clipboard {
|
|
|
381
431
|
cellCount: number;
|
|
382
432
|
colCount: number;
|
|
383
433
|
constructor(quill: Quill, options: Partial<ClipboardOptions>);
|
|
384
|
-
getStyleBackgroundColor(node: Node, delta: Delta): void;
|
|
385
|
-
matchTable(node: Node, delta: Delta): Delta;
|
|
386
|
-
matchTbody(node: Node, delta: Delta): Delta;
|
|
387
|
-
matchThead(node: Node, delta: Delta): Delta;
|
|
388
|
-
matchTfoot(node: Node, delta: Delta): Delta;
|
|
389
|
-
matchColgroup(node: Node, delta: Delta): Delta;
|
|
390
|
-
matchCol(node: Node, _delta: Delta): Delta;
|
|
391
|
-
matchTr(node: Node, delta: Delta): Delta;
|
|
392
|
-
matchTd(node: Node, delta: Delta): Delta;
|
|
393
|
-
matchTdAttributor(node: Node, delta: Delta): Delta;
|
|
434
|
+
getStyleBackgroundColor(node: Node, delta: Delta$1): void;
|
|
435
|
+
matchTable(node: Node, delta: Delta$1): Delta$1;
|
|
436
|
+
matchTbody(node: Node, delta: Delta$1): Delta$1;
|
|
437
|
+
matchThead(node: Node, delta: Delta$1): Delta$1;
|
|
438
|
+
matchTfoot(node: Node, delta: Delta$1): Delta$1;
|
|
439
|
+
matchColgroup(node: Node, delta: Delta$1): Delta$1;
|
|
440
|
+
matchCol(node: Node, _delta: Delta$1): Delta$1;
|
|
441
|
+
matchTr(node: Node, delta: Delta$1): Delta$1;
|
|
442
|
+
matchTd(node: Node, delta: Delta$1): Delta$1;
|
|
443
|
+
matchTdAttributor(node: Node, delta: Delta$1): Delta$1;
|
|
394
444
|
convert({
|
|
395
445
|
html,
|
|
396
446
|
text
|
|
397
447
|
}: {
|
|
398
448
|
html?: string;
|
|
399
449
|
text?: string;
|
|
400
|
-
}, formats?: Record<string, unknown>): Delta;
|
|
401
|
-
matchCaption(node: Node, delta: Delta): Delta;
|
|
450
|
+
}, formats?: Record<string, unknown>): Delta$1;
|
|
451
|
+
matchCaption(node: Node, delta: Delta$1): Delta$1;
|
|
402
452
|
}
|
|
403
453
|
//#endregion
|
|
404
454
|
//#region src/modules/table-menu/constants.d.ts
|
|
@@ -839,9 +889,11 @@ declare class TableSelection extends TableDomSelector {
|
|
|
839
889
|
set dragging(val: boolean);
|
|
840
890
|
get dragging(): boolean;
|
|
841
891
|
constructor(tableModule: TableUp, quill: Quill, options?: Partial<TableSelectionOptions>);
|
|
892
|
+
handlePaste: (event: ClipboardEvent) => void;
|
|
893
|
+
keyboardHandler: (e: KeyboardEvent) => Promise<void>;
|
|
842
894
|
updateWhenTextChange: (eventName: string) => void;
|
|
843
895
|
updateAfterEvent: () => void;
|
|
844
|
-
|
|
896
|
+
removeCellBySelectedTds(): void;
|
|
845
897
|
setSelectedTds(tds: TableCellInnerFormat[]): void;
|
|
846
898
|
getFirstTextNode(dom: HTMLElement | Node): Node;
|
|
847
899
|
getLastTextNode(dom: HTMLElement | Node): Node;
|
|
@@ -1208,5 +1260,5 @@ declare class TableUp {
|
|
|
1208
1260
|
convertTableBodyByCells(tableBlot: TableMainFormat, selecteds: TableCellInnerFormat[], tag: TableBodyTag): void;
|
|
1209
1261
|
}
|
|
1210
1262
|
//#endregion
|
|
1211
|
-
export { BlockEmbedOverride, BlockOverride, ClipboardOptions, Constructor, ContainerFormat, InternalModule, InternalTableMenuModule, InternalTableSelectionModule, Matcher, MenuTooltipInstance, QuillTheme, QuillThemePicker, RelactiveRect, ScrollOverride, Scrollbar, SelectionData, Selector, SkipRowCount, TableAlign, TableBodyFormat, TableBodyTag, TableCaptionFormat, TableCaptionValue, TableCellFormat, TableCellInnerFormat, TableCellValue, TableClipboard, TableColFormat, TableColValue, TableColgroupFormat, TableConstantsData, TableCreatorTextOptions, TableDomSelector, TableFootFormat, TableHeadFormat, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuOptions, TableMenuOptionsInput, TableMenuSelect, TableMenuTexts, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableResizeScaleOptions, TableRowFormat, TableRowValue, TableSelection, TableSelectionOptions, TableTextOptions, TableUp, TableUpExtraModule, TableUpModule, TableUpOptions, TableValue, TableVirtualScrollbar, TableWrapperFormat, Tool, ToolOption, ToolOptionBreak, Writable, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, getTableMainRect, isTableAlignRight, randomId, sizeChangeValue, tableMenuTools, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|
|
1263
|
+
export { BlockEmbedOverride, BlockOverride, ClipboardOptions, Constructor, ContainerFormat, InternalModule, InternalTableMenuModule, InternalTableSelectionModule, Matcher, MenuTooltipInstance, QuillTheme, QuillThemePicker, RelactiveRect, ScrollOverride, Scrollbar, SelectionData, Selector, SkipRowCount, TableAlign, TableBodyFormat, TableBodyTag, TableCaptionFormat, TableCaptionValue, TableCellFormat, TableCellInnerFormat, TableCellValue, TableClipboard, TableColFormat, TableColValue, TableColgroupFormat, TableConstantsData, TableCreatorTextOptions, TableDomSelector, TableFootFormat, TableHeadFormat, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuOptions, TableMenuOptionsInput, TableMenuSelect, TableMenuTexts, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableResizeScaleOptions, TableRowFormat, TableRowValue, TableSelection, TableSelectionOptions, TableTextOptions, TableUp, TableUpExtraModule, TableUpModule, TableUpOptions, TableValue, TableVirtualScrollbar, TableWrapperFormat, Tool, ToolOption, ToolOptionBreak, Writable, applyCellUpdates, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, getCellPositions, getCountByPosition, getTableCellStructure, getTableMainRect, groupCellByRow, isTableAlignRight, parsePasteDelta, pasteCells, pasteWithLoop, pasteWithStructure, prepareCellUpdate, randomId, removeOverlappingCells, sizeChangeValue, tableMenuTools, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|
|
1212
1264
|
//# sourceMappingURL=index.d.ts.map
|