@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
|
@@ -8,139 +8,138 @@ import { CellAttributes } from '@atlaskit/adf-schema';
|
|
|
8
8
|
import { removeEmptyColumns } from './merge';
|
|
9
9
|
import { setMeta } from './metadata';
|
|
10
10
|
|
|
11
|
-
export const deleteRows =
|
|
12
|
-
rect: Rect,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
export const deleteRows =
|
|
12
|
+
(rect: Rect, isHeaderRowRequired: boolean = false) =>
|
|
13
|
+
(tr: Transaction): Transaction => {
|
|
14
|
+
const table = findTable(tr.selection);
|
|
15
|
+
if (!table) {
|
|
16
|
+
return tr;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const rowsToDelete: number[] = [];
|
|
20
|
+
|
|
21
|
+
const map = TableMap.get(table.node);
|
|
22
|
+
|
|
23
|
+
for (let i = rect.top; i < rect.bottom; i++) {
|
|
24
|
+
// skip header row if its required
|
|
25
|
+
if (isHeaderRowRequired) {
|
|
26
|
+
const cell = table.node.nodeAt(map.map[i * map.width]);
|
|
27
|
+
if (cell && cell.type !== cell.type.schema.nodes.tableHeader) {
|
|
28
|
+
rowsToDelete.push(i);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
29
31
|
rowsToDelete.push(i);
|
|
30
32
|
}
|
|
31
|
-
} else {
|
|
32
|
-
rowsToDelete.push(i);
|
|
33
33
|
}
|
|
34
|
-
}
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (!rowsToDelete.length) {
|
|
36
|
+
return tr;
|
|
37
|
+
}
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const rows: PMNode[] = [];
|
|
40
|
+
const seen: { [key: string]: boolean } = {};
|
|
41
|
+
const deletedCells: { [key: string]: boolean } = {};
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
44
|
+
const rowCells: PMNode[] = [];
|
|
45
|
+
const row = table.node.child(rowIndex);
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
47
|
+
for (let colIndex = 0; colIndex < map.width; colIndex++) {
|
|
48
|
+
const cellPos = map.map[rowIndex * map.width + colIndex];
|
|
49
|
+
const cell = table.node.nodeAt(cellPos);
|
|
50
|
+
if (!cell) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const cellsInRow = map.cellsInRect({
|
|
54
|
+
left: 0,
|
|
55
|
+
top: rowIndex,
|
|
56
|
+
right: map.width,
|
|
57
|
+
bottom: rowIndex + 1,
|
|
58
|
+
});
|
|
59
|
+
if (rowsToDelete.indexOf(rowIndex) === -1 && !seen[cellPos]) {
|
|
60
|
+
// decrement rowspans for row-spanning cells that overlap deleted rows
|
|
61
|
+
if (cellsInRow.indexOf(cellPos) > -1) {
|
|
62
|
+
let overlappingRows = 0;
|
|
63
|
+
rowsToDelete.forEach((rowIndexToDelete) => {
|
|
64
|
+
if (
|
|
65
|
+
rowIndex < rowIndexToDelete &&
|
|
66
|
+
cell.attrs.rowspan + rowIndex - 1 >= rowIndexToDelete
|
|
67
|
+
) {
|
|
68
|
+
overlappingRows += 1;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
if (overlappingRows > 0) {
|
|
72
|
+
const newCell = cell.type.createChecked(
|
|
73
|
+
{
|
|
74
|
+
...cell.attrs,
|
|
75
|
+
rowspan: cell.attrs.rowspan - overlappingRows,
|
|
76
|
+
},
|
|
77
|
+
cell.content,
|
|
78
|
+
cell.marks,
|
|
79
|
+
);
|
|
80
|
+
rowCells.push(newCell);
|
|
81
|
+
seen[cellPos] = true;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
} else if (deletedCells[cellPos]) {
|
|
85
|
+
// if we're removing a row-spanning cell, we need to add missing cells to rows below
|
|
86
|
+
const attrs: CellAttributes = {
|
|
87
|
+
...cell.attrs,
|
|
88
|
+
colspan: 1,
|
|
89
|
+
rowspan: 1,
|
|
90
|
+
};
|
|
91
|
+
if (cell.attrs.colwidth) {
|
|
92
|
+
const pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
|
|
93
|
+
attrs.colwidth = cell.attrs.colwidth.slice().splice(pos, 1);
|
|
70
94
|
}
|
|
71
|
-
});
|
|
72
|
-
if (overlappingRows > 0) {
|
|
73
95
|
const newCell = cell.type.createChecked(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
rowspan: cell.attrs.rowspan - overlappingRows,
|
|
77
|
-
},
|
|
78
|
-
cell.content,
|
|
96
|
+
attrs,
|
|
97
|
+
cell.type.schema.nodes.paragraph.createChecked(),
|
|
79
98
|
cell.marks,
|
|
80
99
|
);
|
|
81
100
|
rowCells.push(newCell);
|
|
82
|
-
seen[cellPos] = true;
|
|
83
101
|
continue;
|
|
84
102
|
}
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
rowspan: 1,
|
|
91
|
-
};
|
|
92
|
-
if (cell.attrs.colwidth) {
|
|
93
|
-
const pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
|
|
94
|
-
attrs.colwidth = cell.attrs.colwidth.slice().splice(pos, 1);
|
|
103
|
+
|
|
104
|
+
// normal cells that we want to keep
|
|
105
|
+
if (!seen[cellPos]) {
|
|
106
|
+
seen[cellPos] = true;
|
|
107
|
+
rowCells.push(cell);
|
|
95
108
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
cell.type.schema.nodes.paragraph.createChecked(),
|
|
99
|
-
cell.marks,
|
|
100
|
-
);
|
|
101
|
-
rowCells.push(newCell);
|
|
102
|
-
continue;
|
|
109
|
+
} else if (cellsInRow.indexOf(cellPos) > -1) {
|
|
110
|
+
deletedCells[cellPos] = true;
|
|
103
111
|
}
|
|
112
|
+
}
|
|
104
113
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
seen[cellPos] = true;
|
|
108
|
-
rowCells.push(cell);
|
|
109
|
-
}
|
|
110
|
-
} else if (cellsInRow.indexOf(cellPos) > -1) {
|
|
111
|
-
deletedCells[cellPos] = true;
|
|
114
|
+
if (rowCells.length) {
|
|
115
|
+
rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
if (
|
|
116
|
-
|
|
119
|
+
if (!rows.length) {
|
|
120
|
+
return setMeta({ type: 'DELETE_ROWS', problem: 'EMPTY_TABLE' })(tr);
|
|
117
121
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
|
|
123
|
+
const newTable = table.node.type.createChecked(
|
|
124
|
+
table.node.attrs,
|
|
125
|
+
rows,
|
|
126
|
+
table.node.marks,
|
|
127
|
+
);
|
|
128
|
+
const fixedTable = removeEmptyColumns(newTable);
|
|
129
|
+
if (fixedTable === null) {
|
|
130
|
+
return setMeta({ type: 'DELETE_ROWS', problem: 'REMOVE_EMPTY_COLUMNS' })(
|
|
131
|
+
tr,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
const cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
135
|
+
|
|
136
|
+
return setMeta({ type: 'DELETE_ROWS' })(
|
|
137
|
+
tr
|
|
138
|
+
.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
139
|
+
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
140
|
+
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos))),
|
|
133
141
|
);
|
|
134
|
-
}
|
|
135
|
-
const cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
136
|
-
|
|
137
|
-
return setMeta({ type: 'DELETE_ROWS' })(
|
|
138
|
-
tr
|
|
139
|
-
.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
140
|
-
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
141
|
-
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos))),
|
|
142
|
-
);
|
|
143
|
-
};
|
|
142
|
+
};
|
|
144
143
|
|
|
145
144
|
function getNextCursorPos(table: PMNode, deletedRows: number[]): number {
|
|
146
145
|
const minRow = Math.min(...deletedRows);
|
|
@@ -9,9 +9,8 @@ import {
|
|
|
9
9
|
akEditorWideLayoutWidth,
|
|
10
10
|
} from '@atlaskit/editor-shared-styles';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { sendLogs } from '../todo-stubs';
|
|
12
|
+
import { sendLogs } from '@atlaskit/editor-common/utils';
|
|
13
|
+
|
|
15
14
|
import {
|
|
16
15
|
calculateColumnWidth,
|
|
17
16
|
contentWidth,
|
|
@@ -24,12 +24,12 @@ export type TableMetaData =
|
|
|
24
24
|
problem?: TableProblems;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export const setMeta =
|
|
28
|
-
|
|
29
|
-
): Transaction => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
27
|
+
export const setMeta =
|
|
28
|
+
(meta: TableMetaData) =>
|
|
29
|
+
(tr: Transaction): Transaction => {
|
|
30
|
+
if ('problem' in meta) {
|
|
31
|
+
// Send analytics event whenever we encounter with a problem
|
|
32
|
+
fireAnalytics(meta);
|
|
33
|
+
}
|
|
34
|
+
return tr.setMeta(pluginKey, meta);
|
|
35
|
+
};
|
|
@@ -167,7 +167,6 @@ export class FloatingContextualButtonInner extends React.Component<
|
|
|
167
167
|
this.props.stickyHeader !== nextProps.stickyHeader
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
|
-
// TODO: restore
|
|
171
170
|
private handleClick = () => {
|
|
172
171
|
const { state, dispatch } = this.props.editorView;
|
|
173
172
|
// Clicking outside the dropdown handles toggling the menu closed
|
|
@@ -29,9 +29,7 @@ import { closestElement } from '@atlaskit/editor-common/utils';
|
|
|
29
29
|
|
|
30
30
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
31
31
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
32
|
-
// import { DropdownItem } from '../../../block-type/ui/ToolbarBlockType';
|
|
33
32
|
|
|
34
|
-
// TODO ED-15449 - unstub type?
|
|
35
33
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
36
34
|
type DropdownItem = MenuItem & {
|
|
37
35
|
value: {
|
|
@@ -365,20 +363,27 @@ export class ContextualMenu extends Component<
|
|
|
365
363
|
this.toggleOpen();
|
|
366
364
|
break;
|
|
367
365
|
case 'merge':
|
|
368
|
-
mergeCellsWithAnalytics(editorAnalyticsAPI)(
|
|
366
|
+
mergeCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU)(
|
|
367
|
+
state,
|
|
368
|
+
dispatch,
|
|
369
|
+
);
|
|
369
370
|
this.toggleOpen();
|
|
370
371
|
break;
|
|
371
372
|
case 'split':
|
|
372
|
-
splitCellWithAnalytics(editorAnalyticsAPI)(
|
|
373
|
+
splitCellWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU)(
|
|
374
|
+
state,
|
|
375
|
+
dispatch,
|
|
376
|
+
);
|
|
373
377
|
this.toggleOpen();
|
|
374
378
|
break;
|
|
375
379
|
case 'distribute_columns':
|
|
376
|
-
const newResizeStateWithAnalytics =
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
const newResizeStateWithAnalytics =
|
|
381
|
+
getNewResizeStateFromSelectedColumns(
|
|
382
|
+
selectionRect,
|
|
383
|
+
state,
|
|
384
|
+
editorView.domAtPos.bind(editorView),
|
|
385
|
+
getEditorContainerWidth,
|
|
386
|
+
);
|
|
382
387
|
|
|
383
388
|
if (newResizeStateWithAnalytics) {
|
|
384
389
|
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(
|
|
@@ -511,12 +516,11 @@ export class ContextualMenu extends Component<
|
|
|
511
516
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
512
517
|
const { targetCellPosition } = getPluginState(editorView.state);
|
|
513
518
|
const { state, dispatch } = editorView;
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
);
|
|
519
|
+
setColorWithAnalytics(editorAnalyticsAPI)(
|
|
520
|
+
INPUT_METHOD.CONTEXT_MENU,
|
|
521
|
+
color,
|
|
522
|
+
targetCellPosition,
|
|
523
|
+
)(state, dispatch);
|
|
520
524
|
this.toggleOpen();
|
|
521
525
|
};
|
|
522
526
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
1
|
+
import React, { Component, SyntheticEvent } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Selection } from 'prosemirror-state';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -12,7 +12,6 @@ import { createPortal } from 'react-dom';
|
|
|
12
12
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
13
13
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
14
14
|
|
|
15
|
-
// import { closestElement } from '../../../../utils/dom';
|
|
16
15
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
17
16
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
17
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
|
|
@@ -264,7 +263,8 @@ class FloatingDeleteButton extends Component<Props, State> {
|
|
|
264
263
|
* @private
|
|
265
264
|
* @memberof FloatingDeleteButton
|
|
266
265
|
*/
|
|
267
|
-
private handleClick = () => {
|
|
266
|
+
private handleClick = (event: SyntheticEvent) => {
|
|
267
|
+
event.preventDefault();
|
|
268
268
|
const { editorAnalyticsAPI } = this.props;
|
|
269
269
|
let { state, dispatch } = this.props.editorView;
|
|
270
270
|
const {
|
|
@@ -10,7 +10,6 @@ import { WrappedComponentProps, injectIntl } from 'react-intl-next';
|
|
|
10
10
|
|
|
11
11
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
12
12
|
|
|
13
|
-
// import { closestElement } from '../../../../utils/dom';
|
|
14
13
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
15
14
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
15
|
import {
|
|
@@ -203,11 +202,8 @@ export class FloatingInsertButton extends React.Component<
|
|
|
203
202
|
}
|
|
204
203
|
|
|
205
204
|
private getCellPosition(type: 'column' | 'row'): number | null {
|
|
206
|
-
const {
|
|
207
|
-
|
|
208
|
-
insertColumnButtonIndex,
|
|
209
|
-
insertRowButtonIndex,
|
|
210
|
-
} = this.props;
|
|
205
|
+
const { tableNode, insertColumnButtonIndex, insertRowButtonIndex } =
|
|
206
|
+
this.props;
|
|
211
207
|
const tableMap = TableMap.get(tableNode!);
|
|
212
208
|
|
|
213
209
|
if (type === 'column') {
|
|
@@ -107,8 +107,7 @@ class LayoutButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
renderSticky(button: JSX.Element, targetRef: Node, tableRef: Node) {
|
|
110
|
-
|
|
111
|
-
const title = 'TODO MISSING TITLE';
|
|
110
|
+
const title = this.getTitle();
|
|
112
111
|
|
|
113
112
|
if (
|
|
114
113
|
!(targetRef instanceof HTMLElement) ||
|
|
@@ -135,19 +134,14 @@ class LayoutButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
renderPopup(button: JSX.Element) {
|
|
138
|
-
const {
|
|
139
|
-
|
|
140
|
-
boundariesElement,
|
|
141
|
-
scrollableElement,
|
|
142
|
-
targetRef,
|
|
143
|
-
} = this.props;
|
|
137
|
+
const { mountPoint, boundariesElement, scrollableElement, targetRef } =
|
|
138
|
+
this.props;
|
|
144
139
|
|
|
145
140
|
if (!targetRef) {
|
|
146
141
|
return null;
|
|
147
142
|
}
|
|
148
143
|
|
|
149
|
-
|
|
150
|
-
const title = 'TODO MISSING TITLE';
|
|
144
|
+
const title = this.getTitle();
|
|
151
145
|
|
|
152
146
|
return (
|
|
153
147
|
<Popup
|
|
@@ -333,9 +333,7 @@ export const tableStyles = (props: ThemeProps) => css`
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
${props.featureFlags?.stickyHeadersOptimization ? sentinelStyles : ''}
|
|
336
|
-
${OverflowShadow(
|
|
337
|
-
props,
|
|
338
|
-
)}
|
|
336
|
+
${OverflowShadow(props)}
|
|
339
337
|
|
|
340
338
|
.${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
|
|
341
339
|
height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts
|
|
@@ -33,9 +33,8 @@ export function getSelectedCellInfo(selection: Selection) {
|
|
|
33
33
|
let verticalCells = 1;
|
|
34
34
|
let totalCells = 1;
|
|
35
35
|
|
|
36
|
-
const { table, map, totalRowCount, totalColumnCount } =
|
|
37
|
-
selection
|
|
38
|
-
);
|
|
36
|
+
const { table, map, totalRowCount, totalColumnCount } =
|
|
37
|
+
getSelectedTableInfo(selection);
|
|
39
38
|
|
|
40
39
|
if (table && map) {
|
|
41
40
|
const rect = getSelectionRect(selection);
|
|
@@ -55,27 +54,27 @@ export function getSelectedCellInfo(selection: Selection) {
|
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
export const withEditorAnalyticsAPI =
|
|
59
|
-
payload: AnalyticsEventPayload | AnalyticsEventPayloadCallback
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
): HigherOrderCommand => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
export const withEditorAnalyticsAPI =
|
|
58
|
+
(payload: AnalyticsEventPayload | AnalyticsEventPayloadCallback) =>
|
|
59
|
+
(
|
|
60
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
61
|
+
): HigherOrderCommand => {
|
|
62
|
+
return (command) => (state, dispatch, view) =>
|
|
63
|
+
command(
|
|
64
|
+
state,
|
|
65
|
+
(tr) => {
|
|
66
|
+
const dynamicPayload =
|
|
67
|
+
payload instanceof Function ? payload(state) : payload;
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
if (dynamicPayload) {
|
|
70
|
+
editorAnalyticsAPI?.attachAnalyticsEvent(dynamicPayload)(tr);
|
|
71
|
+
}
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
73
|
+
if (dispatch) {
|
|
74
|
+
dispatch(tr);
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
},
|
|
78
|
+
view,
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -12,7 +12,6 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
|
12
12
|
|
|
13
13
|
import { CellAttributes } from '@atlaskit/adf-schema';
|
|
14
14
|
|
|
15
|
-
// import { nonNullable } from '@atlaskit/editor-core/src/utils';
|
|
16
15
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
17
16
|
import {
|
|
18
17
|
Cell,
|
|
@@ -61,10 +60,49 @@ export const createCellHoverDecoration = (
|
|
|
61
60
|
export const createControlsHoverDecoration = (
|
|
62
61
|
cells: Cell[],
|
|
63
62
|
type: 'row' | 'column' | 'table',
|
|
63
|
+
tr: Transaction | ReadonlyTransaction,
|
|
64
64
|
danger?: boolean,
|
|
65
65
|
selected?: boolean,
|
|
66
|
-
): Decoration[] =>
|
|
67
|
-
|
|
66
|
+
): Decoration[] => {
|
|
67
|
+
const table = findTable(tr.selection);
|
|
68
|
+
if (!table) {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const map = TableMap.get(table.node);
|
|
73
|
+
const [min, max] = cells.reduce<[number | null, number | null]>(
|
|
74
|
+
([min, max], cell) => {
|
|
75
|
+
if (min === null || cell.pos < min) {
|
|
76
|
+
min = cell.pos;
|
|
77
|
+
}
|
|
78
|
+
if (max === null || cell.pos > max) {
|
|
79
|
+
max = cell.pos;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return [min, max];
|
|
83
|
+
},
|
|
84
|
+
[null, null],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
if (min === null || max === null) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let updatedCells: number[] = cells.map((x) => x.pos);
|
|
92
|
+
|
|
93
|
+
// ED-15246 fixed trello card table overflow issue
|
|
94
|
+
// If columns / rows have been merged the hovered selection is different to the actual selection
|
|
95
|
+
// So If the table cells are in danger we want to create a "rectangle" selection
|
|
96
|
+
// to match the "clicked" selection
|
|
97
|
+
|
|
98
|
+
if (danger) {
|
|
99
|
+
const rect = map.rectBetween(min - table.start, max - table.start);
|
|
100
|
+
updatedCells = map.cellsInRect(rect).map((x) => x + table.start);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return updatedCells.map((pos) => {
|
|
104
|
+
const cell = tr.doc.nodeAt(pos);
|
|
105
|
+
|
|
68
106
|
const classes = [ClassName.HOVERED_CELL];
|
|
69
107
|
if (danger) {
|
|
70
108
|
classes.push(ClassName.HOVERED_CELL_IN_DANGER);
|
|
@@ -97,14 +135,15 @@ export const createControlsHoverDecoration = (
|
|
|
97
135
|
}
|
|
98
136
|
|
|
99
137
|
return Decoration.node(
|
|
100
|
-
|
|
101
|
-
|
|
138
|
+
pos,
|
|
139
|
+
pos + cell!.nodeSize,
|
|
102
140
|
{
|
|
103
141
|
class: classes.join(' '),
|
|
104
142
|
},
|
|
105
143
|
{ key },
|
|
106
144
|
);
|
|
107
145
|
});
|
|
146
|
+
};
|
|
108
147
|
|
|
109
148
|
export const createColumnSelectedDecoration = (
|
|
110
149
|
tr: Transaction | ReadonlyTransaction,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// import { containsClassName } from '@atlaskit/editor-core/src/utils';
|
|
2
|
-
// import { closestElement } from '@atlaskit/editor-core/src/utils/dom';
|
|
3
1
|
import {
|
|
4
2
|
closestElement,
|
|
5
3
|
containsClassName,
|
|
@@ -170,9 +168,9 @@ export const updateResizeHandles = (tableRef?: HTMLElement) => {
|
|
|
170
168
|
const height = tableRef.offsetHeight + tableToolbarSize;
|
|
171
169
|
// see ED-7600
|
|
172
170
|
const nodes = Array.from(
|
|
173
|
-
tableRef.querySelectorAll(
|
|
174
|
-
|
|
175
|
-
>,
|
|
171
|
+
tableRef.querySelectorAll(
|
|
172
|
+
`.${ClassName.RESIZE_HANDLE}`,
|
|
173
|
+
) as NodeListOf<HTMLElement>,
|
|
176
174
|
);
|
|
177
175
|
if (!nodes || !nodes.length) {
|
|
178
176
|
return;
|
|
@@ -2,7 +2,6 @@ import { Fragment, Node as PMNode, Schema, Slice } from 'prosemirror-model';
|
|
|
2
2
|
import { EditorState } from 'prosemirror-state';
|
|
3
3
|
import { flatten } from 'prosemirror-utils';
|
|
4
4
|
|
|
5
|
-
// import { flatmap, mapSlice } from '@atlaskit/editor-core/src/utils/slice';
|
|
6
5
|
import { flatmap, mapSlice } from '@atlaskit/editor-common/utils';
|
|
7
6
|
|
|
8
7
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|