@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
|
@@ -22,51 +22,51 @@ export const updateShadowListForStickyStyles = (
|
|
|
22
22
|
* Update overflow shadows for a given wrapper & table.
|
|
23
23
|
* if `overflowShadowOptimization` is enabled, this will exit early.
|
|
24
24
|
*/
|
|
25
|
-
export const updateOverflowShadows =
|
|
26
|
-
getEditorFeatureFlags: GetEditorFeatureFlags
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
export const updateOverflowShadows =
|
|
26
|
+
(getEditorFeatureFlags: GetEditorFeatureFlags) =>
|
|
27
|
+
(
|
|
28
|
+
editorState: EditorState,
|
|
29
|
+
wrapper?: HTMLElement | null,
|
|
30
|
+
table?: HTMLElement | null,
|
|
31
|
+
rightShadows?: NodeListOf<HTMLElement> | null,
|
|
32
|
+
leftShadows?: NodeListOf<HTMLElement> | null,
|
|
33
|
+
) => {
|
|
34
|
+
if (getEditorFeatureFlags()?.tableOverflowShadowsOptimization === true) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
// Right shadow
|
|
38
|
+
if (table && wrapper) {
|
|
39
|
+
const stickyRow = wrapper.querySelector('tr.sticky');
|
|
40
|
+
const stickyCell = stickyRow && stickyRow.firstElementChild;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if (rightShadows) {
|
|
43
|
+
const diff = table.offsetWidth - wrapper.offsetWidth;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
for (let i = 0; i < rightShadows.length; i++) {
|
|
46
|
+
const rightShadow = rightShadows[i];
|
|
47
|
+
rightShadow.style.display =
|
|
48
|
+
diff > 0 && diff > wrapper.scrollLeft ? 'block' : 'none';
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if (
|
|
51
|
+
rightShadow.classList.contains(ClassName.TABLE_STICKY_SHADOW) &&
|
|
52
|
+
stickyCell
|
|
53
|
+
) {
|
|
54
|
+
rightShadow.style.height = `${stickyCell.clientHeight + 1}px`;
|
|
55
|
+
}
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
leftShadow.style.display = wrapper.scrollLeft > 0 ? 'block' : 'none';
|
|
58
|
+
if (leftShadows) {
|
|
59
|
+
for (let i = 0; i < leftShadows.length; i++) {
|
|
60
|
+
const leftShadow = leftShadows[i];
|
|
61
|
+
leftShadow.style.display = wrapper.scrollLeft > 0 ? 'block' : 'none';
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
if (
|
|
64
|
+
leftShadow.classList.contains(ClassName.TABLE_STICKY_SHADOW) &&
|
|
65
|
+
stickyCell
|
|
66
|
+
) {
|
|
67
|
+
leftShadow.style.height = `${stickyCell.clientHeight + 1}px`;
|
|
68
|
+
}
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
72
|
+
};
|
|
@@ -65,16 +65,14 @@ const removeColumnControlsSelectedDecoration: DecorationTransformer = ({
|
|
|
65
65
|
const hasColumnSelectedDecorations = (decorationSet: DecorationSet): boolean =>
|
|
66
66
|
!!findColumnControlSelectedDecoration(decorationSet).length;
|
|
67
67
|
|
|
68
|
-
export const maybeUpdateColumnControlsSelectedDecoration: DecorationTransformer =
|
|
69
|
-
decorationSet,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return decorationSet;
|
|
74
|
-
}
|
|
68
|
+
export const maybeUpdateColumnControlsSelectedDecoration: DecorationTransformer =
|
|
69
|
+
({ decorationSet, tr }): DecorationSet => {
|
|
70
|
+
if (!hasColumnSelectedDecorations(decorationSet)) {
|
|
71
|
+
return decorationSet;
|
|
72
|
+
}
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
};
|
|
74
|
+
return removeColumnControlsSelectedDecoration({ decorationSet, tr });
|
|
75
|
+
};
|
|
78
76
|
|
|
79
77
|
export const buildColumnControlsDecorations: DecorationTransformer = ({
|
|
80
78
|
decorationSet,
|
|
@@ -11,36 +11,36 @@ import { DecorationTransformer } from './types';
|
|
|
11
11
|
|
|
12
12
|
const emptyDecorations = [[], []];
|
|
13
13
|
|
|
14
|
-
const updateColumnResizeHandle =
|
|
15
|
-
columnResizesDecorations: Decoration[]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
const updateColumnResizeHandle =
|
|
15
|
+
(columnResizesDecorations: Decoration[]): DecorationTransformer =>
|
|
16
|
+
({ decorationSet, tr }) =>
|
|
17
|
+
updateDecorations(
|
|
18
|
+
tr.doc,
|
|
19
|
+
decorationSet,
|
|
20
|
+
columnResizesDecorations,
|
|
21
|
+
TableDecorations.COLUMN_RESIZING_HANDLE,
|
|
22
|
+
);
|
|
23
23
|
|
|
24
|
-
const updateLastCellElement =
|
|
25
|
-
lastCellElementsDecorations: Decoration[]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const updateLastCellElement =
|
|
25
|
+
(lastCellElementsDecorations: Decoration[]): DecorationTransformer =>
|
|
26
|
+
({ decorationSet, tr }) =>
|
|
27
|
+
updateDecorations(
|
|
28
|
+
tr.doc,
|
|
29
|
+
decorationSet,
|
|
30
|
+
lastCellElementsDecorations,
|
|
31
|
+
TableDecorations.LAST_CELL_ELEMENT,
|
|
32
|
+
);
|
|
33
33
|
|
|
34
|
-
export const buildColumnResizingDecorations =
|
|
35
|
-
columnEndIndex: number
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
export const buildColumnResizingDecorations =
|
|
35
|
+
(columnEndIndex: number): DecorationTransformer =>
|
|
36
|
+
({ tr, decorationSet }): DecorationSet => {
|
|
37
|
+
const [columnResizesDecorations, lastCellElementsDecorations] =
|
|
38
|
+
columnEndIndex < 0
|
|
39
|
+
? emptyDecorations
|
|
40
|
+
: createResizeHandleDecoration(tr, { right: columnEndIndex });
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
42
|
+
return composeDecorations([
|
|
43
|
+
updateColumnResizeHandle(columnResizesDecorations),
|
|
44
|
+
updateLastCellElement(lastCellElementsDecorations),
|
|
45
|
+
])({ decorationSet, tr });
|
|
46
|
+
};
|
|
@@ -2,10 +2,10 @@ import { DecorationSet } from 'prosemirror-view';
|
|
|
2
2
|
|
|
3
3
|
import { DecorationTransformer } from './types';
|
|
4
4
|
|
|
5
|
-
export const composeDecorations =
|
|
6
|
-
transformers: Array<DecorationTransformer
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
export const composeDecorations =
|
|
6
|
+
(transformers: Array<DecorationTransformer>): DecorationTransformer =>
|
|
7
|
+
({ decorationSet, tr }): DecorationSet =>
|
|
8
|
+
transformers.reduce(
|
|
9
|
+
(decorationSet, transform) => transform({ decorationSet, tr }),
|
|
10
|
+
decorationSet,
|
|
11
|
+
);
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
INPUT_METHOD,
|
|
12
12
|
} from '@atlaskit/editor-common/analytics';
|
|
13
13
|
import {
|
|
14
|
+
triggerUnlessTableHeader,
|
|
14
15
|
createTable,
|
|
15
16
|
goToNextCell,
|
|
16
17
|
moveCursorBackward,
|
|
17
|
-
triggerUnlessTableHeader,
|
|
18
18
|
} from '../commands';
|
|
19
19
|
import {
|
|
20
20
|
addRowAroundSelection,
|
|
@@ -3,41 +3,41 @@ import { handleDocOrSelectionChanged } from '../handlers';
|
|
|
3
3
|
import reducer from '../reducer';
|
|
4
4
|
import { pluginKey } from './plugin-key';
|
|
5
5
|
|
|
6
|
-
export const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const { pos, deleted } = tr.mapping.mapResult(
|
|
16
|
-
pluginState.targetCellPosition,
|
|
17
|
-
);
|
|
6
|
+
export const { createPluginState, createCommand, getPluginState } =
|
|
7
|
+
pluginFactory(pluginKey, reducer, {
|
|
8
|
+
mapping: (tr, pluginState) => {
|
|
9
|
+
if (tr.docChanged) {
|
|
10
|
+
let updatedTargetCell = {};
|
|
11
|
+
if (pluginState.targetCellPosition) {
|
|
12
|
+
const { pos, deleted } = tr.mapping.mapResult(
|
|
13
|
+
pluginState.targetCellPosition,
|
|
14
|
+
);
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
updatedTargetCell = {
|
|
17
|
+
targetCellPosition: deleted ? undefined : pos,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
let updatedTablePos = {};
|
|
22
|
+
if (pluginState.tablePos) {
|
|
23
|
+
const { pos, deleted } = tr.mapping.mapResult(
|
|
24
|
+
pluginState.tablePos,
|
|
25
|
+
-1,
|
|
26
|
+
);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
updatedTablePos = {
|
|
29
|
+
tablePos: deleted ? undefined : pos,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
...pluginState,
|
|
35
|
+
...updatedTargetCell,
|
|
36
|
+
...updatedTablePos,
|
|
30
37
|
};
|
|
31
38
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return pluginState;
|
|
40
|
-
},
|
|
41
|
-
onDocChanged: handleDocOrSelectionChanged,
|
|
42
|
-
onSelectionChanged: handleDocOrSelectionChanged,
|
|
43
|
-
});
|
|
39
|
+
return pluginState;
|
|
40
|
+
},
|
|
41
|
+
onDocChanged: handleDocOrSelectionChanged,
|
|
42
|
+
onSelectionChanged: handleDocOrSelectionChanged,
|
|
43
|
+
});
|
|
@@ -12,9 +12,10 @@ interface SafariDeleteCompositionTextIssueWorkaroundPluginState {
|
|
|
12
12
|
decorations: DecorationSet;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const tableSafariDeleteCompositionTextIssueWorkaroundKey =
|
|
16
|
-
SafariDeleteCompositionTextIssueWorkaroundPluginState
|
|
17
|
-
|
|
15
|
+
export const tableSafariDeleteCompositionTextIssueWorkaroundKey =
|
|
16
|
+
new PluginKey<SafariDeleteCompositionTextIssueWorkaroundPluginState>(
|
|
17
|
+
'tableSafariDeleteCompositionTextIssueWorkaround',
|
|
18
|
+
);
|
|
18
19
|
|
|
19
20
|
export const createPlugin = () => {
|
|
20
21
|
return new SafePlugin<SafariDeleteCompositionTextIssueWorkaroundPluginState>({
|
|
@@ -73,12 +74,8 @@ export const createPlugin = () => {
|
|
|
73
74
|
return false;
|
|
74
75
|
}
|
|
75
76
|
const range = selection.getRangeAt(0);
|
|
76
|
-
const {
|
|
77
|
-
|
|
78
|
-
endContainer,
|
|
79
|
-
endOffset,
|
|
80
|
-
startOffset,
|
|
81
|
-
} = range;
|
|
77
|
+
const { startContainer, endContainer, endOffset, startOffset } =
|
|
78
|
+
range;
|
|
82
79
|
/**
|
|
83
80
|
* On Safari when composition text is deleted, it deletes any empty elements it finds up the dom tree. Prosemirror can sometimes be confused by this
|
|
84
81
|
* and will think that we meant to delete those elements. This fix forces the resulting node to not be empty.
|
|
@@ -526,8 +526,9 @@ export class TableRowNodeView implements NodeView {
|
|
|
526
526
|
shouldHeaderStick = (tree: TableDOMElements): boolean => {
|
|
527
527
|
const { wrapper } = tree;
|
|
528
528
|
const tableWrapperRect = wrapper.getBoundingClientRect();
|
|
529
|
-
const editorAreaRect = (
|
|
530
|
-
.editorScrollableElement as HTMLElement
|
|
529
|
+
const editorAreaRect = (
|
|
530
|
+
this.editorScrollableElement as HTMLElement
|
|
531
|
+
).getBoundingClientRect();
|
|
531
532
|
|
|
532
533
|
const stickyHeaderRect = this.contentDOM.getBoundingClientRect();
|
|
533
534
|
const firstHeaderRow = !this.dom.previousElementSibling;
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
* TODO: https://product-fabric.atlassian.net/browse/ED-12714
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
// import { Dispatch } from '../../../event-dispatcher';
|
|
14
13
|
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
15
14
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
16
15
|
import { EditorState, PluginKey, Transaction } from 'prosemirror-state';
|
|
@@ -19,7 +18,6 @@ import rafSchedule from 'raf-schd';
|
|
|
19
18
|
|
|
20
19
|
import { uuid } from '@atlaskit/adf-schema';
|
|
21
20
|
|
|
22
|
-
// import { stepAddsOneOf } from '../../../utils/step';
|
|
23
21
|
import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
|
|
24
22
|
|
|
25
23
|
interface TableLocalIdPluginState {
|
|
@@ -22,106 +22,114 @@ import {
|
|
|
22
22
|
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
23
23
|
|
|
24
24
|
// Scale the table to meet new requirements (col, layout change etc)
|
|
25
|
-
export const scaleTable =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
export const scaleTable =
|
|
26
|
+
(
|
|
27
|
+
tableRef: HTMLTableElement | null | undefined,
|
|
28
|
+
options: ScaleOptions,
|
|
29
|
+
domAtPos: DomAtPos,
|
|
30
|
+
): Command =>
|
|
31
|
+
(state, dispatch) => {
|
|
32
|
+
if (!tableRef) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const { node, start, parentWidth } = options;
|
|
37
|
+
|
|
38
|
+
// If a table has not been resized yet, columns should be auto.
|
|
39
|
+
if (hasTableBeenResized(node) === false) {
|
|
40
|
+
// If its not a re-sized table, we still want to re-create cols
|
|
41
|
+
// To force reflow of columns upon delete.
|
|
42
|
+
recreateResizeColsByNode(tableRef, node);
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
let resizeState;
|
|
47
|
+
if (parentWidth) {
|
|
48
|
+
resizeState = scaleWithParent(
|
|
49
|
+
tableRef,
|
|
50
|
+
parentWidth,
|
|
51
|
+
node,
|
|
52
|
+
start,
|
|
53
|
+
domAtPos,
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
56
|
+
resizeState = scale(tableRef, options, domAtPos);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (resizeState) {
|
|
60
|
+
let { tr } = state;
|
|
61
|
+
tr = updateColumnWidths(resizeState, node, start)(tr);
|
|
62
|
+
|
|
63
|
+
if (tr.docChanged && dispatch) {
|
|
64
|
+
tr.setMeta('scrollIntoView', false);
|
|
65
|
+
// TODO: ED-8995
|
|
66
|
+
// We need to do this check to reduce the number of race conditions when working with tables.
|
|
67
|
+
// This metadata is been used in the sendTransaction function in the Collab plugin
|
|
68
|
+
tr.setMeta('scaleTable', true);
|
|
69
|
+
dispatch(tr);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
35
73
|
|
|
36
|
-
// If a table has not been resized yet, columns should be auto.
|
|
37
|
-
if (hasTableBeenResized(node) === false) {
|
|
38
|
-
// If its not a re-sized table, we still want to re-create cols
|
|
39
|
-
// To force reflow of columns upon delete.
|
|
40
|
-
recreateResizeColsByNode(tableRef, node);
|
|
41
74
|
return false;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
resizeState
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const evenColumns =
|
|
78
|
+
({
|
|
79
|
+
resizeState,
|
|
80
|
+
table,
|
|
81
|
+
start,
|
|
82
|
+
event,
|
|
83
|
+
}: {
|
|
84
|
+
resizeState: ResizeState;
|
|
85
|
+
table: PMNode;
|
|
86
|
+
start: number;
|
|
87
|
+
event: MouseEvent;
|
|
88
|
+
}): Command =>
|
|
89
|
+
(state, dispatch) => {
|
|
90
|
+
if (!isTableSelected(state.selection)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// double click detection logic
|
|
95
|
+
// Note: ProseMirror's handleDoubleClick doesn't quite work with DOM mousedown event handler
|
|
96
|
+
const { lastClick } = getPluginState(state);
|
|
97
|
+
const now = Date.now();
|
|
98
|
+
if (
|
|
99
|
+
lastClick &&
|
|
100
|
+
now - lastClick.time < 500 &&
|
|
101
|
+
isClickNear(event, lastClick)
|
|
102
|
+
) {
|
|
103
|
+
const newState = evenAllColumnsWidths(resizeState);
|
|
104
|
+
setLastClick(null, (tr) =>
|
|
105
|
+
updateColumnWidths(newState, table, start)(tr),
|
|
106
|
+
)(state, dispatch);
|
|
107
|
+
|
|
62
108
|
return true;
|
|
63
109
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return false;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const evenColumns = ({
|
|
70
|
-
resizeState,
|
|
71
|
-
table,
|
|
72
|
-
start,
|
|
73
|
-
event,
|
|
74
|
-
}: {
|
|
75
|
-
resizeState: ResizeState;
|
|
76
|
-
table: PMNode;
|
|
77
|
-
start: number;
|
|
78
|
-
event: MouseEvent;
|
|
79
|
-
}): Command => (state, dispatch) => {
|
|
80
|
-
if (!isTableSelected(state.selection)) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// double click detection logic
|
|
85
|
-
// Note: ProseMirror's handleDoubleClick doesn't quite work with DOM mousedown event handler
|
|
86
|
-
const { lastClick } = getPluginState(state);
|
|
87
|
-
const now = Date.now();
|
|
88
|
-
if (
|
|
89
|
-
lastClick &&
|
|
90
|
-
now - lastClick.time < 500 &&
|
|
91
|
-
isClickNear(event, lastClick)
|
|
92
|
-
) {
|
|
93
|
-
const newState = evenAllColumnsWidths(resizeState);
|
|
94
|
-
setLastClick(null, (tr) => updateColumnWidths(newState, table, start)(tr))(
|
|
110
|
+
|
|
111
|
+
setLastClick({ x: event.clientX, y: event.clientY, time: now })(
|
|
95
112
|
state,
|
|
96
113
|
dispatch,
|
|
97
114
|
);
|
|
98
115
|
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
return false;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const distributeColumnsWidths =
|
|
120
|
+
(newResizeState: ResizeState, table: ContentNodeWithPos): Command =>
|
|
121
|
+
(state, dispatch) => {
|
|
122
|
+
if (dispatch) {
|
|
123
|
+
const tr = updateColumnWidths(
|
|
124
|
+
newResizeState,
|
|
125
|
+
table.node,
|
|
126
|
+
table.start,
|
|
127
|
+
)(state.tr);
|
|
128
|
+
stopResizing(tr)(state, dispatch);
|
|
129
|
+
}
|
|
106
130
|
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const distributeColumnsWidths = (
|
|
111
|
-
newResizeState: ResizeState,
|
|
112
|
-
table: ContentNodeWithPos,
|
|
113
|
-
): Command => (state, dispatch) => {
|
|
114
|
-
if (dispatch) {
|
|
115
|
-
const tr = updateColumnWidths(
|
|
116
|
-
newResizeState,
|
|
117
|
-
table.node,
|
|
118
|
-
table.start,
|
|
119
|
-
)(state.tr);
|
|
120
|
-
stopResizing(tr)(state, dispatch);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return true;
|
|
124
|
-
};
|
|
131
|
+
return true;
|
|
132
|
+
};
|
|
125
133
|
|
|
126
134
|
export const setResizeHandlePos = (resizeHandlePos: number | null) =>
|
|
127
135
|
createCommand({
|