@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
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
+
import { IntlProvider } from 'react-intl-next';
|
|
3
|
+
import {
|
|
4
|
+
createProsemirrorEditorFactory,
|
|
5
|
+
LightEditorPlugin,
|
|
6
|
+
Preset,
|
|
7
|
+
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
3
8
|
import {
|
|
4
9
|
doc,
|
|
5
10
|
p,
|
|
@@ -14,39 +19,18 @@ import {
|
|
|
14
19
|
import { selectRows } from '@atlaskit/editor-test-helpers/table';
|
|
15
20
|
import { getSelectionRect, selectRow } from '@atlaskit/editor-tables/utils';
|
|
16
21
|
import React from 'react';
|
|
17
|
-
import type { EditorProps } from '@atlaskit/editor-core';
|
|
18
22
|
import { setTextSelection } from '@atlaskit/editor-common/utils';
|
|
19
23
|
import { hoverRows } from '../../../plugins/table/commands';
|
|
20
|
-
import {
|
|
21
|
-
TableCssClassName as ClassName,
|
|
22
|
-
TablePluginState,
|
|
23
|
-
} from '../../../plugins/table/types';
|
|
24
24
|
import TableFloatingControls from '../../../plugins/table/ui/TableFloatingControls';
|
|
25
25
|
import { RowControls } from '../../../plugins/table/ui/TableFloatingControls/RowControls';
|
|
26
26
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
27
|
-
import { ReactWrapper } from 'enzyme';
|
|
28
27
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
29
28
|
|
|
30
|
-
const ControlsButton = `.${ClassName.CONTROLS_BUTTON}`;
|
|
31
|
-
const RowControlsButtonWrap = `.${ClassName.ROW_CONTROLS_BUTTON_WRAP}`;
|
|
32
|
-
|
|
33
29
|
describe('RowControls', () => {
|
|
34
|
-
const createEditor =
|
|
30
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
35
31
|
const fakeGetEditorFeatureFlags = jest.fn(() => ({}));
|
|
36
|
-
let floatingControls: ReactWrapper;
|
|
37
32
|
let originalResizeObserver: any;
|
|
38
33
|
|
|
39
|
-
let triggerElementResize = (element: HTMLElement, height: number) => {
|
|
40
|
-
const entries = [
|
|
41
|
-
{
|
|
42
|
-
target: element,
|
|
43
|
-
contentRect: { height },
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
resizeCallback(entries);
|
|
47
|
-
};
|
|
48
|
-
let resizeCallback: (entries: any[]) => {};
|
|
49
|
-
|
|
50
34
|
beforeAll(() => {
|
|
51
35
|
originalResizeObserver = (window as any).ResizeObserver;
|
|
52
36
|
(window as any).ResizeObserver = function resizeObserverMock(
|
|
@@ -54,7 +38,6 @@ describe('RowControls', () => {
|
|
|
54
38
|
) {
|
|
55
39
|
this.disconnect = jest.fn();
|
|
56
40
|
this.observe = jest.fn();
|
|
57
|
-
resizeCallback = callback;
|
|
58
41
|
};
|
|
59
42
|
});
|
|
60
43
|
|
|
@@ -63,23 +46,13 @@ describe('RowControls', () => {
|
|
|
63
46
|
});
|
|
64
47
|
|
|
65
48
|
afterEach(() => {
|
|
66
|
-
if (floatingControls && floatingControls.length) {
|
|
67
|
-
floatingControls.unmount();
|
|
68
|
-
}
|
|
69
49
|
jest.clearAllMocks();
|
|
70
50
|
});
|
|
71
51
|
|
|
72
|
-
const editor = (doc: DocBuilder
|
|
73
|
-
const { featureFlags } = props || {};
|
|
74
|
-
fakeGetEditorFeatureFlags.mockReturnValue(featureFlags || {});
|
|
75
|
-
|
|
52
|
+
const editor = (doc: DocBuilder) => {
|
|
76
53
|
return createEditor({
|
|
77
54
|
doc,
|
|
78
|
-
|
|
79
|
-
allowTables: false,
|
|
80
|
-
dangerouslyAppendPlugins: { __plugins: [tablePlugin()] },
|
|
81
|
-
...props,
|
|
82
|
-
},
|
|
55
|
+
preset: new Preset<LightEditorPlugin>().add(tablePlugin),
|
|
83
56
|
pluginKey,
|
|
84
57
|
});
|
|
85
58
|
};
|
|
@@ -92,52 +65,42 @@ describe('RowControls', () => {
|
|
|
92
65
|
rows.push(tr(tdEmpty));
|
|
93
66
|
}
|
|
94
67
|
const { editorView } = editor(doc(p('text'), table()(...rows)));
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
68
|
+
const ref = editorView.dom.querySelector('table') || undefined;
|
|
69
|
+
|
|
70
|
+
render(
|
|
71
|
+
<IntlProvider locale="en">
|
|
72
|
+
<TableFloatingControls
|
|
73
|
+
tableRef={ref}
|
|
74
|
+
tableActive
|
|
75
|
+
editorView={editorView}
|
|
76
|
+
getEditorFeatureFlags={fakeGetEditorFeatureFlags}
|
|
77
|
+
/>
|
|
78
|
+
</IntlProvider>,
|
|
102
79
|
);
|
|
103
|
-
|
|
80
|
+
|
|
81
|
+
const rowControlButtons = screen.getAllByLabelText('Highlight row');
|
|
82
|
+
|
|
83
|
+
expect(rowControlButtons).toHaveLength(row);
|
|
104
84
|
});
|
|
105
85
|
});
|
|
106
86
|
});
|
|
107
87
|
|
|
108
88
|
it('does not render rowControls if table is not active', () => {
|
|
109
89
|
const { editorView } = editor(doc(p('text'), table()(tr(tdCursor))));
|
|
110
|
-
|
|
111
|
-
<TableFloatingControls
|
|
112
|
-
tableRef={document.querySelector('table')!}
|
|
113
|
-
tableActive={false}
|
|
114
|
-
editorView={editorView}
|
|
115
|
-
getEditorFeatureFlags={fakeGetEditorFeatureFlags}
|
|
116
|
-
/>,
|
|
117
|
-
);
|
|
118
|
-
expect(floatingControls.find(RowControlsButtonWrap)).toHaveLength(0);
|
|
119
|
-
});
|
|
90
|
+
const ref = editorView.dom.querySelector('table') || undefined;
|
|
120
91
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const { editorView } = editor(doc(table()(tr(tdCursor))), {
|
|
124
|
-
featureFlags: { tableRenderOptimization: true },
|
|
125
|
-
});
|
|
126
|
-
floatingControls = mountWithIntl(
|
|
92
|
+
render(
|
|
93
|
+
<IntlProvider locale="en">
|
|
127
94
|
<TableFloatingControls
|
|
128
|
-
tableRef={
|
|
129
|
-
tableActive={
|
|
95
|
+
tableRef={ref}
|
|
96
|
+
tableActive={false}
|
|
130
97
|
editorView={editorView}
|
|
131
98
|
getEditorFeatureFlags={fakeGetEditorFeatureFlags}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
tableElement.style.height = '100px';
|
|
138
|
-
triggerElementResize(tableElement, 100);
|
|
139
|
-
expect(floatingControls.state('tableHeight')).toBe(100);
|
|
140
|
-
});
|
|
99
|
+
/>
|
|
100
|
+
</IntlProvider>,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
expect(screen.queryByLabelText('Highlight row')).toBeFalsy();
|
|
141
104
|
});
|
|
142
105
|
|
|
143
106
|
[0, 1, 2].forEach((row) => {
|
|
@@ -153,13 +116,17 @@ describe('RowControls', () => {
|
|
|
153
116
|
),
|
|
154
117
|
);
|
|
155
118
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
119
|
+
const ref = editorView.dom.querySelector('table') || undefined;
|
|
120
|
+
|
|
121
|
+
render(
|
|
122
|
+
<IntlProvider locale="en">
|
|
123
|
+
<TableFloatingControls
|
|
124
|
+
tableRef={ref}
|
|
125
|
+
tableActive
|
|
126
|
+
editorView={editorView}
|
|
127
|
+
getEditorFeatureFlags={fakeGetEditorFeatureFlags}
|
|
128
|
+
/>
|
|
129
|
+
</IntlProvider>,
|
|
163
130
|
);
|
|
164
131
|
|
|
165
132
|
// move to header row
|
|
@@ -167,24 +134,16 @@ describe('RowControls', () => {
|
|
|
167
134
|
setTextSelection(editorView, nextPos);
|
|
168
135
|
|
|
169
136
|
// now hover the row
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
.find('button')
|
|
174
|
-
.first()
|
|
175
|
-
.simulate('mouseover');
|
|
137
|
+
const rowControls = screen.getAllByLabelText('Highlight row');
|
|
138
|
+
|
|
139
|
+
fireEvent.mouseOver(rowControls[row]);
|
|
176
140
|
|
|
177
141
|
// assert the cursor is still in same position
|
|
178
142
|
expect(editorView.state.selection.$from.pos).toBe(nextPos);
|
|
179
143
|
expect(editorView.state.selection.$to.pos).toBe(nextPos);
|
|
180
144
|
|
|
181
145
|
// release the hover
|
|
182
|
-
|
|
183
|
-
.find(RowControlsButtonWrap)
|
|
184
|
-
.at(row)
|
|
185
|
-
.find('button')
|
|
186
|
-
.first()
|
|
187
|
-
.simulate('mouseout');
|
|
146
|
+
fireEvent.mouseOut(rowControls[row]);
|
|
188
147
|
|
|
189
148
|
// assert the cursor is still in same position
|
|
190
149
|
expect(editorView.state.selection.$from.pos).toBe(nextPos);
|
|
@@ -204,31 +163,37 @@ describe('RowControls', () => {
|
|
|
204
163
|
),
|
|
205
164
|
);
|
|
206
165
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
166
|
+
const ref = editorView.dom.querySelector('table') || undefined;
|
|
167
|
+
|
|
168
|
+
render(
|
|
169
|
+
<IntlProvider locale="en">
|
|
170
|
+
<RowControls
|
|
171
|
+
tableRef={ref!}
|
|
172
|
+
editorView={editorView}
|
|
173
|
+
hoverRows={(rows, danger) => {
|
|
174
|
+
hoverRows(rows, danger)(editorView.state, editorView.dispatch);
|
|
175
|
+
}}
|
|
176
|
+
hoveredRows={[0, 1]}
|
|
177
|
+
isInDanger={true}
|
|
178
|
+
selectRow={(row) => {
|
|
179
|
+
editorView.dispatch(selectRow(row)(editorView.state.tr));
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
</IntlProvider>,
|
|
220
183
|
);
|
|
221
184
|
|
|
222
|
-
|
|
223
|
-
|
|
185
|
+
const rowControls = screen.getAllByLabelText('Highlight row');
|
|
186
|
+
rowControls
|
|
224
187
|
.slice(0, 2)
|
|
225
|
-
.forEach((
|
|
226
|
-
expect(
|
|
227
|
-
|
|
188
|
+
.forEach((control) =>
|
|
189
|
+
expect(
|
|
190
|
+
control?.parentElement?.classList?.contains('danger'),
|
|
191
|
+
).toBeTruthy(),
|
|
192
|
+
);
|
|
228
193
|
});
|
|
229
194
|
|
|
230
195
|
describe('row shift selection', () => {
|
|
231
|
-
it('should shift select rows after the currently selected row', () => {
|
|
196
|
+
it('should be able to shift + click to select rows after the currently selected row', () => {
|
|
232
197
|
const { editorView } = editor(
|
|
233
198
|
doc(
|
|
234
199
|
table()(
|
|
@@ -241,29 +206,32 @@ describe('RowControls', () => {
|
|
|
241
206
|
);
|
|
242
207
|
|
|
243
208
|
selectRows([0])(editorView.state, editorView.dispatch);
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
209
|
+
|
|
210
|
+
const ref = editorView.dom.querySelector('table');
|
|
211
|
+
|
|
212
|
+
render(
|
|
213
|
+
<IntlProvider locale="en">
|
|
214
|
+
<RowControls
|
|
215
|
+
tableRef={ref!}
|
|
216
|
+
editorView={editorView}
|
|
217
|
+
hoverRows={(rows, danger) => {
|
|
218
|
+
hoverRows(rows, danger)(editorView.state, editorView.dispatch);
|
|
219
|
+
}}
|
|
220
|
+
selectRow={(row, expand) => {
|
|
221
|
+
editorView.dispatch(selectRow(row, expand)(editorView.state.tr));
|
|
222
|
+
}}
|
|
223
|
+
/>
|
|
224
|
+
</IntlProvider>,
|
|
255
225
|
);
|
|
256
226
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
.at(2)
|
|
260
|
-
.simulate('click', { shiftKey: true });
|
|
227
|
+
const rowControls = screen.getAllByLabelText('Highlight row');
|
|
228
|
+
fireEvent.click(rowControls[2], { shiftKey: true });
|
|
261
229
|
|
|
262
230
|
const rect = getSelectionRect(editorView.state.selection);
|
|
263
231
|
expect(rect).toEqual({ left: 0, top: 0, right: 3, bottom: 3 });
|
|
264
232
|
});
|
|
265
233
|
|
|
266
|
-
it('should shift select
|
|
234
|
+
it('should be able to shift + click to select rows before the currently selected row', () => {
|
|
267
235
|
const { editorView } = editor(
|
|
268
236
|
doc(
|
|
269
237
|
table()(
|
|
@@ -276,23 +244,26 @@ describe('RowControls', () => {
|
|
|
276
244
|
);
|
|
277
245
|
|
|
278
246
|
selectRows([2])(editorView.state, editorView.dispatch);
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
247
|
+
|
|
248
|
+
const ref = editorView.dom.querySelector('table') || undefined;
|
|
249
|
+
|
|
250
|
+
render(
|
|
251
|
+
<IntlProvider locale="en">
|
|
252
|
+
<RowControls
|
|
253
|
+
tableRef={ref!}
|
|
254
|
+
editorView={editorView}
|
|
255
|
+
hoverRows={(rows, danger) => {
|
|
256
|
+
hoverRows(rows, danger)(editorView.state, editorView.dispatch);
|
|
257
|
+
}}
|
|
258
|
+
selectRow={(row, expand) => {
|
|
259
|
+
editorView.dispatch(selectRow(row, expand)(editorView.state.tr));
|
|
260
|
+
}}
|
|
261
|
+
/>
|
|
262
|
+
</IntlProvider>,
|
|
290
263
|
);
|
|
291
264
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
.first()
|
|
295
|
-
.simulate('click', { shiftKey: true });
|
|
265
|
+
const rowControls = screen.getAllByLabelText('Highlight row');
|
|
266
|
+
fireEvent.click(rowControls[0], { shiftKey: true });
|
|
296
267
|
|
|
297
268
|
const rect = getSelectionRect(editorView.state.selection);
|
|
298
269
|
expect(rect).toEqual({ left: 0, top: 0, right: 3, bottom: 3 });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { IntlProvider } from 'react-intl-next';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
import {
|
|
@@ -19,8 +20,6 @@ import {
|
|
|
19
20
|
import { TablePluginState } from '../../../plugins/table/types';
|
|
20
21
|
import { hoverTable } from '../../../plugins/table/commands';
|
|
21
22
|
import TableFloatingControls from '../../../plugins/table/ui/TableFloatingControls';
|
|
22
|
-
import { CornerControls } from '../../../plugins/table/ui/TableFloatingControls/CornerControls';
|
|
23
|
-
import { RowControls } from '../../../plugins/table/ui/TableFloatingControls/RowControls';
|
|
24
23
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
25
24
|
import { getDecorations } from '../../../plugins/table/pm-plugins/decorations/plugin';
|
|
26
25
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
@@ -43,14 +42,13 @@ describe('TableFloatingControls', () => {
|
|
|
43
42
|
const { editorView } = editor(
|
|
44
43
|
doc(p('text'), table()(tr(tdEmpty, tdEmpty, tdEmpty))),
|
|
45
44
|
);
|
|
46
|
-
const
|
|
45
|
+
const { container } = render(
|
|
47
46
|
<TableFloatingControls
|
|
48
47
|
editorView={editorView}
|
|
49
48
|
getEditorFeatureFlags={fakeGetEditorFeatureFlags}
|
|
50
49
|
/>,
|
|
51
50
|
);
|
|
52
|
-
expect(
|
|
53
|
-
floatingControls.unmount();
|
|
51
|
+
expect(container.innerHTML).toEqual('');
|
|
54
52
|
});
|
|
55
53
|
});
|
|
56
54
|
|
|
@@ -59,16 +57,21 @@ describe('TableFloatingControls', () => {
|
|
|
59
57
|
const { editorView } = editor(
|
|
60
58
|
doc(p('text'), table()(tr(tdEmpty, tdEmpty, tdEmpty))),
|
|
61
59
|
);
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
const ref = editorView.dom.querySelector('table') || undefined;
|
|
61
|
+
|
|
62
|
+
render(
|
|
63
|
+
<IntlProvider locale="en">
|
|
64
|
+
<TableFloatingControls
|
|
65
|
+
tableRef={ref}
|
|
66
|
+
tableActive={true}
|
|
67
|
+
editorView={editorView}
|
|
68
|
+
getEditorFeatureFlags={fakeGetEditorFeatureFlags}
|
|
69
|
+
/>
|
|
70
|
+
</IntlProvider>,
|
|
69
71
|
);
|
|
70
|
-
|
|
71
|
-
expect(
|
|
72
|
+
|
|
73
|
+
expect(screen.getByLabelText('Highlight row')).toBeTruthy();
|
|
74
|
+
expect(screen.getByLabelText('Highlight table')).toBeTruthy();
|
|
72
75
|
});
|
|
73
76
|
});
|
|
74
77
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createProsemirrorEditorFactory,
|
|
3
|
+
LightEditorPlugin,
|
|
4
|
+
Preset,
|
|
5
|
+
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
2
6
|
import {
|
|
3
7
|
doc,
|
|
4
8
|
p,
|
|
@@ -12,7 +16,6 @@ import {
|
|
|
12
16
|
tdEmpty,
|
|
13
17
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
14
18
|
import { EditorView } from 'prosemirror-view';
|
|
15
|
-
import { TablePluginState } from '../../plugins/table/types';
|
|
16
19
|
import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
17
20
|
import { redo, undo } from 'prosemirror-history';
|
|
18
21
|
import { insertColumn } from '../../plugins/table/commands';
|
|
@@ -21,6 +24,7 @@ import { colsToRect } from '../../plugins/table/utils/table';
|
|
|
21
24
|
import sendKeyToPm from '@atlaskit/editor-test-helpers/send-key-to-pm';
|
|
22
25
|
import clone from 'lodash/clone';
|
|
23
26
|
import tablePlugin from '../../plugins/table';
|
|
27
|
+
import widthPlugin from '@atlaskit/editor-core/src/plugins/width';
|
|
24
28
|
|
|
25
29
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
26
30
|
|
|
@@ -46,7 +50,7 @@ const SHORTCUT_ADD_COLUMN_AFTER = (editorView: EditorView) =>
|
|
|
46
50
|
sendKeyToPm(editorView, 'Ctrl-Alt-ArrowRight');
|
|
47
51
|
|
|
48
52
|
describe('undo/redo with tables', () => {
|
|
49
|
-
const createEditor =
|
|
53
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
50
54
|
const editor = (doc: DocBuilder) => {
|
|
51
55
|
const tableOptions = {
|
|
52
56
|
advanced: true,
|
|
@@ -54,12 +58,9 @@ describe('undo/redo with tables', () => {
|
|
|
54
58
|
};
|
|
55
59
|
return createEditor({
|
|
56
60
|
doc,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
__plugins: [tablePlugin({ tableOptions })],
|
|
61
|
-
},
|
|
62
|
-
},
|
|
61
|
+
preset: new Preset<LightEditorPlugin>()
|
|
62
|
+
.add([tablePlugin, { tableOptions }])
|
|
63
|
+
.add(widthPlugin),
|
|
63
64
|
pluginKey: tablePluginKey,
|
|
64
65
|
});
|
|
65
66
|
};
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
DocBuilder,
|
|
12
12
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
13
13
|
|
|
14
|
-
import tablePlugin from '
|
|
14
|
+
import tablePlugin from '../../../plugins/table';
|
|
15
15
|
import expandPlugin from '@atlaskit/editor-core/src/plugins/expand';
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
isTableCollapsible,
|
|
19
19
|
collapseSelectedTable,
|
|
20
|
-
} from '../../../utils/collapse';
|
|
20
|
+
} from '../../../plugins/table/utils/collapse';
|
|
21
21
|
|
|
22
22
|
describe('collapse', () => {
|
|
23
23
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createProsemirrorEditorFactory,
|
|
4
|
+
LightEditorPlugin,
|
|
5
|
+
Preset,
|
|
6
|
+
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
3
7
|
import {
|
|
4
8
|
doc,
|
|
5
9
|
p,
|
|
@@ -11,17 +15,17 @@ import {
|
|
|
11
15
|
thEmpty,
|
|
12
16
|
DocBuilder,
|
|
13
17
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
14
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
15
18
|
import { containsHeaderColumn } from '../../../plugins/table/utils/nodes';
|
|
16
19
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
20
|
+
import tablePlugin from '../../../plugins/table-plugin';
|
|
17
21
|
|
|
18
22
|
describe('table merging logic', () => {
|
|
19
|
-
const createEditor =
|
|
23
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
20
24
|
|
|
21
25
|
const editor = (doc: DocBuilder) =>
|
|
22
26
|
createEditor({
|
|
23
27
|
doc,
|
|
24
|
-
|
|
28
|
+
preset: new Preset<LightEditorPlugin>().add(tablePlugin),
|
|
25
29
|
pluginKey,
|
|
26
30
|
});
|
|
27
31
|
|
|
@@ -2,7 +2,11 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
2
2
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
3
3
|
import { uuid } from '@atlaskit/adf-schema';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createProsemirrorEditorFactory,
|
|
7
|
+
LightEditorPlugin,
|
|
8
|
+
Preset,
|
|
9
|
+
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
6
10
|
import {
|
|
7
11
|
doc,
|
|
8
12
|
p,
|
|
@@ -12,9 +16,9 @@ import {
|
|
|
12
16
|
td,
|
|
13
17
|
DocBuilder,
|
|
14
18
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
15
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
16
19
|
import { copyPreviousRow } from '../../../plugins/table/utils/row-controls';
|
|
17
20
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
21
|
+
import tablePlugin from '../../../plugins/table-plugin';
|
|
18
22
|
|
|
19
23
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
20
24
|
|
|
@@ -27,11 +31,11 @@ describe('table plugin: utils/row-controls.js', () => {
|
|
|
27
31
|
uuid.setStatic(false);
|
|
28
32
|
});
|
|
29
33
|
|
|
30
|
-
const createEditor =
|
|
34
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
31
35
|
const editor = (doc: DocBuilder) =>
|
|
32
36
|
createEditor({
|
|
33
37
|
doc,
|
|
34
|
-
|
|
38
|
+
preset: new Preset<LightEditorPlugin>().add(tablePlugin),
|
|
35
39
|
pluginKey,
|
|
36
40
|
});
|
|
37
41
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|