quill-table-up 2.3.1 → 2.4.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 +1 -0
- package/dist/index.d.ts +35 -12
- package/dist/index.js +26 -25
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +35 -31
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/e2e/table-blots.test.ts +22 -0
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +218 -0
- package/src/__tests__/e2e/table-selection.test.ts +137 -131
- package/src/__tests__/unit/table-cell-merge.test.ts +261 -1
- package/src/__tests__/unit/table-clipboard.test.ts +62 -44
- package/src/__tests__/unit/table-insert.test.ts +39 -2
- package/src/__tests__/unit/table-redo-undo.test.ts +69 -0
- package/src/__tests__/unit/table-remove.test.ts +4 -2
- package/src/__tests__/unit/utils.ts +22 -4
- package/src/__tests__/unit/vitest.d.ts +4 -1
- package/src/formats/index.ts +6 -0
- package/src/formats/overrides/block-embed.ts +54 -0
- package/src/formats/overrides/block.ts +23 -4
- package/src/formats/overrides/index.ts +1 -0
- package/src/formats/table-cell-format.ts +39 -6
- package/src/formats/table-cell-inner-format.ts +70 -21
- package/src/formats/table-main-format.ts +92 -1
- package/src/formats/table-row-format.ts +13 -2
- package/src/modules/table-clipboard.ts +30 -35
- package/src/modules/table-resize/table-resize-box.ts +2 -2
- package/src/modules/table-resize/table-resize-common.ts +3 -5
- package/src/modules/table-resize/table-resize-line.ts +1 -1
- package/src/modules/table-resize/table-resize-scale.ts +1 -1
- package/src/modules/table-scrollbar.ts +9 -10
- package/src/modules/table-selection.ts +52 -31
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/table-up.ts +57 -23
- package/src/utils/blot-helper.ts +7 -4
- package/src/utils/index.ts +1 -1
- package/src/utils/{scroll-event-handle.ts → scroll-event-helper.ts} +7 -0
- package/src/utils/types.ts +2 -0
package/README.md
CHANGED
|
@@ -85,6 +85,7 @@ const quill = new Quill('#editor', {
|
|
|
85
85
|
| resizeScaleOptions | equal scale table cell handler options | `TableResizeScaleOptions` | - |
|
|
86
86
|
| alignOptions | table alignment handler options | `any` | - |
|
|
87
87
|
| scrollbarOptions | table virtual scrollbar handler options | `any` | - |
|
|
88
|
+
| autoMergeCell | empty row or column will auto merge to one | `boolean` | `true` |
|
|
88
89
|
|
|
89
90
|
> I'm not suggest to use `TableVirtualScrollbar` and `TableResizeLine` at same time, because it have a little conflict when user hover on it. Just like the first editor in [demo](https://zzxming.github.io/quill-table-up/)
|
|
90
91
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as quill1 from "quill";
|
|
1
2
|
import Quill, { EmitterSource, Parchment, Range } from "quill";
|
|
2
3
|
import { Context } from "quill/modules/keyboard";
|
|
3
4
|
import TypeScroll from "quill/blots/scroll";
|
|
@@ -24,8 +25,8 @@ declare class ContainerFormat extends Container {
|
|
|
24
25
|
}
|
|
25
26
|
//#endregion
|
|
26
27
|
//#region src/formats/table-col-format.d.ts
|
|
27
|
-
declare const BlockEmbed$
|
|
28
|
-
declare class TableColFormat extends BlockEmbed$
|
|
28
|
+
declare const BlockEmbed$2: typeof BlockEmbed;
|
|
29
|
+
declare class TableColFormat extends BlockEmbed$2 {
|
|
29
30
|
static blotName: "table-up-col";
|
|
30
31
|
static tagName: string;
|
|
31
32
|
static validWidth(width: string | number, full: boolean): string;
|
|
@@ -67,7 +68,10 @@ declare class TableCellInnerFormat extends ContainerFormat {
|
|
|
67
68
|
set rowspan(value: number);
|
|
68
69
|
get colspan(): number;
|
|
69
70
|
set colspan(value: number);
|
|
71
|
+
get emptyRow(): string[];
|
|
72
|
+
set emptyRow(value: string[]);
|
|
70
73
|
getColumnIndex(): number;
|
|
74
|
+
setStyleByString(styleStr: string): void;
|
|
71
75
|
formatAt(index: number, length: number, name: string, value: any): void;
|
|
72
76
|
insertAt(index: number, value: string, def?: any): void;
|
|
73
77
|
formats(): Record<string, any>;
|
|
@@ -95,6 +99,7 @@ declare class TableCellFormat extends ContainerFormat {
|
|
|
95
99
|
get colId(): string;
|
|
96
100
|
get rowspan(): number;
|
|
97
101
|
get colspan(): number;
|
|
102
|
+
get emptyRow(): string[];
|
|
98
103
|
getColumnIndex(): number;
|
|
99
104
|
getCellInner(): TableCellInnerFormat;
|
|
100
105
|
checkMerge(): boolean;
|
|
@@ -120,7 +125,7 @@ declare class TableRowFormat extends ContainerFormat {
|
|
|
120
125
|
removeCell(targetIndex: number): SkipRowCount;
|
|
121
126
|
foreachCellInner(func: (tableCell: TableCellInnerFormat, index: number) => boolean | void): void;
|
|
122
127
|
checkMerge(): boolean;
|
|
123
|
-
optimize(
|
|
128
|
+
optimize(_context: Record<string, any>): void;
|
|
124
129
|
}
|
|
125
130
|
//#endregion
|
|
126
131
|
//#region src/formats/table-main-format.d.ts
|
|
@@ -146,6 +151,9 @@ declare class TableMainFormat extends ContainerFormat {
|
|
|
146
151
|
getColIds(): string[];
|
|
147
152
|
checkMerge(): boolean;
|
|
148
153
|
optimize(context: Record<string, any>): void;
|
|
154
|
+
mergeRow(): void;
|
|
155
|
+
checkEmptyCol(autoMerge: boolean): void;
|
|
156
|
+
checkEmptyRow(autoMerge: boolean): void;
|
|
149
157
|
sortMergeChildren(): void;
|
|
150
158
|
}
|
|
151
159
|
//#endregion
|
|
@@ -167,6 +175,13 @@ declare class BlockOverride extends Block {
|
|
|
167
175
|
format(name: string, value: any): void;
|
|
168
176
|
}
|
|
169
177
|
//#endregion
|
|
178
|
+
//#region src/formats/overrides/block-embed.d.ts
|
|
179
|
+
declare const BlockEmbed$1: typeof BlockEmbed;
|
|
180
|
+
declare class BlockEmbedOverride extends BlockEmbed$1 {
|
|
181
|
+
delta(): quill1.Delta;
|
|
182
|
+
length(): number;
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
170
185
|
//#region src/formats/overrides/scroll.d.ts
|
|
171
186
|
declare const ScrollBlot: any;
|
|
172
187
|
declare class ScrollOverride extends ScrollBlot {
|
|
@@ -231,6 +246,9 @@ declare class TableWrapperFormat extends ContainerFormat {
|
|
|
231
246
|
//#endregion
|
|
232
247
|
//#region src/formats/index.d.ts
|
|
233
248
|
declare function getTableMainRect(tableMainBlot: TableMainFormat): {
|
|
249
|
+
body: null;
|
|
250
|
+
rect: null;
|
|
251
|
+
} | {
|
|
234
252
|
body: TableBodyFormat;
|
|
235
253
|
rect: DOMRect;
|
|
236
254
|
};
|
|
@@ -302,9 +320,7 @@ declare class TableClipboard extends Clipboard {
|
|
|
302
320
|
quill: Quill;
|
|
303
321
|
tableId: string;
|
|
304
322
|
rowId: string;
|
|
305
|
-
rowIds: string[];
|
|
306
323
|
colIds: string[];
|
|
307
|
-
emptyRowCount: number[];
|
|
308
324
|
rowspanCount: {
|
|
309
325
|
rowspan: number;
|
|
310
326
|
colspan: number;
|
|
@@ -722,8 +738,11 @@ declare class TableSelection {
|
|
|
722
738
|
quill: Quill;
|
|
723
739
|
options: TableSelectionOptions;
|
|
724
740
|
boundary: RelactiveRect | null;
|
|
725
|
-
|
|
726
|
-
|
|
741
|
+
scrollRecordEls: HTMLElement[];
|
|
742
|
+
startScrollRecordPosition: {
|
|
743
|
+
x: number;
|
|
744
|
+
y: number;
|
|
745
|
+
}[];
|
|
727
746
|
selectedTableScrollX: number;
|
|
728
747
|
selectedTableScrollY: number;
|
|
729
748
|
selectedEditorScrollX: number;
|
|
@@ -775,13 +794,15 @@ declare class TableSelection {
|
|
|
775
794
|
x: number;
|
|
776
795
|
y: number;
|
|
777
796
|
}): TableCellInnerFormat[];
|
|
778
|
-
|
|
779
|
-
updateWithSelectedTds(): void;
|
|
780
|
-
update(): void;
|
|
781
|
-
getQuillViewScroll(): {
|
|
797
|
+
getScrollPositionDiff(): {
|
|
782
798
|
x: number;
|
|
783
799
|
y: number;
|
|
784
800
|
};
|
|
801
|
+
recordScrollPosition(): void;
|
|
802
|
+
clearRecordScrollPosition(): void;
|
|
803
|
+
mouseDownHandler: (mousedownEvent: MouseEvent) => void;
|
|
804
|
+
updateWithSelectedTds(): void;
|
|
805
|
+
update(): void;
|
|
785
806
|
getTableViewScroll(): {
|
|
786
807
|
x: number;
|
|
787
808
|
y: number;
|
|
@@ -862,6 +883,7 @@ interface TableUpOptions {
|
|
|
862
883
|
alignOptions: any;
|
|
863
884
|
resizeScale?: Constructor<InternalModule, [TableUp, HTMLElement, Quill, Partial<TableResizeScaleOptions>]>;
|
|
864
885
|
resizeScaleOptions: Partial<TableResizeScaleOptions>;
|
|
886
|
+
autoMergeCell: boolean;
|
|
865
887
|
}
|
|
866
888
|
interface TableColValue {
|
|
867
889
|
tableId: string;
|
|
@@ -877,6 +899,7 @@ interface TableCellValue {
|
|
|
877
899
|
rowspan: number;
|
|
878
900
|
colspan: number;
|
|
879
901
|
style?: string;
|
|
902
|
+
emptyRow?: string[];
|
|
880
903
|
}
|
|
881
904
|
interface TableRowValue {
|
|
882
905
|
tableId: string;
|
|
@@ -1115,5 +1138,5 @@ declare class TableUp {
|
|
|
1115
1138
|
splitCell(selectedTds: TableCellInnerFormat[]): void;
|
|
1116
1139
|
}
|
|
1117
1140
|
//#endregion
|
|
1118
|
-
export { BlockOverride, ClipboardOptions, Constructor, ContainerFormat, InternalModule, InternalTableMenuModule, InternalTableSelectionModule, Matcher, MenuTooltipInstance, QuillTheme, QuillThemePicker, RelactiveRect, ScrollOverride, Scrollbar, SelectionData, Selector, SkipRowCount, TableAlign, TableBodyFormat, TableCaptionFormat, TableCaptionValue, TableCellFormat, TableCellInnerFormat, TableCellValue, TableClipboard, TableColFormat, TableColValue, TableColgroupFormat, TableConstantsData, TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuOptions, TableMenuOptionsInput, TableMenuSelect, TableMenuTexts, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableResizeScaleOptions, TableRowFormat, TableRowValue, TableSelection, TableSelectionOptions, TableTextOptions, TableUp, 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 };
|
|
1141
|
+
export { BlockEmbedOverride, BlockOverride, ClipboardOptions, Constructor, ContainerFormat, InternalModule, InternalTableMenuModule, InternalTableSelectionModule, Matcher, MenuTooltipInstance, QuillTheme, QuillThemePicker, RelactiveRect, ScrollOverride, Scrollbar, SelectionData, Selector, SkipRowCount, TableAlign, TableBodyFormat, TableCaptionFormat, TableCaptionValue, TableCellFormat, TableCellInnerFormat, TableCellValue, TableClipboard, TableColFormat, TableColValue, TableColgroupFormat, TableConstantsData, TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuOptions, TableMenuOptionsInput, TableMenuSelect, TableMenuTexts, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableResizeScaleOptions, TableRowFormat, TableRowValue, TableSelection, TableSelectionOptions, TableTextOptions, TableUp, 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 };
|
|
1119
1142
|
//# sourceMappingURL=index.d.ts.map
|