@atlaskit/editor-plugin-table 2.3.1 → 2.5.0
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 +6 -0
- package/CHANGELOG.md +16 -0
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +2 -2
- package/dist/cjs/plugins/table/commands/insert.js +3 -3
- package/dist/cjs/plugins/table/commands/misc.js +26 -26
- package/dist/cjs/plugins/table/commands/referentiality.js +1 -1
- package/dist/cjs/plugins/table/commands/selection.js +2 -2
- package/dist/cjs/plugins/table/commands/sort.js +8 -8
- package/dist/cjs/plugins/table/commands-with-analytics.js +3 -3
- package/dist/cjs/plugins/table/event-handlers.js +15 -15
- package/dist/cjs/plugins/table/handlers.js +6 -7
- package/dist/cjs/plugins/table/index.js +16 -16
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +44 -40
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +6 -9
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +4 -3
- package/dist/cjs/plugins/table/nodeviews/table.js +11 -9
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/main.js +24 -21
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-width.js +3 -3
- package/dist/cjs/plugins/table/toolbar.js +26 -26
- package/dist/cjs/plugins/table/transforms/column-width.js +5 -5
- package/dist/cjs/plugins/table/transforms/delete-columns.js +1 -1
- package/dist/cjs/plugins/table/transforms/merge.js +1 -1
- package/dist/cjs/plugins/table/transforms/replace-table.js +2 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/FixedButton.js +2 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +3 -3
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +11 -11
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +6 -3
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +10 -10
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +3 -3
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +9 -9
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +3 -3
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +1 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +2 -2
- package/dist/cjs/plugins/table/ui/consts.js +2 -2
- package/dist/cjs/plugins/table/ui/ui-styles.js +2 -2
- package/dist/cjs/plugins/table/utils/column-controls.js +11 -11
- package/dist/cjs/plugins/table/utils/decoration.js +11 -11
- package/dist/cjs/plugins/table/utils/nodes.js +1 -1
- package/dist/cjs/plugins/table/utils/row-controls.js +9 -9
- package/dist/cjs/plugins/table/utils/selection.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/clear.js +3 -1
- package/dist/es2019/plugins/table/commands/go-to-next-cell.js +2 -2
- package/dist/es2019/plugins/table/commands/insert.js +4 -3
- package/dist/es2019/plugins/table/commands/misc.js +4 -4
- package/dist/es2019/plugins/table/commands/referentiality.js +1 -1
- package/dist/es2019/plugins/table/commands/selection.js +3 -3
- package/dist/es2019/plugins/table/commands/sort.js +3 -4
- package/dist/es2019/plugins/table/commands/toggle.js +1 -2
- package/dist/es2019/plugins/table/commands-with-analytics.js +4 -4
- package/dist/es2019/plugins/table/event-handlers.js +3 -5
- package/dist/es2019/plugins/table/handlers.js +5 -5
- package/dist/es2019/plugins/table/index.js +16 -16
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +19 -15
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +7 -10
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +6 -5
- package/dist/es2019/plugins/table/nodeviews/table.js +11 -9
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +2 -3
- package/dist/es2019/plugins/table/pm-plugins/keymap.js +4 -4
- package/dist/es2019/plugins/table/pm-plugins/main.js +13 -13
- package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +2 -3
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -3
- package/dist/es2019/plugins/table/pm-plugins/table-selection-keymap.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-width.js +3 -3
- package/dist/es2019/plugins/table/toolbar.js +16 -18
- package/dist/es2019/plugins/table/transforms/column-width.js +6 -7
- package/dist/es2019/plugins/table/transforms/delete-columns.js +1 -1
- package/dist/es2019/plugins/table/transforms/merge.js +2 -1
- package/dist/es2019/plugins/table/transforms/replace-table.js +2 -2
- package/dist/es2019/plugins/table/transforms/split.js +1 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/FixedButton.js +2 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +4 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +10 -10
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/styles.js +7 -4
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +5 -5
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +3 -3
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +4 -5
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +3 -3
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +5 -5
- package/dist/es2019/plugins/table/ui/consts.js +2 -2
- package/dist/es2019/plugins/table/ui/ui-styles.js +3 -3
- package/dist/es2019/plugins/table/utils/column-controls.js +3 -3
- package/dist/es2019/plugins/table/utils/decoration.js +2 -2
- package/dist/es2019/plugins/table/utils/guidelines.js +1 -1
- package/dist/es2019/plugins/table/utils/nodes.js +1 -1
- package/dist/es2019/plugins/table/utils/row-controls.js +3 -3
- package/dist/es2019/plugins/table/utils/selection.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/clear.js +3 -1
- package/dist/esm/plugins/table/commands/go-to-next-cell.js +2 -2
- package/dist/esm/plugins/table/commands/insert.js +4 -3
- package/dist/esm/plugins/table/commands/misc.js +4 -4
- package/dist/esm/plugins/table/commands/referentiality.js +1 -1
- package/dist/esm/plugins/table/commands/selection.js +3 -3
- package/dist/esm/plugins/table/commands/sort.js +3 -4
- package/dist/esm/plugins/table/commands/toggle.js +1 -2
- package/dist/esm/plugins/table/commands-with-analytics.js +4 -4
- package/dist/esm/plugins/table/event-handlers.js +3 -5
- package/dist/esm/plugins/table/handlers.js +5 -5
- package/dist/esm/plugins/table/index.js +16 -16
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +37 -34
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +7 -10
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +6 -5
- package/dist/esm/plugins/table/nodeviews/table.js +11 -9
- package/dist/esm/plugins/table/nodeviews/tableCell.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +2 -3
- package/dist/esm/plugins/table/pm-plugins/keymap.js +4 -4
- package/dist/esm/plugins/table/pm-plugins/main.js +13 -13
- package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +2 -3
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -3
- package/dist/esm/plugins/table/pm-plugins/table-selection-keymap.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-width.js +3 -3
- package/dist/esm/plugins/table/toolbar.js +16 -18
- package/dist/esm/plugins/table/transforms/column-width.js +6 -7
- package/dist/esm/plugins/table/transforms/delete-columns.js +1 -1
- package/dist/esm/plugins/table/transforms/merge.js +2 -1
- package/dist/esm/plugins/table/transforms/replace-table.js +2 -2
- package/dist/esm/plugins/table/transforms/split.js +1 -0
- package/dist/esm/plugins/table/ui/FloatingContextualButton/FixedButton.js +2 -2
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +4 -4
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +10 -10
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +6 -3
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +5 -5
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +3 -3
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +4 -5
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +3 -3
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +1 -1
- package/dist/esm/plugins/table/ui/common-styles.js +5 -5
- package/dist/esm/plugins/table/ui/consts.js +2 -2
- package/dist/esm/plugins/table/ui/ui-styles.js +3 -3
- package/dist/esm/plugins/table/utils/column-controls.js +3 -3
- package/dist/esm/plugins/table/utils/decoration.js +2 -2
- package/dist/esm/plugins/table/utils/guidelines.js +1 -1
- package/dist/esm/plugins/table/utils/nodes.js +1 -1
- package/dist/esm/plugins/table/utils/row-controls.js +3 -3
- package/dist/esm/plugins/table/utils/selection.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/commands/go-to-next-cell.d.ts +2 -2
- package/dist/types/plugins/table/commands/insert.d.ts +1 -1
- package/dist/types/plugins/table/commands/selection.d.ts +1 -1
- package/dist/types/plugins/table/commands/sort.d.ts +1 -1
- package/dist/types/plugins/table/commands-with-analytics.d.ts +4 -5
- package/dist/types/plugins/table/event-handlers.d.ts +1 -1
- package/dist/types/plugins/table/handlers.d.ts +1 -1
- package/dist/types/plugins/table/index.d.ts +4 -4
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +3 -4
- package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +2 -2
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +1 -1
- package/dist/types/plugins/table/nodeviews/table.d.ts +3 -4
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +1 -2
- package/dist/types/plugins/table/nodeviews/types.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/main.d.ts +4 -6
- package/dist/types/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-local-id.d.ts +0 -12
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +3 -3
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +3 -4
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -3
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-width.d.ts +1 -1
- package/dist/types/plugins/table/toolbar.d.ts +4 -5
- package/dist/types/plugins/table/transforms/column-width.d.ts +1 -1
- package/dist/types/plugins/table/transforms/replace-table.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +1 -1
- package/dist/types/plugins/table/ui/FloatingContextualButton/index.d.ts +2 -2
- package/dist/types/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
- package/dist/types/plugins/table/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +1 -2
- package/dist/types/plugins/table/ui/FloatingDeleteButton/index.d.ts +1 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -1
- package/dist/types/plugins/table/ui/LayoutButton/index.d.ts +1 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +1 -1
- package/dist/types/plugins/table/utils/analytics.d.ts +1 -1
- package/dist/types/plugins/table/utils/collapse.d.ts +2 -2
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +4 -5
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/index.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +3 -4
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +3 -4
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +1 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +4 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +0 -12
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +3 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +4 -5
- package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +1 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +1 -1
- package/examples/99-testing.tsx +11 -10
- package/package.json +12 -4
- package/report.api.md +2 -0
- package/src/__tests__/integration/arrow-down-into-table.ts +3 -2
- package/src/__tests__/integration/auto-size.ts +8 -10
- package/src/__tests__/integration/cell-selection.ts +8 -7
- package/src/__tests__/integration/change-date-inside-table.ts +4 -5
- package/src/__tests__/integration/delete-columns.ts +6 -4
- package/src/__tests__/integration/delete-last-column-in-full-width.ts +4 -4
- package/src/__tests__/integration/delete-last-column-with-empty-action.ts +4 -4
- package/src/__tests__/integration/delete-last-row-with-empty-action.ts +4 -4
- package/src/__tests__/integration/delete-rows.ts +8 -6
- package/src/__tests__/integration/delete-table-when-selected.ts +10 -11
- package/src/__tests__/integration/deleting-empty-paragraph-under-table.ts +5 -4
- package/src/__tests__/integration/even-columns.ts +8 -8
- package/src/__tests__/integration/floating-toolbar.ts +3 -1
- package/src/__tests__/integration/horizontal-scroll-shadows.ts +7 -8
- package/src/__tests__/integration/horizontal-scroll.ts +8 -7
- package/src/__tests__/integration/insert-cell-header-with-strong-mark.ts +3 -4
- package/src/__tests__/integration/insert-row-inside-layout.ts +8 -6
- package/src/__tests__/integration/layout.ts +8 -11
- package/src/__tests__/integration/meta-arrowup-cursor-in-first-row.ts +3 -2
- package/src/__tests__/integration/resize-handler.ts +2 -2
- package/src/__tests__/integration/resize.ts +15 -15
- package/src/__tests__/integration/scale.ts +8 -8
- package/src/__tests__/integration/sticky-header.ts +3 -2
- package/src/__tests__/unit/analytics.ts +21 -21
- package/src/__tests__/unit/collab.ts +16 -16
- package/src/__tests__/unit/commands/go-to-next-cell.ts +14 -13
- package/src/__tests__/unit/commands/insert.ts +12 -12
- package/src/__tests__/unit/commands/misc.ts +18 -16
- package/src/__tests__/unit/commands/sort.ts +9 -8
- package/src/__tests__/unit/commands.ts +13 -14
- package/src/__tests__/unit/copy-paste.ts +31 -25
- package/src/__tests__/unit/event-handlers/index.ts +15 -13
- package/src/__tests__/unit/event-handlers.ts +18 -18
- package/src/__tests__/unit/fix-tables.ts +9 -9
- package/src/__tests__/unit/get-toolbar-config.ts +21 -21
- package/src/__tests__/unit/handlers.ts +13 -12
- package/src/__tests__/unit/hover-selection.ts +14 -13
- package/src/__tests__/unit/index-with-fake-timers.ts +6 -5
- package/src/__tests__/unit/index.ts +30 -31
- package/src/__tests__/unit/layout.ts +16 -16
- package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +4 -2
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +21 -20
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +38 -105
- package/src/__tests__/unit/nodeviews/cell.ts +17 -16
- package/src/__tests__/unit/nodeviews/table.ts +15 -13
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +1 -1
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +7 -8
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +45 -57
- package/src/__tests__/unit/pm-plugins/main.ts +15 -14
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +7 -6
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +23 -21
- package/src/__tests__/unit/pm-plugins/table-local-id.ts +14 -15
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +3 -2
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +22 -21
- package/src/__tests__/unit/sort-column.ts +16 -14
- package/src/__tests__/unit/toolbar.ts +22 -21
- package/src/__tests__/unit/transforms/delete-columns.ts +16 -14
- package/src/__tests__/unit/transforms/delete-rows.ts +16 -14
- package/src/__tests__/unit/transforms/merging.ts +15 -13
- package/src/__tests__/unit/ui/ContextualMenu.tsx +8 -6
- package/src/__tests__/unit/ui/CornerControls.tsx +11 -9
- package/src/__tests__/unit/ui/DeleteButton.tsx +3 -1
- package/src/__tests__/unit/ui/FixedButton.tsx +4 -1
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +14 -11
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +8 -6
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +12 -9
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +21 -19
- package/src/__tests__/unit/ui/RowControls.tsx +15 -12
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +16 -15
- package/src/__tests__/unit/undo-redo.ts +17 -15
- package/src/__tests__/unit/utils/collapse.ts +7 -8
- package/src/__tests__/unit/utils/nodes.ts +12 -11
- package/src/__tests__/unit/utils/row-controls.ts +12 -12
- package/src/__tests__/unit/utils/table.ts +5 -4
- package/src/__tests__/unit/utils.ts +18 -16
- package/src/__tests__/visual-regression/cell-options-menu.ts +2 -2
- package/src/__tests__/visual-regression/index.ts +8 -7
- package/src/__tests__/visual-regression/sticky-header.ts +6 -5
- package/src/plugins/table/commands/clear.ts +3 -2
- package/src/plugins/table/commands/collapse.ts +1 -0
- package/src/plugins/table/commands/go-to-next-cell.ts +8 -7
- package/src/plugins/table/commands/insert.ts +8 -7
- package/src/plugins/table/commands/misc.ts +15 -18
- package/src/plugins/table/commands/referentiality.ts +3 -1
- package/src/plugins/table/commands/selection.ts +11 -10
- package/src/plugins/table/commands/sort.ts +9 -9
- package/src/plugins/table/commands/split-cell.ts +1 -1
- package/src/plugins/table/commands/toggle.ts +2 -3
- package/src/plugins/table/commands-with-analytics.ts +15 -15
- package/src/plugins/table/event-handlers.ts +19 -20
- package/src/plugins/table/handlers.ts +6 -7
- package/src/plugins/table/index.tsx +51 -51
- package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +2 -1
- package/src/plugins/table/nodeviews/TableComponent.tsx +22 -25
- package/src/plugins/table/nodeviews/TableContainer.tsx +13 -24
- package/src/plugins/table/nodeviews/TableResizer.tsx +9 -7
- package/src/plugins/table/nodeviews/table.tsx +25 -18
- package/src/plugins/table/nodeviews/tableCell.tsx +9 -7
- package/src/plugins/table/nodeviews/types.ts +4 -2
- package/src/plugins/table/nodeviews/update-overflow-shadows.ts +3 -1
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +4 -3
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +2 -1
- package/src/plugins/table/pm-plugins/keymap.ts +8 -8
- package/src/plugins/table/pm-plugins/main.ts +38 -33
- package/src/plugins/table/pm-plugins/plugin-factory.ts +2 -0
- package/src/plugins/table/pm-plugins/plugin-key.ts +1 -0
- package/src/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -1
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +6 -7
- package/src/plugins/table/pm-plugins/sticky-headers/plugin-key.ts +1 -0
- package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +3 -4
- package/src/plugins/table/pm-plugins/table-local-id.ts +3 -4
- package/src/plugins/table/pm-plugins/table-resizing/commands.ts +3 -2
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +13 -14
- package/src/plugins/table/pm-plugins/table-resizing/plugin-factory.ts +1 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin-key.ts +1 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin.ts +7 -6
- package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +2 -1
- package/src/plugins/table/pm-plugins/table-resizing/utils/column-state.ts +1 -1
- package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +3 -3
- package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +8 -9
- package/src/plugins/table/pm-plugins/table-resizing/utils/resize-state.ts +8 -6
- package/src/plugins/table/pm-plugins/table-resizing/utils/scale-table.ts +4 -5
- package/src/plugins/table/pm-plugins/table-resizing/utils/types.ts +2 -1
- package/src/plugins/table/pm-plugins/table-selection-keymap.ts +4 -3
- package/src/plugins/table/pm-plugins/table-width.ts +5 -4
- package/src/plugins/table/toolbar.tsx +54 -57
- package/src/plugins/table/transforms/column-width.ts +13 -13
- package/src/plugins/table/transforms/delete-columns.ts +2 -2
- package/src/plugins/table/transforms/delete-rows.ts +2 -2
- package/src/plugins/table/transforms/merge.ts +3 -3
- package/src/plugins/table/transforms/replace-table.ts +6 -5
- package/src/plugins/table/transforms/split.ts +1 -1
- package/src/plugins/table/types.ts +3 -3
- package/src/plugins/table/ui/FloatingContextualButton/FixedButton.tsx +4 -2
- package/src/plugins/table/ui/FloatingContextualButton/index.tsx +12 -11
- package/src/plugins/table/ui/FloatingContextualButton/styles.ts +5 -3
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +27 -28
- package/src/plugins/table/ui/FloatingContextualMenu/index.tsx +10 -11
- package/src/plugins/table/ui/FloatingContextualMenu/styles.ts +8 -4
- package/src/plugins/table/ui/FloatingDeleteButton/DeleteButton.tsx +5 -2
- package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +9 -9
- package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +4 -5
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +16 -18
- package/src/plugins/table/ui/LayoutButton/index.tsx +6 -6
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +3 -2
- package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +2 -1
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +2 -3
- package/src/plugins/table/ui/common-styles.ts +33 -34
- package/src/plugins/table/ui/consts.ts +12 -13
- package/src/plugins/table/ui/ui-styles.ts +24 -22
- package/src/plugins/table/utils/analytics.ts +3 -2
- package/src/plugins/table/utils/collapse.ts +2 -2
- package/src/plugins/table/utils/column-controls.ts +5 -6
- package/src/plugins/table/utils/decoration.ts +6 -7
- package/src/plugins/table/utils/dom.ts +1 -0
- package/src/plugins/table/utils/guidelines.ts +2 -2
- package/src/plugins/table/utils/nodes.ts +2 -1
- package/src/plugins/table/utils/row-controls.ts +4 -3
- package/src/plugins/table/utils/selection.ts +2 -1
- package/src/plugins/table/utils/table.ts +2 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
+
import { PluginKey } from 'prosemirror-state';
|
|
2
|
+
|
|
3
|
+
import { TableLayout } from '@atlaskit/adf-schema';
|
|
4
|
+
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
|
+
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
|
+
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
8
|
+
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
9
|
+
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
1
10
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
2
11
|
import {
|
|
3
12
|
createProsemirrorEditorFactory,
|
|
4
|
-
Preset,
|
|
5
13
|
LightEditorPlugin,
|
|
14
|
+
Preset,
|
|
6
15
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
7
|
-
|
|
8
16
|
import {
|
|
9
17
|
doc,
|
|
18
|
+
DocBuilder,
|
|
10
19
|
table,
|
|
11
|
-
tr,
|
|
12
20
|
tdCursor,
|
|
13
21
|
tdEmpty,
|
|
14
|
-
|
|
22
|
+
tr,
|
|
15
23
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
16
24
|
|
|
17
|
-
import
|
|
25
|
+
import tablePlugin from '../../plugins/table-plugin';
|
|
26
|
+
import { toggleTableLayout } from '../../plugins/table/commands';
|
|
27
|
+
import { getPluginState } from '../../plugins/table/pm-plugins/plugin-factory';
|
|
28
|
+
import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
18
29
|
import {
|
|
19
30
|
PermittedLayoutsDescriptor,
|
|
20
31
|
TablePluginState,
|
|
21
32
|
} from '../../plugins/table/types';
|
|
22
|
-
import { toggleTableLayout } from '../../plugins/table/commands';
|
|
23
|
-
import { getPluginState } from '../../plugins/table/pm-plugins/plugin-factory';
|
|
24
|
-
import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
25
|
-
import tablePlugin from '../../plugins/table-plugin';
|
|
26
|
-
import { PluginKey } from 'prosemirror-state';
|
|
27
|
-
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
28
|
-
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
29
|
-
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
30
|
-
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
31
|
-
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
32
|
-
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
33
33
|
|
|
34
34
|
describe('table toolbar', () => {
|
|
35
35
|
const tableOptions = {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { MockIntersectionObserver } from '@atlaskit/editor-test-helpers/mock-intersection-observer';
|
|
2
2
|
|
|
3
3
|
import { OverflowShadowsObserver } from '../../../plugins/table/nodeviews/OverflowShadowsObserver';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
TableCssClassName as className,
|
|
6
|
+
ShadowEvent,
|
|
7
|
+
} from '../../../plugins/table/types';
|
|
6
8
|
|
|
7
9
|
describe('OverflowShadowsObserver', () => {
|
|
8
10
|
let table: HTMLTableElement;
|
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
3
4
|
import { TextSelection } from 'prosemirror-state';
|
|
5
|
+
import { replaceRaf } from 'raf-stub';
|
|
4
6
|
|
|
7
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
8
|
import { Command } from '@atlaskit/editor-common/types';
|
|
6
|
-
import { render } from '@testing-library/react';
|
|
7
|
-
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
8
9
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/src/utils/select-nodes';
|
|
9
|
-
import
|
|
10
|
+
import {
|
|
11
|
+
findTable,
|
|
12
|
+
findTableClosestToPos,
|
|
13
|
+
selectTable,
|
|
14
|
+
} from '@atlaskit/editor-tables/utils';
|
|
15
|
+
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
10
16
|
import {
|
|
11
17
|
doc,
|
|
18
|
+
DocBuilder,
|
|
12
19
|
p,
|
|
13
20
|
table,
|
|
14
|
-
tr,
|
|
15
21
|
td,
|
|
16
|
-
tdEmpty,
|
|
17
22
|
tdCursor,
|
|
18
|
-
|
|
23
|
+
tdEmpty,
|
|
19
24
|
thEmpty,
|
|
25
|
+
tr,
|
|
20
26
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
21
|
-
import {
|
|
22
|
-
findTable,
|
|
23
|
-
findTableClosestToPos,
|
|
24
|
-
selectTable,
|
|
25
|
-
} from '@atlaskit/editor-tables/utils';
|
|
26
|
-
import {
|
|
27
|
-
TableCssClassName as ClassName,
|
|
28
|
-
TablePluginState,
|
|
29
|
-
} from '../../../plugins/table/types';
|
|
30
|
-
import TableComponent from '../../../plugins/table/nodeviews/TableComponent';
|
|
31
27
|
|
|
32
|
-
import
|
|
33
|
-
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
28
|
+
import tablePlugin from '../../../plugins/table-plugin';
|
|
34
29
|
import * as commands from '../../../plugins/table/commands';
|
|
35
30
|
import {
|
|
36
|
-
toggleNumberColumn,
|
|
37
31
|
hoverTable,
|
|
32
|
+
toggleNumberColumn,
|
|
38
33
|
} from '../../../plugins/table/commands';
|
|
34
|
+
import TableComponent from '../../../plugins/table/nodeviews/TableComponent';
|
|
35
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
36
|
+
import {
|
|
37
|
+
TableCssClassName as ClassName,
|
|
38
|
+
TablePluginState,
|
|
39
|
+
} from '../../../plugins/table/types';
|
|
39
40
|
|
|
40
41
|
jest.mock('../../../plugins/table/utils/nodes', () =>
|
|
41
42
|
Object.assign({}, jest.requireActual('../../../plugins/table/utils/nodes'), {
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
2
3
|
import { render } from '@testing-library/react';
|
|
3
4
|
|
|
5
|
+
import { TableAttributes } from '@atlaskit/adf-schema';
|
|
6
|
+
import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
8
|
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
5
|
-
import { ffTest } from '@atlassian/feature-flags-test-utils';
|
|
6
9
|
import {
|
|
7
10
|
doc,
|
|
11
|
+
DocBuilder,
|
|
8
12
|
p,
|
|
9
13
|
table,
|
|
10
|
-
tr,
|
|
11
14
|
td,
|
|
12
15
|
tdEmpty,
|
|
13
|
-
|
|
16
|
+
tr,
|
|
14
17
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
15
|
-
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
16
18
|
|
|
17
|
-
import
|
|
19
|
+
import tablePlugin from '../../../plugins/table-plugin';
|
|
18
20
|
import {
|
|
19
21
|
ResizableTableContainer,
|
|
20
22
|
TableContainer,
|
|
21
23
|
} from '../../../plugins/table/nodeviews/TableContainer';
|
|
24
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
22
25
|
import { TablePluginState } from '../../../plugins/table/types';
|
|
23
|
-
import tablePlugin from '../../../plugins/table-plugin';
|
|
24
|
-
import { TableAttributes } from '@atlaskit/adf-schema';
|
|
25
|
-
import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
26
26
|
|
|
27
27
|
describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
28
28
|
const createEditor = createEditorFactory<TablePluginState>();
|
|
@@ -52,7 +52,10 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
describe('show correct container for FF and options', () => {
|
|
55
|
-
const buildContainer = (
|
|
55
|
+
const buildContainer = (
|
|
56
|
+
isTableResizingEnabled: boolean,
|
|
57
|
+
isBreakoutEnabled: boolean = true,
|
|
58
|
+
) => {
|
|
56
59
|
const node = createNode();
|
|
57
60
|
|
|
58
61
|
const { container } = render(
|
|
@@ -62,8 +65,8 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
62
65
|
lineLength: 720,
|
|
63
66
|
}}
|
|
64
67
|
node={node}
|
|
65
|
-
|
|
66
|
-
isBreakoutEnabled={
|
|
68
|
+
isTableResizingEnabled={isTableResizingEnabled}
|
|
69
|
+
isBreakoutEnabled={isBreakoutEnabled}
|
|
67
70
|
className={''}
|
|
68
71
|
editorView={{} as any}
|
|
69
72
|
getPos={() => 1}
|
|
@@ -75,42 +78,22 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
75
78
|
return container;
|
|
76
79
|
};
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
) => {
|
|
82
|
-
ffTest(
|
|
83
|
-
'platform.editor.custom-table-width',
|
|
84
|
-
async () => {
|
|
85
|
-
const container = buildContainer(allowResizing);
|
|
86
|
-
|
|
87
|
-
expect(!!container.querySelector('.resizer-item')).toBe(
|
|
88
|
-
expected?.ffTrue ?? true,
|
|
89
|
-
);
|
|
90
|
-
},
|
|
91
|
-
async () => {
|
|
92
|
-
const container = buildContainer(allowResizing);
|
|
93
|
-
|
|
94
|
-
expect(!!container.querySelector('.resizer-item')).toBe(
|
|
95
|
-
expected?.ffFalse ?? false,
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
describe('when allowResizing is true', () => {
|
|
102
|
-
buildTest(true);
|
|
81
|
+
test('when isTableResizingEnabled is true', () => {
|
|
82
|
+
const container = buildContainer(true);
|
|
83
|
+
expect(!!container.querySelector('.resizer-item')).toBeTruthy();
|
|
103
84
|
});
|
|
104
85
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
});
|
|
86
|
+
test('when isTableResizingEnabled is false', () => {
|
|
87
|
+
const container = buildContainer(false);
|
|
88
|
+
expect(!!container.querySelector('.resizer-item')).toBeFalsy();
|
|
109
89
|
});
|
|
110
90
|
});
|
|
111
91
|
|
|
112
|
-
describe('
|
|
113
|
-
const buildContainer = (
|
|
92
|
+
describe('when table is nested', () => {
|
|
93
|
+
const buildContainer = (
|
|
94
|
+
isTableResizingEnabled: boolean,
|
|
95
|
+
isBreakoutEnabled: boolean = true,
|
|
96
|
+
) => {
|
|
114
97
|
const node = createNode();
|
|
115
98
|
|
|
116
99
|
const { container } = render(
|
|
@@ -120,8 +103,8 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
120
103
|
lineLength: 720,
|
|
121
104
|
}}
|
|
122
105
|
node={node}
|
|
123
|
-
|
|
124
|
-
isBreakoutEnabled={
|
|
106
|
+
isTableResizingEnabled={isTableResizingEnabled}
|
|
107
|
+
isBreakoutEnabled={isBreakoutEnabled}
|
|
125
108
|
className={''}
|
|
126
109
|
editorView={{} as any}
|
|
127
110
|
getPos={() => 1}
|
|
@@ -133,38 +116,14 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
133
116
|
return container;
|
|
134
117
|
};
|
|
135
118
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
) => {
|
|
140
|
-
ffTest(
|
|
141
|
-
'platform.editor.custom-table-width',
|
|
142
|
-
async () => {
|
|
143
|
-
const container = buildContainer(allowResizing);
|
|
144
|
-
|
|
145
|
-
expect(!!container.querySelector('.resizer-item')).toBe(
|
|
146
|
-
expected?.ffTrue ?? true,
|
|
147
|
-
);
|
|
148
|
-
},
|
|
149
|
-
async () => {
|
|
150
|
-
const container = buildContainer(allowResizing);
|
|
151
|
-
|
|
152
|
-
expect(!!container.querySelector('.resizer-item')).toBe(
|
|
153
|
-
expected?.ffFalse ?? false,
|
|
154
|
-
);
|
|
155
|
-
},
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
describe('when allowResizing is true', () => {
|
|
160
|
-
buildTest(true, { ffTrue: false, ffFalse: false });
|
|
119
|
+
test('when isTableResizingEnabled is true - should not render resizer', () => {
|
|
120
|
+
const container = buildContainer(true);
|
|
121
|
+
expect(!!container.querySelector('.resizer-item')).toBeFalsy();
|
|
161
122
|
});
|
|
162
123
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
ffFalse: false,
|
|
167
|
-
});
|
|
124
|
+
test('when isTableResizingEnabled is false - should not render resizer', () => {
|
|
125
|
+
const container = buildContainer(false);
|
|
126
|
+
expect(!!container.querySelector('.resizer-item')).toBeFalsy();
|
|
168
127
|
});
|
|
169
128
|
});
|
|
170
129
|
|
|
@@ -187,38 +146,12 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
187
146
|
return container;
|
|
188
147
|
};
|
|
189
148
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const container = buildContainer({ layout: 'wide' });
|
|
149
|
+
test('when width attribute is not set', () => {
|
|
150
|
+
const container = buildContainer({ layout: 'wide' });
|
|
193
151
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
describe('when width attribute is set', () => {
|
|
201
|
-
ffTest(
|
|
202
|
-
'platform.editor.custom-table-width',
|
|
203
|
-
() => {
|
|
204
|
-
const container = buildContainer({ width: 860 });
|
|
205
|
-
|
|
206
|
-
const style = window.getComputedStyle(
|
|
207
|
-
container.firstChild as Element,
|
|
208
|
-
);
|
|
209
|
-
expect(style.width).toBe(`860px`);
|
|
210
|
-
expect(style.marginLeft).toBe('-70px');
|
|
211
|
-
}, // fallback to layout because width can't be an attribute in schema
|
|
212
|
-
() => {
|
|
213
|
-
const container = buildContainer({ width: 860 });
|
|
214
|
-
|
|
215
|
-
const style = window.getComputedStyle(
|
|
216
|
-
container.firstChild as Element,
|
|
217
|
-
);
|
|
218
|
-
expect(style.width).toBe(`760px`);
|
|
219
|
-
expect(style.marginLeft).toBe('-20px');
|
|
220
|
-
},
|
|
221
|
-
);
|
|
152
|
+
const style = window.getComputedStyle(container.firstChild as Element);
|
|
153
|
+
expect(style.width).toBe(`${akEditorWideLayoutWidth}px`);
|
|
154
|
+
expect(style.marginLeft).toBe('-120px');
|
|
222
155
|
});
|
|
223
156
|
});
|
|
224
157
|
});
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
rgbToHex,
|
|
3
|
+
tableBackgroundColorNames,
|
|
4
|
+
uuid,
|
|
5
|
+
} from '@atlaskit/adf-schema';
|
|
6
|
+
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
|
+
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
8
|
+
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
9
|
+
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
10
|
+
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
11
|
+
import {
|
|
3
12
|
findCellClosestToPos,
|
|
13
|
+
setCellAttrs,
|
|
4
14
|
} from '@atlaskit/editor-tables/utils';
|
|
5
15
|
import {
|
|
6
16
|
createProsemirrorEditorFactory,
|
|
@@ -9,27 +19,18 @@ import {
|
|
|
9
19
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
10
20
|
import {
|
|
11
21
|
doc,
|
|
22
|
+
DocBuilder,
|
|
12
23
|
p,
|
|
13
24
|
table,
|
|
14
|
-
tr,
|
|
15
25
|
td,
|
|
16
26
|
tdEmpty,
|
|
17
|
-
|
|
27
|
+
tr,
|
|
18
28
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
19
|
-
|
|
20
|
-
tableBackgroundColorNames,
|
|
21
|
-
rgbToHex,
|
|
22
|
-
uuid,
|
|
23
|
-
} from '@atlaskit/adf-schema';
|
|
24
|
-
import { PluginConfig } from '../../../plugins/table/types';
|
|
25
|
-
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
26
|
-
import TableCellViews from '../../../plugins/table/nodeviews/tableCell';
|
|
29
|
+
|
|
27
30
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
28
|
-
import
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
32
|
-
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
31
|
+
import TableCellViews from '../../../plugins/table/nodeviews/tableCell';
|
|
32
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
33
|
+
import { PluginConfig } from '../../../plugins/table/types';
|
|
33
34
|
|
|
34
35
|
jest.mock('@atlaskit/editor-common/utils', () => ({
|
|
35
36
|
...jest.requireActual<Object>('@atlaskit/editor-common/utils'),
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
|
|
4
|
+
import { TableAttributes } from '@atlaskit/adf-schema';
|
|
5
|
+
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
7
|
+
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
8
|
+
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
9
|
+
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
2
10
|
import {
|
|
3
11
|
createProsemirrorEditorFactory,
|
|
4
12
|
LightEditorPlugin,
|
|
@@ -6,26 +14,20 @@ import {
|
|
|
6
14
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
7
15
|
import {
|
|
8
16
|
doc,
|
|
17
|
+
DocBuilder,
|
|
9
18
|
p,
|
|
10
19
|
table,
|
|
11
|
-
tr,
|
|
12
20
|
td,
|
|
13
|
-
tdEmpty,
|
|
14
21
|
tdCursor,
|
|
15
|
-
|
|
22
|
+
tdEmpty,
|
|
23
|
+
tr,
|
|
16
24
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
17
|
-
import { TableAttributes } from '@atlaskit/adf-schema';
|
|
18
|
-
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
19
|
-
import tablePlugin from '../../../plugins/table';
|
|
20
|
-
import TableView from '../../../plugins/table/nodeviews/table';
|
|
21
25
|
import defaultSchema from '@atlaskit/editor-test-helpers/schema';
|
|
22
|
-
|
|
26
|
+
|
|
27
|
+
import tablePlugin from '../../../plugins/table';
|
|
23
28
|
import { hoverRows } from '../../../plugins/table/commands';
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
27
|
-
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
28
|
-
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
29
|
+
import TableView from '../../../plugins/table/nodeviews/table';
|
|
30
|
+
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
29
31
|
|
|
30
32
|
describe('table -> nodeviews -> table.tsx', () => {
|
|
31
33
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DecorationSet } from 'prosemirror-view';
|
|
2
2
|
|
|
3
|
+
import { createEditorState } from '@atlaskit/editor-test-helpers/create-editor-state';
|
|
3
4
|
import {
|
|
4
5
|
doc,
|
|
5
6
|
table,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
tdEmpty,
|
|
8
9
|
tr,
|
|
9
10
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
10
|
-
import { createEditorState } from '@atlaskit/editor-test-helpers/create-editor-state';
|
|
11
11
|
|
|
12
12
|
import { buildColumnControlsDecorations } from '../../../../plugins/table/pm-plugins/decorations/utils';
|
|
13
13
|
import { TableDecorations } from '../../../../plugins/table/types';
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { PluginKey } from 'prosemirror-state';
|
|
2
2
|
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
3
|
-
import { getCellsInColumn } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
|
|
5
3
|
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
6
4
|
|
|
5
|
+
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
7
|
+
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
8
|
+
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
9
|
+
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
|
+
import { getCellsInColumn } from '@atlaskit/editor-tables/utils';
|
|
7
11
|
import {
|
|
8
12
|
createProsemirrorEditorFactory,
|
|
9
13
|
LightEditorPlugin,
|
|
@@ -11,13 +15,13 @@ import {
|
|
|
11
15
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
12
16
|
import {
|
|
13
17
|
doc,
|
|
18
|
+
DocBuilder,
|
|
14
19
|
p,
|
|
15
20
|
table,
|
|
16
21
|
td,
|
|
17
22
|
tdCursor,
|
|
18
23
|
tdEmpty,
|
|
19
24
|
tr,
|
|
20
|
-
DocBuilder,
|
|
21
25
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
22
26
|
|
|
23
27
|
import tablePlugin from '../../../../plugins/table';
|
|
@@ -32,11 +36,6 @@ import {
|
|
|
32
36
|
TableDecorations,
|
|
33
37
|
TablePluginState,
|
|
34
38
|
} from '../../../../plugins/table/types';
|
|
35
|
-
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
36
|
-
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
37
|
-
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
38
|
-
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
39
|
-
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
40
39
|
|
|
41
40
|
describe('tables: column resizing decorations', () => {
|
|
42
41
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Selection } from 'prosemirror-state';
|
|
2
|
-
import { addColumnAt } from '@atlaskit/editor-tables/utils';
|
|
3
2
|
import { DecorationSet } from 'prosemirror-view';
|
|
4
3
|
|
|
4
|
+
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
|
+
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
7
|
+
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
8
|
+
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
|
+
import { addColumnAt } from '@atlaskit/editor-tables/utils';
|
|
5
10
|
import {
|
|
6
11
|
createProsemirrorEditorFactory,
|
|
7
12
|
LightEditorPlugin,
|
|
@@ -9,13 +14,14 @@ import {
|
|
|
9
14
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
10
15
|
import {
|
|
11
16
|
doc,
|
|
17
|
+
DocBuilder,
|
|
12
18
|
table,
|
|
13
19
|
tdCursor,
|
|
14
20
|
tdEmpty,
|
|
15
21
|
tr,
|
|
16
|
-
DocBuilder,
|
|
17
22
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
18
23
|
|
|
24
|
+
import tablePlugin from '../../../../plugins/table';
|
|
19
25
|
import { selectColumn } from '../../../../plugins/table/commands';
|
|
20
26
|
import {
|
|
21
27
|
getDecorations,
|
|
@@ -24,13 +30,6 @@ import {
|
|
|
24
30
|
import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
|
|
25
31
|
import { pluginKey as tableWidthPluginKey } from '../../../../plugins/table/pm-plugins/table-width';
|
|
26
32
|
import { TableDecorations } from '../../../../plugins/table/types';
|
|
27
|
-
import tablePlugin from '../../../../plugins/table';
|
|
28
|
-
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
29
|
-
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
30
|
-
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
31
|
-
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
32
|
-
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
33
|
-
import { ffTest } from '@atlassian/feature-flags-test-utils';
|
|
34
33
|
|
|
35
34
|
describe('decorations plugin', () => {
|
|
36
35
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -158,60 +157,49 @@ describe('decorations plugin', () => {
|
|
|
158
157
|
});
|
|
159
158
|
|
|
160
159
|
describe('table width resizing', () => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
160
|
+
const editor = (doc: DocBuilder) =>
|
|
161
|
+
createEditor({
|
|
162
|
+
doc,
|
|
163
|
+
attachTo: document.body,
|
|
164
|
+
preset: new Preset<LightEditorPlugin>()
|
|
165
|
+
.add([featureFlagsPlugin, {}])
|
|
166
|
+
.add([analyticsPlugin, {}])
|
|
167
|
+
.add(contentInsertionPlugin)
|
|
168
|
+
.add(widthPlugin)
|
|
169
|
+
.add(guidelinePlugin)
|
|
170
|
+
.add([
|
|
171
|
+
tablePlugin,
|
|
171
172
|
{
|
|
172
|
-
|
|
173
|
+
tableResizingEnabled: true,
|
|
174
|
+
tableOptions: {
|
|
175
|
+
advanced: true,
|
|
176
|
+
},
|
|
173
177
|
},
|
|
174
|
-
)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
expect(startDecorationSet).toEqual(DecorationSet.empty);
|
|
178
|
+
]),
|
|
179
|
+
pluginKey,
|
|
180
|
+
});
|
|
178
181
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
);
|
|
185
|
-
editorView.dispatch(endTransaction);
|
|
186
|
-
const endDecorationSet = getDecorations(editorView.state);
|
|
187
|
-
expect(endDecorationSet).not.toEqual(DecorationSet.empty);
|
|
188
|
-
},
|
|
189
|
-
() => {
|
|
190
|
-
const { editorView } = editor(
|
|
191
|
-
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
const startTransaction = editorView.state.tr.setMeta(
|
|
195
|
-
tableWidthPluginKey,
|
|
196
|
-
{
|
|
197
|
-
resizing: true,
|
|
198
|
-
},
|
|
199
|
-
);
|
|
200
|
-
editorView.dispatch(startTransaction);
|
|
201
|
-
const startDecorationSet = getDecorations(editorView.state);
|
|
202
|
-
expect(startDecorationSet).not.toEqual(DecorationSet.empty);
|
|
182
|
+
it('should remove column controls when resizing starts and add back when it ends when customTableWidth is enabled', () => {
|
|
183
|
+
const { editorView } = editor(
|
|
184
|
+
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
185
|
+
);
|
|
203
186
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
);
|
|
210
|
-
editorView.dispatch(endTransaction);
|
|
211
|
-
const endDecorationSet = getDecorations(editorView.state);
|
|
212
|
-
expect(endDecorationSet).not.toEqual(DecorationSet.empty);
|
|
187
|
+
const startTransaction = editorView.state.tr.setMeta(
|
|
188
|
+
tableWidthPluginKey,
|
|
189
|
+
{
|
|
190
|
+
resizing: true,
|
|
213
191
|
},
|
|
214
192
|
);
|
|
193
|
+
editorView.dispatch(startTransaction);
|
|
194
|
+
const startDecorationSet = getDecorations(editorView.state);
|
|
195
|
+
expect(startDecorationSet).toEqual(DecorationSet.empty);
|
|
196
|
+
|
|
197
|
+
const endTransaction = editorView.state.tr.setMeta(tableWidthPluginKey, {
|
|
198
|
+
resizing: false,
|
|
199
|
+
});
|
|
200
|
+
editorView.dispatch(endTransaction);
|
|
201
|
+
const endDecorationSet = getDecorations(editorView.state);
|
|
202
|
+
expect(endDecorationSet).not.toEqual(DecorationSet.empty);
|
|
215
203
|
});
|
|
216
204
|
});
|
|
217
205
|
});
|