@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
|
@@ -2,12 +2,10 @@ import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
4
|
export declare const getColumnsWidths: (view: EditorView) => Array<number | undefined>;
|
|
5
|
-
export declare const isColumnDeleteButtonVisible: (selection: Selection) => boolean;
|
|
6
5
|
export declare const getColumnDeleteButtonParams: (columnsWidths: Array<number | undefined>, selection: Selection) => {
|
|
7
6
|
left: number;
|
|
8
7
|
indexes: number[];
|
|
9
8
|
} | null;
|
|
10
|
-
export declare const getColumnClassNames: (index: number, selection: Selection, hoveredColumns?: number[], isInDanger?: boolean, isResizing?: boolean) => string;
|
|
11
9
|
export declare const colWidthsForRow: (tr: HTMLTableRowElement) => string;
|
|
12
10
|
export declare const convertHTMLCellIndexToColumnIndex: (htmlColIndex: number, htmlRowIndex: number, tableMap: TableMap) => number;
|
|
13
11
|
export declare const getColumnIndexMappedToColumnIndexInFirstRow: (convertedColIndex: number, htmlRowIndex: number, tableMap: TableMap) => number;
|
|
@@ -11,7 +11,6 @@ export declare const isResizeHandleDecoration: (node: HTMLElement | null) => boo
|
|
|
11
11
|
export declare const isTableControlsButton: (node: HTMLElement | null) => boolean;
|
|
12
12
|
export declare const isTableContainerOrWrapper: (node: HTMLElement | null) => boolean;
|
|
13
13
|
/** drag-and-drop classes */
|
|
14
|
-
export declare const isDragRowControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
15
14
|
export declare const isDragRowFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
16
15
|
export declare const isDragColumnFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
17
16
|
export declare const isDragCornerButton: (node: HTMLElement | null) => boolean;
|
|
@@ -14,4 +14,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
|
|
|
14
14
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
15
15
|
keymap?: string;
|
|
16
16
|
}
|
|
17
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined) => DragMenuConfig[];
|
|
17
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { getSelectedColumnIndexes, getSelectedRowIndexes
|
|
2
|
-
export { findControlsHoverDecoration, createControlsHoverDecoration,
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton,
|
|
6
|
-
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths,
|
|
7
|
-
export { getRowHeights,
|
|
1
|
+
export { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
2
|
+
export { findControlsHoverDecoration, createControlsHoverDecoration, createCellHoverDecoration, updateDecorations, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
|
+
export { containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, tablesHaveDifferentNoOfRows, isTableNested, } from './nodes';
|
|
4
|
+
export { transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
|
|
6
|
+
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, getColumnDeleteButtonParams, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
|
|
7
|
+
export { getRowHeights, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow, } from './row-controls';
|
|
8
8
|
export type { RowParams } from './row-controls';
|
|
9
9
|
export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
10
10
|
export { getMergedCellsPositions, getAssistiveMessage } from './table';
|
|
11
11
|
export { updatePluginStateDecorations } from './update-plugin-state-decorations';
|
|
12
|
-
export {
|
|
12
|
+
export { hasMergedCellsInBetween, hasMergedCellsInSelection, findDuplicatePosition, } from './merged-cells';
|
|
13
13
|
export { createTableWithWidth } from './create';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
3
3
|
type MergeType = 'row' | 'column';
|
|
4
|
-
export declare const hasMergedCellsInColumn: (columnIndexes: number | number[]) => (selection: Selection) => boolean;
|
|
5
|
-
export declare const hasMergedCellsInRow: (rowIndexes: number | number[]) => (selection: Selection) => boolean;
|
|
6
4
|
export declare const hasMergedCellsInBetween: (indexes: number[], type: MergeType) => (selection: Selection) => boolean;
|
|
7
5
|
export declare const hasMergedCellsWithColumnNextToColumnIndex: (colIndex: number, selection: Selection) => boolean;
|
|
8
6
|
export declare const hasMergedCellsWithRowNextToRowIndex: (rowIndex: number, selection: Selection) => boolean;
|
|
@@ -11,7 +11,6 @@ export declare const tablesHaveDifferentColumnWidths: (currentTable: PmNode, pre
|
|
|
11
11
|
export declare const tablesHaveDifferentNoOfColumns: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
12
12
|
export declare const tablesHaveDifferentNoOfRows: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
13
13
|
export declare const isTableNested: (state: EditorState, tablePos?: number) => boolean;
|
|
14
|
-
export declare const anyChildCellMergedAcrossRow: (node: PmNode) => boolean;
|
|
15
14
|
/**
|
|
16
15
|
* Check if a given node is a header row with this definition:
|
|
17
16
|
* - all children are tableHeader cells
|
|
@@ -6,7 +6,6 @@ export interface RowParams {
|
|
|
6
6
|
height: number;
|
|
7
7
|
}
|
|
8
8
|
export declare const getRowHeights: (tableRef: HTMLTableElement) => number[];
|
|
9
|
-
export declare const isRowDeleteButtonVisible: (selection: Selection) => boolean;
|
|
10
9
|
export declare const getRowDeleteButtonParams: (rowsHeights: Array<number | undefined>, selection: Selection, offsetTop?: number) => {
|
|
11
10
|
top: number;
|
|
12
11
|
indexes: number[];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
1
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
3
|
-
export declare const isSelectionUpdated: (oldSelection: Selection, newSelection?: Selection) => boolean;
|
|
4
|
-
export declare const normalizeSelection: (tr: Transaction) => Transaction;
|
|
5
2
|
export declare const getSelectedColumnIndexes: (selectionRect: Rect) => number[];
|
|
6
3
|
export declare const getSelectedRowIndexes: (selectionRect: Rect) => number[];
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
5
4
|
export declare const getMergedCellsPositions: (tr: Transaction) => number[];
|
|
6
|
-
export declare const colsToRect: (cols: Array<number>, noOfRows: number) => Rect;
|
|
7
5
|
export declare const getAssistiveMessage: (prevTableNode: PmNode, currentTableNode: PmNode, intl: IntlShape) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.25.
|
|
3
|
+
"version": "7.25.11",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@atlaskit/adf-schema": "^40.8.1",
|
|
32
32
|
"@atlaskit/button": "^20.1.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
34
|
-
"@atlaskit/editor-common": "^
|
|
34
|
+
"@atlaskit/editor-common": "^88.1.0",
|
|
35
35
|
"@atlaskit/editor-palette": "1.6.0",
|
|
36
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^1.8.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-guideline": "^1.2.0",
|
package/src/commands/clear.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
// #region Imports
|
|
2
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
2
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
import type { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
4
|
import { emptyCell, findCellClosestToPos, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
6
5
|
|
|
7
|
-
// #endregion
|
|
8
|
-
|
|
9
|
-
// #region Commands
|
|
10
6
|
export const clearMultipleCells =
|
|
11
7
|
(targetCellPosition?: number): Command =>
|
|
12
8
|
(state, dispatch) => {
|
|
@@ -39,13 +35,3 @@ export const clearMultipleCells =
|
|
|
39
35
|
}
|
|
40
36
|
return false;
|
|
41
37
|
};
|
|
42
|
-
|
|
43
|
-
export const clearSelection: Command = (state, dispatch) => {
|
|
44
|
-
if (dispatch) {
|
|
45
|
-
dispatch(
|
|
46
|
-
state.tr.setSelection(Selection.near(state.selection.$from)).setMeta('addToHistory', false),
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
};
|
|
51
|
-
// #endregion
|
|
@@ -35,6 +35,10 @@ import {
|
|
|
35
35
|
resizeColumn,
|
|
36
36
|
updateControls,
|
|
37
37
|
} from '../pm-plugins/table-resizing/utils';
|
|
38
|
+
import {
|
|
39
|
+
getScalingPercentForTableWithoutWidth,
|
|
40
|
+
getTableScalingPercent,
|
|
41
|
+
} from '../pm-plugins/table-resizing/utils/misc';
|
|
38
42
|
import { updateColumnWidths } from '../transforms';
|
|
39
43
|
import { TableDecorations } from '../types';
|
|
40
44
|
import type { PluginInjectionAPI, TablePluginAction } from '../types';
|
|
@@ -323,11 +327,14 @@ export const changeColumnWidthByStep =
|
|
|
323
327
|
isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
|
|
324
328
|
}
|
|
325
329
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
let shouldUseIncreasedScalingPercent =
|
|
331
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
332
|
+
fg('platform.editor.table.use-increased-scaling-percent');
|
|
333
|
+
|
|
334
|
+
if (isTableScalingEnabled && isCommentEditor) {
|
|
335
|
+
isTableScalingEnabledOnCurrentTable = true;
|
|
336
|
+
shouldUseIncreasedScalingPercent = true;
|
|
337
|
+
}
|
|
331
338
|
|
|
332
339
|
const initialResizeState = getResizeState({
|
|
333
340
|
minWidth: tableCellMinWidth,
|
|
@@ -338,6 +345,7 @@ export const changeColumnWidthByStep =
|
|
|
338
345
|
domAtPos,
|
|
339
346
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
340
347
|
shouldUseIncreasedScalingPercent,
|
|
348
|
+
isCommentEditor,
|
|
341
349
|
});
|
|
342
350
|
|
|
343
351
|
updateControls()(state);
|
|
@@ -347,6 +355,11 @@ export const changeColumnWidthByStep =
|
|
|
347
355
|
// only selected (or selected - 1) columns should be distributed
|
|
348
356
|
const resizingSelectedColumns =
|
|
349
357
|
selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
|
|
358
|
+
|
|
359
|
+
const scalePercent =
|
|
360
|
+
isTableScalingEnabled && isCommentEditor && !originalTable.attrs?.width
|
|
361
|
+
? getScalingPercentForTableWithoutWidth(originalTable, dom)
|
|
362
|
+
: getTableScalingPercent(originalTable, dom, shouldUseIncreasedScalingPercent);
|
|
350
363
|
let newResizeState = resizeColumn(
|
|
351
364
|
initialResizeState,
|
|
352
365
|
colIndex,
|
|
@@ -355,7 +368,7 @@ export const changeColumnWidthByStep =
|
|
|
355
368
|
originalTable,
|
|
356
369
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
357
370
|
isTableScalingEnabled,
|
|
358
|
-
|
|
371
|
+
scalePercent,
|
|
359
372
|
);
|
|
360
373
|
|
|
361
374
|
customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition, api)(customTr);
|
package/src/commands/delete.ts
CHANGED
|
@@ -12,6 +12,7 @@ export const deleteColumnsCommand =
|
|
|
12
12
|
isTableScalingEnabled = false,
|
|
13
13
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
14
14
|
shouldUseIncreasedScalingPercent = false,
|
|
15
|
+
isCommentEditor = false,
|
|
15
16
|
): Command =>
|
|
16
17
|
(state, dispatch, view) => {
|
|
17
18
|
const tr = deleteColumns(
|
|
@@ -22,6 +23,7 @@ export const deleteColumnsCommand =
|
|
|
22
23
|
isTableScalingEnabled,
|
|
23
24
|
isTableFixedColumnWidthsOptionEnabled,
|
|
24
25
|
shouldUseIncreasedScalingPercent,
|
|
26
|
+
isCommentEditor,
|
|
25
27
|
)(state.tr);
|
|
26
28
|
if (dispatch) {
|
|
27
29
|
dispatch(tr);
|
package/src/commands/insert.ts
CHANGED
|
@@ -45,6 +45,7 @@ export function addColumnAt(
|
|
|
45
45
|
isCellBackgroundDuplicated?: boolean,
|
|
46
46
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
47
47
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
48
|
+
isCommentEditor?: boolean,
|
|
48
49
|
) {
|
|
49
50
|
return (
|
|
50
51
|
column: number,
|
|
@@ -66,6 +67,7 @@ export function addColumnAt(
|
|
|
66
67
|
isTableFixedColumnWidthsOptionEnabled,
|
|
67
68
|
shouldUseIncreasedScalingPercent,
|
|
68
69
|
api,
|
|
70
|
+
isCommentEditor,
|
|
69
71
|
)(
|
|
70
72
|
table,
|
|
71
73
|
view,
|
|
@@ -97,6 +99,7 @@ export const addColumnBefore =
|
|
|
97
99
|
isCellBackgroundDuplicated = false,
|
|
98
100
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
99
101
|
shouldUseIncreasedScalingPercent = false,
|
|
102
|
+
isCommentEditor = false,
|
|
100
103
|
): Command =>
|
|
101
104
|
(state, dispatch, view) => {
|
|
102
105
|
const table = findTable(state.selection);
|
|
@@ -112,6 +115,7 @@ export const addColumnBefore =
|
|
|
112
115
|
isCellBackgroundDuplicated,
|
|
113
116
|
isTableFixedColumnWidthsOptionEnabled,
|
|
114
117
|
shouldUseIncreasedScalingPercent,
|
|
118
|
+
isCommentEditor,
|
|
115
119
|
)(
|
|
116
120
|
rect.left,
|
|
117
121
|
getAllowAddColumnCustomStep(state),
|
|
@@ -131,6 +135,7 @@ export const addColumnAfter =
|
|
|
131
135
|
isCellBackgroundDuplicated?: boolean,
|
|
132
136
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
133
137
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
138
|
+
isCommentEditor?: boolean,
|
|
134
139
|
): Command =>
|
|
135
140
|
(state, dispatch, view) => {
|
|
136
141
|
const table = findTable(state.selection);
|
|
@@ -147,6 +152,7 @@ export const addColumnAfter =
|
|
|
147
152
|
isCellBackgroundDuplicated,
|
|
148
153
|
isTableFixedColumnWidthsOptionEnabled,
|
|
149
154
|
shouldUseIncreasedScalingPercent,
|
|
155
|
+
isCommentEditor,
|
|
150
156
|
)(
|
|
151
157
|
rect.right,
|
|
152
158
|
getAllowAddColumnCustomStep(state),
|
|
@@ -164,6 +170,7 @@ export const insertColumn =
|
|
|
164
170
|
isCellBackgroundDuplicated?: boolean,
|
|
165
171
|
isTableFixedColumnWidthsOptionEnabled?: boolean,
|
|
166
172
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
173
|
+
isCommentEditor?: boolean,
|
|
167
174
|
) =>
|
|
168
175
|
(column: number): Command =>
|
|
169
176
|
(state, dispatch, view) => {
|
|
@@ -173,6 +180,7 @@ export const insertColumn =
|
|
|
173
180
|
isCellBackgroundDuplicated,
|
|
174
181
|
isTableFixedColumnWidthsOptionEnabled,
|
|
175
182
|
shouldUseIncreasedScalingPercent,
|
|
183
|
+
isCommentEditor,
|
|
176
184
|
)(
|
|
177
185
|
column,
|
|
178
186
|
getAllowAddColumnCustomStep(state),
|
|
@@ -28,7 +28,7 @@ import type tablePlugin from '../plugin';
|
|
|
28
28
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
29
29
|
import { getClosestSelectionRect } from '../toolbar';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
enum TableSelectionDirection {
|
|
32
32
|
TopToBottom = 'TopToBottom',
|
|
33
33
|
BottomToTop = 'BottomToTop',
|
|
34
34
|
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
EVENT_TYPE,
|
|
9
9
|
INPUT_METHOD,
|
|
10
10
|
TABLE_ACTION,
|
|
11
|
-
TABLE_BREAKOUT,
|
|
12
11
|
TABLE_DISPLAY_MODE,
|
|
13
12
|
} from '@atlaskit/editor-common/analytics';
|
|
14
13
|
import type { AnalyticsEventPayload, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
@@ -42,13 +41,7 @@ import {
|
|
|
42
41
|
} from './commands/misc';
|
|
43
42
|
import { sortByColumn } from './commands/sort';
|
|
44
43
|
import { splitCell } from './commands/split-cell';
|
|
45
|
-
import {
|
|
46
|
-
getNextLayout,
|
|
47
|
-
toggleHeaderColumn,
|
|
48
|
-
toggleHeaderRow,
|
|
49
|
-
toggleNumberColumn,
|
|
50
|
-
toggleTableLayout,
|
|
51
|
-
} from './commands/toggle';
|
|
44
|
+
import { toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn } from './commands/toggle';
|
|
52
45
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
53
46
|
import { distributeColumnsWidths } from './pm-plugins/table-resizing/commands';
|
|
54
47
|
import type { ResizeStateWithAnalytics } from './pm-plugins/table-resizing/utils';
|
|
@@ -63,12 +56,6 @@ import type {
|
|
|
63
56
|
import { checkIfNumberColumnEnabled, getSelectedCellInfo, getSelectedTableInfo } from './utils';
|
|
64
57
|
import { withEditorAnalyticsAPI } from './utils/analytics';
|
|
65
58
|
|
|
66
|
-
const TABLE_BREAKOUT_NAME_MAPPING = {
|
|
67
|
-
default: TABLE_BREAKOUT.NORMAL,
|
|
68
|
-
wide: TABLE_BREAKOUT.WIDE,
|
|
69
|
-
'full-width': TABLE_BREAKOUT.FULL_WIDTH,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
59
|
// #region Analytics wrappers
|
|
73
60
|
export const emptyMultipleCellsWithAnalytics =
|
|
74
61
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
@@ -288,6 +275,7 @@ export const insertColumnWithAnalytics =
|
|
|
288
275
|
isCellbackgroundDuplicated = false,
|
|
289
276
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
290
277
|
shouldUseIncreasedScalingPercent = false,
|
|
278
|
+
isCommentEditor = false,
|
|
291
279
|
) =>
|
|
292
280
|
(
|
|
293
281
|
inputMethod:
|
|
@@ -319,6 +307,7 @@ export const insertColumnWithAnalytics =
|
|
|
319
307
|
isCellbackgroundDuplicated,
|
|
320
308
|
isTableFixedColumnWidthsOptionEnabled,
|
|
321
309
|
shouldUseIncreasedScalingPercent,
|
|
310
|
+
isCommentEditor,
|
|
322
311
|
)(position),
|
|
323
312
|
);
|
|
324
313
|
|
|
@@ -364,6 +353,7 @@ export const deleteColumnsWithAnalytics =
|
|
|
364
353
|
isTableScalingEnabled = false,
|
|
365
354
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
366
355
|
shouldUseIncreasedScalingPercent = false,
|
|
356
|
+
isCommentEditor = false,
|
|
367
357
|
) =>
|
|
368
358
|
(
|
|
369
359
|
inputMethod:
|
|
@@ -397,6 +387,7 @@ export const deleteColumnsWithAnalytics =
|
|
|
397
387
|
isTableScalingEnabled,
|
|
398
388
|
isTableFixedColumnWidthsOptionEnabled,
|
|
399
389
|
shouldUseIncreasedScalingPercent,
|
|
390
|
+
isCommentEditor,
|
|
400
391
|
),
|
|
401
392
|
);
|
|
402
393
|
|
|
@@ -532,32 +523,6 @@ export const toggleNumberColumnWithAnalytics = (
|
|
|
532
523
|
};
|
|
533
524
|
})(editorAnalyticsAPI)(toggleNumberColumn);
|
|
534
525
|
|
|
535
|
-
export const toggleTableLayoutWithAnalytics = (
|
|
536
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
537
|
-
) =>
|
|
538
|
-
withEditorAnalyticsAPI((state) => {
|
|
539
|
-
const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
|
|
540
|
-
|
|
541
|
-
if (table) {
|
|
542
|
-
const { layout } = table.node.attrs as {
|
|
543
|
-
layout: 'default' | 'wide' | 'full-width';
|
|
544
|
-
};
|
|
545
|
-
return {
|
|
546
|
-
action: TABLE_ACTION.CHANGED_BREAKOUT_MODE,
|
|
547
|
-
actionSubject: ACTION_SUBJECT.TABLE,
|
|
548
|
-
actionSubjectId: null,
|
|
549
|
-
attributes: {
|
|
550
|
-
newBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[getNextLayout(layout)],
|
|
551
|
-
previousBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[layout],
|
|
552
|
-
totalRowCount,
|
|
553
|
-
totalColumnCount,
|
|
554
|
-
},
|
|
555
|
-
eventType: EVENT_TYPE.TRACK,
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
return;
|
|
559
|
-
})(editorAnalyticsAPI)(toggleTableLayout);
|
|
560
|
-
|
|
561
526
|
export const sortColumnWithAnalytics =
|
|
562
527
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
563
528
|
(
|
|
@@ -49,8 +49,15 @@ import {
|
|
|
49
49
|
updateColgroup,
|
|
50
50
|
} from '../pm-plugins/table-resizing/utils';
|
|
51
51
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
52
|
-
import {
|
|
52
|
+
import {
|
|
53
|
+
TABLE_EDITOR_MARGIN,
|
|
54
|
+
TABLE_OFFSET_IN_COMMENT_EDITOR,
|
|
55
|
+
} from '../pm-plugins/table-resizing/utils/consts';
|
|
53
56
|
import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
|
|
57
|
+
import {
|
|
58
|
+
getScalingPercentForTableWithoutWidth,
|
|
59
|
+
getTableScalingPercent,
|
|
60
|
+
} from '../pm-plugins/table-resizing/utils/misc';
|
|
54
61
|
import type { CellHoverMeta, PluginInjectionAPI } from '../types';
|
|
55
62
|
import { TableCssClassName as ClassName, ShadowEvent } from '../types';
|
|
56
63
|
import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
|
|
@@ -82,7 +89,7 @@ const initialOverflowCaptureTimeroutDelay = 300;
|
|
|
82
89
|
// PLEASE NOTE: that the current way this alaytics has been configured WILL cause reflows to occur. This is why the has been disabled.
|
|
83
90
|
const isOverflowAnalyticsEnabled = false;
|
|
84
91
|
|
|
85
|
-
|
|
92
|
+
interface ComponentProps {
|
|
86
93
|
view: EditorView;
|
|
87
94
|
getNode: () => PmNode;
|
|
88
95
|
allowColumnResizing?: boolean;
|
|
@@ -376,7 +383,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
376
383
|
}
|
|
377
384
|
|
|
378
385
|
handleColgroupUpdates(force = false) {
|
|
379
|
-
const { getNode, containerWidth, isResizing, view, getPos, getEditorFeatureFlags } =
|
|
386
|
+
const { getNode, containerWidth, isResizing, view, getPos, getEditorFeatureFlags, options } =
|
|
387
|
+
this.props;
|
|
380
388
|
|
|
381
389
|
if (!this.table) {
|
|
382
390
|
return;
|
|
@@ -384,8 +392,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
384
392
|
|
|
385
393
|
// Remove any widths styles after resizing preview is completed
|
|
386
394
|
this.table.style.width = '';
|
|
387
|
-
|
|
388
|
-
const tableRenderWidth = containerWidth.width - TABLE_EDITOR_MARGIN;
|
|
389
395
|
const tableNode = getNode();
|
|
390
396
|
const start = getPos() || 0;
|
|
391
397
|
const depth = view.state.doc.resolve(start).depth;
|
|
@@ -394,10 +400,19 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
394
400
|
return;
|
|
395
401
|
}
|
|
396
402
|
|
|
397
|
-
|
|
403
|
+
let tableNodeWidth = getTableContainerWidth(tableNode);
|
|
398
404
|
const isTableResizedFullWidth = tableNodeWidth === 1800 && this.wasResizing && !isResizing;
|
|
405
|
+
|
|
399
406
|
// Needed for undo / redo
|
|
400
407
|
const isTableWidthChanged = tableNodeWidth !== this.tableNodeWidth;
|
|
408
|
+
|
|
409
|
+
const tableRenderWidth = options?.isCommentEditor
|
|
410
|
+
? containerWidth.width - (TABLE_OFFSET_IN_COMMENT_EDITOR + 1) // should be the same as this.table.parentElement?.clientWidth - 1, subtract 1 to avoid overflow
|
|
411
|
+
: containerWidth.width - TABLE_EDITOR_MARGIN;
|
|
412
|
+
|
|
413
|
+
tableNodeWidth =
|
|
414
|
+
options?.isCommentEditor && !tableNode.attrs.width ? tableRenderWidth : tableNodeWidth;
|
|
415
|
+
|
|
401
416
|
const isTableSquashed = tableRenderWidth < tableNodeWidth;
|
|
402
417
|
const isNumberColumnChanged =
|
|
403
418
|
tableNode.attrs.isNumberColumnEnabled !== this.node.attrs.isNumberColumnEnabled;
|
|
@@ -406,7 +421,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
406
421
|
const maybeScale =
|
|
407
422
|
isTableSquashed ||
|
|
408
423
|
isTableWidthChanged ||
|
|
409
|
-
isTableResizedFullWidth ||
|
|
424
|
+
(isTableResizedFullWidth && !options?.isCommentEditor) ||
|
|
410
425
|
isNumberColumnChanged ||
|
|
411
426
|
isNumberOfColumnsChanged;
|
|
412
427
|
|
|
@@ -448,6 +463,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
448
463
|
domAtPos: view.domAtPos.bind(view),
|
|
449
464
|
isTableScalingEnabled: true,
|
|
450
465
|
shouldUseIncreasedScalingPercent,
|
|
466
|
+
isCommentEditor: !!this.props.options?.isCommentEditor,
|
|
451
467
|
});
|
|
452
468
|
|
|
453
469
|
let shouldScaleOnColgroupUpdate = false;
|
|
@@ -462,6 +478,24 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
462
478
|
shouldScaleOnColgroupUpdate = true;
|
|
463
479
|
}
|
|
464
480
|
|
|
481
|
+
if (this.props.options?.isTableScalingEnabled && this.props.options?.isCommentEditor) {
|
|
482
|
+
shouldScaleOnColgroupUpdate = true;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
let scalePercent = 1;
|
|
486
|
+
if (
|
|
487
|
+
!this.props.options?.isCommentEditor ||
|
|
488
|
+
(this.props.options?.isCommentEditor && tableNode.attrs.width)
|
|
489
|
+
) {
|
|
490
|
+
scalePercent = getTableScalingPercent(
|
|
491
|
+
tableNode,
|
|
492
|
+
this.table!,
|
|
493
|
+
shouldUseIncreasedScalingPercent,
|
|
494
|
+
);
|
|
495
|
+
} else {
|
|
496
|
+
scalePercent = getScalingPercentForTableWithoutWidth(tableNode, this.table!);
|
|
497
|
+
}
|
|
498
|
+
|
|
465
499
|
// Request animation frame required for Firefox
|
|
466
500
|
requestAnimationFrame(() => {
|
|
467
501
|
updateColgroup(
|
|
@@ -469,7 +503,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
469
503
|
this.table!,
|
|
470
504
|
tableNode,
|
|
471
505
|
shouldScaleOnColgroupUpdate,
|
|
472
|
-
|
|
506
|
+
scalePercent,
|
|
473
507
|
);
|
|
474
508
|
});
|
|
475
509
|
}
|
|
@@ -590,13 +624,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
590
624
|
const start = getPos() || 0;
|
|
591
625
|
const depth = view.state.doc.resolve(start).depth;
|
|
592
626
|
shouldScale = depth === 0 && shouldScale;
|
|
593
|
-
|
|
594
627
|
insertColgroupFromNode(
|
|
595
628
|
this.table,
|
|
596
629
|
currentTable,
|
|
597
630
|
shouldScale,
|
|
598
631
|
undefined,
|
|
599
632
|
shouldUseIncreasedScalingPercent,
|
|
633
|
+
options?.isCommentEditor,
|
|
600
634
|
);
|
|
601
635
|
}
|
|
602
636
|
|
|
@@ -42,7 +42,7 @@ type InnerContainerProps = {
|
|
|
42
42
|
node: PMNode;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
const InnerContainer = forwardRef<HTMLDivElement, PropsWithChildren<InnerContainerProps>>(
|
|
46
46
|
({ className, style, node, children }, ref) => {
|
|
47
47
|
return (
|
|
48
48
|
<div
|
|
@@ -90,9 +90,6 @@ interface TableResizerProps {
|
|
|
90
90
|
isFullWidthModeEnabled?: boolean;
|
|
91
91
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
92
92
|
isCommentEditor?: boolean;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
96
93
|
onResizeStop?: () => void;
|
|
97
94
|
onResizeStart?: () => void;
|
|
98
95
|
}
|
|
@@ -206,7 +203,7 @@ export const TableResizer = ({
|
|
|
206
203
|
pluginInjectionApi,
|
|
207
204
|
isFullWidthModeEnabled,
|
|
208
205
|
isCommentEditor,
|
|
209
|
-
}: PropsWithChildren<
|
|
206
|
+
}: PropsWithChildren<TableResizerProps>) => {
|
|
210
207
|
const currentGap = useRef(0);
|
|
211
208
|
// track resizing state - use ref over state to avoid re-render
|
|
212
209
|
const isResizing = useRef(false);
|
|
@@ -586,6 +583,7 @@ export const TableResizer = ({
|
|
|
586
583
|
pluginInjectionApi,
|
|
587
584
|
isTableScalingEnabled,
|
|
588
585
|
shouldUseIncreasedScalingPercent || false,
|
|
586
|
+
isCommentEditor,
|
|
589
587
|
)(tr);
|
|
590
588
|
|
|
591
589
|
const scaledNode = tr.doc.nodeAt(pos)!;
|
package/src/plugin.tsx
CHANGED
|
@@ -601,6 +601,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
601
601
|
}
|
|
602
602
|
isChromelessEditor={options?.isChromelessEditor}
|
|
603
603
|
api={api}
|
|
604
|
+
isCommentEditor={options?.isCommentEditor}
|
|
604
605
|
/>
|
|
605
606
|
)}
|
|
606
607
|
{options?.allowContextualMenu && (
|
|
@@ -642,6 +643,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
642
643
|
}
|
|
643
644
|
ariaNotifyPlugin={ariaNotifyPlugin}
|
|
644
645
|
api={api}
|
|
646
|
+
isCommentEditor={options?.isCommentEditor}
|
|
645
647
|
/>
|
|
646
648
|
)}
|
|
647
649
|
{allowControls && !isDragAndDropEnabled && !isResizing && (
|
|
@@ -8,12 +8,12 @@ export enum AnalyticPluginTypes {
|
|
|
8
8
|
UpdateRowOrColumnMovedAndOverflowTrigger,
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
type UpdateRowOrColumnMovedAction = {
|
|
12
12
|
type: AnalyticPluginTypes.UpdateRowOrColumnMovedAction;
|
|
13
13
|
data: RowOrColumnMovedState;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type RemoveRowOrColumnMovedAction = {
|
|
17
17
|
type: AnalyticPluginTypes.RemoveRowOrColumnMovedAction;
|
|
18
18
|
data: undefined;
|
|
19
19
|
};
|
|
@@ -4,7 +4,7 @@ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
|
|
5
5
|
export type DecorationTransformer = (params: DecorationTransformerParams) => DecorationSet;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type DecorationTransformerParams = {
|
|
8
8
|
decorationSet: DecorationSet;
|
|
9
9
|
tr: Transaction | ReadonlyTransaction;
|
|
10
10
|
};
|
|
@@ -4,7 +4,7 @@ import type { TableDirection } from '../../types';
|
|
|
4
4
|
|
|
5
5
|
import type { DropTargetType } from './consts';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface DragAndDropAction<T, D> {
|
|
8
8
|
type: T;
|
|
9
9
|
data: D;
|
|
10
10
|
}
|
|
@@ -15,7 +15,7 @@ export const DragAndDropActionType = {
|
|
|
15
15
|
TOGGLE_DRAG_MENU: 'TOGGLE_DRAG_MENU',
|
|
16
16
|
} as const;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
type DragAndDropSetDropTargetAction = DragAndDropAction<
|
|
19
19
|
typeof DragAndDropActionType.SET_DROP_TARGET,
|
|
20
20
|
{
|
|
21
21
|
type: DropTargetType;
|
|
@@ -24,14 +24,14 @@ export type DragAndDropSetDropTargetAction = DragAndDropAction<
|
|
|
24
24
|
}
|
|
25
25
|
>;
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
type DragAndDropClearDropTargetAction = DragAndDropAction<
|
|
28
28
|
typeof DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
29
29
|
{
|
|
30
30
|
decorationSet: DecorationSet;
|
|
31
31
|
}
|
|
32
32
|
>;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
type DragAndDropToggleDragMenuAction = DragAndDropAction<
|
|
35
35
|
typeof DragAndDropActionType.TOGGLE_DRAG_MENU,
|
|
36
36
|
{
|
|
37
37
|
isDragMenuOpen: boolean;
|