quill-table-up 2.2.0 → 2.2.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 +101 -93
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -1
- package/src/__tests__/e2e/table-caption.test.ts +41 -0
- package/src/__tests__/e2e/table-scrollbar.test.ts +35 -0
- package/src/__tests__/e2e/table-selection.test.ts +61 -0
- package/src/__tests__/unit/table-clipboard.test.ts +261 -123
- package/src/formats/index.ts +12 -0
- package/src/formats/table-caption-format.ts +1 -0
- package/src/formats/table-cell-format.ts +1 -1
- package/src/formats/utils.ts +1 -1
- package/src/modules/table-clipboard.ts +30 -1
- package/src/modules/table-resize/table-resize-box.ts +13 -15
- package/src/modules/table-resize/table-resize-common.ts +8 -8
- package/src/modules/table-resize/table-resize-scale.ts +5 -5
- package/src/modules/table-scrollbar.ts +6 -7
- package/src/modules/table-selection.ts +7 -7
- package/src/table-up.ts +22 -4
- package/src/utils/transformer.ts +13 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import Quill, { Parchment, Range, EmitterSource } from 'quill';
|
|
2
2
|
import { Context } from 'quill/modules/keyboard';
|
|
3
|
-
import
|
|
3
|
+
import TypeBlock, { BlockEmbed as BlockEmbed$1 } from 'quill/blots/block';
|
|
4
4
|
import BaseTheme from 'quill/themes/base';
|
|
5
5
|
import Picker from 'quill/ui/picker';
|
|
6
|
-
import
|
|
7
|
-
import TypeInline from 'quill/blots/inline';
|
|
8
|
-
import TypeText from 'quill/blots/text';
|
|
6
|
+
import TypeScroll from 'quill/blots/scroll';
|
|
9
7
|
import { Delta } from 'quill/core';
|
|
10
8
|
import TypeClipboard from 'quill/modules/clipboard';
|
|
9
|
+
import TypeInline from 'quill/blots/inline';
|
|
10
|
+
import TypeText from 'quill/blots/text';
|
|
11
11
|
|
|
12
12
|
declare const Container: typeof Parchment.ContainerBlot;
|
|
13
13
|
declare class ContainerFormat extends Container {
|
|
@@ -23,34 +23,24 @@ declare class ContainerFormat extends Container {
|
|
|
23
23
|
enforceAllowedChildren(): void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare const
|
|
27
|
-
declare class
|
|
28
|
-
|
|
29
|
-
format(name: string, value: any): void;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare class TableCellFormat extends ContainerFormat {
|
|
33
|
-
static blotName: "table-up-cell";
|
|
26
|
+
declare const BlockEmbed: typeof BlockEmbed$1;
|
|
27
|
+
declare class TableColFormat extends BlockEmbed {
|
|
28
|
+
static blotName: "table-up-col";
|
|
34
29
|
static tagName: string;
|
|
35
|
-
static
|
|
36
|
-
static
|
|
37
|
-
static
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
static create(value: TableCellValue): HTMLElement;
|
|
41
|
-
static formats(domNode: HTMLElement): Record<string, any>;
|
|
42
|
-
setFormatValue(name: string, value?: any): void;
|
|
43
|
-
setStyleBoder(name: string, value?: any): void;
|
|
44
|
-
getNearByCell(direction: 'left' | 'top'): TableCellFormat[];
|
|
30
|
+
static validWidth(width: string | number, full: boolean): string;
|
|
31
|
+
static create(value: TableColValue): HTMLElement;
|
|
32
|
+
static value(domNode: HTMLElement): Record<string, any>;
|
|
33
|
+
get width(): number;
|
|
34
|
+
set width(value: string | number);
|
|
45
35
|
get tableId(): string;
|
|
46
|
-
get rowId(): string;
|
|
47
36
|
get colId(): string;
|
|
48
|
-
get
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
get full(): boolean;
|
|
38
|
+
set full(value: boolean);
|
|
39
|
+
get align(): string;
|
|
40
|
+
set align(value: string);
|
|
52
41
|
checkMerge(): boolean;
|
|
53
42
|
optimize(context: Record<string, any>): void;
|
|
43
|
+
insertAt(index: number, value: string, def?: any): void;
|
|
54
44
|
}
|
|
55
45
|
|
|
56
46
|
declare class TableCellInnerFormat extends ContainerFormat {
|
|
@@ -83,75 +73,26 @@ declare class TableCellInnerFormat extends ContainerFormat {
|
|
|
83
73
|
insertBefore(blot: Parchment.Blot, ref?: Parchment.Blot | null): void;
|
|
84
74
|
}
|
|
85
75
|
|
|
86
|
-
declare
|
|
87
|
-
|
|
88
|
-
domNode: HTMLElement;
|
|
89
|
-
enable(enabled?: boolean): void;
|
|
90
|
-
createBlock(attributes: Record<string, any>, refBlot?: Parchment.Blot): Parchment.ParentBlot | TableCellInnerFormat;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
declare class TableBodyFormat extends ContainerFormat {
|
|
94
|
-
static blotName: "table-up-body";
|
|
95
|
-
static tagName: string;
|
|
96
|
-
static create(value: string): HTMLElement;
|
|
97
|
-
get tableId(): string;
|
|
98
|
-
insertRow(targetIndex: number): void;
|
|
99
|
-
checkMerge(): boolean;
|
|
100
|
-
optimize(context: Record<string, any>): void;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
declare class TableCaptionFormat extends BlockOverride {
|
|
104
|
-
static blotName: "table-up-caption";
|
|
76
|
+
declare class TableCellFormat extends ContainerFormat {
|
|
77
|
+
static blotName: "table-up-cell";
|
|
105
78
|
static tagName: string;
|
|
106
79
|
static className: string;
|
|
107
|
-
static
|
|
108
|
-
static
|
|
109
|
-
static
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
get side(): TableCaptionValue["side"];
|
|
117
|
-
format(name: string, value: any): void;
|
|
118
|
-
checkMerge(): boolean;
|
|
119
|
-
optimize(context: Record<string, any>): void;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
declare const BlockEmbed: typeof BlockEmbed$1;
|
|
123
|
-
declare class TableColFormat extends BlockEmbed {
|
|
124
|
-
static blotName: "table-up-col";
|
|
125
|
-
static tagName: string;
|
|
126
|
-
static validWidth(width: string | number, full: boolean): string;
|
|
127
|
-
static create(value: TableColValue): HTMLElement;
|
|
128
|
-
static value(domNode: HTMLElement): Record<string, any>;
|
|
129
|
-
get width(): number;
|
|
130
|
-
set width(value: string | number);
|
|
80
|
+
static allowDataAttrs: Set<string>;
|
|
81
|
+
static allowAttrs: Set<string>;
|
|
82
|
+
static allowStyle: Set<string>;
|
|
83
|
+
static isAllowStyle(str: string): boolean;
|
|
84
|
+
static create(value: TableCellValue): HTMLElement;
|
|
85
|
+
static formats(domNode: HTMLElement): Record<string, any>;
|
|
86
|
+
setFormatValue(name: string, value?: any): void;
|
|
87
|
+
setStyleBoder(name: string, value?: any): void;
|
|
88
|
+
getNearByCell(direction: 'left' | 'top'): TableCellFormat[];
|
|
131
89
|
get tableId(): string;
|
|
90
|
+
get rowId(): string;
|
|
132
91
|
get colId(): string;
|
|
133
|
-
get
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
checkMerge(): boolean;
|
|
138
|
-
optimize(context: Record<string, any>): void;
|
|
139
|
-
insertAt(index: number, value: string, def?: any): void;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
declare class TableColgroupFormat extends ContainerFormat {
|
|
143
|
-
static blotName: "table-up-colgroup";
|
|
144
|
-
static tagName: string;
|
|
145
|
-
children: Parchment.LinkedList<TableColFormat>;
|
|
146
|
-
static create(value: TableValue): HTMLElement;
|
|
147
|
-
get tableId(): string;
|
|
148
|
-
get full(): boolean;
|
|
149
|
-
set full(value: boolean);
|
|
150
|
-
get align(): string;
|
|
151
|
-
set align(value: string);
|
|
152
|
-
findCol(index: number): TableColFormat | null;
|
|
153
|
-
insertColByIndex(index: number, value: TableColValue): void;
|
|
154
|
-
removeColByIndex(index: number): void;
|
|
92
|
+
get rowspan(): number;
|
|
93
|
+
get colspan(): number;
|
|
94
|
+
getColumnIndex(): number;
|
|
95
|
+
getCellInner(): TableCellInnerFormat;
|
|
155
96
|
checkMerge(): boolean;
|
|
156
97
|
optimize(context: Record<string, any>): void;
|
|
157
98
|
}
|
|
@@ -200,6 +141,65 @@ declare class TableMainFormat extends ContainerFormat {
|
|
|
200
141
|
optimize(context: Record<string, any>): void;
|
|
201
142
|
}
|
|
202
143
|
|
|
144
|
+
declare class TableBodyFormat extends ContainerFormat {
|
|
145
|
+
static blotName: "table-up-body";
|
|
146
|
+
static tagName: string;
|
|
147
|
+
static create(value: string): HTMLElement;
|
|
148
|
+
get tableId(): string;
|
|
149
|
+
insertRow(targetIndex: number): void;
|
|
150
|
+
checkMerge(): boolean;
|
|
151
|
+
optimize(context: Record<string, any>): void;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare const Block: typeof TypeBlock;
|
|
155
|
+
declare class BlockOverride extends Block {
|
|
156
|
+
replaceWith(name: string | Parchment.Blot, value?: any): Parchment.Blot;
|
|
157
|
+
format(name: string, value: any): void;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare const ScrollBlot: any;
|
|
161
|
+
declare class ScrollOverride extends ScrollBlot {
|
|
162
|
+
domNode: HTMLElement;
|
|
163
|
+
enable(enabled?: boolean): void;
|
|
164
|
+
createBlock(attributes: Record<string, any>, refBlot?: Parchment.Blot): Parchment.ParentBlot | TableCellInnerFormat;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
declare class TableCaptionFormat extends BlockOverride {
|
|
168
|
+
static blotName: "table-up-caption";
|
|
169
|
+
static tagName: string;
|
|
170
|
+
static className: string;
|
|
171
|
+
static allowedChildren: (typeof TypeInline | typeof TypeText)[];
|
|
172
|
+
static create(value: TableCaptionValue): HTMLElement;
|
|
173
|
+
static formats(domNode: HTMLElement): TableCaptionValue;
|
|
174
|
+
scroll: TypeScroll;
|
|
175
|
+
uiNode: HTMLElement;
|
|
176
|
+
constructor(scroll: TypeScroll, domNode: HTMLElement, _value: TableCaptionValue);
|
|
177
|
+
createUI(): HTMLElement;
|
|
178
|
+
get tableId(): string;
|
|
179
|
+
set side(value: TableCaptionValue['side']);
|
|
180
|
+
get side(): TableCaptionValue["side"];
|
|
181
|
+
format(name: string, value: any): void;
|
|
182
|
+
checkMerge(): boolean;
|
|
183
|
+
optimize(context: Record<string, any>): void;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare class TableColgroupFormat extends ContainerFormat {
|
|
187
|
+
static blotName: "table-up-colgroup";
|
|
188
|
+
static tagName: string;
|
|
189
|
+
children: Parchment.LinkedList<TableColFormat>;
|
|
190
|
+
static create(value: TableValue): HTMLElement;
|
|
191
|
+
get tableId(): string;
|
|
192
|
+
get full(): boolean;
|
|
193
|
+
set full(value: boolean);
|
|
194
|
+
get align(): string;
|
|
195
|
+
set align(value: string);
|
|
196
|
+
findCol(index: number): TableColFormat | null;
|
|
197
|
+
insertColByIndex(index: number, value: TableColValue): void;
|
|
198
|
+
removeColByIndex(index: number): void;
|
|
199
|
+
checkMerge(): boolean;
|
|
200
|
+
optimize(context: Record<string, any>): void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
203
|
declare class TableWrapperFormat extends ContainerFormat {
|
|
204
204
|
scroll: any;
|
|
205
205
|
static blotName: "table-up";
|
|
@@ -214,6 +214,11 @@ declare class TableWrapperFormat extends ContainerFormat {
|
|
|
214
214
|
insertLineAround: () => void;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
declare function getTableMainRect(tableMainBlot: TableMainFormat): {
|
|
218
|
+
body: TableBodyFormat;
|
|
219
|
+
rect: DOMRect;
|
|
220
|
+
};
|
|
221
|
+
|
|
217
222
|
declare const blotName: {
|
|
218
223
|
readonly container: "table-up-container";
|
|
219
224
|
readonly tableCaption: "table-up-caption";
|
|
@@ -287,6 +292,7 @@ declare class TableClipboard extends Clipboard {
|
|
|
287
292
|
colCount: number;
|
|
288
293
|
constructor(quill: Quill, options: Partial<ClipboardOptions>);
|
|
289
294
|
matchTable(node: Node, delta: Delta): any;
|
|
295
|
+
matchTbody(node: Node, delta: Delta): Delta;
|
|
290
296
|
matchColgroup(node: Node, delta: Delta): any;
|
|
291
297
|
matchCol(node: Node): any;
|
|
292
298
|
matchTr(node: Node, delta: Delta): Delta;
|
|
@@ -1002,8 +1008,10 @@ declare class TableUp {
|
|
|
1002
1008
|
tableScrollbar?: InternalModule;
|
|
1003
1009
|
tableAlign?: InternalModule;
|
|
1004
1010
|
tableResizeScale?: InternalModule;
|
|
1011
|
+
resizeOb: ResizeObserver;
|
|
1005
1012
|
get statics(): any;
|
|
1006
1013
|
constructor(quill: Quill, options: Partial<TableUpOptions>);
|
|
1014
|
+
initialContainer(): HTMLDivElement;
|
|
1007
1015
|
addContainer(classes: string | HTMLElement): HTMLElement;
|
|
1008
1016
|
resolveOptions(options: Partial<TableUpOptions>): TableUpOptions;
|
|
1009
1017
|
resolveTexts(options: Partial<TableTextOptions>): {
|
|
@@ -1057,5 +1065,5 @@ declare class TableUp {
|
|
|
1057
1065
|
splitCell(selectedTds: TableCellInnerFormat[]): void;
|
|
1058
1066
|
}
|
|
1059
1067
|
|
|
1060
|
-
export { BlockOverride, ContainerFormat, ScrollOverride, Scrollbar, TableAlign, TableBodyFormat, TableCaptionFormat, TableCellFormat, TableCellInnerFormat, TableClipboard, TableColFormat, TableColgroupFormat, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuSelect, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableRowFormat, TableSelection, TableUp, TableVirtualScrollbar, TableWrapperFormat, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, isTableAlignRight, randomId, tableMenuTools, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|
|
1068
|
+
export { BlockOverride, ContainerFormat, ScrollOverride, Scrollbar, TableAlign, TableBodyFormat, TableCaptionFormat, TableCellFormat, TableCellInnerFormat, TableClipboard, TableColFormat, TableColgroupFormat, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuSelect, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableRowFormat, TableSelection, TableUp, TableVirtualScrollbar, TableWrapperFormat, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, getTableMainRect, isTableAlignRight, randomId, tableMenuTools, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|
|
1061
1069
|
export type { ClipboardOptions, Constructor, InternalModule, InternalTableMenuModule, InternalTableSelectionModule, Matcher, MenuTooltipInstance, QuillTheme, QuillThemePicker, RelactiveRect, SelectionData, Selector, SkipRowCount, TableCaptionValue, TableCellValue, TableColValue, TableConstantsData, TableCreatorTextOptions, TableMenuOptions, TableMenuOptionsInput$1 as TableMenuOptionsInput, TableMenuTexts, TableResizeScaleOptions, TableRowValue, TableSelectionOptions, TableTextOptions, TableUpOptions, TableValue, Tool, ToolOption, ToolOptionBreak, Writable, sizeChangeValue };
|