@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,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,11 +16,14 @@ import {
|
|
|
12
16
|
status,
|
|
13
17
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
14
18
|
import { EditorView } from 'prosemirror-view';
|
|
15
|
-
import { mentionResourceProvider } from '@atlaskit/util-data-test/mention-story-data';
|
|
16
19
|
import { sortByColumn } from '../../../plugins/table/commands/sort';
|
|
17
20
|
import { uuid } from '@atlaskit/adf-schema';
|
|
18
21
|
import { TableSortOrder as SortOrder } from '@atlaskit/adf-schema/steps';
|
|
19
22
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
23
|
+
import statusPlugin from '@atlaskit/editor-core/src/plugins/status';
|
|
24
|
+
import mentionsPlugin from '@atlaskit/editor-core/src/plugins/mentions';
|
|
25
|
+
import hyperlinkPlugin from '@atlaskit/editor-core/src/plugins/hyperlink';
|
|
26
|
+
import datePlugin from '@atlaskit/editor-core/src/plugins/date';
|
|
20
27
|
|
|
21
28
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
22
29
|
|
|
@@ -29,14 +36,13 @@ describe('Sort Table', () => {
|
|
|
29
36
|
uuid.setStatic(false);
|
|
30
37
|
});
|
|
31
38
|
|
|
32
|
-
const createEditor =
|
|
39
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
33
40
|
it('should test a basic table with heading', () => {
|
|
34
41
|
const { editorView } = createEditor({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
42
|
+
preset: new Preset<LightEditorPlugin>().add([
|
|
43
|
+
tablePlugin,
|
|
44
|
+
{ tableOptions: { allowHeaderRow: true } },
|
|
45
|
+
]),
|
|
40
46
|
doc: doc(
|
|
41
47
|
table()(
|
|
42
48
|
tr(th({})(p('Number{<>}'))),
|
|
@@ -62,11 +68,10 @@ describe('Sort Table', () => {
|
|
|
62
68
|
|
|
63
69
|
it('should test a basic table descending', () => {
|
|
64
70
|
const { editorView } = createEditor({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
71
|
+
preset: new Preset<LightEditorPlugin>().add([
|
|
72
|
+
tablePlugin,
|
|
73
|
+
{ tableOptions: { allowHeaderRow: true } },
|
|
74
|
+
]),
|
|
70
75
|
doc: doc(
|
|
71
76
|
table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
|
|
72
77
|
),
|
|
@@ -86,11 +91,10 @@ describe('Sort Table', () => {
|
|
|
86
91
|
|
|
87
92
|
it('should test a basic table ascending', () => {
|
|
88
93
|
const { editorView } = createEditor({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
+
preset: new Preset<LightEditorPlugin>().add([
|
|
95
|
+
tablePlugin,
|
|
96
|
+
{ tableOptions: { allowHeaderRow: true } },
|
|
97
|
+
]),
|
|
94
98
|
doc: doc(
|
|
95
99
|
table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
|
|
96
100
|
),
|
|
@@ -113,16 +117,12 @@ describe('Sort Table', () => {
|
|
|
113
117
|
|
|
114
118
|
beforeEach(() => {
|
|
115
119
|
({ editorView } = createEditor({
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
mentionProvider: Promise.resolve(mentionResourceProvider),
|
|
125
|
-
},
|
|
120
|
+
preset: new Preset<LightEditorPlugin>()
|
|
121
|
+
.add([tablePlugin, { tableOptions: { allowHeaderRow: true } }])
|
|
122
|
+
.add([statusPlugin, { menuDisabled: false }])
|
|
123
|
+
.add(mentionsPlugin)
|
|
124
|
+
.add(hyperlinkPlugin)
|
|
125
|
+
.add(datePlugin),
|
|
126
126
|
doc: doc(
|
|
127
127
|
table()(
|
|
128
128
|
tr(th({})(p('Mixed{<>}'))),
|
|
@@ -48,13 +48,13 @@ import {
|
|
|
48
48
|
toggleHeaderColumn,
|
|
49
49
|
toggleHeaderRow,
|
|
50
50
|
transformSliceToAddTableHeaders,
|
|
51
|
-
} from '../../commands';
|
|
52
|
-
import { splitCell } from '../../commands/split-cell';
|
|
53
|
-
import { wrapTableInExpand } from '../../commands/collapse';
|
|
54
|
-
import { handleCut } from '../../event-handlers';
|
|
55
|
-
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
56
|
-
import { pluginKey } from '../../pm-plugins/plugin-key';
|
|
57
|
-
import tablePlugin from '
|
|
51
|
+
} from '../../plugins/table/commands';
|
|
52
|
+
import { splitCell } from '../../plugins/table/commands/split-cell';
|
|
53
|
+
import { wrapTableInExpand } from '../../plugins/table/commands/collapse';
|
|
54
|
+
import { handleCut } from '../../plugins/table/event-handlers';
|
|
55
|
+
import { getPluginState } from '../../plugins/table/pm-plugins/plugin-factory';
|
|
56
|
+
import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
57
|
+
import tablePlugin from '../../plugins/table';
|
|
58
58
|
import panelPlugin from '@atlaskit/editor-core/src/plugins/panel';
|
|
59
59
|
import expandPlugin from '@atlaskit/editor-core/src/plugins/expand';
|
|
60
60
|
import extensionPlugin from '@atlaskit/editor-core/src/plugins/extension';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
it.skip('TODO; restore unit', () => {});
|
|
4
|
+
|
|
5
|
+
// import { _getCopyButtonTestSuite } from '../../../copy-button/__tests__/unit/_getCopyButtonTestSuite';
|
|
6
|
+
// import {
|
|
7
|
+
// doc,
|
|
8
|
+
// p,
|
|
9
|
+
// table,
|
|
10
|
+
// tr,
|
|
11
|
+
// td,
|
|
12
|
+
// } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
13
|
+
|
|
14
|
+
// _getCopyButtonTestSuite({
|
|
15
|
+
// nodeType: 'table',
|
|
16
|
+
// editorOptions: {
|
|
17
|
+
// allowTables: {
|
|
18
|
+
// advanced: true,
|
|
19
|
+
// },
|
|
20
|
+
// },
|
|
21
|
+
// doc: doc(table()(tr(td({})(p())), tr(td({})(p())), tr(td({})(p())))),
|
|
22
|
+
// });
|
|
@@ -49,14 +49,12 @@ const array = (...args: any): Node[] => args.map((i: any) => i(defaultSchema));
|
|
|
49
49
|
const fragment = (...args: any) =>
|
|
50
50
|
Fragment.from(args.map((i: any) => i(defaultSchema)));
|
|
51
51
|
|
|
52
|
-
const selectCell =
|
|
53
|
-
pos: number;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return tr.setSelection(new CellSelection($anchor, $anchor) as any);
|
|
59
|
-
};
|
|
52
|
+
const selectCell =
|
|
53
|
+
(cell: { pos: number; start: number; node: ProsemirrorNode }) =>
|
|
54
|
+
(tr: Transaction) => {
|
|
55
|
+
const $anchor = tr.doc.resolve(cell.pos);
|
|
56
|
+
return tr.setSelection(new CellSelection($anchor, $anchor) as any);
|
|
57
|
+
};
|
|
60
58
|
|
|
61
59
|
const copySelectionAndPasteAtPos = ({
|
|
62
60
|
editorView,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { MediaAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
import { TextSelection } from 'prosemirror-state';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createProsemirrorEditorFactory,
|
|
5
|
+
LightEditorPlugin,
|
|
6
|
+
Preset,
|
|
7
|
+
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
4
8
|
import {
|
|
5
9
|
doc,
|
|
6
10
|
table,
|
|
@@ -14,7 +18,6 @@ import {
|
|
|
14
18
|
mediaGroup,
|
|
15
19
|
p,
|
|
16
20
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
17
|
-
import { TablePluginState } from '../../plugins/table/types';
|
|
18
21
|
import {
|
|
19
22
|
handleMouseOver,
|
|
20
23
|
handleMouseMove,
|
|
@@ -24,25 +27,139 @@ import {
|
|
|
24
27
|
showInsertColumnButton,
|
|
25
28
|
addResizeHandleDecorations,
|
|
26
29
|
} from '../../plugins/table/commands';
|
|
30
|
+
import {
|
|
31
|
+
handleMouseOut,
|
|
32
|
+
handleMouseDown,
|
|
33
|
+
} from '../../plugins/table/event-handlers';
|
|
27
34
|
import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
35
|
+
import { TableCssClassName as ClassName } from '../../plugins/table/types';
|
|
28
36
|
import tablePlugin from '../../plugins/table-plugin';
|
|
37
|
+
import mediaPlugin from '@atlaskit/editor-core/src/plugins/media';
|
|
38
|
+
|
|
39
|
+
describe('table plugin: decorations', () => {
|
|
40
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
41
|
+
const editor = (doc: DocBuilder) =>
|
|
42
|
+
createEditor({
|
|
43
|
+
doc,
|
|
44
|
+
preset: new Preset<LightEditorPlugin>().add(tablePlugin),
|
|
45
|
+
pluginKey,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('#handleMouseDown', () => {
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
jest.resetAllMocks();
|
|
51
|
+
});
|
|
52
|
+
it('should return true & prevent default behaviour for table wrappers: pm-table-contianer', () => {
|
|
53
|
+
const { editorView } = editor(
|
|
54
|
+
doc(table()(tr(td({})(p())), tr(td({})(p())), tr(td({})(p())))),
|
|
55
|
+
);
|
|
56
|
+
const tableContainer = document.createElement('div');
|
|
57
|
+
tableContainer.className = 'pm-table-container';
|
|
58
|
+
const event = new MouseEvent('mousedown');
|
|
59
|
+
Object.defineProperty(event, 'target', { value: tableContainer });
|
|
60
|
+
const preventDefaultSpy = jest.spyOn(
|
|
61
|
+
MouseEvent.prototype,
|
|
62
|
+
'preventDefault',
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(handleMouseDown(editorView, event)).toEqual(true);
|
|
66
|
+
expect(preventDefaultSpy).toHaveBeenCalledTimes(1);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should return true & prevent default behaviour for table wrappers: pm-table-wrapper', () => {
|
|
70
|
+
const { editorView } = editor(
|
|
71
|
+
doc(table()(tr(td({})(p())), tr(td({})(p())), tr(td({})(p())))),
|
|
72
|
+
);
|
|
73
|
+
const tableContainer = document.createElement('div');
|
|
74
|
+
tableContainer.className = 'pm-table-wrapper';
|
|
75
|
+
const event = new MouseEvent('mousedown');
|
|
76
|
+
Object.defineProperty(event, 'target', { value: tableContainer });
|
|
77
|
+
const preventDefaultSpy = jest.spyOn(
|
|
78
|
+
MouseEvent.prototype,
|
|
79
|
+
'preventDefault',
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
expect(handleMouseDown(editorView, event)).toEqual(true);
|
|
83
|
+
expect(preventDefaultSpy).toHaveBeenCalledTimes(1);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should return false & not prevent default behaviour for editor content area: ak-editor-content-area', () => {
|
|
87
|
+
const { editorView } = editor(
|
|
88
|
+
doc(table()(tr(td({})(p())), tr(td({})(p())), tr(td({})(p())))),
|
|
89
|
+
);
|
|
90
|
+
const editorContentArea = document.createElement('div');
|
|
91
|
+
editorContentArea.className = 'ak-editor-content-area';
|
|
92
|
+
const event = new MouseEvent('mousedown');
|
|
93
|
+
Object.defineProperty(event, 'target', { value: editorContentArea });
|
|
94
|
+
const preventDefaultSpy = jest.spyOn(
|
|
95
|
+
MouseEvent.prototype,
|
|
96
|
+
'preventDefault',
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
expect(handleMouseDown(editorView, event)).toEqual(false);
|
|
100
|
+
expect(preventDefaultSpy).toHaveBeenCalledTimes(0);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('#handleMouseOut', () => {
|
|
105
|
+
describe('when the target is a resize handle column', () => {
|
|
106
|
+
it('should return true', () => {
|
|
107
|
+
const { editorView } = editor(
|
|
108
|
+
doc(table()(tr(tdCursor, tdEmpty), tr(td()(p('{o}')), tdEmpty))),
|
|
109
|
+
);
|
|
110
|
+
const firstCell = document.createElement('div');
|
|
111
|
+
firstCell.classList.add(ClassName.RESIZE_HANDLE_DECORATION);
|
|
112
|
+
|
|
113
|
+
const spy = jest
|
|
114
|
+
.spyOn(MouseEvent.prototype, 'target', 'get')
|
|
115
|
+
.mockReturnValue(firstCell);
|
|
116
|
+
|
|
117
|
+
const event = new MouseEvent('opa');
|
|
118
|
+
|
|
119
|
+
expect(handleMouseOut(editorView, event)).toEqual(true);
|
|
120
|
+
spy.mockRestore();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe('when the relatedTarget is a resize handle column too', () => {
|
|
125
|
+
it('should return false', () => {
|
|
126
|
+
const { editorView } = editor(
|
|
127
|
+
doc(table()(tr(tdCursor, tdEmpty), tr(td()(p('{o}')), tdEmpty))),
|
|
128
|
+
);
|
|
129
|
+
const firstCell = document.createElement('div');
|
|
130
|
+
firstCell.classList.add(ClassName.RESIZE_HANDLE_DECORATION);
|
|
131
|
+
const secondCell = document.createElement('div');
|
|
132
|
+
secondCell.classList.add(ClassName.RESIZE_HANDLE_DECORATION);
|
|
133
|
+
|
|
134
|
+
const spy = jest
|
|
135
|
+
.spyOn(MouseEvent.prototype, 'target', 'get')
|
|
136
|
+
.mockReturnValue(secondCell);
|
|
137
|
+
|
|
138
|
+
const event = new MouseEvent('opa', {
|
|
139
|
+
relatedTarget: firstCell,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
expect(handleMouseOut(editorView, event)).toEqual(false);
|
|
143
|
+
spy.mockRestore();
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
});
|
|
29
148
|
|
|
30
149
|
describe('table event handlers', () => {
|
|
31
|
-
const createEditor =
|
|
150
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
32
151
|
const fakeGetEditorFeatureFlags = () => ({});
|
|
33
152
|
const editor = (doc: DocBuilder) =>
|
|
34
153
|
createEditor({
|
|
35
154
|
doc,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
155
|
+
attachTo: document.body,
|
|
156
|
+
preset: new Preset<LightEditorPlugin>().add(tablePlugin).add([
|
|
157
|
+
mediaPlugin,
|
|
158
|
+
{
|
|
39
159
|
allowMediaSingle: true,
|
|
40
160
|
allowMediaGroup: true,
|
|
41
161
|
},
|
|
42
|
-
|
|
43
|
-
__plugins: [tablePlugin()],
|
|
44
|
-
},
|
|
45
|
-
},
|
|
162
|
+
]),
|
|
46
163
|
pluginKey,
|
|
47
164
|
});
|
|
48
165
|
|
|
@@ -160,7 +277,6 @@ describe('table event handlers', () => {
|
|
|
160
277
|
collection: testCollectionName,
|
|
161
278
|
};
|
|
162
279
|
const tableAttrs = { localId: 'table' };
|
|
163
|
-
|
|
164
280
|
const { editorView } = editor(
|
|
165
281
|
doc(
|
|
166
282
|
table(tableAttrs)(
|
|
@@ -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,
|
|
@@ -8,21 +12,17 @@ import {
|
|
|
8
12
|
th,
|
|
9
13
|
DocBuilder,
|
|
10
14
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
11
|
-
import {
|
|
15
|
+
import { PluginConfig } from '../../plugins/table/types';
|
|
12
16
|
|
|
13
17
|
import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
14
18
|
import tablePlugin from '../../plugins/table-plugin';
|
|
19
|
+
|
|
15
20
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
16
21
|
|
|
17
22
|
describe('fix tables', () => {
|
|
18
|
-
const createEditor =
|
|
23
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
19
24
|
// @ts-ignore
|
|
20
25
|
global['fetch'] = jest.fn();
|
|
21
|
-
const createAnalyticsEvent = jest.fn();
|
|
22
|
-
|
|
23
|
-
afterEach(() => {
|
|
24
|
-
createAnalyticsEvent.mockReset();
|
|
25
|
-
});
|
|
26
26
|
|
|
27
27
|
const editor = (doc: DocBuilder) => {
|
|
28
28
|
const tableOptions = {
|
|
@@ -35,18 +35,12 @@ describe('fix tables', () => {
|
|
|
35
35
|
|
|
36
36
|
return createEditor({
|
|
37
37
|
doc,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}),
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
allowAnalyticsGASV3: true,
|
|
47
|
-
},
|
|
38
|
+
attachTo: document.body,
|
|
39
|
+
preset: new Preset<LightEditorPlugin>().add([
|
|
40
|
+
tablePlugin,
|
|
41
|
+
{ tableOptions },
|
|
42
|
+
]),
|
|
48
43
|
pluginKey: tablePluginKey,
|
|
49
|
-
createAnalyticsEvent,
|
|
50
44
|
});
|
|
51
45
|
};
|
|
52
46
|
|
|
@@ -92,7 +86,7 @@ describe('fix tables', () => {
|
|
|
92
86
|
const TABLE_LOCAL_ID = 'test-table-2';
|
|
93
87
|
const SPAN_VALUE = -2;
|
|
94
88
|
it('should fire v3 analytics', () => {
|
|
95
|
-
editor(
|
|
89
|
+
const { dispatchAnalyticsEvent } = editor(
|
|
96
90
|
doc(
|
|
97
91
|
table({ localId: TABLE_LOCAL_ID })(
|
|
98
92
|
tr(
|
|
@@ -105,7 +99,7 @@ describe('fix tables', () => {
|
|
|
105
99
|
),
|
|
106
100
|
);
|
|
107
101
|
|
|
108
|
-
expect(
|
|
102
|
+
expect(dispatchAnalyticsEvent).toHaveBeenCalledWith(
|
|
109
103
|
expect.objectContaining({
|
|
110
104
|
action: 'invalidDocumentEncountered',
|
|
111
105
|
actionSubject: 'editor',
|
|
@@ -125,7 +119,7 @@ describe('fix tables', () => {
|
|
|
125
119
|
const TABLE_LOCAL_ID = 'test-table-3';
|
|
126
120
|
const SPAN_VALUE = -2;
|
|
127
121
|
it('should fire v3 analytics', () => {
|
|
128
|
-
editor(
|
|
122
|
+
const { dispatchAnalyticsEvent } = editor(
|
|
129
123
|
doc(
|
|
130
124
|
table({ localId: TABLE_LOCAL_ID })(
|
|
131
125
|
tr(
|
|
@@ -138,7 +132,7 @@ describe('fix tables', () => {
|
|
|
138
132
|
),
|
|
139
133
|
);
|
|
140
134
|
|
|
141
|
-
expect(
|
|
135
|
+
expect(dispatchAnalyticsEvent).toHaveBeenCalledWith(
|
|
142
136
|
expect.objectContaining({
|
|
143
137
|
action: 'invalidDocumentEncountered',
|
|
144
138
|
actionSubject: 'editor',
|
|
@@ -17,15 +17,16 @@ import {
|
|
|
17
17
|
Preset,
|
|
18
18
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
19
19
|
|
|
20
|
-
import tablePlugin from '
|
|
20
|
+
import tablePlugin from '../../plugins/table';
|
|
21
21
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
22
|
-
import { getToolbarConfig } from '../../toolbar';
|
|
23
|
-
import { setTableRef, setEditorFocus } from '../../commands';
|
|
22
|
+
import { getToolbarConfig } from '../../plugins/table/toolbar';
|
|
23
|
+
import { setTableRef, setEditorFocus } from '../../plugins/table/commands';
|
|
24
24
|
import extensionPlugin from '@atlaskit/editor-core/src/plugins/extension';
|
|
25
25
|
import dataConsumerPlugin from '@atlaskit/editor-core/src/plugins/data-consumer';
|
|
26
26
|
import type {
|
|
27
27
|
FloatingToolbarItem,
|
|
28
28
|
FloatingToolbarButton,
|
|
29
|
+
GetEditorFeatureFlags,
|
|
29
30
|
} from '@atlaskit/editor-common/types';
|
|
30
31
|
|
|
31
32
|
const formatMessage: (t: { id: string }) => string = (message) =>
|
|
@@ -36,11 +37,15 @@ describe('getToolbarConfig', () => {
|
|
|
36
37
|
const editorAnalyticsAPIFake: EditorAnalyticsAPI = {
|
|
37
38
|
attachAnalyticsEvent: jest.fn().mockReturnValue(() => jest.fn()),
|
|
38
39
|
};
|
|
40
|
+
const getEditorFeatureFlags: GetEditorFeatureFlags = jest
|
|
41
|
+
.fn()
|
|
42
|
+
.mockReturnValue({});
|
|
39
43
|
const getButton = (editorView: EditorView) => {
|
|
40
44
|
const { state } = editorView;
|
|
41
45
|
const config = getToolbarConfig(
|
|
42
46
|
getEditorContainerWidth,
|
|
43
47
|
editorAnalyticsAPIFake,
|
|
48
|
+
getEditorFeatureFlags,
|
|
44
49
|
)({})(state, { formatMessage } as any, {} as any)!;
|
|
45
50
|
//
|
|
46
51
|
expect(config).not.toBeUndefined();
|
|
@@ -60,11 +65,6 @@ describe('getToolbarConfig', () => {
|
|
|
60
65
|
return button;
|
|
61
66
|
};
|
|
62
67
|
|
|
63
|
-
/**
|
|
64
|
-
* Use `createEditorFactory` here to enable referentiality as
|
|
65
|
-
* `createProsemirrorEditorFactory` has some issues with correctly mimicking
|
|
66
|
-
* old state for the unique localId plugin
|
|
67
|
-
*/
|
|
68
68
|
const createEditorFn = createProsemirrorEditorFactory();
|
|
69
69
|
const createEditor = (doc: DocBuilder) => {
|
|
70
70
|
const output = createEditorFn({
|
|
@@ -26,11 +26,7 @@ import {
|
|
|
26
26
|
hoverRows,
|
|
27
27
|
hoverTable,
|
|
28
28
|
} from '../../plugins/table/commands';
|
|
29
|
-
import {
|
|
30
|
-
TableDecorations,
|
|
31
|
-
TableCssClassName as ClassName,
|
|
32
|
-
TablePluginState,
|
|
33
|
-
} from '../../plugins/table/types';
|
|
29
|
+
import { TableDecorations, TablePluginState } from '../../plugins/table/types';
|
|
34
30
|
import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
35
31
|
import { getDecorations } from '../../plugins/table/pm-plugins/decorations/plugin';
|
|
36
32
|
import tablePlugin from '../../plugins/table-plugin';
|
|
@@ -130,51 +126,6 @@ describe('table hover selection plugin', () => {
|
|
|
130
126
|
// selection spans 2 cells in the selected column (because we have 2 rows in the table)
|
|
131
127
|
expect(decos).toHaveLength(2);
|
|
132
128
|
});
|
|
133
|
-
|
|
134
|
-
it('should apply the hovered column class', () => {
|
|
135
|
-
hoverColumns([column])(editorView.state, editorView.dispatch);
|
|
136
|
-
|
|
137
|
-
const decos = getTableDecorations(
|
|
138
|
-
editorView,
|
|
139
|
-
getCellsInColumn(column)(editorView.state.selection)!,
|
|
140
|
-
TableDecorations.ALL_CONTROLS_HOVER,
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
decos.forEach((deco) => {
|
|
144
|
-
expect(deco).toEqual(
|
|
145
|
-
expect.objectContaining({
|
|
146
|
-
type: expect.objectContaining({
|
|
147
|
-
attrs: expect.objectContaining({
|
|
148
|
-
class: expect.stringContaining(ClassName.HOVERED_COLUMN),
|
|
149
|
-
}),
|
|
150
|
-
}),
|
|
151
|
-
}),
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('can apply the danger class to the decoration', () => {
|
|
157
|
-
hoverColumns([column], true)(editorView.state, editorView.dispatch);
|
|
158
|
-
|
|
159
|
-
const decos = getTableDecorations(
|
|
160
|
-
editorView,
|
|
161
|
-
getCellsInColumn(column)(editorView.state.selection)!,
|
|
162
|
-
TableDecorations.ALL_CONTROLS_HOVER,
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
expect(decos).toHaveLength(2);
|
|
166
|
-
const expected = [
|
|
167
|
-
ClassName.HOVERED_CELL_IN_DANGER,
|
|
168
|
-
ClassName.HOVERED_COLUMN,
|
|
169
|
-
];
|
|
170
|
-
|
|
171
|
-
decos.forEach((deco) => {
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
expect(deco.type.attrs.class.split(' ')).toEqual(
|
|
174
|
-
expect.arrayContaining(expected),
|
|
175
|
-
);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
129
|
},
|
|
179
130
|
);
|
|
180
131
|
});
|
|
@@ -224,22 +175,6 @@ describe('table hover selection plugin', () => {
|
|
|
224
175
|
),
|
|
225
176
|
).toHaveLength(2);
|
|
226
177
|
});
|
|
227
|
-
|
|
228
|
-
it('can apply the danger class to the decoration', () => {
|
|
229
|
-
hoverRows([row], true)(editorView.state, editorView.dispatch);
|
|
230
|
-
const cells = getCellsInRow(row)(editorView.state.selection)!;
|
|
231
|
-
const decos = getTableDecorations(
|
|
232
|
-
editorView,
|
|
233
|
-
cells,
|
|
234
|
-
TableDecorations.ALL_CONTROLS_HOVER,
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
expect(decos).toHaveLength(2);
|
|
238
|
-
decos.forEach((deco) => {
|
|
239
|
-
// @ts-ignore
|
|
240
|
-
expect(deco.type.attrs.class.split(' ')).toContain('danger');
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
178
|
});
|
|
244
179
|
});
|
|
245
180
|
});
|
|
@@ -72,7 +72,7 @@ describe.skip('TableView', () => {
|
|
|
72
72
|
// create the NodeView
|
|
73
73
|
const node = table()(tr(tdCursor, tdEmpty, tdEmpty))(defaultSchema);
|
|
74
74
|
const { editorView, portalProviderAPI } = editor(doc(p()));
|
|
75
|
-
const eventDispatcher =
|
|
75
|
+
const eventDispatcher = { on: () => {} } as unknown as EventDispatcher;
|
|
76
76
|
const tableView = new TableView({
|
|
77
77
|
node,
|
|
78
78
|
allowColumnResizing: false,
|
|
@@ -450,8 +450,8 @@ describe('table plugin', () => {
|
|
|
450
450
|
);
|
|
451
451
|
|
|
452
452
|
editorView.dispatch(selectColumn(column)(editorView.state.tr));
|
|
453
|
-
const selection =
|
|
454
|
-
.selection as any
|
|
453
|
+
const selection = editorView.state
|
|
454
|
+
.selection as any as CellSelection;
|
|
455
455
|
const tableNode = selection.$anchorCell.node(-1);
|
|
456
456
|
const map = TableMap.get(tableNode);
|
|
457
457
|
const start = selection.$anchorCell.start(-1);
|
|
@@ -476,8 +476,8 @@ describe('table plugin', () => {
|
|
|
476
476
|
);
|
|
477
477
|
|
|
478
478
|
editorView.dispatch(selectRow(row)(editorView.state.tr));
|
|
479
|
-
const selection =
|
|
480
|
-
.selection as any
|
|
479
|
+
const selection = editorView.state
|
|
480
|
+
.selection as any as CellSelection;
|
|
481
481
|
const anchor = selection.$anchorCell.index(-1);
|
|
482
482
|
const head = selection.$headCell.index(-1);
|
|
483
483
|
expect(anchor).toEqual(row);
|
|
@@ -496,7 +496,7 @@ describe('table plugin', () => {
|
|
|
496
496
|
);
|
|
497
497
|
|
|
498
498
|
editorView.dispatch(selectTable(editorView.state.tr));
|
|
499
|
-
const selection =
|
|
499
|
+
const selection = editorView.state.selection as any as CellSelection;
|
|
500
500
|
expect(selection.isRowSelection()).toEqual(true);
|
|
501
501
|
expect(selection.isColSelection()).toEqual(true);
|
|
502
502
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MockIntersectionObserver } from '@atlaskit/editor-test-helpers/mock-intersection-observer';
|
|
2
2
|
|
|
3
|
-
import { OverflowShadowsObserver } from '../../../nodeviews/OverflowShadowsObserver';
|
|
4
|
-
import { ShadowEvent } from '../../../types';
|
|
3
|
+
import { OverflowShadowsObserver } from '../../../plugins/table/nodeviews/OverflowShadowsObserver';
|
|
4
|
+
import { ShadowEvent } from '../../../plugins/table/types';
|
|
5
5
|
|
|
6
6
|
describe('OverflowShadowsObserver', () => {
|
|
7
7
|
let table: HTMLTableElement;
|