@atlaskit/editor-plugin-table 7.25.9 → 7.25.11
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/CHANGELOG.md +24 -0
- package/dist/cjs/commands/clear.js +2 -14
- package/dist/cjs/commands/column-resize.js +11 -5
- package/dist/cjs/commands/delete.js +2 -1
- package/dist/cjs/commands/insert.js +8 -5
- package/dist/cjs/commands/selection.js +3 -3
- package/dist/cjs/commands-with-analytics.js +23 -52
- package/dist/cjs/nodeviews/TableComponent.js +29 -14
- package/dist/cjs/nodeviews/TableContainer.js +2 -2
- package/dist/cjs/nodeviews/TableResizer.js +1 -1
- package/dist/cjs/plugin.js +4 -2
- package/dist/cjs/pm-plugins/decorations/utils/index.js +1 -8
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/cjs/pm-plugins/drag-and-drop/index.js +1 -14
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +4 -1
- package/dist/cjs/pm-plugins/drag-and-drop/utils/index.js +0 -7
- package/dist/cjs/pm-plugins/safari-delete-composition-text-issue-workaround.js +2 -2
- package/dist/cjs/pm-plugins/sticky-headers/index.js +1 -14
- package/dist/cjs/pm-plugins/table-analytics.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/commands.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +33 -15
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +15 -6
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +1 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/dom.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +0 -103
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +23 -15
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +6 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +23 -18
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +13 -8
- package/dist/cjs/pm-plugins/table-selection-keymap.js +1 -3
- package/dist/cjs/pm-plugins/view-mode-sort/utils.js +2 -2
- package/dist/cjs/toolbar.js +9 -9
- package/dist/cjs/transforms/column-width.js +3 -1
- package/dist/cjs/transforms/delete-columns.js +2 -1
- package/dist/cjs/transforms/index.js +0 -6
- package/dist/cjs/ui/DragHandle/index.js +3 -1
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/cjs/ui/FloatingDeleteButton/index.js +0 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +5 -4
- package/dist/cjs/ui/FloatingDragMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +2 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -2
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -3
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/cjs/ui/icons/index.js +0 -7
- package/dist/cjs/utils/column-controls.js +1 -22
- package/dist/cjs/utils/dom.js +1 -4
- package/dist/cjs/utils/drag-menu.js +3 -2
- package/dist/cjs/utils/index.js +0 -108
- package/dist/cjs/utils/merged-cells.js +1 -60
- package/dist/cjs/utils/nodes.js +2 -2
- package/dist/cjs/utils/row-controls.js +1 -8
- package/dist/cjs/utils/selection.js +1 -60
- package/dist/cjs/utils/table.js +1 -11
- package/dist/es2019/commands/clear.js +1 -14
- package/dist/es2019/commands/column-resize.js +11 -5
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +8 -8
- package/dist/es2019/commands/selection.js +2 -2
- package/dist/es2019/commands-with-analytics.js +6 -36
- package/dist/es2019/nodeviews/TableComponent.js +30 -15
- package/dist/es2019/nodeviews/TableContainer.js +1 -1
- package/dist/es2019/nodeviews/TableResizer.js +1 -1
- package/dist/es2019/plugin.js +4 -2
- package/dist/es2019/pm-plugins/decorations/utils/index.js +1 -2
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +2 -2
- package/dist/es2019/pm-plugins/drag-and-drop/index.js +1 -2
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +4 -1
- package/dist/es2019/pm-plugins/drag-and-drop/utils/index.js +0 -1
- package/dist/es2019/pm-plugins/safari-delete-composition-text-issue-workaround.js +1 -1
- package/dist/es2019/pm-plugins/sticky-headers/index.js +1 -2
- package/dist/es2019/pm-plugins/table-analytics.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/commands.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +32 -14
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +15 -7
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +0 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/dom.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +5 -6
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +22 -14
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +6 -7
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +21 -15
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +10 -7
- package/dist/es2019/pm-plugins/table-selection-keymap.js +1 -2
- package/dist/es2019/pm-plugins/view-mode-sort/utils.js +1 -1
- package/dist/es2019/toolbar.js +8 -8
- package/dist/es2019/transforms/column-width.js +3 -2
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/transforms/index.js +1 -1
- package/dist/es2019/ui/DragHandle/index.js +3 -1
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/ui/FloatingDeleteButton/index.js +1 -1
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +4 -3
- package/dist/es2019/ui/FloatingDragMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -1
- package/dist/es2019/ui/FloatingInsertButton/index.js +3 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -2
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/es2019/ui/icons/index.js +0 -1
- package/dist/es2019/utils/column-controls.js +1 -19
- package/dist/es2019/utils/dom.js +0 -1
- package/dist/es2019/utils/drag-menu.js +3 -3
- package/dist/es2019/utils/index.js +8 -8
- package/dist/es2019/utils/merged-cells.js +0 -47
- package/dist/es2019/utils/nodes.js +1 -1
- package/dist/es2019/utils/row-controls.js +1 -8
- package/dist/es2019/utils/selection.js +0 -60
- package/dist/es2019/utils/table.js +0 -6
- package/dist/esm/commands/clear.js +1 -14
- package/dist/esm/commands/column-resize.js +11 -5
- package/dist/esm/commands/delete.js +2 -1
- package/dist/esm/commands/insert.js +8 -5
- package/dist/esm/commands/selection.js +2 -2
- package/dist/esm/commands-with-analytics.js +24 -52
- package/dist/esm/nodeviews/TableComponent.js +30 -15
- package/dist/esm/nodeviews/TableContainer.js +1 -1
- package/dist/esm/nodeviews/TableResizer.js +1 -1
- package/dist/esm/plugin.js +4 -2
- package/dist/esm/pm-plugins/decorations/utils/index.js +1 -2
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +2 -2
- package/dist/esm/pm-plugins/drag-and-drop/index.js +1 -2
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +4 -1
- package/dist/esm/pm-plugins/drag-and-drop/utils/index.js +0 -1
- package/dist/esm/pm-plugins/safari-delete-composition-text-issue-workaround.js +1 -1
- package/dist/esm/pm-plugins/sticky-headers/index.js +1 -2
- package/dist/esm/pm-plugins/table-analytics.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/commands.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +33 -15
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +15 -6
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +0 -1
- package/dist/esm/pm-plugins/table-resizing/utils/dom.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +5 -6
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +24 -14
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +6 -7
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +22 -17
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +12 -6
- package/dist/esm/pm-plugins/table-selection-keymap.js +1 -2
- package/dist/esm/pm-plugins/view-mode-sort/utils.js +1 -1
- package/dist/esm/toolbar.js +8 -8
- package/dist/esm/transforms/column-width.js +3 -1
- package/dist/esm/transforms/delete-columns.js +2 -1
- package/dist/esm/transforms/index.js +1 -1
- package/dist/esm/ui/DragHandle/index.js +3 -1
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/esm/ui/FloatingDeleteButton/index.js +1 -1
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +4 -3
- package/dist/esm/ui/FloatingDragMenu/index.js +4 -2
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -1
- package/dist/esm/ui/FloatingInsertButton/index.js +3 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -2
- package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/esm/ui/icons/index.js +0 -1
- package/dist/esm/utils/column-controls.js +1 -22
- package/dist/esm/utils/dom.js +0 -3
- package/dist/esm/utils/drag-menu.js +3 -2
- package/dist/esm/utils/index.js +8 -8
- package/dist/esm/utils/merged-cells.js +0 -59
- package/dist/esm/utils/nodes.js +1 -1
- package/dist/esm/utils/row-controls.js +1 -8
- package/dist/esm/utils/selection.js +0 -59
- package/dist/esm/utils/table.js +0 -9
- package/dist/types/commands/clear.d.ts +0 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +4 -4
- package/dist/types/commands/selection.d.ts +0 -4
- package/dist/types/commands-with-analytics.d.ts +2 -3
- package/dist/types/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types/nodeviews/TableContainer.d.ts +0 -11
- package/dist/types/nodeviews/TableResizer.d.ts +1 -3
- package/dist/types/pm-plugins/analytics/actions.d.ts +3 -2
- package/dist/types/pm-plugins/decorations/utils/index.d.ts +0 -1
- package/dist/types/pm-plugins/decorations/utils/types.d.ts +2 -1
- package/dist/types/pm-plugins/drag-and-drop/actions.d.ts +5 -4
- package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -6
- package/dist/types/pm-plugins/drag-and-drop/index.d.ts +0 -2
- package/dist/types/pm-plugins/drag-and-drop/utils/index.d.ts +0 -1
- package/dist/types/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -2
- package/dist/types/pm-plugins/sticky-headers/index.d.ts +0 -1
- package/dist/types/pm-plugins/sticky-headers/types.d.ts +3 -2
- package/dist/types/pm-plugins/table-analytics.d.ts +0 -12
- package/dist/types/pm-plugins/table-resizing/commands.d.ts +0 -5
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +3 -2
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +0 -1
- package/dist/types/pm-plugins/table-resizing/utils/dom.d.ts +0 -2
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +5 -8
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -2
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +3 -2
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -5
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -4
- package/dist/types/pm-plugins/table-selection-keymap.d.ts +0 -1
- package/dist/types/pm-plugins/view-mode-sort/types.d.ts +2 -1
- package/dist/types/pm-plugins/view-mode-sort/utils.d.ts +0 -6
- package/dist/types/toolbar.d.ts +1 -14
- package/dist/types/transforms/column-width.d.ts +1 -1
- package/dist/types/transforms/delete-columns.d.ts +1 -1
- package/dist/types/transforms/index.d.ts +1 -1
- package/dist/types/ui/FloatingContextualButton/FixedButton.d.ts +1 -2
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDeleteButton/DeleteButton.d.ts +1 -1
- package/dist/types/ui/FloatingDeleteButton/index.d.ts +2 -3
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingInsertButton/InsertButton.d.ts +1 -2
- package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +2 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -1
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingControls/NumberColumn/index.d.ts +2 -1
- package/dist/types/ui/TableFloatingControls/RowDropTarget/index.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/index.d.ts +1 -1
- package/dist/types/ui/icons/index.d.ts +0 -1
- package/dist/types/utils/column-controls.d.ts +0 -2
- package/dist/types/utils/dom.d.ts +0 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types/utils/index.d.ts +8 -8
- package/dist/types/utils/merged-cells.d.ts +0 -2
- package/dist/types/utils/nodes.d.ts +0 -1
- package/dist/types/utils/row-controls.d.ts +0 -1
- package/dist/types/utils/selection.d.ts +0 -3
- package/dist/types/utils/table.d.ts +0 -2
- package/dist/types-ts4.5/commands/clear.d.ts +0 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +4 -4
- package/dist/types-ts4.5/commands/selection.d.ts +0 -4
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -3
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +0 -11
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +1 -3
- package/dist/types-ts4.5/pm-plugins/analytics/actions.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/decorations/utils/index.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/decorations/utils/types.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/actions.d.ts +5 -4
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -6
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/index.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/index.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/sticky-headers/index.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/sticky-headers/types.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/table-analytics.d.ts +0 -12
- package/dist/types-ts4.5/pm-plugins/table-resizing/commands.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/dom.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +5 -8
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -5
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -4
- package/dist/types-ts4.5/pm-plugins/table-selection-keymap.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/types.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/utils.d.ts +0 -6
- package/dist/types-ts4.5/toolbar.d.ts +1 -14
- package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
- package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
- package/dist/types-ts4.5/transforms/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualButton/FixedButton.d.ts +1 -2
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDeleteButton/DeleteButton.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDeleteButton/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/InsertButton.d.ts +1 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/NumberColumn/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/RowDropTarget/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/icons/index.d.ts +0 -1
- package/dist/types-ts4.5/utils/column-controls.d.ts +0 -2
- package/dist/types-ts4.5/utils/dom.d.ts +0 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/utils/index.d.ts +8 -8
- package/dist/types-ts4.5/utils/merged-cells.d.ts +0 -2
- package/dist/types-ts4.5/utils/nodes.d.ts +0 -1
- package/dist/types-ts4.5/utils/row-controls.d.ts +0 -1
- package/dist/types-ts4.5/utils/selection.d.ts +0 -3
- package/dist/types-ts4.5/utils/table.d.ts +0 -2
- package/package.json +3 -3
- package/src/commands/clear.ts +0 -14
- package/src/commands/column-resize.ts +19 -6
- package/src/commands/delete.ts +2 -0
- package/src/commands/insert.ts +8 -0
- package/src/commands/selection.ts +1 -1
- package/src/commands-with-analytics.ts +5 -40
- package/src/nodeviews/TableComponent.tsx +43 -9
- package/src/nodeviews/TableContainer.tsx +1 -1
- package/src/nodeviews/TableResizer.tsx +2 -4
- package/src/plugin.tsx +2 -0
- package/src/pm-plugins/analytics/actions.ts +2 -2
- package/src/pm-plugins/decorations/utils/index.ts +0 -1
- package/src/pm-plugins/decorations/utils/types.ts +1 -1
- package/src/pm-plugins/drag-and-drop/actions.ts +4 -4
- package/src/pm-plugins/drag-and-drop/commands.ts +2 -2
- package/src/pm-plugins/drag-and-drop/index.ts +0 -3
- package/src/pm-plugins/drag-and-drop/plugin.ts +4 -0
- package/src/pm-plugins/drag-and-drop/utils/index.ts +0 -2
- package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +1 -1
- package/src/pm-plugins/sticky-headers/index.ts +0 -1
- package/src/pm-plugins/sticky-headers/types.ts +2 -2
- package/src/pm-plugins/table-analytics.ts +1 -1
- package/src/pm-plugins/table-resizing/commands.ts +1 -1
- package/src/pm-plugins/table-resizing/event-handlers.ts +39 -15
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +18 -7
- package/src/pm-plugins/table-resizing/utils/consts.ts +0 -1
- package/src/pm-plugins/table-resizing/utils/dom.ts +2 -5
- package/src/pm-plugins/table-resizing/utils/index.ts +4 -30
- package/src/pm-plugins/table-resizing/utils/misc.ts +25 -17
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +14 -13
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +28 -21
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +18 -6
- package/src/pm-plugins/table-selection-keymap.ts +0 -2
- package/src/pm-plugins/view-mode-sort/types.ts +1 -1
- package/src/pm-plugins/view-mode-sort/utils.ts +1 -5
- package/src/toolbar.tsx +8 -5
- package/src/transforms/column-width.ts +2 -0
- package/src/transforms/delete-columns.ts +2 -0
- package/src/transforms/index.ts +1 -1
- package/src/ui/DragHandle/index.tsx +2 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +2 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +5 -2
- package/src/ui/FloatingContextualMenu/index.tsx +1 -1
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +1 -1
- package/src/ui/FloatingDeleteButton/index.tsx +2 -2
- package/src/ui/FloatingDragMenu/DragMenu.tsx +4 -1
- package/src/ui/FloatingDragMenu/index.tsx +4 -1
- package/src/ui/FloatingInsertButton/InsertButton.tsx +2 -2
- package/src/ui/FloatingInsertButton/index.tsx +3 -0
- package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +1 -1
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -3
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +1 -1
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +1 -1
- package/src/ui/TableFloatingColumnControls/index.tsx +2 -2
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -1
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +2 -0
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +1 -1
- package/src/ui/TableFloatingControls/index.tsx +1 -1
- package/src/ui/icons/index.ts +0 -1
- package/src/utils/column-controls.ts +2 -38
- package/src/utils/dom.ts +0 -4
- package/src/utils/drag-menu.ts +3 -0
- package/src/utils/index.ts +1 -22
- package/src/utils/merged-cells.ts +0 -62
- package/src/utils/nodes.ts +1 -1
- package/src/utils/row-controls.ts +1 -19
- package/src/utils/selection.ts +0 -84
- package/src/utils/table.ts +0 -8
- package/dist/cjs/utils/transforms.js +0 -11
- package/dist/es2019/utils/transforms.js +0 -5
- package/dist/esm/utils/transforms.js +0 -5
- package/dist/types/utils/transforms.d.ts +0 -2
- package/dist/types-ts4.5/utils/transforms.d.ts +0 -2
- package/src/utils/transforms.ts +0 -10
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { getParentNodeWidth, getTableContainerWidth, layoutToWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import {
|
|
4
|
-
import { calcTableColumnWidths, containsClassName } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
5
4
|
import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { hasTableBeenResized } from './colgroup';
|
|
5
|
+
import { hasTableBeenResized, hasTableColumnBeenResized } from './colgroup';
|
|
7
6
|
import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION } from './consts';
|
|
8
7
|
|
|
9
8
|
// Translates named layouts in number values.
|
|
@@ -20,9 +19,6 @@ export function getLayoutSize(tableLayout, containerWidth = 0, options) {
|
|
|
20
19
|
}
|
|
21
20
|
return layoutToWidth[tableLayout] || containerWidth;
|
|
22
21
|
}
|
|
23
|
-
export function getDefaultLayoutMaxWidth(containerWidth) {
|
|
24
|
-
return mapBreakpointToLayoutMaxWidth(getBreakpoint(containerWidth));
|
|
25
|
-
}
|
|
26
22
|
|
|
27
23
|
// Does the current position point at a cell.
|
|
28
24
|
export function pointsAtCell($pos) {
|
|
@@ -51,14 +47,6 @@ export function currentColWidth(view, cellPos, {
|
|
|
51
47
|
}
|
|
52
48
|
return domWidth / parts;
|
|
53
49
|
}
|
|
54
|
-
|
|
55
|
-
// Attempts to find a parent TD/TH depending on target element.
|
|
56
|
-
export function domCellAround(target) {
|
|
57
|
-
while (target && target.nodeName !== 'TD' && target.nodeName !== 'TH') {
|
|
58
|
-
target = containsClassName(target, 'ProseMirror') ? null : target.parentNode;
|
|
59
|
-
}
|
|
60
|
-
return target;
|
|
61
|
-
}
|
|
62
50
|
export const getTableMaxWidth = ({
|
|
63
51
|
table,
|
|
64
52
|
tableStart,
|
|
@@ -100,6 +88,26 @@ export const getTableScalingPercent = (table, tableRef, shouldUseIncreasedScalin
|
|
|
100
88
|
scalePercent = Math.max(scalePercent, 1 - maxScalingPercent);
|
|
101
89
|
return Math.min(scalePercent, 1);
|
|
102
90
|
};
|
|
91
|
+
|
|
92
|
+
// This function is used to default and full-width tables in Comment/Chromeless editors
|
|
93
|
+
// These tables don't have node.attrs.width set. Their pm-table-wrapper width depend on the editor container width.
|
|
94
|
+
// actual table node width can be calculated as sum of colwidth values if table's columns were resized.
|
|
95
|
+
// If colwidth are not set, table columns are not resized, they all are equal widths.
|
|
96
|
+
export const getScalingPercentForTableWithoutWidth = (table, tableRef) => {
|
|
97
|
+
// are table columns resized
|
|
98
|
+
if (hasTableColumnBeenResized(table)) {
|
|
99
|
+
var _tableRef$parentEleme2;
|
|
100
|
+
const tableWidth = calcTableColumnWidths(table).reduce((sum, width) => sum + width, 0);
|
|
101
|
+
let renderWidth = (tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$parentEleme2 = tableRef.parentElement) === null || _tableRef$parentEleme2 === void 0 ? void 0 : _tableRef$parentEleme2.clientWidth) || tableWidth;
|
|
102
|
+
|
|
103
|
+
// minus 1 here to avoid any 1px scroll in Firefox
|
|
104
|
+
return (renderWidth - 1) / tableWidth;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// When table cols are not resized and table width is not set,
|
|
108
|
+
// tableWidth is equal to renderWidth
|
|
109
|
+
return 1;
|
|
110
|
+
};
|
|
103
111
|
export const getStaticTableScalingPercent = (table, tableRenderWidth, shouldUseIncreasedScalingPercent) => {
|
|
104
112
|
const maxScalingPercent = shouldUseIncreasedScalingPercent ? MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION : MAX_SCALING_PERCENT;
|
|
105
113
|
const tableWidth = getTableContainerElementWidth(table);
|
|
@@ -6,15 +6,13 @@ import { ALIGN_CENTER, ALIGN_START, shouldChangeAlignmentToCenterResized } from
|
|
|
6
6
|
import { getTableScalingPercent } from './misc';
|
|
7
7
|
import { growColumn, shrinkColumn, updateAffectedColumn } from './resize-logic';
|
|
8
8
|
import { updateColgroup } from './resize-state';
|
|
9
|
-
export const resizeColumn = (resizeState, colIndex, amount, tableRef, tableNode, selectedColumns, isTableScalingEnabled = false,
|
|
10
|
-
let scalePercent = 1;
|
|
9
|
+
export const resizeColumn = (resizeState, colIndex, amount, tableRef, tableNode, selectedColumns, isTableScalingEnabled = false, scalePercent = 1) => {
|
|
11
10
|
let resizeAmount = amount;
|
|
12
11
|
if (isTableScalingEnabled) {
|
|
13
|
-
scalePercent = getTableScalingPercent(tableNode, tableRef, shouldUseIncreasedScalingPercent);
|
|
14
12
|
resizeAmount = amount / scalePercent;
|
|
15
13
|
}
|
|
16
14
|
const newState = resizeAmount > 0 ? growColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? shrinkColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
|
|
17
|
-
updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled,
|
|
15
|
+
updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled, scalePercent);
|
|
18
16
|
return newState;
|
|
19
17
|
};
|
|
20
18
|
export const resizeColumnAndTable = ({
|
|
@@ -66,7 +64,7 @@ export const resizeColumnAndTable = ({
|
|
|
66
64
|
isNumberColumnEnabled ? resizeState.maxSize + akEditorTableNumberColumnWidth + delta : resizeState.maxSize + delta);
|
|
67
65
|
|
|
68
66
|
// do not apply scaling logic because resize state is already scaled
|
|
69
|
-
updateColgroup(newState, tableRef, tableNode, false,
|
|
67
|
+
updateColgroup(newState, tableRef, tableNode, false, 1);
|
|
70
68
|
updateTablePreview(tableRef, newState.maxSize, shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, newState.maxSize));
|
|
71
69
|
return newState;
|
|
72
70
|
};
|
|
@@ -92,7 +90,8 @@ export const scaleResizeState = ({
|
|
|
92
90
|
resizeState,
|
|
93
91
|
tableRef,
|
|
94
92
|
tableNode,
|
|
95
|
-
editorWidth
|
|
93
|
+
editorWidth,
|
|
94
|
+
shouldUseIncreasedScalingPercent
|
|
96
95
|
}) => {
|
|
97
96
|
const isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
|
|
98
97
|
const isTableScaled = isNumberColumnEnabled || resizeState.maxSize > getEditorContainerWidth(editorWidth);
|
|
@@ -106,7 +105,7 @@ export const scaleResizeState = ({
|
|
|
106
105
|
if (!isTableScaled || isNumberColumnEnabled && resizeState.maxSize > resizeState.tableWidth) {
|
|
107
106
|
return resizeState;
|
|
108
107
|
}
|
|
109
|
-
const scalePercent = getTableScalingPercent(tableNode, tableRef);
|
|
108
|
+
const scalePercent = getTableScalingPercent(tableNode, tableRef, shouldUseIncreasedScalingPercent);
|
|
110
109
|
const scaledTableWidth = Math.round(resizeState.tableWidth * scalePercent);
|
|
111
110
|
let cols = resizeState.cols.map(col => {
|
|
112
111
|
return {
|
|
@@ -15,14 +15,16 @@ export const getResizeState = ({
|
|
|
15
15
|
start,
|
|
16
16
|
domAtPos,
|
|
17
17
|
isTableScalingEnabled = false,
|
|
18
|
-
shouldUseIncreasedScalingPercent = false
|
|
18
|
+
shouldUseIncreasedScalingPercent = false,
|
|
19
|
+
isCommentEditor = false
|
|
19
20
|
}) => {
|
|
20
|
-
|
|
21
|
+
var _table$attrs;
|
|
22
|
+
if (isTableScalingEnabled && !isCommentEditor || isTableScalingEnabled && isCommentEditor && (_table$attrs = table.attrs) !== null && _table$attrs !== void 0 && _table$attrs.width) {
|
|
21
23
|
const scalePercent = getTableScalingPercent(table, tableRef, shouldUseIncreasedScalingPercent);
|
|
22
24
|
minWidth = Math.ceil(minWidth / scalePercent);
|
|
23
25
|
}
|
|
24
|
-
// If the table has been resized, we can use the column widths from the table node
|
|
25
26
|
if (hasTableBeenResized(table)) {
|
|
27
|
+
// If the table has been resized, we can use the column widths from the table node
|
|
26
28
|
const cols = calcTableColumnWidths(table).map((width, index) => ({
|
|
27
29
|
width: width === 0 ? tableNewColumnMinWidth : width,
|
|
28
30
|
minWidth: width === 0 ? tableNewColumnMinWidth : minWidth,
|
|
@@ -45,12 +47,15 @@ export const getResizeState = ({
|
|
|
45
47
|
// Getting the resize state from DOM
|
|
46
48
|
const colgroupChildren = insertColgroupFromNode(tableRef, table, isTableScalingEnabled, shouldReinsertColgroup,
|
|
47
49
|
// don't reinsert colgroup when preserving table width - this causes widths to jump
|
|
48
|
-
shouldUseIncreasedScalingPercent);
|
|
50
|
+
shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
49
51
|
const cols = Array.from(colgroupChildren).map((_, index) => {
|
|
50
52
|
// If the table hasn't been resized and we have a table width attribute, we can use it
|
|
51
53
|
// to calculate the widths of the columns
|
|
52
54
|
if (isTableScalingEnabled) {
|
|
53
|
-
|
|
55
|
+
var _table$attrs2;
|
|
56
|
+
// isCommentEditor when table cols were not resized,
|
|
57
|
+
// we want to use tableRef.parentElement.clientWidth, which is the same as maxSize
|
|
58
|
+
const tableNodeWidth = isCommentEditor && !((_table$attrs2 = table.attrs) !== null && _table$attrs2 !== void 0 && _table$attrs2.width) ? maxSize : getTableContainerWidth(table);
|
|
54
59
|
return {
|
|
55
60
|
index,
|
|
56
61
|
width: tableNodeWidth / colgroupChildren.length,
|
|
@@ -74,7 +79,7 @@ export const getResizeState = ({
|
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
// updates Colgroup DOM node with new widths
|
|
77
|
-
export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled,
|
|
82
|
+
export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled, scalePercent) => {
|
|
78
83
|
const cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
|
|
79
84
|
const columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
80
85
|
/**
|
|
@@ -83,11 +88,10 @@ export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled
|
|
|
83
88
|
We need to remove !isColumnResizing if we handled auto scale table when mouseUp event.
|
|
84
89
|
* */
|
|
85
90
|
if (isTableScalingEnabled && tableNode) {
|
|
86
|
-
const scalePercent = getTableScalingPercent(tableNode, tableRef, shouldUseIncreasedScalingPercent);
|
|
87
91
|
state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
|
|
88
92
|
.forEach((column, i) => {
|
|
89
93
|
const fixedColWidth = getColWidthFix(column.width, columnsCount !== null && columnsCount !== void 0 ? columnsCount : 0);
|
|
90
|
-
const scaledWidth = fixedColWidth * scalePercent;
|
|
94
|
+
const scaledWidth = fixedColWidth * (scalePercent || 1);
|
|
91
95
|
const finalWidth = Math.max(scaledWidth, tableCellMinWidth);
|
|
92
96
|
// we aren't handling the remaining pixels here when the 48px min width is reached
|
|
93
97
|
if (cols !== null && cols !== void 0 && cols[i]) {
|
|
@@ -148,7 +152,7 @@ export const evenAllColumnsWidths = resizeState => {
|
|
|
148
152
|
}, maxSize);
|
|
149
153
|
};
|
|
150
154
|
const getSpace = (columns, start, end) => columns.slice(start, end).map(col => col.width).reduce((sum, width) => sum + width, 0);
|
|
151
|
-
|
|
155
|
+
const evenSelectedColumnsWidths = (resizeState, rect) => {
|
|
152
156
|
const cols = resizeState.cols;
|
|
153
157
|
const selectedSpace = getSpace(cols, rect.left, rect.right);
|
|
154
158
|
const allSpace = getSpace(cols, 0, cols.length);
|
|
@@ -257,13 +261,9 @@ export const bulkColumnsResize = (resizeState, columnsIndexes, sourceColumnIndex
|
|
|
257
261
|
// fix total table widths by adding missing pixels to columns widths here and there
|
|
258
262
|
return adjustColumnsWidths(newState, resizeState.maxSize);
|
|
259
263
|
};
|
|
260
|
-
export const areColumnsEven = resizeState => {
|
|
261
|
-
const newResizeState = evenAllColumnsWidths(resizeState);
|
|
262
|
-
return newResizeState.cols.every((col, i) => col.width === resizeState.cols[i].width);
|
|
263
|
-
};
|
|
264
264
|
|
|
265
265
|
// Get the layout
|
|
266
|
-
|
|
266
|
+
const normaliseTableLayout = input => {
|
|
267
267
|
switch (input) {
|
|
268
268
|
case 'wide':
|
|
269
269
|
return input;
|
|
@@ -312,6 +312,11 @@ export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, getE
|
|
|
312
312
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
313
313
|
isTableScalingEnabledOnCurrentTable = table.node.attrs.displayMode !== 'fixed';
|
|
314
314
|
}
|
|
315
|
+
let shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
316
|
+
if (isTableScalingEnabled && isCommentEditor) {
|
|
317
|
+
isTableScalingEnabledOnCurrentTable = true;
|
|
318
|
+
shouldUseIncreasedScalingPercent = true;
|
|
319
|
+
}
|
|
315
320
|
resizeState = getResizeState({
|
|
316
321
|
minWidth: tableCellMinWidth,
|
|
317
322
|
maxSize,
|
|
@@ -320,7 +325,8 @@ export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, getE
|
|
|
320
325
|
start: table.start,
|
|
321
326
|
domAtPos,
|
|
322
327
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
323
|
-
shouldUseIncreasedScalingPercent
|
|
328
|
+
shouldUseIncreasedScalingPercent,
|
|
329
|
+
isCommentEditor
|
|
324
330
|
});
|
|
325
331
|
const newResizeState = evenSelectedColumnsWidths(resizeState, rect);
|
|
326
332
|
const widthsBefore = resizeState.widths;
|
|
@@ -11,7 +11,7 @@ import { hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
|
11
11
|
import { syncStickyRowToTable } from './dom';
|
|
12
12
|
// Base function to trigger the actual scale on a table node.
|
|
13
13
|
// Will only resize/scale if a table has been previously resized.
|
|
14
|
-
|
|
14
|
+
const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
|
|
15
15
|
const {
|
|
16
16
|
node,
|
|
17
17
|
containerWidth,
|
|
@@ -50,11 +50,12 @@ export const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurren
|
|
|
50
50
|
start,
|
|
51
51
|
domAtPos,
|
|
52
52
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
53
|
-
shouldUseIncreasedScalingPercent
|
|
53
|
+
shouldUseIncreasedScalingPercent,
|
|
54
|
+
isCommentEditor
|
|
54
55
|
});
|
|
55
56
|
return scaleTableTo(resizeState, newWidth);
|
|
56
57
|
};
|
|
57
|
-
|
|
58
|
+
const scaleWithParent = (tableRef, parentWidth, table, start, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
|
|
58
59
|
const resizeState = getResizeState({
|
|
59
60
|
minWidth: tableCellMinWidth,
|
|
60
61
|
maxSize: parentWidth,
|
|
@@ -63,7 +64,8 @@ export const scaleWithParent = (tableRef, parentWidth, table, start, domAtPos, i
|
|
|
63
64
|
start,
|
|
64
65
|
domAtPos,
|
|
65
66
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
66
|
-
shouldUseIncreasedScalingPercent
|
|
67
|
+
shouldUseIncreasedScalingPercent,
|
|
68
|
+
isCommentEditor
|
|
67
69
|
});
|
|
68
70
|
if (table.attrs.isNumberColumnEnabled) {
|
|
69
71
|
parentWidth -= akEditorTableNumberColumnWidth;
|
|
@@ -130,12 +132,12 @@ export const previewScaleTable = (tableRef, options, domAtPos, isTableScalingEna
|
|
|
130
132
|
// Here isTableScalingEnabled = false
|
|
131
133
|
shouldUseIncreasedScalingPercent) : scale(tableRef, options, domAtPos, false, shouldUseIncreasedScalingPercent);
|
|
132
134
|
if (resizeState) {
|
|
133
|
-
updateColgroup(resizeState, tableRef, node, false,
|
|
135
|
+
updateColgroup(resizeState, tableRef, node, false, 1);
|
|
134
136
|
}
|
|
135
137
|
};
|
|
136
138
|
|
|
137
139
|
// Scale the table to meet new requirements (col, layout change etc)
|
|
138
|
-
export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false) => tr => {
|
|
140
|
+
export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => tr => {
|
|
139
141
|
if (!tableRef) {
|
|
140
142
|
return tr;
|
|
141
143
|
}
|
|
@@ -150,7 +152,8 @@ export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabl
|
|
|
150
152
|
// If its not a re-sized table, we still want to re-create cols
|
|
151
153
|
// To force reflow of columns upon delete.
|
|
152
154
|
if (!isTableScalingEnabledOnCurrentTable) {
|
|
153
|
-
|
|
155
|
+
const isTableScalingEnabled = false;
|
|
156
|
+
insertColgroupFromNode(tableRef, node, isTableScalingEnabled, undefined, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
154
157
|
}
|
|
155
158
|
tr.setMeta('scrollIntoView', false);
|
|
156
159
|
return tr;
|
|
@@ -13,5 +13,4 @@ export function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
|
|
|
13
13
|
bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
|
|
14
14
|
bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
|
|
15
15
|
return keymap(list);
|
|
16
|
-
}
|
|
17
|
-
export default tableSelectionKeymapPlugin;
|
|
16
|
+
}
|
|
@@ -9,7 +9,7 @@ export const unsort = (oldOrder, tableElement) => {
|
|
|
9
9
|
tbody === null || tbody === void 0 ? void 0 : tbody.appendChild(rows[item.index + 1]);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
const getSortOrderFromTable = (tableNode, sortIndex, direction) => {
|
|
13
13
|
const tableArray = convertProsemirrorTableNodeToArrayOfRows(tableNode);
|
|
14
14
|
tableArray.shift(); // remove header row
|
|
15
15
|
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -133,7 +133,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
133
133
|
const selectionRect = getClosestSelectionRect(state);
|
|
134
134
|
const index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
|
|
135
135
|
if (index) {
|
|
136
|
-
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
|
|
136
|
+
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
|
|
137
137
|
}
|
|
138
138
|
return true;
|
|
139
139
|
},
|
|
@@ -171,7 +171,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
171
171
|
onClick: (state, dispatch, view) => {
|
|
172
172
|
const selectionRect = getClosestSelectionRect(state);
|
|
173
173
|
if (selectionRect) {
|
|
174
|
-
deleteColumnsWithAnalytics(editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
|
|
174
|
+
deleteColumnsWithAnalytics(editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
|
|
175
175
|
}
|
|
176
176
|
return true;
|
|
177
177
|
},
|
|
@@ -316,7 +316,7 @@ export const getClosestSelectionRect = state => {
|
|
|
316
316
|
const selection = state.selection;
|
|
317
317
|
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
318
318
|
};
|
|
319
|
-
|
|
319
|
+
const getClosestSelectionOrTableRect = state => {
|
|
320
320
|
const selection = state.selection;
|
|
321
321
|
const tableObject = findTable(state.selection);
|
|
322
322
|
if (!tableObject) {
|
|
@@ -450,7 +450,7 @@ const getCellItems = (state, view, {
|
|
|
450
450
|
}
|
|
451
451
|
return [];
|
|
452
452
|
};
|
|
453
|
-
|
|
453
|
+
const getDistributeConfig = (getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false) => (state, dispatch, editorView) => {
|
|
454
454
|
const selectionOrTableRect = getClosestSelectionOrTableRect(state);
|
|
455
455
|
if (!editorView || !selectionOrTableRect) {
|
|
456
456
|
return false;
|
|
@@ -474,7 +474,7 @@ const getColumnSettingItems = (editorState, editorView, {
|
|
|
474
474
|
if (!selectionOrTableRect || !editorView) {
|
|
475
475
|
return [];
|
|
476
476
|
}
|
|
477
|
-
const newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled);
|
|
477
|
+
const newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
478
478
|
const wouldChange = (_newResizeStateWithAn2 = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn2 !== void 0 ? _newResizeStateWithAn2 : false;
|
|
479
479
|
const items = [];
|
|
480
480
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo3 = pluginState.pluginConfig) !== null && _pluginState$pluginCo3 !== void 0 && _pluginState$pluginCo3.allowDistributeColumns && pluginState.isDragAndDropEnabled) {
|
|
@@ -551,7 +551,7 @@ const highlightColumnsHandler = (state, dispatch) => {
|
|
|
551
551
|
}
|
|
552
552
|
return false;
|
|
553
553
|
};
|
|
554
|
-
|
|
554
|
+
const getAlignmentOptionsConfig = (editorState, {
|
|
555
555
|
formatMessage
|
|
556
556
|
}, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) => {
|
|
557
557
|
const tableObject = findTable(editorState.selection);
|
|
@@ -612,11 +612,11 @@ export const getAlignmentOptionsConfig = (editorState, {
|
|
|
612
612
|
}];
|
|
613
613
|
return alignmentToolbarItem;
|
|
614
614
|
};
|
|
615
|
-
|
|
615
|
+
const getSelectedAlignmentIcon = (alignmentIcons, selectedNode) => {
|
|
616
616
|
const selectedAlignment = selectedNode.attrs.layout;
|
|
617
617
|
return alignmentIcons.find(icon => icon.value === normaliseAlignment(selectedAlignment));
|
|
618
618
|
};
|
|
619
|
-
|
|
619
|
+
const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) => {
|
|
620
620
|
const {
|
|
621
621
|
lineLength
|
|
622
622
|
} = getEditorContainerWidth();
|
|
@@ -86,7 +86,7 @@ export const updateColumnWidths = (resizeState, table, start, _api) => tr => {
|
|
|
86
86
|
* @param view
|
|
87
87
|
* @returns Updated transaction with rescaled columns for a given table
|
|
88
88
|
*/
|
|
89
|
-
export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, api) => (table, view) => tr => {
|
|
89
|
+
export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, api, isCommentEditor = false) => (table, view) => tr => {
|
|
90
90
|
if (!view) {
|
|
91
91
|
return tr;
|
|
92
92
|
}
|
|
@@ -169,7 +169,8 @@ export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumn
|
|
|
169
169
|
domAtPos,
|
|
170
170
|
maxSize: previousTableInfo.possibleMaxWidth,
|
|
171
171
|
isTableScalingEnabled: shouldScale,
|
|
172
|
-
shouldUseIncreasedScalingPercent
|
|
172
|
+
shouldUseIncreasedScalingPercent,
|
|
173
|
+
isCommentEditor
|
|
173
174
|
});
|
|
174
175
|
// Two scenarios that require scaling:
|
|
175
176
|
// 1. If the new table width will result in the table going into overflow
|
|
@@ -192,7 +192,7 @@ function fixRowSpans(table) {
|
|
|
192
192
|
}
|
|
193
193
|
return table.type.createChecked(table.attrs, rows, table.marks);
|
|
194
194
|
}
|
|
195
|
-
export const deleteColumns = (rect, allowCustomStep, api, view, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => tr => {
|
|
195
|
+
export const deleteColumns = (rect, allowCustomStep, api, view, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => tr => {
|
|
196
196
|
let updatedTr = tr;
|
|
197
197
|
updatedTr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
198
198
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.DELETED_COLUMN
|
|
@@ -204,7 +204,7 @@ export const deleteColumns = (rect, allowCustomStep, api, view, isTableScalingEn
|
|
|
204
204
|
}
|
|
205
205
|
const table = findTable(updatedTr.selection);
|
|
206
206
|
if (table) {
|
|
207
|
-
updatedTr = rescaleColumns(isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, api)(table, view)(updatedTr);
|
|
207
|
+
updatedTr = rescaleColumns(isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, api, isCommentEditor)(table, view)(updatedTr);
|
|
208
208
|
}
|
|
209
209
|
return updatedTr;
|
|
210
210
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { fixTables, fixAutoSizedTable } from './fix-tables';
|
|
2
|
-
export { mergeCells, canMergeCells
|
|
2
|
+
export { mergeCells, canMergeCells } from './merge';
|
|
3
3
|
export { deleteColumns } from './delete-columns';
|
|
4
4
|
export { deleteRows } from './delete-rows';
|
|
5
5
|
export { updateColumnWidths } from './column-width';
|
|
@@ -168,7 +168,9 @@ const DragHandleComponent = ({
|
|
|
168
168
|
left: isRow ? `${"var(--ds-space-050, 4px)"}` : undefined,
|
|
169
169
|
bottom: isColumn ? `${"var(--ds-space-0, 0px)"}` : undefined,
|
|
170
170
|
alignSelf: isColumn ? 'none' : 'center',
|
|
171
|
-
zIndex: isColumn ? '-1' : 'auto'
|
|
171
|
+
zIndex: isColumn ? '-1' : 'auto',
|
|
172
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
173
|
+
pointerEvents: 'auto'
|
|
172
174
|
},
|
|
173
175
|
onMouseUp: e => {
|
|
174
176
|
// should toggle menu if current drag menu open.
|
|
@@ -4,7 +4,7 @@ import { createPortal } from 'react-dom';
|
|
|
4
4
|
import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
5
|
import { TableCssClassName as ClassName } from '../../types';
|
|
6
6
|
import { insertColumnButtonOffset } from '../common-styles';
|
|
7
|
-
|
|
7
|
+
const BUTTON_WIDTH = 20;
|
|
8
8
|
export const calcLeftPos = ({
|
|
9
9
|
buttonWidth,
|
|
10
10
|
cellRectLeft,
|
|
@@ -544,7 +544,7 @@ export class ContextualMenu extends Component {
|
|
|
544
544
|
this.toggleOpen();
|
|
545
545
|
break;
|
|
546
546
|
case 'distribute_columns':
|
|
547
|
-
const newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, tableWithFixedColumnWidthsOption);
|
|
547
|
+
const newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, tableWithFixedColumnWidthsOption, isCommentEditor);
|
|
548
548
|
if (newResizeStateWithAnalytics) {
|
|
549
549
|
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI, this.props.api)(INPUT_METHOD.CONTEXT_MENU, newResizeStateWithAnalytics)(state, dispatch);
|
|
550
550
|
this.toggleOpen();
|
|
@@ -555,7 +555,7 @@ export class ContextualMenu extends Component {
|
|
|
555
555
|
this.toggleOpen();
|
|
556
556
|
break;
|
|
557
557
|
case 'insert_column':
|
|
558
|
-
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
558
|
+
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
559
559
|
this.toggleOpen();
|
|
560
560
|
break;
|
|
561
561
|
case 'insert_row':
|
|
@@ -566,7 +566,7 @@ export class ContextualMenu extends Component {
|
|
|
566
566
|
this.toggleOpen();
|
|
567
567
|
break;
|
|
568
568
|
case 'delete_column':
|
|
569
|
-
deleteColumnsWithAnalytics(editorAnalyticsAPI, this.props.api, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent)(INPUT_METHOD.CONTEXT_MENU, selectionRect)(state, dispatch, editorView);
|
|
569
|
+
deleteColumnsWithAnalytics(editorAnalyticsAPI, this.props.api, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.CONTEXT_MENU, selectionRect)(state, dispatch, editorView);
|
|
570
570
|
this.toggleOpen();
|
|
571
571
|
break;
|
|
572
572
|
case 'delete_row':
|
|
@@ -17,7 +17,7 @@ import { getColumnDeleteButtonParams, getColumnsWidths, getRowDeleteButtonParams
|
|
|
17
17
|
import { stickyRowZIndex } from '../consts';
|
|
18
18
|
import DeleteButton from './DeleteButton';
|
|
19
19
|
import getPopupOptions from './getPopUpOptions';
|
|
20
|
-
|
|
20
|
+
function getSelectionType(selection) {
|
|
21
21
|
if (!isTableSelected(selection) && selection instanceof CellSelection) {
|
|
22
22
|
if (selection.isRowSelection()) {
|
|
23
23
|
return 'row';
|
|
@@ -170,7 +170,7 @@ const convertToDropdownItems = (dragMenuConfig, formatMessage, tableSortColumnRe
|
|
|
170
170
|
};
|
|
171
171
|
};
|
|
172
172
|
const ColorPaletteWithListeners = withOuterListeners(ColorPalette);
|
|
173
|
-
|
|
173
|
+
const DragMenu = /*#__PURE__*/React.memo(({
|
|
174
174
|
direction = 'row',
|
|
175
175
|
index,
|
|
176
176
|
target,
|
|
@@ -195,7 +195,8 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
195
195
|
shouldUseIncreasedScalingPercent,
|
|
196
196
|
isTableFixedColumnWidthsOptionEnabled,
|
|
197
197
|
tableSortColumnReorder,
|
|
198
|
-
ariaNotifyPlugin
|
|
198
|
+
ariaNotifyPlugin,
|
|
199
|
+
isCommentEditor
|
|
199
200
|
}) => {
|
|
200
201
|
var _tableMap$hasMergedCe, _pluginConfig$allowBa;
|
|
201
202
|
const {
|
|
@@ -213,7 +214,7 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
213
214
|
const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
214
215
|
const hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
215
216
|
const allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
216
|
-
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder, ariaNotifyPlugin);
|
|
217
|
+
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder, ariaNotifyPlugin, isCommentEditor);
|
|
217
218
|
const {
|
|
218
219
|
menuItems,
|
|
219
220
|
menuCallback
|
|
@@ -22,7 +22,8 @@ const FloatingDragMenu = ({
|
|
|
22
22
|
isTableScalingEnabled,
|
|
23
23
|
getEditorFeatureFlags,
|
|
24
24
|
ariaNotifyPlugin,
|
|
25
|
-
api
|
|
25
|
+
api,
|
|
26
|
+
isCommentEditor
|
|
26
27
|
}) => {
|
|
27
28
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
28
29
|
return null;
|
|
@@ -78,7 +79,8 @@ const FloatingDragMenu = ({
|
|
|
78
79
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
79
80
|
tableSortColumnReorder: tableSortColumnReorder,
|
|
80
81
|
ariaNotifyPlugin: ariaNotifyPlugin,
|
|
81
|
-
api: api
|
|
82
|
+
api: api,
|
|
83
|
+
isCommentEditor: isCommentEditor || false
|
|
82
84
|
}));
|
|
83
85
|
};
|
|
84
86
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -55,7 +55,7 @@ const getInsertLineWidth = (tableRef, isDragAndDropEnabled, isChromelessEditor)
|
|
|
55
55
|
const tooltipMessageByType = type => {
|
|
56
56
|
return type === 'row' ? messages.insertRow : messages.insertColumn;
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
const InsertButtonForDragAndDrop = ({
|
|
59
59
|
onMouseDown,
|
|
60
60
|
tableRef,
|
|
61
61
|
type,
|
|
@@ -180,7 +180,8 @@ export class FloatingInsertButton extends React.Component {
|
|
|
180
180
|
insertColumnButtonIndex,
|
|
181
181
|
editorAnalyticsAPI,
|
|
182
182
|
getEditorFeatureFlags,
|
|
183
|
-
isTableScalingEnabled
|
|
183
|
+
isTableScalingEnabled,
|
|
184
|
+
isCommentEditor
|
|
184
185
|
} = this.props;
|
|
185
186
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
186
187
|
event.preventDefault();
|
|
@@ -193,7 +194,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
193
194
|
state,
|
|
194
195
|
dispatch
|
|
195
196
|
} = editorView;
|
|
196
|
-
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
197
|
+
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
}
|
|
@@ -5,7 +5,7 @@ import { TableCssClassName as ClassName } from '../../types';
|
|
|
5
5
|
import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
|
|
6
6
|
import { ColumnControls } from './ColumnControls';
|
|
7
7
|
import { ColumnDropTargets } from './ColumnDropTargets';
|
|
8
|
-
|
|
8
|
+
const TableFloatingColumnControls = ({
|
|
9
9
|
editorView,
|
|
10
10
|
tableRef,
|
|
11
11
|
getNode,
|
|
@@ -134,7 +134,9 @@ const DragControlsComponent = ({
|
|
|
134
134
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
135
135
|
position: 'relative',
|
|
136
136
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
137
|
-
right: '-0.5px'
|
|
137
|
+
right: '-0.5px',
|
|
138
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
139
|
+
pointerEvents: 'none'
|
|
138
140
|
},
|
|
139
141
|
"data-testid": `table-floating-row-${isHover ? rowIndex : selectedRowIndexes[0]}-drag-handle`
|
|
140
142
|
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
|
-
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
2
|
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
4
3
|
export { MinimisedHandleIcon } from './MinimisedHandle';
|
|
5
4
|
export { MergeCellsIcon } from './MergeCellsIcon';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { maphElem } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
|
-
import { findTable, getSelectionRect
|
|
6
|
-
import { TableCssClassName as ClassName } from '../types';
|
|
4
|
+
import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
5
|
import { tableDeleteButtonSize } from '../ui/consts';
|
|
8
6
|
export const getColumnsWidths = view => {
|
|
9
7
|
const {
|
|
@@ -32,12 +30,6 @@ export const getColumnsWidths = view => {
|
|
|
32
30
|
}
|
|
33
31
|
return widths;
|
|
34
32
|
};
|
|
35
|
-
export const isColumnDeleteButtonVisible = selection => {
|
|
36
|
-
if (!isTableSelected(selection) && selection instanceof CellSelection && selection.isColSelection()) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
};
|
|
41
33
|
export const getColumnDeleteButtonParams = (columnsWidths, selection) => {
|
|
42
34
|
const rect = getSelectionRect(selection);
|
|
43
35
|
if (!rect) {
|
|
@@ -67,16 +59,6 @@ export const getColumnDeleteButtonParams = (columnsWidths, selection) => {
|
|
|
67
59
|
indexes
|
|
68
60
|
};
|
|
69
61
|
};
|
|
70
|
-
export const getColumnClassNames = (index, selection, hoveredColumns = [], isInDanger, isResizing) => {
|
|
71
|
-
const classNames = [];
|
|
72
|
-
if (isColumnSelected(index)(selection) || hoveredColumns.indexOf(index) > -1 && !isResizing) {
|
|
73
|
-
classNames.push(ClassName.HOVERED_CELL_ACTIVE);
|
|
74
|
-
if (isInDanger) {
|
|
75
|
-
classNames.push(ClassName.HOVERED_CELL_IN_DANGER);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return classNames.join(' ');
|
|
79
|
-
};
|
|
80
62
|
|
|
81
63
|
// give a row colspan and a colwidths
|
|
82
64
|
// and map to a row's colwidths
|
package/dist/es2019/utils/dom.js
CHANGED
|
@@ -13,7 +13,6 @@ export const isTableControlsButton = node => containsClassName(node, ClassName.C
|
|
|
13
13
|
export const isTableContainerOrWrapper = node => containsClassName(node, ClassName.TABLE_CONTAINER) || containsClassName(node, ClassName.TABLE_NODE_WRAPPER);
|
|
14
14
|
|
|
15
15
|
/** drag-and-drop classes */
|
|
16
|
-
export const isDragRowControlsButton = node => containsClassName(node, ClassName.DRAG_ROW_CONTROLS) || closestElement(node, `.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
17
16
|
export const isDragRowFloatingInsertDot = node => containsClassName(node, ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER);
|
|
18
17
|
export const isDragColumnFloatingInsertDot = node => containsClassName(node, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER);
|
|
19
18
|
export const isDragCornerButton = node => containsClassName(node, ClassName.DRAG_CORNER_BUTTON) || containsClassName(node, ClassName.DRAG_CORNER_BUTTON_INNER);
|