@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
|
+
import React from 'react';
|
|
2
|
+
import { replaceRaf } from 'raf-stub';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
5
|
+
import tablePlugin from '../../../plugins/table-plugin';
|
|
6
|
+
import {
|
|
7
|
+
doc,
|
|
8
|
+
p,
|
|
9
|
+
table,
|
|
10
|
+
tr,
|
|
11
|
+
td,
|
|
12
|
+
tdEmpty,
|
|
13
|
+
tdCursor,
|
|
14
|
+
DocBuilder,
|
|
15
|
+
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
16
|
+
import { findTable, selectTable } from '@atlaskit/editor-tables/utils';
|
|
17
|
+
import {
|
|
18
|
+
TableCssClassName as ClassName,
|
|
19
|
+
TablePluginState,
|
|
20
|
+
} from '../../../plugins/table/types';
|
|
21
|
+
import TableComponent from '../../../plugins/table/nodeviews/TableComponent';
|
|
22
|
+
|
|
23
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
24
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
25
|
+
import { toggleNumberColumn } from '../../../plugins/table/commands';
|
|
26
|
+
|
|
27
|
+
jest.mock('../../../plugins/table/utils/nodes', () =>
|
|
28
|
+
Object.assign({}, jest.requireActual('../../../plugins/table/utils/nodes'), {
|
|
29
|
+
tablesHaveDifferentColumnWidths: jest.fn(),
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
replaceRaf();
|
|
34
|
+
const requestAnimationFrame = window.requestAnimationFrame as any;
|
|
35
|
+
|
|
36
|
+
describe('table -> nodeviews -> TableComponent.tsx', () => {
|
|
37
|
+
const createEditor = createEditorFactory<TablePluginState>();
|
|
38
|
+
const getEditorFeatureFlags = jest.fn();
|
|
39
|
+
const editor = (
|
|
40
|
+
doc: DocBuilder,
|
|
41
|
+
featureFlags?: { [featureFlag: string]: string | boolean },
|
|
42
|
+
) => {
|
|
43
|
+
getEditorFeatureFlags.mockReturnValue(featureFlags || {});
|
|
44
|
+
return createEditor({
|
|
45
|
+
doc,
|
|
46
|
+
editorProps: {
|
|
47
|
+
allowTables: false,
|
|
48
|
+
dangerouslyAppendPlugins: {
|
|
49
|
+
__plugins: [tablePlugin()],
|
|
50
|
+
},
|
|
51
|
+
featureFlags,
|
|
52
|
+
},
|
|
53
|
+
pluginKey,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
afterEach(() => {
|
|
57
|
+
jest.clearAllMocks();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe('when the table is selected', () => {
|
|
61
|
+
it('should add table selected css class', () => {
|
|
62
|
+
const { editorView } = editor(
|
|
63
|
+
doc(p('text'), table()(tr(tdEmpty, tdEmpty, tdCursor))),
|
|
64
|
+
{
|
|
65
|
+
tableCellOptimization: true,
|
|
66
|
+
tableRenderOptimization: true,
|
|
67
|
+
stickyHeadersOptimization: true,
|
|
68
|
+
initialRenderOptimization: true,
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
const { state, dispatch } = editorView;
|
|
72
|
+
dispatch(selectTable(state.tr));
|
|
73
|
+
requestAnimationFrame.step();
|
|
74
|
+
const tableContainer = document.querySelector(
|
|
75
|
+
`.${ClassName.TABLE_CONTAINER}`,
|
|
76
|
+
);
|
|
77
|
+
expect(
|
|
78
|
+
tableContainer!.classList.contains(ClassName.TABLE_SELECTED),
|
|
79
|
+
).toBeTruthy();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('when the numbered column attribute is changed', () => {
|
|
84
|
+
it('should not resize the columns', () => {
|
|
85
|
+
const { editorView } = editor(
|
|
86
|
+
doc(
|
|
87
|
+
table({ isNumberColumnEnabled: false, layout: 'default' })(
|
|
88
|
+
tr(
|
|
89
|
+
td({ colwidth: [1400] })(p('{<>}')),
|
|
90
|
+
td({ colwidth: [48] })(p()),
|
|
91
|
+
td({ colwidth: [48] })(p()),
|
|
92
|
+
),
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
const { state, dispatch } = editorView;
|
|
97
|
+
const tableCell = state.schema.nodes.tableCell;
|
|
98
|
+
const columnWidths: number[][] = [];
|
|
99
|
+
|
|
100
|
+
toggleNumberColumn(state, dispatch);
|
|
101
|
+
requestAnimationFrame.step();
|
|
102
|
+
|
|
103
|
+
editorView.state.doc.nodesBetween(3, 14, (node) => {
|
|
104
|
+
if (node.type === tableCell) {
|
|
105
|
+
columnWidths.push(node.attrs.colwidth);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return node.type !== tableCell;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(columnWidths).toEqual([[1400], [48], [48]]);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('WITH_CONTROLS css class', () => {
|
|
116
|
+
it.each<[string, object, boolean]>([
|
|
117
|
+
[
|
|
118
|
+
'is added when allowControls is set',
|
|
119
|
+
{
|
|
120
|
+
allowControls: true,
|
|
121
|
+
tableActive: true,
|
|
122
|
+
},
|
|
123
|
+
true,
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
'is added by default when allowControls is not provided',
|
|
127
|
+
{
|
|
128
|
+
tableActive: true,
|
|
129
|
+
},
|
|
130
|
+
true,
|
|
131
|
+
],
|
|
132
|
+
[
|
|
133
|
+
'is not added when allowControls is false',
|
|
134
|
+
{
|
|
135
|
+
allowControls: false,
|
|
136
|
+
tableActive: true,
|
|
137
|
+
},
|
|
138
|
+
false,
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
'is not added when table is not active',
|
|
142
|
+
{
|
|
143
|
+
allowControls: true,
|
|
144
|
+
tableActive: false,
|
|
145
|
+
},
|
|
146
|
+
false,
|
|
147
|
+
],
|
|
148
|
+
])('%s', (_, props, expected) => {
|
|
149
|
+
const { editorView: view } = editor(
|
|
150
|
+
doc(p('text'), table()(tr(td()(p('{<>}text')), tdEmpty, tdEmpty))),
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const tableF = findTable(view.state.selection);
|
|
154
|
+
const getNode = () => tableF!.node;
|
|
155
|
+
const { container } = render(
|
|
156
|
+
<TableComponent
|
|
157
|
+
view={view}
|
|
158
|
+
eventDispatcher={
|
|
159
|
+
{ on: jest.fn(), off: jest.fn() } as unknown as EventDispatcher
|
|
160
|
+
}
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
containerWidth={{}}
|
|
163
|
+
getNode={getNode}
|
|
164
|
+
contentDOM={(contentElement: HTMLElement | null) => {
|
|
165
|
+
const node = view.dom.getElementsByTagName('table')[0];
|
|
166
|
+
|
|
167
|
+
if (!contentElement?.firstChild) {
|
|
168
|
+
contentElement?.appendChild(node);
|
|
169
|
+
}
|
|
170
|
+
}}
|
|
171
|
+
getEditorFeatureFlags={getEditorFeatureFlags}
|
|
172
|
+
{...props}
|
|
173
|
+
/>,
|
|
174
|
+
);
|
|
175
|
+
const controlsContainer = container.querySelector(
|
|
176
|
+
`.${ClassName.WITH_CONTROLS}`,
|
|
177
|
+
);
|
|
178
|
+
expect(!!controlsContainer).toBe(expected);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
});
|
|
@@ -2,7 +2,11 @@ import {
|
|
|
2
2
|
setCellAttrs,
|
|
3
3
|
findCellClosestToPos,
|
|
4
4
|
} from '@atlaskit/editor-tables/utils';
|
|
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,
|
|
@@ -19,13 +23,14 @@ import {
|
|
|
19
23
|
rgbToHex,
|
|
20
24
|
uuid,
|
|
21
25
|
} from '@atlaskit/adf-schema';
|
|
22
|
-
import {
|
|
26
|
+
import { PluginConfig } from '../../../plugins/table/types';
|
|
23
27
|
import { mergeCells } from '../../../plugins/table/transforms';
|
|
24
28
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
25
29
|
import TableCellViews from '../../../plugins/table/nodeviews/tableCell';
|
|
26
30
|
import sendKeyToPm from '@atlaskit/editor-test-helpers/send-key-to-pm';
|
|
27
31
|
import * as domHelpers from '../../../plugins/table/pm-plugins/sticky-headers/nodeviews/dom';
|
|
28
32
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
33
|
+
import undoRedoPlugin from '@atlaskit/editor-core/src/plugins/undo-redo';
|
|
29
34
|
|
|
30
35
|
jest.mock('@atlaskit/editor-common/utils', () => ({
|
|
31
36
|
...jest.requireActual<Object>('@atlaskit/editor-common/utils'),
|
|
@@ -36,18 +41,15 @@ jest.mock('@atlaskit/editor-common/utils', () => ({
|
|
|
36
41
|
|
|
37
42
|
describe('table -> nodeviews -> tableCell.tsx', () => {
|
|
38
43
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
39
|
-
const createEditor =
|
|
44
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
40
45
|
|
|
41
46
|
const editor = (doc: DocBuilder, props?: PluginConfig) =>
|
|
42
47
|
createEditor({
|
|
43
48
|
doc,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
},
|
|
49
|
+
attachTo: document.body,
|
|
50
|
+
preset: new Preset<LightEditorPlugin>()
|
|
51
|
+
.add([tablePlugin, { tableOptions: { advanced: true, ...props } }])
|
|
52
|
+
.add(undoRedoPlugin),
|
|
51
53
|
pluginKey,
|
|
52
54
|
});
|
|
53
55
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Node as PMNode } from 'prosemirror-model';
|
|
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,39 +15,37 @@ import {
|
|
|
11
15
|
DocBuilder,
|
|
12
16
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
13
17
|
import { TableAttributes } from '@atlaskit/adf-schema';
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import TableView from '../../../../../plugins/table/nodeviews/table';
|
|
18
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
19
|
+
import tablePlugin from '../../../plugins/table';
|
|
20
|
+
import TableView from '../../../plugins/table/nodeviews/table';
|
|
18
21
|
import defaultSchema from '@atlaskit/editor-test-helpers/schema';
|
|
19
|
-
import type { EditorProps } from '@atlaskit/editor-core';
|
|
20
22
|
import { EditorView } from 'prosemirror-view';
|
|
21
|
-
import { hoverRows } from '../../../commands';
|
|
23
|
+
import { hoverRows } from '../../../plugins/table/commands';
|
|
22
24
|
|
|
23
25
|
describe('table -> nodeviews -> table.tsx', () => {
|
|
24
|
-
const createEditor =
|
|
25
|
-
const createTableNode =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
createEditor({
|
|
30
|
-
doc,
|
|
31
|
-
editorProps: {
|
|
32
|
-
allowTables: false,
|
|
33
|
-
dangerouslyAppendPlugins: {
|
|
34
|
-
__plugins: [tablePlugin()],
|
|
35
|
-
},
|
|
36
|
-
...props,
|
|
37
|
-
},
|
|
38
|
-
pluginKey,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
afterEach(() => {
|
|
42
|
-
jest.clearAllMocks();
|
|
43
|
-
});
|
|
26
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
27
|
+
const createTableNode =
|
|
28
|
+
(attrs?: TableAttributes) =>
|
|
29
|
+
(...args: any) =>
|
|
30
|
+
table(attrs)(...args)(defaultSchema);
|
|
44
31
|
|
|
45
32
|
describe('TableView', () => {
|
|
46
33
|
describe('with tableRenderOptimization', () => {
|
|
34
|
+
const editor = (doc: DocBuilder) =>
|
|
35
|
+
createEditor({
|
|
36
|
+
doc,
|
|
37
|
+
preset: new Preset<LightEditorPlugin>().add([
|
|
38
|
+
tablePlugin,
|
|
39
|
+
{
|
|
40
|
+
tableOptions: {},
|
|
41
|
+
getEditorFeatureFlags: () => ({
|
|
42
|
+
tableRenderOptimization: true,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
]),
|
|
46
|
+
pluginKey,
|
|
47
|
+
});
|
|
48
|
+
|
|
47
49
|
describe('on view update', () => {
|
|
48
50
|
let tableNode: PMNode,
|
|
49
51
|
tableNodeView: TableView,
|
|
@@ -58,9 +60,6 @@ describe('table -> nodeviews -> table.tsx', () => {
|
|
|
58
60
|
p('text'),
|
|
59
61
|
table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty)),
|
|
60
62
|
),
|
|
61
|
-
{
|
|
62
|
-
featureFlags: { tableRenderOptimization: true },
|
|
63
|
-
},
|
|
64
63
|
);
|
|
65
64
|
view = editorView;
|
|
66
65
|
tableNodeView = new TableView({
|
package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-controls.ts
RENAMED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
10
10
|
import { createEditorState } from '@atlaskit/editor-test-helpers/create-editor-state';
|
|
11
11
|
|
|
12
|
-
import { buildColumnControlsDecorations } from '../../../../pm-plugins/decorations/utils';
|
|
13
|
-
import { TableDecorations } from '../../../../types';
|
|
12
|
+
import { buildColumnControlsDecorations } from '../../../../plugins/table/pm-plugins/decorations/utils';
|
|
13
|
+
import { TableDecorations } from '../../../../plugins/table/types';
|
|
14
14
|
|
|
15
15
|
describe('tables: column controls decorations', () => {
|
|
16
16
|
describe('#buildColumnControlsDecorations', () => {
|
package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-resizing.ts
RENAMED
|
@@ -20,15 +20,18 @@ import {
|
|
|
20
20
|
DocBuilder,
|
|
21
21
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
22
22
|
|
|
23
|
-
import tablePlugin from '
|
|
23
|
+
import tablePlugin from '../../../../plugins/table';
|
|
24
24
|
import {
|
|
25
25
|
hideResizeHandleLine,
|
|
26
26
|
showResizeHandleLine,
|
|
27
|
-
} from '../../../../commands/hover';
|
|
28
|
-
import { getDecorations } from '../../../../pm-plugins/decorations/plugin';
|
|
29
|
-
import { buildColumnResizingDecorations } from '../../../../pm-plugins/decorations/utils';
|
|
30
|
-
import { pluginKey } from '../../../../pm-plugins/plugin-key';
|
|
31
|
-
import {
|
|
27
|
+
} from '../../../../plugins/table/commands/hover';
|
|
28
|
+
import { getDecorations } from '../../../../plugins/table/pm-plugins/decorations/plugin';
|
|
29
|
+
import { buildColumnResizingDecorations } from '../../../../plugins/table/pm-plugins/decorations/utils';
|
|
30
|
+
import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
|
|
31
|
+
import {
|
|
32
|
+
TableDecorations,
|
|
33
|
+
TablePluginState,
|
|
34
|
+
} from '../../../../plugins/table/types';
|
|
32
35
|
|
|
33
36
|
describe('tables: column resizing decorations', () => {
|
|
34
37
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
DocBuilder,
|
|
17
17
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
18
18
|
|
|
19
|
-
import { selectColumn } from '../../../../commands';
|
|
19
|
+
import { selectColumn } from '../../../../plugins/table/commands';
|
|
20
20
|
import {
|
|
21
21
|
getDecorations,
|
|
22
22
|
handleDocOrSelectionChanged,
|
|
23
|
-
} from '../../../../pm-plugins/decorations/plugin';
|
|
24
|
-
import { pluginKey } from '../../../../pm-plugins/plugin-key';
|
|
25
|
-
import { TableDecorations } from '../../../../types';
|
|
26
|
-
import tablePlugin from '
|
|
23
|
+
} from '../../../../plugins/table/pm-plugins/decorations/plugin';
|
|
24
|
+
import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
|
|
25
|
+
import { TableDecorations } from '../../../../plugins/table/types';
|
|
26
|
+
import tablePlugin from '../../../../plugins/table';
|
|
27
27
|
|
|
28
28
|
describe('decorations plugin', () => {
|
|
29
29
|
const createEditor = createProsemirrorEditorFactory();
|
package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main-with-allow-collapse.ts
RENAMED
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
DocBuilder,
|
|
16
16
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
17
17
|
|
|
18
|
-
import tablePlugin from '
|
|
19
|
-
import { pluginKey } from '../../../pm-plugins/plugin-key';
|
|
20
|
-
import { TablePluginState } from '../../../types';
|
|
21
|
-
import { handleDocOrSelectionChanged } from '../../../handlers';
|
|
18
|
+
import tablePlugin from '../../../plugins/table';
|
|
19
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
20
|
+
import { TablePluginState } from '../../../plugins/table/types';
|
|
21
|
+
import { handleDocOrSelectionChanged } from '../../../plugins/table/handlers';
|
|
22
22
|
import expandPlugin from '@atlaskit/editor-core/src/plugins/expand';
|
|
23
23
|
import extensionPlugin from '@atlaskit/editor-core/src/plugins/extension';
|
|
24
24
|
|
|
@@ -15,19 +15,19 @@ import {
|
|
|
15
15
|
import { Selection } from 'prosemirror-state';
|
|
16
16
|
import * as pmUtils from 'prosemirror-utils';
|
|
17
17
|
|
|
18
|
-
import tablePlugin from '
|
|
18
|
+
import tablePlugin from '../../../plugins/table';
|
|
19
19
|
import textFormattingPlugin from '@atlaskit/editor-core/src/plugins/text-formatting';
|
|
20
|
-
import { pluginKey } from '../../../pm-plugins/plugin-key';
|
|
21
|
-
import { getPluginState } from '../../../pm-plugins/plugin-factory';
|
|
22
|
-
import { setEditorFocus } from '
|
|
23
|
-
import * as miscCommands from '
|
|
20
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
21
|
+
import { getPluginState } from '../../../plugins/table/pm-plugins/plugin-factory';
|
|
22
|
+
import { setEditorFocus } from '../../../plugins/table/commands/misc';
|
|
23
|
+
import * as miscCommands from '../../../plugins/table/commands/misc';
|
|
24
24
|
import { NodeType } from 'prosemirror-model';
|
|
25
25
|
import { undo } from 'prosemirror-history';
|
|
26
26
|
import {
|
|
27
27
|
toggleHeaderColumn,
|
|
28
28
|
toggleHeaderRow,
|
|
29
29
|
toggleNumberColumn,
|
|
30
|
-
} from '
|
|
30
|
+
} from '../../../plugins/table/commands';
|
|
31
31
|
|
|
32
32
|
describe('tables: main plugin', () => {
|
|
33
33
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -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
|
DocBuilder,
|
|
@@ -7,21 +11,20 @@ import {
|
|
|
7
11
|
td,
|
|
8
12
|
tr,
|
|
9
13
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
10
|
-
import { pluginKey } from '../../../pm-plugins/plugin-key';
|
|
11
|
-
import
|
|
14
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
15
|
+
import tablePlugin from '../../../plugins/table-plugin';
|
|
12
16
|
|
|
13
17
|
describe('table/safari-delete-composition-text-issue-workaround', () => {
|
|
14
18
|
let editor: any;
|
|
15
19
|
beforeEach(() => {
|
|
16
|
-
const createEditor =
|
|
20
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
17
21
|
editor = (doc: DocBuilder) =>
|
|
18
22
|
createEditor({
|
|
19
23
|
doc,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
24
|
+
preset: new Preset<LightEditorPlugin>().add([
|
|
25
|
+
tablePlugin,
|
|
26
|
+
{ tableOptions: { allowColumnResizing: true } },
|
|
27
|
+
]),
|
|
25
28
|
pluginKey,
|
|
26
29
|
});
|
|
27
30
|
});
|
package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/sticky-headers/tableRow.tsx
RENAMED
|
@@ -13,33 +13,36 @@ import {
|
|
|
13
13
|
tr,
|
|
14
14
|
DocBuilder,
|
|
15
15
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
16
|
-
import { TableRowNodeView } from '../../../../pm-plugins/sticky-headers';
|
|
17
|
-
import tablePlugin from '
|
|
18
|
-
import { pluginKey } from '../../../../pm-plugins/plugin-key';
|
|
16
|
+
import { TableRowNodeView } from '../../../../plugins/table/pm-plugins/sticky-headers';
|
|
17
|
+
import tablePlugin from '../../../../plugins/table';
|
|
18
|
+
import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
|
|
19
19
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
20
20
|
import createStub, { Stub } from 'raf-stub';
|
|
21
21
|
import featureFlagsPlugin from '@atlaskit/editor-core/src/plugins/feature-flags-context';
|
|
22
|
-
jest.mock(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
jest.mock(
|
|
23
|
+
'../../../../plugins/table/pm-plugins/sticky-headers/commands',
|
|
24
|
+
() => ({
|
|
25
|
+
...jest.requireActual<Object>(
|
|
26
|
+
'../../../../plugins/table/pm-plugins/sticky-headers/commands',
|
|
27
|
+
),
|
|
28
|
+
updateStickyState: jest.fn(() => jest.fn()),
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
28
31
|
jest.mock('@atlaskit/editor-common/ui', () => ({
|
|
29
32
|
...jest.requireActual<Object>('@atlaskit/editor-common/ui'),
|
|
30
33
|
findOverflowScrollParent: jest.fn(() => jest.fn()),
|
|
31
34
|
}));
|
|
32
35
|
|
|
33
36
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
34
|
-
import { updateStickyState } from '../../../../pm-plugins/sticky-headers/commands';
|
|
35
|
-
import { TableCssClassName } from '../../../../types';
|
|
36
|
-
import TableComponent from '../../../../nodeviews/TableComponent';
|
|
37
|
+
import { updateStickyState } from '../../../../plugins/table/pm-plugins/sticky-headers/commands';
|
|
38
|
+
import { TableCssClassName } from '../../../../plugins/table/types';
|
|
39
|
+
import TableComponent from '../../../../plugins/table/nodeviews/TableComponent';
|
|
37
40
|
import React from 'react';
|
|
38
41
|
import { render, screen } from '@testing-library/react';
|
|
39
42
|
import {
|
|
40
43
|
stickyRowOffsetTop,
|
|
41
44
|
tableScrollbarOffset,
|
|
42
|
-
} from '../../../../ui/consts';
|
|
45
|
+
} from '../../../../plugins/table/ui/consts';
|
|
43
46
|
|
|
44
47
|
describe('TableRowNodeView', () => {
|
|
45
48
|
let tableRowNodeView: TableRowNodeView;
|
|
@@ -358,10 +361,9 @@ describe('TableRowNodeView', () => {
|
|
|
358
361
|
}
|
|
359
362
|
|
|
360
363
|
function mockScrollPositions(tableRowDom: HTMLTableRowElement) {
|
|
361
|
-
const { tableWrapper, tableParent, scrollContainer } =
|
|
362
|
-
tableRowDom
|
|
363
|
-
)
|
|
364
|
-
((findOverflowScrollParent as unknown) as jest.SpyInstance).mockReturnValue(
|
|
364
|
+
const { tableWrapper, tableParent, scrollContainer } =
|
|
365
|
+
getTableElements(tableRowDom);
|
|
366
|
+
(findOverflowScrollParent as unknown as jest.SpyInstance).mockReturnValue(
|
|
365
367
|
scrollContainer,
|
|
366
368
|
);
|
|
367
369
|
|
|
@@ -406,11 +408,11 @@ describe('TableRowNodeView', () => {
|
|
|
406
408
|
contentDOM={
|
|
407
409
|
disableContentDomMock
|
|
408
410
|
? jest.fn()
|
|
409
|
-
: (
|
|
411
|
+
: (table: HTMLElement | null) => {
|
|
410
412
|
const node = editorView.dom.getElementsByTagName('table')[0];
|
|
411
413
|
|
|
412
|
-
if (!
|
|
413
|
-
|
|
414
|
+
if (!table?.firstChild) {
|
|
415
|
+
table?.appendChild(node);
|
|
414
416
|
}
|
|
415
417
|
}
|
|
416
418
|
}
|
|
@@ -436,8 +438,8 @@ describe('TableRowNodeView', () => {
|
|
|
436
438
|
expect(sentinelBottom).toBeTruthy();
|
|
437
439
|
});
|
|
438
440
|
|
|
439
|
-
describe('updates sticky header
|
|
440
|
-
it('
|
|
441
|
+
describe('updates sticky header', () => {
|
|
442
|
+
it('does not update sticky header if trigger is sentinel top in confluence preview mode', () => {
|
|
441
443
|
renderTableComponent();
|
|
442
444
|
const sentinelTop = screen.getByTestId('sticky-sentinel-top');
|
|
443
445
|
|
|
@@ -451,7 +453,7 @@ describe('TableRowNodeView', () => {
|
|
|
451
453
|
expect(updateStickyState).not.toHaveBeenCalled();
|
|
452
454
|
});
|
|
453
455
|
|
|
454
|
-
it('
|
|
456
|
+
it('does not update sticky header if trigger is sentinel bottom in confluence preview mode', () => {
|
|
455
457
|
renderTableComponent();
|
|
456
458
|
const sentinelBottom = screen.getByTestId('sticky-sentinel-bottom');
|
|
457
459
|
triggerElementIntersect({
|
|
@@ -464,7 +466,7 @@ describe('TableRowNodeView', () => {
|
|
|
464
466
|
expect(updateStickyState).not.toHaveBeenCalled();
|
|
465
467
|
});
|
|
466
468
|
|
|
467
|
-
it('updates sticky header when
|
|
469
|
+
it('updates sticky header when sentinel is below scroll area', () => {
|
|
468
470
|
renderTableComponent();
|
|
469
471
|
const sentinelTop = screen.getByTestId('sticky-sentinel-top');
|
|
470
472
|
|
|
@@ -499,7 +501,7 @@ describe('TableRowNodeView', () => {
|
|
|
499
501
|
);
|
|
500
502
|
});
|
|
501
503
|
|
|
502
|
-
it('updates sticky header when
|
|
504
|
+
it('updates sticky header when sentinel is above scroll area', () => {
|
|
503
505
|
renderTableComponent();
|
|
504
506
|
const sentinelBottom = screen.getByTestId('sticky-sentinel-bottom');
|
|
505
507
|
|
|
@@ -7,7 +7,7 @@ import dispatchPasteEvent from '@atlaskit/editor-test-helpers/dispatch-paste-eve
|
|
|
7
7
|
import { insertText } from '@atlaskit/editor-test-helpers/transactions';
|
|
8
8
|
import { replaceRaf } from 'raf-stub';
|
|
9
9
|
|
|
10
|
-
import { handleCut } from '../../../event-handlers';
|
|
10
|
+
import { handleCut } from '../../../plugins/table/event-handlers';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
doc,
|
|
@@ -21,11 +21,8 @@ import {
|
|
|
21
21
|
th,
|
|
22
22
|
DocBuilder,
|
|
23
23
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
PluginConfig,
|
|
27
|
-
} from '../../../../../plugins/table/types';
|
|
28
|
-
import { pluginKey as tablePluginKey } from '../../../../../plugins/table/pm-plugins/plugin-key';
|
|
24
|
+
import { TablePluginState, PluginConfig } from '../../../plugins/table/types';
|
|
25
|
+
import { pluginKey as tablePluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
29
26
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
30
27
|
|
|
31
28
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/colgroup.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p, table, tr, td } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
2
2
|
import defaultSchema from '@atlaskit/editor-test-helpers/schema';
|
|
3
|
-
import { generateColgroup } from '../../../../pm-plugins/table-resizing/utils';
|
|
3
|
+
import { generateColgroup } from '../../../../plugins/table/pm-plugins/table-resizing/utils';
|
|
4
4
|
|
|
5
5
|
describe('table-resizing/colgroup', () => {
|
|
6
6
|
describe('#generateColgroup', () => {
|
package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/event-handlers.ts
RENAMED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
LightEditorPlugin,
|
|
4
4
|
Preset,
|
|
5
5
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
6
|
-
import { setResizeHandlePos } from '
|
|
6
|
+
import { setResizeHandlePos } from '../../../../plugins/table/pm-plugins/table-resizing/commands';
|
|
7
7
|
import {
|
|
8
8
|
doc,
|
|
9
9
|
table,
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
TABLE_ACTION,
|
|
20
20
|
} from '@atlaskit/editor-common/analytics';
|
|
21
21
|
|
|
22
|
-
import tablePlugin from '
|
|
23
|
-
import { pluginKey } from '../../../../pm-plugins/plugin-key';
|
|
22
|
+
import tablePlugin from '../../../../plugins/table';
|
|
23
|
+
import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
|
|
24
24
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
25
25
|
import panelPlugin from '@atlaskit/editor-core/src/plugins/panel';
|
|
26
26
|
import widthPlugin from '@atlaskit/editor-core/src/plugins/width';
|
|
@@ -23,9 +23,9 @@ import { uuid } from '@atlaskit/adf-schema';
|
|
|
23
23
|
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
24
24
|
import panelPlugin from '@atlaskit/editor-core/src/plugins/panel';
|
|
25
25
|
import codeBlockPlugin from '@atlaskit/editor-core/src/plugins/code-block';
|
|
26
|
-
import tablePlugin from '../../../
|
|
27
|
-
import { TablePluginState } from '../../../types';
|
|
28
|
-
import { pluginKey } from '../../../pm-plugins/plugin-key';
|
|
26
|
+
import tablePlugin from '../../../plugins/table';
|
|
27
|
+
import { TablePluginState } from '../../../plugins/table/types';
|
|
28
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
29
29
|
import { createEditorSelectionAPI } from '@atlaskit/editor-core/src/selection-api/api';
|
|
30
30
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
31
31
|
|