@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
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
it.skip('TODO: restore vr `packages/editor/editor-plugin-table/src/plugins/table/__tests__/visual-regression/copy-button.ts`', () => {});
|
|
4
|
+
|
|
5
|
+
// import { _getCopyButtonTestSuite } from '../../../copy-button/__tests__/visual-regression/_getCopyButtonTestSuite';
|
|
6
|
+
|
|
7
|
+
// _getCopyButtonTestSuite({
|
|
8
|
+
// nodeName: 'Table',
|
|
9
|
+
// editorOptions: {
|
|
10
|
+
// allowTables: {
|
|
11
|
+
// advanced: true,
|
|
12
|
+
// },
|
|
13
|
+
// defaultValue: {
|
|
14
|
+
// version: 1,
|
|
15
|
+
// type: 'doc',
|
|
16
|
+
// content: [
|
|
17
|
+
// {
|
|
18
|
+
// type: 'table',
|
|
19
|
+
// attrs: {
|
|
20
|
+
// isNumberColumnEnabled: false,
|
|
21
|
+
// layout: 'default',
|
|
22
|
+
// localId: '15804638-b946-4591-b64c-beffe5122733',
|
|
23
|
+
// },
|
|
24
|
+
// content: [
|
|
25
|
+
// {
|
|
26
|
+
// type: 'tableRow',
|
|
27
|
+
// content: [
|
|
28
|
+
// {
|
|
29
|
+
// type: 'tableHeader',
|
|
30
|
+
// attrs: {},
|
|
31
|
+
// content: [
|
|
32
|
+
// {
|
|
33
|
+
// type: 'paragraph',
|
|
34
|
+
// content: [
|
|
35
|
+
// {
|
|
36
|
+
// type: 'text',
|
|
37
|
+
// text: '1',
|
|
38
|
+
// },
|
|
39
|
+
// ],
|
|
40
|
+
// },
|
|
41
|
+
// ],
|
|
42
|
+
// },
|
|
43
|
+
// {
|
|
44
|
+
// type: 'tableHeader',
|
|
45
|
+
// attrs: {},
|
|
46
|
+
// content: [
|
|
47
|
+
// {
|
|
48
|
+
// type: 'paragraph',
|
|
49
|
+
// content: [
|
|
50
|
+
// {
|
|
51
|
+
// type: 'text',
|
|
52
|
+
// text: '2',
|
|
53
|
+
// },
|
|
54
|
+
// ],
|
|
55
|
+
// },
|
|
56
|
+
// ],
|
|
57
|
+
// },
|
|
58
|
+
// {
|
|
59
|
+
// type: 'tableHeader',
|
|
60
|
+
// attrs: {},
|
|
61
|
+
// content: [
|
|
62
|
+
// {
|
|
63
|
+
// type: 'paragraph',
|
|
64
|
+
// content: [
|
|
65
|
+
// {
|
|
66
|
+
// type: 'text',
|
|
67
|
+
// text: '3',
|
|
68
|
+
// },
|
|
69
|
+
// ],
|
|
70
|
+
// },
|
|
71
|
+
// ],
|
|
72
|
+
// },
|
|
73
|
+
// ],
|
|
74
|
+
// },
|
|
75
|
+
// {
|
|
76
|
+
// type: 'tableRow',
|
|
77
|
+
// content: [
|
|
78
|
+
// {
|
|
79
|
+
// type: 'tableCell',
|
|
80
|
+
// attrs: {},
|
|
81
|
+
// content: [
|
|
82
|
+
// {
|
|
83
|
+
// type: 'paragraph',
|
|
84
|
+
// content: [
|
|
85
|
+
// {
|
|
86
|
+
// type: 'text',
|
|
87
|
+
// text: '4',
|
|
88
|
+
// },
|
|
89
|
+
// ],
|
|
90
|
+
// },
|
|
91
|
+
// ],
|
|
92
|
+
// },
|
|
93
|
+
// {
|
|
94
|
+
// type: 'tableCell',
|
|
95
|
+
// attrs: {},
|
|
96
|
+
// content: [
|
|
97
|
+
// {
|
|
98
|
+
// type: 'paragraph',
|
|
99
|
+
// content: [
|
|
100
|
+
// {
|
|
101
|
+
// type: 'text',
|
|
102
|
+
// text: '5',
|
|
103
|
+
// },
|
|
104
|
+
// ],
|
|
105
|
+
// },
|
|
106
|
+
// ],
|
|
107
|
+
// },
|
|
108
|
+
// {
|
|
109
|
+
// type: 'tableCell',
|
|
110
|
+
// attrs: {},
|
|
111
|
+
// content: [
|
|
112
|
+
// {
|
|
113
|
+
// type: 'paragraph',
|
|
114
|
+
// content: [
|
|
115
|
+
// {
|
|
116
|
+
// type: 'text',
|
|
117
|
+
// text: '6',
|
|
118
|
+
// },
|
|
119
|
+
// ],
|
|
120
|
+
// },
|
|
121
|
+
// ],
|
|
122
|
+
// },
|
|
123
|
+
// ],
|
|
124
|
+
// },
|
|
125
|
+
// {
|
|
126
|
+
// type: 'tableRow',
|
|
127
|
+
// content: [
|
|
128
|
+
// {
|
|
129
|
+
// type: 'tableCell',
|
|
130
|
+
// attrs: {},
|
|
131
|
+
// content: [
|
|
132
|
+
// {
|
|
133
|
+
// type: 'paragraph',
|
|
134
|
+
// content: [
|
|
135
|
+
// {
|
|
136
|
+
// type: 'text',
|
|
137
|
+
// text: '7',
|
|
138
|
+
// },
|
|
139
|
+
// ],
|
|
140
|
+
// },
|
|
141
|
+
// ],
|
|
142
|
+
// },
|
|
143
|
+
// {
|
|
144
|
+
// type: 'tableCell',
|
|
145
|
+
// attrs: {},
|
|
146
|
+
// content: [
|
|
147
|
+
// {
|
|
148
|
+
// type: 'paragraph',
|
|
149
|
+
// content: [
|
|
150
|
+
// {
|
|
151
|
+
// type: 'text',
|
|
152
|
+
// text: '8',
|
|
153
|
+
// },
|
|
154
|
+
// ],
|
|
155
|
+
// },
|
|
156
|
+
// ],
|
|
157
|
+
// },
|
|
158
|
+
// {
|
|
159
|
+
// type: 'tableCell',
|
|
160
|
+
// attrs: {},
|
|
161
|
+
// content: [
|
|
162
|
+
// {
|
|
163
|
+
// type: 'paragraph',
|
|
164
|
+
// content: [
|
|
165
|
+
// {
|
|
166
|
+
// type: 'text',
|
|
167
|
+
// text: '9',
|
|
168
|
+
// },
|
|
169
|
+
// ],
|
|
170
|
+
// },
|
|
171
|
+
// ],
|
|
172
|
+
// },
|
|
173
|
+
// ],
|
|
174
|
+
// },
|
|
175
|
+
// ],
|
|
176
|
+
// },
|
|
177
|
+
// ],
|
|
178
|
+
// },
|
|
179
|
+
// },
|
|
180
|
+
// nodeSelector: '.pm-table-cell-content-wrap',
|
|
181
|
+
// });
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
1
3
|
// import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
|
|
4
|
+
// import { Device } from '@atlaskit/editor-test-helpers/vr-utils/device-viewport';
|
|
2
5
|
// import {
|
|
3
6
|
// snapshot,
|
|
4
7
|
// initFullPageEditorWithAdf,
|
|
5
|
-
// Device,
|
|
6
8
|
// } from '../../../../__tests__/visual-regression/_utils';
|
|
7
9
|
// import tableWith100ListItemsADF from './__fixtures__/table-with-100-numbered-list-items.json';
|
|
8
10
|
// import {
|
|
@@ -11,39 +11,40 @@ import { Command } from '@atlaskit/editor-common/types';
|
|
|
11
11
|
// #endregion
|
|
12
12
|
|
|
13
13
|
// #region Commands
|
|
14
|
-
export const clearMultipleCells =
|
|
15
|
-
|
|
16
|
-
dispatch
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let { tr } = state;
|
|
14
|
+
export const clearMultipleCells =
|
|
15
|
+
(targetCellPosition?: number): Command =>
|
|
16
|
+
(state, dispatch) => {
|
|
17
|
+
let cursorPos: number | undefined;
|
|
18
|
+
let { tr } = state;
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const $pos = tr.doc.resolve(tr.mapping.map(cursorPos));
|
|
35
|
-
const textSelection = Selection.findFrom($pos, 1, true);
|
|
36
|
-
if (textSelection) {
|
|
37
|
-
tr.setSelection(textSelection);
|
|
20
|
+
if (isSelectionType(tr.selection, 'cell')) {
|
|
21
|
+
const selection = tr.selection as any as CellSelection;
|
|
22
|
+
selection.forEachCell((_node, pos) => {
|
|
23
|
+
const $pos = tr.doc.resolve(tr.mapping.map(pos + 1));
|
|
24
|
+
tr = emptyCell(findCellClosestToPos($pos)!, state.schema)(tr);
|
|
25
|
+
});
|
|
26
|
+
cursorPos = selection.$headCell.pos;
|
|
27
|
+
} else if (targetCellPosition) {
|
|
28
|
+
const cell = findCellClosestToPos(
|
|
29
|
+
tr.doc.resolve(targetCellPosition + 1),
|
|
30
|
+
)!;
|
|
31
|
+
tr = emptyCell(cell, state.schema)(tr);
|
|
32
|
+
cursorPos = cell.pos;
|
|
38
33
|
}
|
|
34
|
+
if (tr.docChanged && cursorPos) {
|
|
35
|
+
const $pos = tr.doc.resolve(tr.mapping.map(cursorPos));
|
|
36
|
+
const textSelection = Selection.findFrom($pos, 1, true);
|
|
37
|
+
if (textSelection) {
|
|
38
|
+
tr.setSelection(textSelection);
|
|
39
|
+
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
if (dispatch) {
|
|
42
|
+
dispatch(tr);
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
42
45
|
}
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
|
-
};
|
|
46
|
+
return false;
|
|
47
|
+
};
|
|
47
48
|
|
|
48
49
|
export const clearSelection: Command = (state, dispatch) => {
|
|
49
50
|
if (dispatch) {
|
|
@@ -15,42 +15,45 @@ import { insertRowWithAnalytics } from '../commands-with-analytics';
|
|
|
15
15
|
const TAB_FORWARD_DIRECTION = 1;
|
|
16
16
|
const TAB_BACKWARD_DIRECTION = -1;
|
|
17
17
|
|
|
18
|
-
export const goToNextCell =
|
|
19
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
export const goToNextCell =
|
|
19
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
20
|
+
(direction: Direction): Command =>
|
|
21
|
+
(state, dispatch) => {
|
|
22
|
+
const table = findTable(state.selection);
|
|
23
|
+
if (!table) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const map = TableMap.get(table.node);
|
|
28
|
+
const { tableCell, tableHeader } = state.schema.nodes;
|
|
29
|
+
const cell = findParentNodeOfType([tableCell, tableHeader])(
|
|
30
|
+
state.selection,
|
|
31
|
+
)!;
|
|
32
|
+
const firstCellPos = map.positionAt(0, 0, table.node) + table.start;
|
|
33
|
+
const lastCellPos =
|
|
34
|
+
map.positionAt(map.height - 1, map.width - 1, table.node) + table.start;
|
|
35
|
+
|
|
36
|
+
// when tabbing backwards at first cell (top left), insert row at the start of table
|
|
37
|
+
if (firstCellPos === cell.pos && direction === TAB_BACKWARD_DIRECTION) {
|
|
38
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, {
|
|
39
|
+
index: 0,
|
|
40
|
+
moveCursorToInsertedRow: true,
|
|
41
|
+
})(state, dispatch);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// when tabbing forwards at last cell (bottom right), insert row at the end of table
|
|
46
|
+
if (lastCellPos === cell.pos && direction === TAB_FORWARD_DIRECTION) {
|
|
47
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, {
|
|
48
|
+
index: map.height,
|
|
49
|
+
moveCursorToInsertedRow: true,
|
|
50
|
+
})(state, dispatch);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (dispatch) {
|
|
55
|
+
return baseGotoNextCell(direction)(state, dispatch);
|
|
56
|
+
}
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return true;
|
|
56
|
-
};
|
|
58
|
+
return true;
|
|
59
|
+
};
|
|
@@ -59,13 +59,14 @@ export const hoverMergedCells = () =>
|
|
|
59
59
|
export const hoverColumns = (hoveredColumns: number[], isInDanger?: boolean) =>
|
|
60
60
|
createCommand(
|
|
61
61
|
(state) => {
|
|
62
|
-
const cells = getCellsInColumn(hoveredColumns)(state.selection);
|
|
62
|
+
const cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
|
|
63
63
|
if (!cells) {
|
|
64
64
|
return false;
|
|
65
65
|
}
|
|
66
66
|
const decorations = createControlsHoverDecoration(
|
|
67
67
|
cells,
|
|
68
68
|
'column',
|
|
69
|
+
state.tr,
|
|
69
70
|
isInDanger,
|
|
70
71
|
);
|
|
71
72
|
|
|
@@ -95,6 +96,7 @@ export const hoverRows = (hoveredRows: number[], isInDanger?: boolean) =>
|
|
|
95
96
|
const decorations = createControlsHoverDecoration(
|
|
96
97
|
cells,
|
|
97
98
|
'row',
|
|
99
|
+
state.tr,
|
|
98
100
|
isInDanger,
|
|
99
101
|
);
|
|
100
102
|
|
|
@@ -131,6 +133,7 @@ export const hoverTable = (isInDanger?: boolean, isSelected?: boolean) =>
|
|
|
131
133
|
const decorations = createControlsHoverDecoration(
|
|
132
134
|
cells,
|
|
133
135
|
'table',
|
|
136
|
+
state.tr,
|
|
134
137
|
isInDanger,
|
|
135
138
|
isSelected,
|
|
136
139
|
);
|
|
@@ -57,109 +57,109 @@ export function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth) {
|
|
|
57
57
|
|
|
58
58
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
59
59
|
// Command to add a column before the column with the selection.
|
|
60
|
-
export const addColumnBefore =
|
|
61
|
-
getEditorContainerWidth: GetEditorContainerWidth
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
60
|
+
export const addColumnBefore =
|
|
61
|
+
(getEditorContainerWidth: GetEditorContainerWidth): Command =>
|
|
62
|
+
(state, dispatch, view) => {
|
|
63
|
+
const table = findTable(state.selection);
|
|
64
|
+
if (!table) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (dispatch) {
|
|
68
|
+
let rect = selectedRect(state);
|
|
69
|
+
dispatch(
|
|
70
|
+
addColumnAt(getEditorContainerWidth)(
|
|
71
|
+
rect.left,
|
|
72
|
+
getAllowAddColumnCustomStep(state),
|
|
73
|
+
view,
|
|
74
|
+
)(state.tr),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
};
|
|
79
79
|
|
|
80
80
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
81
81
|
// Command to add a column after the column with the selection.
|
|
82
|
-
export const addColumnAfter =
|
|
83
|
-
getEditorContainerWidth: GetEditorContainerWidth
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
82
|
+
export const addColumnAfter =
|
|
83
|
+
(getEditorContainerWidth: GetEditorContainerWidth): Command =>
|
|
84
|
+
(state, dispatch, view) => {
|
|
85
|
+
const table = findTable(state.selection);
|
|
86
|
+
if (!table) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (dispatch) {
|
|
90
|
+
let rect = selectedRect(state);
|
|
91
|
+
dispatch(
|
|
92
|
+
addColumnAt(getEditorContainerWidth)(
|
|
93
|
+
rect.right,
|
|
94
|
+
getAllowAddColumnCustomStep(state),
|
|
95
|
+
view,
|
|
96
|
+
)(state.tr),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
101
101
|
|
|
102
102
|
// #region Commands
|
|
103
|
-
export const insertColumn =
|
|
104
|
-
getEditorContainerWidth: GetEditorContainerWidth
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
export const insertColumn =
|
|
104
|
+
(getEditorContainerWidth: GetEditorContainerWidth) =>
|
|
105
|
+
(column: number): Command =>
|
|
106
|
+
(state, dispatch, view) => {
|
|
107
|
+
let tr = addColumnAt(getEditorContainerWidth)(
|
|
108
|
+
column,
|
|
109
|
+
getAllowAddColumnCustomStep(state),
|
|
110
|
+
view,
|
|
111
|
+
)(state.tr);
|
|
112
|
+
const table = findTable(tr.selection);
|
|
113
|
+
if (!table) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
// move the cursor to the newly created column
|
|
117
|
+
const pos = TableMap.get(table.node).positionAt(0, column, table.node);
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
119
|
+
if (dispatch) {
|
|
120
|
+
dispatch(
|
|
121
|
+
tr.setSelection(Selection.near(tr.doc.resolve(table.start + pos))),
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
};
|
|
125
126
|
|
|
126
|
-
export const insertRow =
|
|
127
|
-
row: number,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
(headerRowEnabled && row > 1) || (!headerRowEnabled && row > 0);
|
|
127
|
+
export const insertRow =
|
|
128
|
+
(row: number, moveCursorToTheNewRow: boolean): Command =>
|
|
129
|
+
(state, dispatch) => {
|
|
130
|
+
// Don't clone the header row
|
|
131
|
+
const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
132
|
+
const clonePreviousRow =
|
|
133
|
+
(headerRowEnabled && row > 1) || (!headerRowEnabled && row > 0);
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
// When the table have header row
|
|
136
|
+
// we should not add row on the position zero
|
|
137
|
+
if (row === 0 && headerRowEnabled) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
const tr = clonePreviousRow
|
|
142
|
+
? copyPreviousRow(state.schema)(row)(state.tr)
|
|
143
|
+
: addRowAt(row)(state.tr);
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
if (dispatch) {
|
|
150
|
-
const { selection } = state;
|
|
151
|
-
if (moveCursorToTheNewRow) {
|
|
152
|
-
// move the cursor to the newly created row
|
|
153
|
-
const pos = TableMap.get(table.node).positionAt(row, 0, table.node);
|
|
154
|
-
tr.setSelection(Selection.near(tr.doc.resolve(table.start + pos)));
|
|
155
|
-
} else {
|
|
156
|
-
tr.setSelection(selection.map(tr.doc, tr.mapping));
|
|
145
|
+
const table = findTable(tr.selection);
|
|
146
|
+
if (!table) {
|
|
147
|
+
return false;
|
|
157
148
|
}
|
|
149
|
+
if (dispatch) {
|
|
150
|
+
const { selection } = state;
|
|
151
|
+
if (moveCursorToTheNewRow) {
|
|
152
|
+
// move the cursor to the newly created row
|
|
153
|
+
const pos = TableMap.get(table.node).positionAt(row, 0, table.node);
|
|
154
|
+
tr.setSelection(Selection.near(tr.doc.resolve(table.start + pos)));
|
|
155
|
+
} else {
|
|
156
|
+
tr.setSelection(selection.map(tr.doc, tr.mapping));
|
|
157
|
+
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
};
|
|
159
|
+
dispatch(tr);
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
};
|
|
163
163
|
|
|
164
164
|
export const createTable = (): Command => (state, dispatch) => {
|
|
165
165
|
const table = createTableNode({
|