@atlaskit/editor-plugin-table 0.0.10 → 0.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/.eslintrc.js +35 -0
- package/CHANGELOG.md +31 -0
- package/commands/package.json +14 -0
- package/dist/cjs/plugins/table/commands/hover.js +4 -4
- package/dist/cjs/plugins/table/commands-with-analytics.js +59 -58
- package/dist/cjs/plugins/table/event-handlers.js +0 -1
- package/dist/cjs/plugins/table/index.js +54 -37
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +9 -1
- package/dist/cjs/plugins/table/toolbar.js +150 -22
- package/dist/cjs/plugins/table/transforms/fix-tables.js +7 -7
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +3 -5
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/cjs/plugins/table/utils/column-controls.js +0 -1
- package/dist/cjs/plugins/table/utils/decoration.js +53 -4
- package/dist/cjs/plugins/table/utils/dom.js +0 -2
- package/dist/cjs/plugins/table/utils/paste.js +0 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/hover.js +4 -4
- package/dist/es2019/plugins/table/commands-with-analytics.js +6 -9
- package/dist/es2019/plugins/table/event-handlers.js +1 -2
- package/dist/es2019/plugins/table/handlers.js +1 -2
- package/dist/es2019/plugins/table/index.js +23 -5
- package/dist/es2019/plugins/table/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +1 -3
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/index.js +2 -1
- package/dist/es2019/plugins/table/toolbar.js +133 -16
- package/dist/es2019/plugins/table/transforms/fix-tables.js +2 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +1 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +3 -3
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -2
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +3 -5
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/es2019/plugins/table/utils/column-controls.js +0 -1
- package/dist/es2019/plugins/table/utils/decoration.js +60 -25
- package/dist/es2019/plugins/table/utils/dom.js +0 -2
- package/dist/es2019/plugins/table/utils/paste.js +1 -2
- package/dist/es2019/plugins/table/utils/row-controls.js +1 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/hover.js +4 -4
- package/dist/esm/plugins/table/commands-with-analytics.js +56 -55
- package/dist/esm/plugins/table/event-handlers.js +1 -2
- package/dist/esm/plugins/table/handlers.js +1 -2
- package/dist/esm/plugins/table/index.js +55 -38
- package/dist/esm/plugins/table/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -3
- package/dist/esm/plugins/table/pm-plugins/table-resizing/index.js +2 -1
- package/dist/esm/plugins/table/toolbar.js +139 -17
- package/dist/esm/plugins/table/transforms/fix-tables.js +2 -4
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +1 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +3 -3
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -2
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +3 -5
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/esm/plugins/table/utils/column-controls.js +0 -1
- package/dist/esm/plugins/table/utils/decoration.js +50 -4
- package/dist/esm/plugins/table/utils/dom.js +0 -2
- package/dist/esm/plugins/table/utils/paste.js +1 -2
- package/dist/esm/plugins/table/utils/row-controls.js +1 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
- package/dist/types/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
- package/dist/types/plugins/table/toolbar.d.ts +2 -2
- package/dist/types/plugins/table/transforms/fix-tables.d.ts +1 -1
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/examples/99-testing.tsx +35 -30
- package/examples/config.jsonc +14 -0
- package/package.json +14 -19
- package/plugin-key/package.json +14 -0
- package/report.api.md +1 -1
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/auto-size-documents.ts +5 -10
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/basic-table.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/empty-paragraph-underneath-table.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/even-columns.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/layout-documents.ts +1 -2
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/merged-rows-and-cols-document.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/nested-in-extension.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/paragraph-and-table-adf.json +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/resize-documents.ts +5 -10
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/scale.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-inside-layout.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-min-width-columns-document.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-multiline-date.adf.json +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-text-and-empty-row.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/auto-size.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/change-date-inside-table.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/copy-button.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-columns.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-rows.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-table-when-selected.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/even-columns.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/layout.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/resize.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/scale.ts.snap +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/arrow-down-into-table.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/auto-size.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/block-node-selection.ts +1 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/cell-selection.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/change-date-inside-table.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/copy-button.ts +1 -1
- package/src/{plugins/table/__tests__ → __tests__}/integration/delete-columns.ts +2 -2
- package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-in-full-width.ts +1 -1
- package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-with-empty-action.ts +1 -1
- package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-row-with-empty-action.ts +1 -1
- package/src/{plugins/table/__tests__ → __tests__}/integration/delete-rows.ts +2 -2
- package/src/{plugins/table/__tests__ → __tests__}/integration/delete-table-when-selected.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/deleting-empty-paragraph-under-table.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/even-columns.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/insert-cell-header-with-strong-mark.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/insert-long-smart-link.ts +1 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/insert-row-inside-layout.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/layout.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/resize-handler.ts +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/integration/resize.ts +2 -3
- package/src/{plugins/table/__tests__ → __tests__}/integration/scale.ts +0 -0
- package/src/__tests__/integration/table-controls-selection.ts +71 -0
- package/src/__tests__/unit/analytics.ts +41 -41
- package/src/__tests__/unit/collab.ts +12 -9
- package/src/{plugins/table/__tests__ → __tests__}/unit/commands/go-to-next-cell.ts +4 -4
- package/src/{plugins/table/__tests__ → __tests__}/unit/commands/insert.ts +4 -4
- package/src/{plugins/table/__tests__ → __tests__}/unit/commands/misc.ts +12 -6
- package/src/__tests__/unit/commands/sort.ts +28 -28
- package/src/{plugins/table/__tests__ → __tests__}/unit/commands.ts +7 -7
- package/src/__tests__/unit/copy-button.ts +22 -0
- package/src/__tests__/unit/copy-paste.ts +6 -8
- package/src/__tests__/unit/event-handlers.ts +127 -11
- package/src/__tests__/unit/fix-tables.ts +17 -23
- package/src/{plugins/table/__tests__ → __tests__}/unit/get-toolbar-config.ts +8 -8
- package/src/__tests__/unit/hover-selection.ts +1 -66
- package/src/__tests__/unit/index-with-fake-timers.ts +1 -1
- package/src/__tests__/unit/index.ts +5 -5
- package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/OverflowShadowsObserver.ts +2 -2
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +181 -0
- package/src/__tests__/unit/nodeviews/cell.ts +12 -10
- package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/table.ts +29 -30
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-controls.ts +2 -2
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-resizing.ts +9 -6
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/plugin.ts +5 -5
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main-with-allow-collapse.ts +4 -4
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main.ts +6 -6
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +12 -9
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/sticky-headers/tableRow.tsx +27 -25
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-local-id.ts +3 -6
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/colgroup.ts +1 -1
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/event-handlers.ts +3 -3
- package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-selection-keymap.ts +3 -3
- package/src/{plugins/table/__tests__ → __tests__}/unit/toolbar.ts +23 -14
- package/src/__tests__/unit/ui/ContextualMenu.tsx +55 -0
- package/src/__tests__/unit/ui/CornerControls.tsx +7 -7
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +45 -49
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +49 -0
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +30 -2
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +143 -111
- package/src/__tests__/unit/ui/RowControls.tsx +112 -141
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +18 -15
- package/src/__tests__/unit/undo-redo.ts +10 -9
- package/src/{plugins/table/__tests__ → __tests__}/unit/utils/collapse.ts +2 -2
- package/src/{plugins/table/__tests__ → __tests__}/unit/utils/column-controls.ts +1 -1
- package/src/__tests__/unit/utils/nodes.ts +8 -4
- package/src/__tests__/unit/utils/row-controls.ts +8 -4
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/cell-options-menu.ts +2 -0
- package/src/__tests__/visual-regression/copy-button.ts +181 -0
- package/src/{plugins/table/__tests__ → __tests__}/visual-regression/index.ts +3 -1
- package/src/plugins/table/commands/clear.ts +30 -29
- package/src/plugins/table/commands/go-to-next-cell.ts +41 -38
- package/src/plugins/table/commands/hover.ts +4 -1
- package/src/plugins/table/commands/insert.ts +91 -91
- package/src/plugins/table/commands/misc.ts +123 -125
- package/src/plugins/table/commands/selection.ts +329 -319
- package/src/plugins/table/commands-with-analytics.ts +299 -290
- package/src/plugins/table/event-handlers.ts +111 -112
- package/src/plugins/table/handlers.ts +95 -95
- package/src/plugins/table/index.tsx +28 -2
- package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +4 -3
- package/src/plugins/table/nodeviews/TableComponent.tsx +6 -9
- package/src/plugins/table/nodeviews/update-overflow-shadows.ts +39 -39
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +7 -9
- package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +30 -30
- package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +7 -7
- package/src/plugins/table/pm-plugins/keymap.ts +1 -1
- package/src/plugins/table/pm-plugins/plugin-factory.ts +33 -33
- package/src/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.ts +6 -9
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +3 -2
- package/src/plugins/table/pm-plugins/table-local-id.ts +0 -2
- package/src/plugins/table/pm-plugins/table-resizing/commands.ts +98 -90
- package/src/plugins/table/pm-plugins/table-resizing/index.ts +1 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +46 -47
- package/src/plugins/table/{toolbar.ts → toolbar.tsx} +276 -101
- package/src/plugins/table/transforms/column-width.ts +143 -146
- package/src/plugins/table/transforms/delete-columns.ts +144 -142
- package/src/plugins/table/transforms/delete-rows.ts +110 -111
- package/src/plugins/table/transforms/fix-tables.ts +2 -3
- package/src/plugins/table/transforms/metadata.ts +9 -9
- package/src/plugins/table/ui/FloatingContextualButton/index.tsx +0 -1
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +20 -16
- package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +3 -3
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +2 -6
- package/src/plugins/table/ui/LayoutButton/index.tsx +4 -10
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +1 -0
- package/src/plugins/table/ui/common-styles.ts +1 -3
- package/src/plugins/table/utils/analytics.ts +24 -25
- package/src/plugins/table/utils/column-controls.ts +0 -1
- package/src/plugins/table/utils/decoration.ts +44 -5
- package/src/plugins/table/utils/dom.ts +3 -5
- package/src/plugins/table/utils/paste.ts +0 -1
- package/src/plugins/table/utils/row-controls.ts +92 -94
- package/types/package.json +5 -5
- package/ui/common-styles/package.json +14 -0
- package/ui/consts/package.json +14 -0
- package/dist/cjs/plugins/plugin-key.js +0 -17
- package/dist/cjs/plugins/table/todo-stubs.js +0 -10
- package/dist/cjs/types.js +0 -5
- package/dist/es2019/plugins/plugin-key.js +0 -3
- package/dist/es2019/plugins/table/todo-stubs.js +0 -1
- package/dist/es2019/types.js +0 -1
- package/dist/esm/plugins/plugin-key.js +0 -5
- package/dist/esm/plugins/table/todo-stubs.js +0 -1
- package/dist/esm/types.js +0 -1
- package/dist/types/plugins/plugin-key.d.ts +0 -4
- package/dist/types/plugins/table/todo-stubs.d.ts +0 -1
- package/dist/types/types.d.ts +0 -3
- package/dist/types-ts4.0/index.d.ts +0 -1
- package/dist/types-ts4.0/plugins/plugin-key.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/commands/clear.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/commands/collapse.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/commands/go-to-next-cell.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/commands/hover.d.ts +0 -8
- package/dist/types-ts4.0/plugins/table/commands/index.d.ts +0 -7
- package/dist/types-ts4.0/plugins/table/commands/insert.d.ts +0 -10
- package/dist/types-ts4.0/plugins/table/commands/misc.d.ts +0 -27
- package/dist/types-ts4.0/plugins/table/commands/selection.d.ts +0 -8
- package/dist/types-ts4.0/plugins/table/commands/sort.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/commands/split-cell.d.ts +0 -6
- package/dist/types-ts4.0/plugins/table/commands/toggle.d.ts +0 -12
- package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +0 -26
- package/dist/types-ts4.0/plugins/table/create-plugin-config.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/event-handlers.d.ts +0 -16
- package/dist/types-ts4.0/plugins/table/handlers.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/index.d.ts +0 -17
- package/dist/types-ts4.0/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +0 -26
- package/dist/types-ts4.0/plugins/table/nodeviews/TableComponent.d.ts +0 -72
- package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +0 -9
- package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +0 -9
- package/dist/types-ts4.0/plugins/table/nodeviews/table.d.ts +0 -31
- package/dist/types-ts4.0/plugins/table/nodeviews/tableCell.d.ts +0 -19
- package/dist/types-ts4.0/plugins/table/nodeviews/types.d.ts +0 -24
- package/dist/types-ts4.0/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -8
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/plugin.d.ts +0 -7
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/index.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/types.d.ts +0 -6
- package/dist/types-ts4.0/plugins/table/pm-plugins/default-table-selection.d.ts +0 -5
- package/dist/types-ts4.0/plugins/table/pm-plugins/keymap.d.ts +0 -5
- package/dist/types-ts4.0/plugins/table/pm-plugins/main.d.ts +0 -8
- package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-factory.d.ts +0 -1
- package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -15
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/commands.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -6
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -65
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/types.d.ts +0 -16
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/util.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-local-id.d.ts +0 -22
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/commands.d.ts +0 -25
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin.d.ts +0 -6
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/reducer.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +0 -8
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +0 -14
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +0 -13
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +0 -12
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +0 -22
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +0 -29
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -17
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +0 -22
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +0 -1
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-selection-keymap.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/reducer.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/todo-stubs.d.ts +0 -1
- package/dist/types-ts4.0/plugins/table/toolbar.d.ts +0 -36
- package/dist/types-ts4.0/plugins/table/transforms/column-width.d.ts +0 -18
- package/dist/types-ts4.0/plugins/table/transforms/delete-columns.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/transforms/delete-rows.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +0 -10
- package/dist/types-ts4.0/plugins/table/transforms/index.d.ts +0 -7
- package/dist/types-ts4.0/plugins/table/transforms/merge.d.ts +0 -5
- package/dist/types-ts4.0/plugins/table/transforms/metadata.d.ts +0 -21
- package/dist/types-ts4.0/plugins/table/transforms/replace-table.d.ts +0 -5
- package/dist/types-ts4.0/plugins/table/transforms/split.d.ts +0 -9
- package/dist/types-ts4.0/plugins/table/types.d.ts +0 -328
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/index.d.ts +0 -29
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/styles.d.ts +0 -1
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +0 -87
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/index.d.ts +0 -22
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/styles.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +0 -14
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +0 -10
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/index.d.ts +0 -54
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/types.d.ts +0 -1
- package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +0 -12
- package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +0 -3
- package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/index.d.ts +0 -35
- package/dist/types-ts4.0/plugins/table/ui/LayoutButton/index.d.ts +0 -21
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +0 -16
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +0 -21
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +0 -17
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/index.d.ts +0 -40
- package/dist/types-ts4.0/plugins/table/ui/common-styles.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/ui/consts.d.ts +0 -39
- package/dist/types-ts4.0/plugins/table/ui/messages.d.ts +0 -38
- package/dist/types-ts4.0/plugins/table/ui/ui-styles.d.ts +0 -15
- package/dist/types-ts4.0/plugins/table/utils/analytics.d.ts +0 -18
- package/dist/types-ts4.0/plugins/table/utils/collapse.d.ts +0 -29
- package/dist/types-ts4.0/plugins/table/utils/column-controls.d.ts +0 -10
- package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +0 -16
- package/dist/types-ts4.0/plugins/table/utils/dom.d.ts +0 -20
- package/dist/types-ts4.0/plugins/table/utils/get-allow-add-column-custom-step.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/utils/index.d.ts +0 -11
- package/dist/types-ts4.0/plugins/table/utils/nodes.d.ts +0 -12
- package/dist/types-ts4.0/plugins/table/utils/paste.d.ts +0 -14
- package/dist/types-ts4.0/plugins/table/utils/referentiality.d.ts +0 -2
- package/dist/types-ts4.0/plugins/table/utils/row-controls.d.ts +0 -16
- package/dist/types-ts4.0/plugins/table/utils/selection.d.ts +0 -6
- package/dist/types-ts4.0/plugins/table/utils/table.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table/utils/update-plugin-state-decorations.d.ts +0 -4
- package/dist/types-ts4.0/plugins/table-plugin.d.ts +0 -2
- package/dist/types-ts4.0/types.d.ts +0 -3
- package/src/plugins/plugin-key.ts +0 -7
- package/src/plugins/table/__tests__/integration/table-controls-selection.ts +0 -70
- package/src/plugins/table/__tests__/unit/event-handlers.ts +0 -130
- package/src/plugins/table/__tests__/unit/nodeviews/TableComponent.tsx +0 -388
- package/src/plugins/table/todo-stubs.ts +0 -1
- package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +0 -55
- package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +0 -49
- package/src/types.ts +0 -3
- package/tmp/api-report-tmp.d.ts +0 -91
|
@@ -62,276 +62,285 @@ const TABLE_BREAKOUT_NAME_MAPPING = {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
// #region Analytics wrappers
|
|
65
|
-
export const emptyMultipleCellsWithAnalytics =
|
|
66
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
) =>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
horizontalCells,
|
|
77
|
-
verticalCells,
|
|
78
|
-
totalRowCount,
|
|
79
|
-
totalColumnCount,
|
|
80
|
-
} = getSelectedCellInfo(selection);
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
action: TABLE_ACTION.CLEARED,
|
|
84
|
-
actionSubject: ACTION_SUBJECT.TABLE,
|
|
85
|
-
actionSubjectId: null,
|
|
86
|
-
attributes: {
|
|
87
|
-
inputMethod,
|
|
65
|
+
export const emptyMultipleCellsWithAnalytics =
|
|
66
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
67
|
+
(
|
|
68
|
+
inputMethod:
|
|
69
|
+
| INPUT_METHOD.CONTEXT_MENU
|
|
70
|
+
| INPUT_METHOD.KEYBOARD
|
|
71
|
+
| INPUT_METHOD.FLOATING_TB,
|
|
72
|
+
targetCellPosition?: number,
|
|
73
|
+
) =>
|
|
74
|
+
withEditorAnalyticsAPI(({ selection }) => {
|
|
75
|
+
const {
|
|
88
76
|
horizontalCells,
|
|
89
77
|
verticalCells,
|
|
90
78
|
totalRowCount,
|
|
91
79
|
totalColumnCount,
|
|
92
|
-
}
|
|
93
|
-
eventType: EVENT_TYPE.TRACK,
|
|
94
|
-
};
|
|
95
|
-
})(editorAnalyticsAPI)(clearMultipleCells(targetCellPosition));
|
|
80
|
+
} = getSelectedCellInfo(selection);
|
|
96
81
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
82
|
+
return {
|
|
83
|
+
action: TABLE_ACTION.CLEARED,
|
|
84
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
85
|
+
actionSubjectId: null,
|
|
86
|
+
attributes: {
|
|
87
|
+
inputMethod,
|
|
88
|
+
horizontalCells,
|
|
89
|
+
verticalCells,
|
|
90
|
+
totalRowCount,
|
|
91
|
+
totalColumnCount,
|
|
92
|
+
},
|
|
93
|
+
eventType: EVENT_TYPE.TRACK,
|
|
94
|
+
};
|
|
95
|
+
})(editorAnalyticsAPI)(clearMultipleCells(targetCellPosition));
|
|
108
96
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
inputMethod: INPUT_METHOD.CONTEXT_MENU, // TODO: merge with floating toolbar once command is updated
|
|
97
|
+
export const mergeCellsWithAnalytics =
|
|
98
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined) =>
|
|
99
|
+
(inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
|
|
100
|
+
withEditorAnalyticsAPI(({ selection }) => {
|
|
101
|
+
const {
|
|
115
102
|
horizontalCells,
|
|
116
103
|
verticalCells,
|
|
117
104
|
totalCells,
|
|
118
105
|
totalRowCount,
|
|
119
106
|
totalColumnCount,
|
|
120
|
-
}
|
|
121
|
-
eventType: EVENT_TYPE.TRACK,
|
|
122
|
-
};
|
|
123
|
-
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
124
|
-
if (dispatch) {
|
|
125
|
-
dispatch(mergeCells(state.tr));
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
export const splitCellWithAnalytics = (
|
|
131
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
132
|
-
) =>
|
|
133
|
-
withEditorAnalyticsAPI(({ selection }) => {
|
|
134
|
-
const { totalRowCount, totalColumnCount } = getSelectedCellInfo(selection);
|
|
135
|
-
const cell = findCellClosestToPos(selection.$anchor);
|
|
136
|
-
if (cell) {
|
|
137
|
-
const {
|
|
138
|
-
rowspan: verticalCells,
|
|
139
|
-
colspan: horizontalCells,
|
|
140
|
-
} = cell.node.attrs;
|
|
107
|
+
} = getSelectedCellInfo(selection);
|
|
141
108
|
|
|
142
109
|
return {
|
|
143
|
-
action: TABLE_ACTION.
|
|
110
|
+
action: TABLE_ACTION.MERGED,
|
|
144
111
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
145
112
|
actionSubjectId: null,
|
|
146
113
|
attributes: {
|
|
147
|
-
inputMethod
|
|
114
|
+
inputMethod,
|
|
148
115
|
horizontalCells,
|
|
149
116
|
verticalCells,
|
|
150
|
-
totalCells
|
|
117
|
+
totalCells,
|
|
151
118
|
totalRowCount,
|
|
152
119
|
totalColumnCount,
|
|
153
120
|
},
|
|
154
121
|
eventType: EVENT_TYPE.TRACK,
|
|
155
122
|
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
123
|
+
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
124
|
+
if (dispatch) {
|
|
125
|
+
dispatch(mergeCells(state.tr));
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const splitCellWithAnalytics =
|
|
131
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
132
|
+
(inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
|
|
133
|
+
withEditorAnalyticsAPI(({ selection }) => {
|
|
134
|
+
const { totalRowCount, totalColumnCount } =
|
|
135
|
+
getSelectedCellInfo(selection);
|
|
136
|
+
const cell = findCellClosestToPos(selection.$anchor);
|
|
137
|
+
if (cell) {
|
|
138
|
+
const { rowspan: verticalCells, colspan: horizontalCells } =
|
|
139
|
+
cell.node.attrs;
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
action: TABLE_ACTION.SPLIT,
|
|
143
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
144
|
+
actionSubjectId: null,
|
|
145
|
+
attributes: {
|
|
146
|
+
inputMethod,
|
|
147
|
+
horizontalCells,
|
|
148
|
+
verticalCells,
|
|
149
|
+
totalCells: horizontalCells * verticalCells,
|
|
150
|
+
totalRowCount,
|
|
151
|
+
totalColumnCount,
|
|
152
|
+
},
|
|
153
|
+
eventType: EVENT_TYPE.TRACK,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
})(editorAnalyticsAPI)(splitCell);
|
|
158
|
+
|
|
159
|
+
export const setColorWithAnalytics =
|
|
160
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
161
|
+
(
|
|
162
|
+
inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
|
|
163
|
+
cellColor: string,
|
|
164
|
+
targetCellPosition?: number,
|
|
165
|
+
) =>
|
|
166
|
+
withEditorAnalyticsAPI(({ selection }) => {
|
|
167
|
+
const {
|
|
181
168
|
horizontalCells,
|
|
182
169
|
verticalCells,
|
|
183
170
|
totalCells,
|
|
184
171
|
totalRowCount,
|
|
185
172
|
totalColumnCount,
|
|
186
|
-
}
|
|
187
|
-
eventType: EVENT_TYPE.TRACK,
|
|
188
|
-
};
|
|
189
|
-
})(editorAnalyticsAPI)(
|
|
190
|
-
setMultipleCellAttrs({ background: cellColor }, targetCellPosition),
|
|
191
|
-
);
|
|
173
|
+
} = getSelectedCellInfo(selection);
|
|
192
174
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
moveCursorToInsertedRow: false,
|
|
214
|
-
})(state, dispatch);
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
export const insertRowWithAnalytics = (
|
|
218
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
219
|
-
) => (inputMethod: InsertRowMethods, options: InsertRowOptions) =>
|
|
220
|
-
withEditorAnalyticsAPI((state) => {
|
|
221
|
-
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
222
|
-
state.selection,
|
|
175
|
+
return {
|
|
176
|
+
action: TABLE_ACTION.COLORED,
|
|
177
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
178
|
+
actionSubjectId: null,
|
|
179
|
+
attributes: {
|
|
180
|
+
inputMethod,
|
|
181
|
+
cellColor: (
|
|
182
|
+
tableBackgroundColorPalette.get(cellColor.toLowerCase()) ||
|
|
183
|
+
cellColor
|
|
184
|
+
).toLowerCase(),
|
|
185
|
+
horizontalCells,
|
|
186
|
+
verticalCells,
|
|
187
|
+
totalCells,
|
|
188
|
+
totalRowCount,
|
|
189
|
+
totalColumnCount,
|
|
190
|
+
},
|
|
191
|
+
eventType: EVENT_TYPE.TRACK,
|
|
192
|
+
};
|
|
193
|
+
})(editorAnalyticsAPI)(
|
|
194
|
+
setMultipleCellAttrs({ background: cellColor }, targetCellPosition),
|
|
223
195
|
);
|
|
224
|
-
return {
|
|
225
|
-
action: TABLE_ACTION.ADDED_ROW,
|
|
226
|
-
actionSubject: ACTION_SUBJECT.TABLE,
|
|
227
|
-
actionSubjectId: null,
|
|
228
|
-
attributes: {
|
|
229
|
-
inputMethod,
|
|
230
|
-
position: options.index,
|
|
231
|
-
totalRowCount,
|
|
232
|
-
totalColumnCount,
|
|
233
|
-
},
|
|
234
|
-
eventType: EVENT_TYPE.TRACK,
|
|
235
|
-
};
|
|
236
|
-
})(editorAnalyticsAPI)(
|
|
237
|
-
insertRow(options.index, options.moveCursorToInsertedRow),
|
|
238
|
-
);
|
|
239
196
|
|
|
240
|
-
export const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
) =>
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
)
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
state.selection,
|
|
254
|
-
);
|
|
255
|
-
return {
|
|
256
|
-
action: TABLE_ACTION.ADDED_COLUMN,
|
|
257
|
-
actionSubject: ACTION_SUBJECT.TABLE,
|
|
258
|
-
actionSubjectId: null,
|
|
259
|
-
attributes: {
|
|
260
|
-
inputMethod,
|
|
261
|
-
position,
|
|
262
|
-
totalRowCount,
|
|
263
|
-
totalColumnCount,
|
|
264
|
-
},
|
|
265
|
-
eventType: EVENT_TYPE.TRACK,
|
|
266
|
-
};
|
|
267
|
-
})(editorAnalyticsAPI)(insertColumn(getEditorContainerWidth)(position));
|
|
197
|
+
export const addRowAroundSelection =
|
|
198
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
199
|
+
(side: RowInsertPosition): Command =>
|
|
200
|
+
(state, dispatch) => {
|
|
201
|
+
const { selection } = state;
|
|
202
|
+
const isCellSelection = selection instanceof CellSelection;
|
|
203
|
+
const rect = isCellSelection
|
|
204
|
+
? getSelectionRect(selection)
|
|
205
|
+
: findCellRectClosestToPos(selection.$from);
|
|
206
|
+
|
|
207
|
+
if (!rect) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
268
210
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
) => (
|
|
272
|
-
inputMethod:
|
|
273
|
-
| INPUT_METHOD.CONTEXT_MENU
|
|
274
|
-
| INPUT_METHOD.BUTTON
|
|
275
|
-
| INPUT_METHOD.FLOATING_TB,
|
|
276
|
-
rect: Rect,
|
|
277
|
-
isHeaderRowRequired: boolean,
|
|
278
|
-
) =>
|
|
279
|
-
withEditorAnalyticsAPI(({ selection }) => {
|
|
280
|
-
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(selection);
|
|
211
|
+
const position =
|
|
212
|
+
isCellSelection && side === 'TOP' ? rect.top : rect.bottom - 1;
|
|
281
213
|
|
|
282
|
-
|
|
283
|
-
action: TABLE_ACTION.DELETED_ROW,
|
|
284
|
-
actionSubject: ACTION_SUBJECT.TABLE,
|
|
285
|
-
actionSubjectId: null,
|
|
286
|
-
attributes: {
|
|
287
|
-
inputMethod,
|
|
288
|
-
position: rect.top,
|
|
289
|
-
count: rect.bottom - rect.top,
|
|
290
|
-
totalRowCount,
|
|
291
|
-
totalColumnCount,
|
|
292
|
-
},
|
|
293
|
-
eventType: EVENT_TYPE.TRACK,
|
|
294
|
-
};
|
|
295
|
-
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
296
|
-
if (dispatch) {
|
|
297
|
-
dispatch(deleteRows(rect, isHeaderRowRequired)(state.tr));
|
|
298
|
-
}
|
|
299
|
-
return true;
|
|
300
|
-
});
|
|
214
|
+
const offset = side === 'BOTTOM' ? 1 : 0;
|
|
301
215
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
| INPUT_METHOD.BUTTON
|
|
308
|
-
| INPUT_METHOD.FLOATING_TB,
|
|
309
|
-
rect: Rect,
|
|
310
|
-
) =>
|
|
311
|
-
withEditorAnalyticsAPI(({ selection }) => {
|
|
312
|
-
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(selection);
|
|
216
|
+
return insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, {
|
|
217
|
+
index: position + offset,
|
|
218
|
+
moveCursorToInsertedRow: false,
|
|
219
|
+
})(state, dispatch);
|
|
220
|
+
};
|
|
313
221
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
position: rect.left,
|
|
321
|
-
count: rect.right - rect.left,
|
|
322
|
-
totalRowCount,
|
|
323
|
-
totalColumnCount,
|
|
324
|
-
},
|
|
325
|
-
eventType: EVENT_TYPE.TRACK,
|
|
326
|
-
};
|
|
327
|
-
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
328
|
-
if (dispatch) {
|
|
329
|
-
dispatch(
|
|
330
|
-
deleteColumns(rect, getAllowAddColumnCustomStep(state))(state.tr),
|
|
222
|
+
export const insertRowWithAnalytics =
|
|
223
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
224
|
+
(inputMethod: InsertRowMethods, options: InsertRowOptions) =>
|
|
225
|
+
withEditorAnalyticsAPI((state) => {
|
|
226
|
+
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
227
|
+
state.selection,
|
|
331
228
|
);
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
229
|
+
return {
|
|
230
|
+
action: TABLE_ACTION.ADDED_ROW,
|
|
231
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
232
|
+
actionSubjectId: null,
|
|
233
|
+
attributes: {
|
|
234
|
+
inputMethod,
|
|
235
|
+
position: options.index,
|
|
236
|
+
totalRowCount,
|
|
237
|
+
totalColumnCount,
|
|
238
|
+
},
|
|
239
|
+
eventType: EVENT_TYPE.TRACK,
|
|
240
|
+
};
|
|
241
|
+
})(editorAnalyticsAPI)(
|
|
242
|
+
insertRow(options.index, options.moveCursorToInsertedRow),
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
export const insertColumnWithAnalytics =
|
|
246
|
+
(
|
|
247
|
+
getEditorContainerWidth: GetEditorContainerWidth,
|
|
248
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
249
|
+
) =>
|
|
250
|
+
(
|
|
251
|
+
inputMethod:
|
|
252
|
+
| INPUT_METHOD.CONTEXT_MENU
|
|
253
|
+
| INPUT_METHOD.BUTTON
|
|
254
|
+
| INPUT_METHOD.SHORTCUT
|
|
255
|
+
| INPUT_METHOD.FLOATING_TB,
|
|
256
|
+
position: number,
|
|
257
|
+
) =>
|
|
258
|
+
withEditorAnalyticsAPI((state) => {
|
|
259
|
+
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
260
|
+
state.selection,
|
|
261
|
+
);
|
|
262
|
+
return {
|
|
263
|
+
action: TABLE_ACTION.ADDED_COLUMN,
|
|
264
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
265
|
+
actionSubjectId: null,
|
|
266
|
+
attributes: {
|
|
267
|
+
inputMethod,
|
|
268
|
+
position,
|
|
269
|
+
totalRowCount,
|
|
270
|
+
totalColumnCount,
|
|
271
|
+
},
|
|
272
|
+
eventType: EVENT_TYPE.TRACK,
|
|
273
|
+
};
|
|
274
|
+
})(editorAnalyticsAPI)(insertColumn(getEditorContainerWidth)(position));
|
|
275
|
+
|
|
276
|
+
export const deleteRowsWithAnalytics =
|
|
277
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
278
|
+
(
|
|
279
|
+
inputMethod:
|
|
280
|
+
| INPUT_METHOD.CONTEXT_MENU
|
|
281
|
+
| INPUT_METHOD.BUTTON
|
|
282
|
+
| INPUT_METHOD.FLOATING_TB,
|
|
283
|
+
rect: Rect,
|
|
284
|
+
isHeaderRowRequired: boolean,
|
|
285
|
+
) =>
|
|
286
|
+
withEditorAnalyticsAPI(({ selection }) => {
|
|
287
|
+
const { totalRowCount, totalColumnCount } =
|
|
288
|
+
getSelectedTableInfo(selection);
|
|
289
|
+
|
|
290
|
+
return {
|
|
291
|
+
action: TABLE_ACTION.DELETED_ROW,
|
|
292
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
293
|
+
actionSubjectId: null,
|
|
294
|
+
attributes: {
|
|
295
|
+
inputMethod,
|
|
296
|
+
position: rect.top,
|
|
297
|
+
count: rect.bottom - rect.top,
|
|
298
|
+
totalRowCount,
|
|
299
|
+
totalColumnCount,
|
|
300
|
+
},
|
|
301
|
+
eventType: EVENT_TYPE.TRACK,
|
|
302
|
+
};
|
|
303
|
+
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
304
|
+
if (dispatch) {
|
|
305
|
+
dispatch(deleteRows(rect, isHeaderRowRequired)(state.tr));
|
|
306
|
+
}
|
|
307
|
+
return true;
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
export const deleteColumnsWithAnalytics =
|
|
311
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
312
|
+
(
|
|
313
|
+
inputMethod:
|
|
314
|
+
| INPUT_METHOD.CONTEXT_MENU
|
|
315
|
+
| INPUT_METHOD.BUTTON
|
|
316
|
+
| INPUT_METHOD.FLOATING_TB,
|
|
317
|
+
rect: Rect,
|
|
318
|
+
) =>
|
|
319
|
+
withEditorAnalyticsAPI(({ selection }) => {
|
|
320
|
+
const { totalRowCount, totalColumnCount } =
|
|
321
|
+
getSelectedTableInfo(selection);
|
|
322
|
+
|
|
323
|
+
return {
|
|
324
|
+
action: TABLE_ACTION.DELETED_COLUMN,
|
|
325
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
326
|
+
actionSubjectId: null,
|
|
327
|
+
attributes: {
|
|
328
|
+
inputMethod,
|
|
329
|
+
position: rect.left,
|
|
330
|
+
count: rect.right - rect.left,
|
|
331
|
+
totalRowCount,
|
|
332
|
+
totalColumnCount,
|
|
333
|
+
},
|
|
334
|
+
eventType: EVENT_TYPE.TRACK,
|
|
335
|
+
};
|
|
336
|
+
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
337
|
+
if (dispatch) {
|
|
338
|
+
dispatch(
|
|
339
|
+
deleteColumns(rect, getAllowAddColumnCustomStep(state))(state.tr),
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
return true;
|
|
343
|
+
});
|
|
335
344
|
|
|
336
345
|
const getTableDeletedAnalytics = (
|
|
337
346
|
selection: Selection,
|
|
@@ -357,12 +366,12 @@ export const deleteTableWithAnalytics = (
|
|
|
357
366
|
getTableDeletedAnalytics(selection, INPUT_METHOD.FLOATING_TB),
|
|
358
367
|
)(editorAnalyticsAPI)(deleteTable);
|
|
359
368
|
|
|
360
|
-
export const deleteTableIfSelectedWithAnalytics =
|
|
361
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
369
|
+
export const deleteTableIfSelectedWithAnalytics =
|
|
370
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
371
|
+
(inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD) =>
|
|
372
|
+
withEditorAnalyticsAPI(({ selection }) =>
|
|
373
|
+
getTableDeletedAnalytics(selection, inputMethod),
|
|
374
|
+
)(editorAnalyticsAPI)(deleteTableIfSelected);
|
|
366
375
|
|
|
367
376
|
export const toggleHeaderRowWithAnalytics = (
|
|
368
377
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
@@ -454,56 +463,56 @@ export const toggleTableLayoutWithAnalytics = (
|
|
|
454
463
|
return;
|
|
455
464
|
})(editorAnalyticsAPI)(toggleTableLayout);
|
|
456
465
|
|
|
457
|
-
export const sortColumnWithAnalytics =
|
|
458
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
) =>
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
export const distributeColumnsWidthsWithAnalytics =
|
|
484
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
) => {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
};
|
|
466
|
+
export const sortColumnWithAnalytics =
|
|
467
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
468
|
+
(
|
|
469
|
+
inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
|
|
470
|
+
columnIndex: number,
|
|
471
|
+
sortOrder: SortOrder,
|
|
472
|
+
) =>
|
|
473
|
+
withEditorAnalyticsAPI((state) => {
|
|
474
|
+
const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
475
|
+
state.selection,
|
|
476
|
+
);
|
|
477
|
+
return {
|
|
478
|
+
action: TABLE_ACTION.SORTED_COLUMN,
|
|
479
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
480
|
+
attributes: {
|
|
481
|
+
inputMethod,
|
|
482
|
+
totalRowCount,
|
|
483
|
+
totalColumnCount,
|
|
484
|
+
position: columnIndex,
|
|
485
|
+
sortOrder,
|
|
486
|
+
mode: 'editor',
|
|
487
|
+
},
|
|
488
|
+
eventType: EVENT_TYPE.TRACK,
|
|
489
|
+
};
|
|
490
|
+
})(editorAnalyticsAPI)(sortByColumn(columnIndex, sortOrder));
|
|
491
|
+
|
|
492
|
+
export const distributeColumnsWidthsWithAnalytics =
|
|
493
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
494
|
+
(
|
|
495
|
+
inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
|
|
496
|
+
{ resizeState, table, attributes }: ResizeStateWithAnalytics,
|
|
497
|
+
) => {
|
|
498
|
+
return withEditorAnalyticsAPI(() => {
|
|
499
|
+
return {
|
|
500
|
+
action: TABLE_ACTION.DISTRIBUTED_COLUMNS_WIDTHS,
|
|
501
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
502
|
+
actionSubjectId: null,
|
|
503
|
+
attributes: {
|
|
504
|
+
inputMethod,
|
|
505
|
+
...attributes,
|
|
506
|
+
},
|
|
507
|
+
eventType: EVENT_TYPE.TRACK,
|
|
508
|
+
};
|
|
509
|
+
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
510
|
+
if (dispatch) {
|
|
511
|
+
distributeColumnsWidths(resizeState, table)(state, dispatch);
|
|
512
|
+
}
|
|
513
|
+
return true;
|
|
514
|
+
});
|
|
515
|
+
};
|
|
507
516
|
|
|
508
517
|
export const wrapTableInExpandWithAnalytics = (
|
|
509
518
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|