quill-table-up 3.0.2 → 3.1.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 CHANGED
@@ -63,11 +63,9 @@ const quill = new Quill('#editor', {
63
63
 
64
64
  ## Options
65
65
 
66
- ### TableUp Options
67
-
68
66
  **Full options usage see [demo](https://github.com/zzxming/quill-table-up/blob/master/docs/index.js#L38)**
69
67
 
70
- | attribute | description | type | default |
68
+ | Attribute | Description | Type | Default |
71
69
  | ------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------ |
72
70
  | full | if set `true`. width max will be 100% | `boolean` | `false` |
73
71
  | fullSwitch | enable to choose insert a full width table | `boolean` | `true` |
@@ -126,7 +124,7 @@ The table cell selection handler
126
124
 
127
125
  #### Options
128
126
 
129
- | attribute | description | type | default |
127
+ | Attribute | Description | Type | Default |
130
128
  | ----------- | --------------------- | -------- | --------- |
131
129
  | selectColor | selector border color | `string` | `#0589f3` |
132
130
 
@@ -142,7 +140,7 @@ The table operate menu
142
140
 
143
141
  #### Options
144
142
 
145
- | attribute | description | type | default |
143
+ | Attribute | Description | Type | Default |
146
144
  | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------------------- |
147
145
  | tipText | when `tableMenuClass` set `TableUp.TableMenuSelect`, display tip text when hover icon. when `tableMenuClass` set `TableUp.TableMenuContextmenu`, display tip text after icon | `boolean` | `true` |
148
146
  | localstorageKey | used color save localstorage key | `string` | `__table-bg-used-color` |
@@ -297,7 +295,7 @@ Equal scale table cell handler
297
295
 
298
296
  #### Options
299
297
 
300
- | attribute | description | type | default |
298
+ | Attribute | Description | Type | Default |
301
299
  | --------- | ------------------------ | -------- | ------- |
302
300
  | blockSize | resize handle block size | `number` | `12` |
303
301
 
@@ -366,7 +364,7 @@ class ScrollBlot extends ScrollOverride {
366
364
 
367
365
  ## Other
368
366
 
369
- ### Change internal constants variable
367
+ ### Change Internal Constants Variable
370
368
 
371
369
  If it's not necessary, you should import constants variable from `quill-table-up` directly but not edit it.
372
370
 
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
- removeCell: (e: KeyboardEvent) => void;
896
+ removeCellBySelectedTds(): void;
845
897
  setSelectedTds(tds: TableCellInnerFormat[]): void;
846
898
  getFirstTextNode(dom: HTMLElement | Node): Node;
847
899
  getLastTextNode(dom: HTMLElement | Node): Node;
@@ -1205,7 +1257,8 @@ declare class TableUp {
1205
1257
  removeCol(selectedTds: TableCellInnerFormat[]): void;
1206
1258
  mergeCells(selectedTds: TableCellInnerFormat[]): void;
1207
1259
  splitCell(selectedTds: TableCellInnerFormat[]): void;
1260
+ convertTableBodyByCells(tableBlot: TableMainFormat, selecteds: TableCellInnerFormat[], tag: TableBodyTag): void;
1208
1261
  }
1209
1262
  //#endregion
1210
- 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 };
1211
1264
  //# sourceMappingURL=index.d.ts.map