@atlaskit/editor-plugin-table 8.4.11 → 8.4.13
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 +17 -0
- package/dist/cjs/nodeviews/ExternalDropTargets.js +6 -3
- package/dist/cjs/nodeviews/TableCell.js +5 -0
- package/dist/cjs/nodeviews/TableComponent.js +92 -29
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +7 -1
- package/dist/cjs/nodeviews/TableContainer.js +16 -6
- package/dist/cjs/nodeviews/TableNodeViewBase.js +4 -0
- package/dist/cjs/nodeviews/TableResizer.js +44 -15
- package/dist/cjs/nodeviews/TableRow.js +45 -1
- package/dist/cjs/nodeviews/TableStickyScrollbar.js +21 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +16 -4
- package/dist/cjs/nodeviews/table.js +53 -18
- package/dist/cjs/pm-plugins/commands/clear.js +6 -0
- package/dist/cjs/pm-plugins/commands/column-resize.js +26 -17
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +39 -26
- package/dist/cjs/pm-plugins/commands/go-to-next-cell.js +2 -0
- package/dist/cjs/pm-plugins/commands/hover.js +17 -13
- package/dist/cjs/pm-plugins/commands/insert.js +27 -10
- package/dist/cjs/pm-plugins/commands/misc.js +29 -9
- package/dist/cjs/pm-plugins/commands/selection.js +4 -0
- package/dist/cjs/pm-plugins/commands/sort.js +10 -1
- package/dist/cjs/pm-plugins/commands/toggle.js +2 -0
- package/dist/cjs/pm-plugins/decorations/plugin.js +9 -4
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +4 -1
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +19 -10
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +16 -7
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +21 -8
- package/dist/cjs/pm-plugins/handlers.js +2 -2
- package/dist/cjs/pm-plugins/keymap.js +103 -24
- package/dist/cjs/pm-plugins/main.js +22 -11
- package/dist/cjs/pm-plugins/table-resizing/commands.js +7 -6
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +39 -20
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +19 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/column-state.js +6 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/content-width.js +17 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/dom.js +4 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +2 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +8 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +10 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +6 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -4
- package/dist/cjs/pm-plugins/table-selection-keymap.js +12 -0
- package/dist/cjs/pm-plugins/table-width.js +9 -4
- package/dist/cjs/pm-plugins/transforms/column-width.js +8 -5
- package/dist/cjs/pm-plugins/transforms/delete-columns.js +2 -0
- package/dist/cjs/pm-plugins/transforms/fix-tables.js +24 -8
- package/dist/cjs/pm-plugins/transforms/merge.js +7 -0
- package/dist/cjs/pm-plugins/transforms/replace-table.js +6 -3
- package/dist/cjs/pm-plugins/transforms/split.js +6 -1
- package/dist/cjs/pm-plugins/utils/alignment.js +4 -1
- package/dist/cjs/pm-plugins/utils/analytics.js +3 -3
- package/dist/cjs/pm-plugins/utils/column-controls.js +4 -0
- package/dist/cjs/pm-plugins/utils/create.js +2 -2
- package/dist/cjs/pm-plugins/utils/decoration.js +24 -6
- package/dist/cjs/pm-plugins/utils/dom.js +4 -0
- package/dist/cjs/pm-plugins/utils/drag-menu.js +19 -7
- package/dist/cjs/pm-plugins/utils/nodes.js +3 -0
- package/dist/cjs/pm-plugins/utils/paste.js +4 -1
- package/dist/cjs/pm-plugins/utils/row-controls.js +4 -1
- package/dist/cjs/tablePlugin.js +24 -18
- package/dist/cjs/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/cjs/ui/DragHandle/HandleIconComponent.js +5 -3
- package/dist/cjs/ui/DragHandle/index.js +14 -7
- package/dist/cjs/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +8 -1
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +4 -0
- package/dist/cjs/ui/FloatingContextualButton/index.js +7 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +32 -15
- package/dist/cjs/ui/FloatingContextualMenu/index.js +19 -4
- package/dist/cjs/ui/FloatingDeleteButton/index.js +27 -5
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +19 -7
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +15 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +4 -1
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +4 -0
- package/dist/cjs/ui/FloatingInsertButton/getPopupOptions.js +6 -0
- package/dist/cjs/ui/FloatingInsertButton/index.js +27 -3
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +30 -8
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +9 -5
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +2 -0
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +4 -4
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +8 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +9 -5
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +68 -41
- package/dist/cjs/ui/TableFloatingControls/index.js +19 -8
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/ui/event-handlers.js +59 -32
- package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -0
- package/dist/cjs/ui/toolbar.js +42 -16
- package/dist/es2019/nodeviews/ExternalDropTargets.js +5 -2
- package/dist/es2019/nodeviews/TableCell.js +5 -0
- package/dist/es2019/nodeviews/TableComponent.js +77 -13
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +8 -1
- package/dist/es2019/nodeviews/TableContainer.js +14 -4
- package/dist/es2019/nodeviews/TableNodeViewBase.js +4 -0
- package/dist/es2019/nodeviews/TableResizer.js +33 -4
- package/dist/es2019/nodeviews/TableRow.js +45 -1
- package/dist/es2019/nodeviews/TableStickyScrollbar.js +20 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +16 -4
- package/dist/es2019/nodeviews/table.js +47 -12
- package/dist/es2019/pm-plugins/commands/clear.js +6 -0
- package/dist/es2019/pm-plugins/commands/column-resize.js +16 -7
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +28 -9
- package/dist/es2019/pm-plugins/commands/delete.js +4 -1
- package/dist/es2019/pm-plugins/commands/go-to-next-cell.js +2 -0
- package/dist/es2019/pm-plugins/commands/hover.js +5 -1
- package/dist/es2019/pm-plugins/commands/insert.js +26 -6
- package/dist/es2019/pm-plugins/commands/misc.js +25 -5
- package/dist/es2019/pm-plugins/commands/selection.js +4 -0
- package/dist/es2019/pm-plugins/commands/sort.js +10 -1
- package/dist/es2019/pm-plugins/commands/toggle.js +2 -0
- package/dist/es2019/pm-plugins/decorations/plugin.js +7 -2
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +4 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +14 -5
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +17 -5
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +21 -5
- package/dist/es2019/pm-plugins/handlers.js +1 -1
- package/dist/es2019/pm-plugins/keymap.js +104 -24
- package/dist/es2019/pm-plugins/main.js +16 -5
- package/dist/es2019/pm-plugins/table-resizing/commands.js +3 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +25 -6
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +4 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +23 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/column-state.js +6 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/content-width.js +17 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/dom.js +4 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +12 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +10 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +9 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +18 -6
- package/dist/es2019/pm-plugins/table-selection-keymap.js +12 -0
- package/dist/es2019/pm-plugins/table-width.js +7 -2
- package/dist/es2019/pm-plugins/transforms/column-width.js +12 -5
- package/dist/es2019/pm-plugins/transforms/delete-columns.js +6 -1
- package/dist/es2019/pm-plugins/transforms/fix-tables.js +20 -4
- package/dist/es2019/pm-plugins/transforms/merge.js +7 -0
- package/dist/es2019/pm-plugins/transforms/replace-table.js +5 -2
- package/dist/es2019/pm-plugins/transforms/split.js +6 -1
- package/dist/es2019/pm-plugins/utils/alignment.js +4 -1
- package/dist/es2019/pm-plugins/utils/analytics.js +2 -2
- package/dist/es2019/pm-plugins/utils/column-controls.js +4 -0
- package/dist/es2019/pm-plugins/utils/create.js +1 -1
- package/dist/es2019/pm-plugins/utils/decoration.js +24 -6
- package/dist/es2019/pm-plugins/utils/dom.js +4 -0
- package/dist/es2019/pm-plugins/utils/drag-menu.js +19 -4
- package/dist/es2019/pm-plugins/utils/nodes.js +3 -0
- package/dist/es2019/pm-plugins/utils/paste.js +8 -2
- package/dist/es2019/pm-plugins/utils/row-controls.js +4 -1
- package/dist/es2019/pm-plugins/utils/snapping.js +4 -1
- package/dist/es2019/tablePlugin.js +13 -4
- package/dist/es2019/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/es2019/ui/DragHandle/HandleIconComponent.js +3 -1
- package/dist/es2019/ui/DragHandle/index.js +10 -3
- package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +8 -1
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +4 -0
- package/dist/es2019/ui/FloatingContextualButton/index.js +7 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +23 -6
- package/dist/es2019/ui/FloatingContextualMenu/index.js +19 -4
- package/dist/es2019/ui/FloatingDeleteButton/index.js +23 -1
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +15 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +15 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +4 -1
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +4 -0
- package/dist/es2019/ui/FloatingInsertButton/getPopupOptions.js +6 -0
- package/dist/es2019/ui/FloatingInsertButton/index.js +26 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +28 -6
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +7 -2
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +2 -0
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +2 -2
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +7 -1
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +7 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +32 -6
- package/dist/es2019/ui/TableFloatingControls/index.js +14 -3
- package/dist/es2019/ui/common-styles.js +7 -0
- package/dist/es2019/ui/event-handlers.js +35 -5
- package/dist/es2019/ui/icons/SortingIconWrapper.js +2 -0
- package/dist/es2019/ui/toolbar.js +58 -14
- package/dist/esm/nodeviews/ExternalDropTargets.js +5 -2
- package/dist/esm/nodeviews/TableCell.js +5 -0
- package/dist/esm/nodeviews/TableComponent.js +75 -11
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +8 -1
- package/dist/esm/nodeviews/TableContainer.js +14 -4
- package/dist/esm/nodeviews/TableNodeViewBase.js +4 -0
- package/dist/esm/nodeviews/TableResizer.js +33 -4
- package/dist/esm/nodeviews/TableRow.js +45 -1
- package/dist/esm/nodeviews/TableStickyScrollbar.js +21 -2
- package/dist/esm/nodeviews/lazy-node-views.js +16 -4
- package/dist/esm/nodeviews/table.js +47 -12
- package/dist/esm/pm-plugins/commands/clear.js +6 -0
- package/dist/esm/pm-plugins/commands/column-resize.js +16 -7
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +20 -7
- package/dist/esm/pm-plugins/commands/go-to-next-cell.js +2 -0
- package/dist/esm/pm-plugins/commands/hover.js +5 -1
- package/dist/esm/pm-plugins/commands/insert.js +22 -5
- package/dist/esm/pm-plugins/commands/misc.js +25 -5
- package/dist/esm/pm-plugins/commands/selection.js +4 -0
- package/dist/esm/pm-plugins/commands/sort.js +10 -1
- package/dist/esm/pm-plugins/commands/toggle.js +2 -0
- package/dist/esm/pm-plugins/decorations/plugin.js +7 -2
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +4 -1
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +14 -5
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +13 -4
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +17 -4
- package/dist/esm/pm-plugins/handlers.js +1 -1
- package/dist/esm/pm-plugins/keymap.js +104 -24
- package/dist/esm/pm-plugins/main.js +16 -5
- package/dist/esm/pm-plugins/table-resizing/commands.js +3 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +25 -6
- package/dist/esm/pm-plugins/table-resizing/plugin.js +4 -1
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +19 -1
- package/dist/esm/pm-plugins/table-resizing/utils/column-state.js +6 -1
- package/dist/esm/pm-plugins/table-resizing/utils/content-width.js +17 -0
- package/dist/esm/pm-plugins/table-resizing/utils/dom.js +4 -0
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -0
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +8 -1
- package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +10 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +5 -2
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +2 -2
- package/dist/esm/pm-plugins/table-selection-keymap.js +12 -0
- package/dist/esm/pm-plugins/table-width.js +7 -2
- package/dist/esm/pm-plugins/transforms/column-width.js +6 -4
- package/dist/esm/pm-plugins/transforms/delete-columns.js +2 -0
- package/dist/esm/pm-plugins/transforms/fix-tables.js +20 -4
- package/dist/esm/pm-plugins/transforms/merge.js +7 -0
- package/dist/esm/pm-plugins/transforms/replace-table.js +5 -2
- package/dist/esm/pm-plugins/transforms/split.js +6 -1
- package/dist/esm/pm-plugins/utils/alignment.js +4 -1
- package/dist/esm/pm-plugins/utils/analytics.js +2 -2
- package/dist/esm/pm-plugins/utils/column-controls.js +4 -0
- package/dist/esm/pm-plugins/utils/create.js +1 -1
- package/dist/esm/pm-plugins/utils/decoration.js +24 -6
- package/dist/esm/pm-plugins/utils/dom.js +4 -0
- package/dist/esm/pm-plugins/utils/drag-menu.js +15 -3
- package/dist/esm/pm-plugins/utils/nodes.js +3 -0
- package/dist/esm/pm-plugins/utils/paste.js +4 -1
- package/dist/esm/pm-plugins/utils/row-controls.js +4 -1
- package/dist/esm/tablePlugin.js +11 -4
- package/dist/esm/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/esm/ui/DragHandle/HandleIconComponent.js +3 -1
- package/dist/esm/ui/DragHandle/index.js +10 -3
- package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +8 -1
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +4 -0
- package/dist/esm/ui/FloatingContextualButton/index.js +7 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +23 -6
- package/dist/esm/ui/FloatingContextualMenu/index.js +19 -4
- package/dist/esm/ui/FloatingDeleteButton/index.js +23 -1
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +15 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +15 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +4 -1
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +4 -0
- package/dist/esm/ui/FloatingInsertButton/getPopupOptions.js +6 -0
- package/dist/esm/ui/FloatingInsertButton/index.js +26 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +28 -6
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/esm/ui/TableFloatingColumnControls/index.js +6 -2
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +2 -0
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +2 -2
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +7 -1
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +65 -38
- package/dist/esm/ui/TableFloatingControls/index.js +14 -3
- package/dist/esm/ui/common-styles.js +1 -1
- package/dist/esm/ui/event-handlers.js +31 -4
- package/dist/esm/ui/icons/SortingIconWrapper.js +2 -0
- package/dist/esm/ui/toolbar.js +34 -8
- package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/commands.d.ts +1 -1
- package/dist/types/pm-plugins/transforms/column-width.d.ts +1 -1
- package/dist/types/pm-plugins/utils/collapse.d.ts +2 -1
- package/dist/types/ui/FloatingContextualButton/FixedButton.d.ts +1 -1
- package/dist/types/ui/FloatingContextualButton/index.d.ts +1 -1
- package/dist/types/ui/FloatingDeleteButton/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +1 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -4
- package/dist/types/ui/TableFloatingControls/index.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/commands.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/transforms/column-width.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/collapse.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingContextualButton/FixedButton.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDeleteButton/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -4
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +3 -3
- package/package.json +4 -4
- package/src/nodeviews/ExternalDropTargets.tsx +3 -1
- package/src/nodeviews/TableCell.ts +4 -0
- package/src/nodeviews/TableComponent.tsx +63 -18
- package/src/nodeviews/TableComponentWithSharedState.tsx +4 -0
- package/src/nodeviews/TableContainer.tsx +7 -1
- package/src/nodeviews/TableNodeViewBase.ts +4 -0
- package/src/nodeviews/TableResizer.tsx +27 -4
- package/src/nodeviews/TableRow.ts +41 -1
- package/src/nodeviews/TableStickyScrollbar.ts +14 -0
- package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +2 -0
- package/src/nodeviews/__mocks__/OverridableMock.ts +6 -0
- package/src/nodeviews/lazy-node-views.ts +8 -0
- package/src/nodeviews/table.tsx +30 -4
- package/src/pm-plugins/commands/clear.ts +6 -0
- package/src/pm-plugins/commands/column-resize.ts +12 -9
- package/src/pm-plugins/commands/commands-with-analytics.ts +21 -4
- package/src/pm-plugins/commands/delete.ts +2 -0
- package/src/pm-plugins/commands/go-to-next-cell.ts +2 -0
- package/src/pm-plugins/commands/hover.ts +7 -5
- package/src/pm-plugins/commands/insert.ts +15 -1
- package/src/pm-plugins/commands/misc.ts +24 -3
- package/src/pm-plugins/commands/selection.ts +4 -0
- package/src/pm-plugins/commands/sort.ts +9 -1
- package/src/pm-plugins/commands/toggle.ts +2 -0
- package/src/pm-plugins/decorations/plugin.ts +5 -1
- package/src/pm-plugins/decorations/utils/column-resizing.ts +2 -0
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +8 -2
- package/src/pm-plugins/drag-and-drop/commands.ts +9 -1
- package/src/pm-plugins/drag-and-drop/plugin.ts +17 -2
- package/src/pm-plugins/handlers.ts +1 -1
- package/src/pm-plugins/keymap.ts +54 -0
- package/src/pm-plugins/main.ts +12 -5
- package/src/pm-plugins/table-resizing/commands.ts +4 -3
- package/src/pm-plugins/table-resizing/event-handlers.ts +24 -10
- package/src/pm-plugins/table-resizing/plugin.ts +3 -1
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +17 -1
- package/src/pm-plugins/table-resizing/utils/column-state.ts +4 -0
- package/src/pm-plugins/table-resizing/utils/content-width.ts +14 -0
- package/src/pm-plugins/table-resizing/utils/dom.ts +4 -0
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +9 -1
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +6 -0
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -1
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +10 -2
- package/src/pm-plugins/table-selection-keymap.ts +8 -0
- package/src/pm-plugins/table-width.ts +5 -1
- package/src/pm-plugins/transforms/column-width.ts +9 -7
- package/src/pm-plugins/transforms/delete-columns.ts +4 -0
- package/src/pm-plugins/transforms/fix-tables.ts +13 -6
- package/src/pm-plugins/transforms/merge.ts +6 -0
- package/src/pm-plugins/transforms/replace-table.ts +3 -1
- package/src/pm-plugins/transforms/split.ts +4 -0
- package/src/pm-plugins/utils/alignment.ts +2 -0
- package/src/pm-plugins/utils/analytics.ts +2 -2
- package/src/pm-plugins/utils/collapse.ts +3 -4
- package/src/pm-plugins/utils/column-controls.ts +4 -0
- package/src/pm-plugins/utils/create.ts +1 -1
- package/src/pm-plugins/utils/decoration.ts +12 -0
- package/src/pm-plugins/utils/dom.ts +4 -0
- package/src/pm-plugins/utils/drag-menu.ts +12 -1
- package/src/pm-plugins/utils/nodes.ts +2 -0
- package/src/pm-plugins/utils/paste.ts +4 -0
- package/src/pm-plugins/utils/row-controls.ts +2 -0
- package/src/pm-plugins/utils/snapping.ts +2 -0
- package/src/tablePlugin.tsx +13 -15
- package/src/tablePluginType.ts +10 -0
- package/src/ui/ColumnResizeWidget/index.tsx +2 -0
- package/src/ui/DragHandle/HandleIconComponent.tsx +3 -1
- package/src/ui/DragHandle/index.tsx +11 -2
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +6 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +5 -1
- package/src/ui/FloatingContextualButton/index.tsx +8 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +17 -7
- package/src/ui/FloatingContextualMenu/index.tsx +11 -1
- package/src/ui/FloatingDeleteButton/index.tsx +23 -4
- package/src/ui/FloatingDragMenu/DragMenu.tsx +13 -6
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +10 -0
- package/src/ui/FloatingDragMenu/index.tsx +3 -1
- package/src/ui/FloatingInsertButton/InsertButton.tsx +4 -0
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +4 -0
- package/src/ui/FloatingInsertButton/index.tsx +21 -1
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +19 -2
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/index.tsx +8 -4
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +2 -0
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +2 -2
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +7 -1
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +11 -3
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +20 -1
- package/src/ui/TableFloatingControls/index.tsx +13 -4
- package/src/ui/common-styles.ts +7 -0
- package/src/ui/event-handlers.ts +28 -3
- package/src/ui/icons/SortingIconWrapper.tsx +2 -0
- package/src/ui/toolbar.tsx +43 -11
- package/tsconfig.json +0 -1
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -67,6 +67,8 @@ import {
|
|
|
67
67
|
insertTableWithNestingSupport,
|
|
68
68
|
} from './commands/insert';
|
|
69
69
|
|
|
70
|
+
// Ignored via go/ees005
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
70
72
|
export function keymapPlugin(
|
|
71
73
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
72
74
|
api: PluginInjectionAPI | undefined | null,
|
|
@@ -89,16 +91,22 @@ export function keymapPlugin(
|
|
|
89
91
|
const ariaNotifyPlugin = pluginInjectionApi?.accessibilityUtils?.actions.ariaNotify;
|
|
90
92
|
|
|
91
93
|
bindKeymapWithCommand(
|
|
94
|
+
// Ignored via go/ees005
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
92
96
|
nextCell.common!,
|
|
93
97
|
goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1),
|
|
94
98
|
list,
|
|
95
99
|
);
|
|
96
100
|
bindKeymapWithCommand(
|
|
101
|
+
// Ignored via go/ees005
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
97
103
|
previousCell.common!,
|
|
98
104
|
goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1),
|
|
99
105
|
list,
|
|
100
106
|
);
|
|
101
107
|
bindKeymapWithCommand(
|
|
108
|
+
// Ignored via go/ees005
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
102
110
|
toggleTable.common!,
|
|
103
111
|
fg('platform_editor_use_nested_table_pm_nodes')
|
|
104
112
|
? editorCommandToPMCommand(
|
|
@@ -133,6 +141,8 @@ export function keymapPlugin(
|
|
|
133
141
|
list,
|
|
134
142
|
);
|
|
135
143
|
bindKeymapWithCommand(
|
|
144
|
+
// Ignored via go/ees005
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
136
146
|
backspace.common!,
|
|
137
147
|
chainCommands(
|
|
138
148
|
deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD),
|
|
@@ -140,22 +150,30 @@ export function keymapPlugin(
|
|
|
140
150
|
),
|
|
141
151
|
list,
|
|
142
152
|
);
|
|
153
|
+
// Ignored via go/ees005
|
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
143
155
|
bindKeymapWithCommand(backspace.common!, moveCursorBackward, list);
|
|
144
156
|
|
|
145
157
|
// Add row/column shortcuts
|
|
146
158
|
bindKeymapWithCommand(
|
|
159
|
+
// Ignored via go/ees005
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
147
161
|
addRowBefore.common!,
|
|
148
162
|
addRowAroundSelection(editorAnalyticsAPI)('TOP'),
|
|
149
163
|
list,
|
|
150
164
|
);
|
|
151
165
|
|
|
152
166
|
bindKeymapWithCommand(
|
|
167
|
+
// Ignored via go/ees005
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
153
169
|
addRowAfter.common!,
|
|
154
170
|
addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'),
|
|
155
171
|
list,
|
|
156
172
|
);
|
|
157
173
|
|
|
158
174
|
bindKeymapWithCommand(
|
|
175
|
+
// Ignored via go/ees005
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
159
177
|
addColumnBefore.common!,
|
|
160
178
|
addColumnBeforeCommand(
|
|
161
179
|
api,
|
|
@@ -167,6 +185,8 @@ export function keymapPlugin(
|
|
|
167
185
|
);
|
|
168
186
|
|
|
169
187
|
bindKeymapWithCommand(
|
|
188
|
+
// Ignored via go/ees005
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
170
190
|
addColumnAfter.common!,
|
|
171
191
|
addColumnAfterCommand(
|
|
172
192
|
api,
|
|
@@ -178,18 +198,24 @@ export function keymapPlugin(
|
|
|
178
198
|
);
|
|
179
199
|
|
|
180
200
|
bindKeymapWithCommand(
|
|
201
|
+
// Ignored via go/ees005
|
|
202
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
181
203
|
addRowBeforeVO.common!,
|
|
182
204
|
addRowAroundSelection(editorAnalyticsAPI)('TOP'),
|
|
183
205
|
list,
|
|
184
206
|
);
|
|
185
207
|
|
|
186
208
|
bindKeymapWithCommand(
|
|
209
|
+
// Ignored via go/ees005
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
187
211
|
addRowAfterVO.common!,
|
|
188
212
|
addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'),
|
|
189
213
|
list,
|
|
190
214
|
);
|
|
191
215
|
|
|
192
216
|
bindKeymapWithCommand(
|
|
217
|
+
// Ignored via go/ees005
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
193
219
|
addColumnBeforeVO.common!,
|
|
194
220
|
addColumnBeforeCommand(
|
|
195
221
|
api,
|
|
@@ -201,6 +227,8 @@ export function keymapPlugin(
|
|
|
201
227
|
);
|
|
202
228
|
|
|
203
229
|
bindKeymapWithCommand(
|
|
230
|
+
// Ignored via go/ees005
|
|
231
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
204
232
|
addColumnAfterVO.common!,
|
|
205
233
|
addColumnAfterCommand(
|
|
206
234
|
api,
|
|
@@ -221,6 +249,8 @@ export function keymapPlugin(
|
|
|
221
249
|
*/
|
|
222
250
|
|
|
223
251
|
bindKeymapWithCommand(
|
|
252
|
+
// Ignored via go/ees005
|
|
253
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
224
254
|
moveRowDown.common!,
|
|
225
255
|
moveSourceWithAnalyticsViaShortcut(
|
|
226
256
|
editorAnalyticsAPI,
|
|
@@ -231,6 +261,8 @@ export function keymapPlugin(
|
|
|
231
261
|
);
|
|
232
262
|
|
|
233
263
|
bindKeymapWithCommand(
|
|
264
|
+
// Ignored via go/ees005
|
|
265
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
234
266
|
moveRowUp.common!,
|
|
235
267
|
moveSourceWithAnalyticsViaShortcut(
|
|
236
268
|
editorAnalyticsAPI,
|
|
@@ -241,6 +273,8 @@ export function keymapPlugin(
|
|
|
241
273
|
);
|
|
242
274
|
|
|
243
275
|
bindKeymapWithCommand(
|
|
276
|
+
// Ignored via go/ees005
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
244
278
|
moveColumnLeft.common!,
|
|
245
279
|
moveSourceWithAnalyticsViaShortcut(
|
|
246
280
|
editorAnalyticsAPI,
|
|
@@ -251,6 +285,8 @@ export function keymapPlugin(
|
|
|
251
285
|
);
|
|
252
286
|
|
|
253
287
|
bindKeymapWithCommand(
|
|
288
|
+
// Ignored via go/ees005
|
|
289
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
254
290
|
moveColumnRight.common!,
|
|
255
291
|
moveSourceWithAnalyticsViaShortcut(
|
|
256
292
|
editorAnalyticsAPI,
|
|
@@ -262,6 +298,8 @@ export function keymapPlugin(
|
|
|
262
298
|
|
|
263
299
|
// Delete row/column shortcuts
|
|
264
300
|
bindKeymapWithCommand(
|
|
301
|
+
// Ignored via go/ees005
|
|
302
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
265
303
|
deleteColumn.common!,
|
|
266
304
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(
|
|
267
305
|
editorAnalyticsAPI,
|
|
@@ -274,6 +312,8 @@ export function keymapPlugin(
|
|
|
274
312
|
);
|
|
275
313
|
|
|
276
314
|
bindKeymapWithCommand(
|
|
315
|
+
// Ignored via go/ees005
|
|
316
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
277
317
|
deleteRow.common!,
|
|
278
318
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(
|
|
279
319
|
editorAnalyticsAPI,
|
|
@@ -287,6 +327,8 @@ export function keymapPlugin(
|
|
|
287
327
|
}
|
|
288
328
|
|
|
289
329
|
bindKeymapWithCommand(
|
|
330
|
+
// Ignored via go/ees005
|
|
331
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
290
332
|
startColumnResizing.common!,
|
|
291
333
|
initiateKeyboardColumnResizing({
|
|
292
334
|
ariaNotify: ariaNotifyPlugin,
|
|
@@ -297,6 +339,8 @@ export function keymapPlugin(
|
|
|
297
339
|
);
|
|
298
340
|
|
|
299
341
|
bindKeymapWithCommand(
|
|
342
|
+
// Ignored via go/ees005
|
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
300
344
|
moveRight.common!,
|
|
301
345
|
activateNextResizeArea({
|
|
302
346
|
direction: 1,
|
|
@@ -308,6 +352,8 @@ export function keymapPlugin(
|
|
|
308
352
|
);
|
|
309
353
|
|
|
310
354
|
bindKeymapWithCommand(
|
|
355
|
+
// Ignored via go/ees005
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
311
357
|
moveLeft.common!,
|
|
312
358
|
activateNextResizeArea({
|
|
313
359
|
direction: -1,
|
|
@@ -319,6 +365,8 @@ export function keymapPlugin(
|
|
|
319
365
|
);
|
|
320
366
|
|
|
321
367
|
bindKeymapWithCommand(
|
|
368
|
+
// Ignored via go/ees005
|
|
369
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
322
370
|
decreaseMediaSize.common!,
|
|
323
371
|
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(
|
|
324
372
|
-10,
|
|
@@ -334,6 +382,8 @@ export function keymapPlugin(
|
|
|
334
382
|
);
|
|
335
383
|
|
|
336
384
|
bindKeymapWithCommand(
|
|
385
|
+
// Ignored via go/ees005
|
|
386
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
337
387
|
increaseMediaSize.common!,
|
|
338
388
|
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(
|
|
339
389
|
10,
|
|
@@ -349,6 +399,8 @@ export function keymapPlugin(
|
|
|
349
399
|
);
|
|
350
400
|
|
|
351
401
|
bindKeymapWithCommand(
|
|
402
|
+
// Ignored via go/ees005
|
|
403
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
352
404
|
escape.common!,
|
|
353
405
|
stopKeyboardColumnResizing({
|
|
354
406
|
ariaNotify: ariaNotifyPlugin,
|
|
@@ -357,6 +409,8 @@ export function keymapPlugin(
|
|
|
357
409
|
list,
|
|
358
410
|
);
|
|
359
411
|
|
|
412
|
+
// Ignored via go/ees005
|
|
413
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
360
414
|
bindKeymapWithCommand(focusToContextMenuTrigger.common!, setFocusToCellMenu(), list);
|
|
361
415
|
|
|
362
416
|
return keymap(list) as SafePlugin;
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -67,17 +67,16 @@ import {
|
|
|
67
67
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
68
68
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
69
69
|
import { pluginKey } from './plugin-key';
|
|
70
|
-
import { fixTables
|
|
70
|
+
import { fixTables } from './transforms/fix-tables';
|
|
71
|
+
import { replaceSelectedTable } from './transforms/replace-table';
|
|
72
|
+
import { findControlsHoverDecoration } from './utils/decoration';
|
|
71
73
|
import {
|
|
72
|
-
findControlsHoverDecoration,
|
|
73
74
|
transformSliceToCorrectEmptyTableCells,
|
|
74
75
|
transformSliceToFixHardBreakProblemOnCopyFromCell,
|
|
75
76
|
transformSliceToRemoveOpenTable,
|
|
76
|
-
|
|
77
|
-
import {
|
|
77
|
+
transformSliceToRemoveNestedTables,
|
|
78
78
|
isHeaderRowRequired,
|
|
79
79
|
transformSliceTableLayoutDefaultToCenter,
|
|
80
|
-
transformSliceToRemoveNestedTables,
|
|
81
80
|
} from './utils/paste';
|
|
82
81
|
|
|
83
82
|
export const createPlugin = (
|
|
@@ -99,6 +98,8 @@ export const createPlugin = (
|
|
|
99
98
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
100
99
|
isCommentEditor?: boolean,
|
|
101
100
|
isChromelessEditor?: boolean,
|
|
101
|
+
// Ignored via go/ees005
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
102
103
|
) => {
|
|
103
104
|
const state = createPluginState(dispatch, {
|
|
104
105
|
pluginConfig,
|
|
@@ -195,6 +196,8 @@ export const createPlugin = (
|
|
|
195
196
|
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
196
197
|
if (parent) {
|
|
197
198
|
tableRef =
|
|
199
|
+
// Ignored via go/ees005
|
|
200
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
198
201
|
(parent as HTMLElement).querySelector<HTMLTableElement>('table') || undefined;
|
|
199
202
|
}
|
|
200
203
|
const tableNode = findTable(state.selection);
|
|
@@ -325,6 +328,8 @@ export const createPlugin = (
|
|
|
325
328
|
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
326
329
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
327
330
|
if (browser.chrome && event.target) {
|
|
331
|
+
// Ignored via go/ees005
|
|
332
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
328
333
|
const targetClassList = (event.target as HTMLElement).classList;
|
|
329
334
|
|
|
330
335
|
if (
|
|
@@ -350,6 +355,8 @@ export const createPlugin = (
|
|
|
350
355
|
const maybeTr = closestElement(domRef as HTMLElement | undefined, 'tr');
|
|
351
356
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
352
357
|
},
|
|
358
|
+
// Ignored via go/ees005
|
|
359
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
353
360
|
handleTextInput: (view, _from, _to, text) => {
|
|
354
361
|
const { state, dispatch } = view;
|
|
355
362
|
const { isKeyboardResize } = getPluginState(state);
|
|
@@ -7,11 +7,12 @@ import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
|
7
7
|
|
|
8
8
|
import type { PluginInjectionAPI } from '../../types';
|
|
9
9
|
import { META_KEYS } from '../table-analytics';
|
|
10
|
-
import { updateColumnWidths } from '../transforms';
|
|
10
|
+
import { updateColumnWidths } from '../transforms/column-width';
|
|
11
11
|
|
|
12
12
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
13
|
-
import
|
|
14
|
-
import { evenAllColumnsWidths
|
|
13
|
+
import { isClickNear } from './utils/dom';
|
|
14
|
+
import { evenAllColumnsWidths } from './utils/resize-state';
|
|
15
|
+
import type { ResizeState } from './utils/types';
|
|
15
16
|
|
|
16
17
|
export const evenColumns =
|
|
17
18
|
({
|
|
@@ -20,28 +20,28 @@ import { stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
|
20
20
|
import { updateResizeHandleDecorations } from '../commands/misc';
|
|
21
21
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
22
22
|
import { META_KEYS } from '../table-analytics';
|
|
23
|
-
import { updateColumnWidths } from '../transforms';
|
|
24
|
-
import { getSelectedColumnIndexes, isTableNested } from '../utils';
|
|
23
|
+
import { updateColumnWidths } from '../transforms/column-width';
|
|
25
24
|
import {
|
|
26
25
|
ALIGN_CENTER,
|
|
27
26
|
ALIGN_START,
|
|
28
27
|
shouldChangeAlignmentToCenterResized,
|
|
29
28
|
} from '../utils/alignment';
|
|
29
|
+
import { isTableNested } from '../utils/nodes';
|
|
30
|
+
import { getSelectedColumnIndexes } from '../utils/selection';
|
|
30
31
|
|
|
31
32
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
32
33
|
import { getPluginState } from './plugin-factory';
|
|
34
|
+
import { TABLE_OFFSET_IN_COMMENT_EDITOR } from './utils/consts';
|
|
35
|
+
import { updateControls } from './utils/dom';
|
|
33
36
|
import {
|
|
34
37
|
currentColWidth,
|
|
35
|
-
getResizeState,
|
|
36
38
|
getTableMaxWidth,
|
|
37
39
|
pointsAtCell,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} from './utils';
|
|
42
|
-
import {
|
|
43
|
-
import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './utils/misc';
|
|
44
|
-
import { scaleResizeState } from './utils/resize-column';
|
|
40
|
+
getScalingPercentForTableWithoutWidth,
|
|
41
|
+
getTableScalingPercent,
|
|
42
|
+
} from './utils/misc';
|
|
43
|
+
import { resizeColumn, resizeColumnAndTable, scaleResizeState } from './utils/resize-column';
|
|
44
|
+
import { getResizeState } from './utils/resize-state';
|
|
45
45
|
|
|
46
46
|
export const handleMouseDown = (
|
|
47
47
|
view: EditorView,
|
|
@@ -56,6 +56,8 @@ export const handleMouseDown = (
|
|
|
56
56
|
isNewColumnResizingEnabled?: boolean,
|
|
57
57
|
isTableAlignmentEnabled?: boolean,
|
|
58
58
|
isCommentEditor?: boolean,
|
|
59
|
+
// Ignored via go/ees005
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
59
61
|
): boolean => {
|
|
60
62
|
const { state, dispatch } = view;
|
|
61
63
|
const editorDisabled = !view.editable;
|
|
@@ -146,6 +148,8 @@ export const handleMouseDown = (
|
|
|
146
148
|
return true;
|
|
147
149
|
}
|
|
148
150
|
|
|
151
|
+
// Ignored via go/ees005
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
149
153
|
const width = currentColWidth(view, localResizeHandlePos, cell!.attrs as CellAttributes);
|
|
150
154
|
|
|
151
155
|
setDragging({ startX: event.clientX, startWidth: width })(state, dispatch);
|
|
@@ -172,7 +176,11 @@ export const handleMouseDown = (
|
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
function finish(event: MouseEvent) {
|
|
179
|
+
// Ignored via go/ees005
|
|
180
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
175
181
|
window.removeEventListener('mouseup', finish);
|
|
182
|
+
// Ignored via go/ees005
|
|
183
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
176
184
|
window.removeEventListener('mousemove', move);
|
|
177
185
|
|
|
178
186
|
const { clientX } = event;
|
|
@@ -369,6 +377,8 @@ export const handleMouseDown = (
|
|
|
369
377
|
// const tablePos = state.doc.resolve(start).start(-1);
|
|
370
378
|
const tableDepth = state.doc.resolve(tablePos).depth;
|
|
371
379
|
const map = TableMap.get(table);
|
|
380
|
+
// Ignored via go/ees005
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
372
382
|
const colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter!.attrs.colspan - 1;
|
|
373
383
|
|
|
374
384
|
let shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
@@ -415,7 +425,11 @@ export const handleMouseDown = (
|
|
|
415
425
|
updateControls()(state);
|
|
416
426
|
}
|
|
417
427
|
|
|
428
|
+
// Ignored via go/ees005
|
|
429
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
418
430
|
window.addEventListener('mouseup', finish);
|
|
431
|
+
// Ignored via go/ees005
|
|
432
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
419
433
|
window.addEventListener('mousemove', move);
|
|
420
434
|
|
|
421
435
|
return true;
|
|
@@ -14,8 +14,10 @@ import { setResizeHandlePos } from './commands';
|
|
|
14
14
|
import { handleMouseDown } from './event-handlers';
|
|
15
15
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
16
16
|
import { pluginKey } from './plugin-key';
|
|
17
|
-
import { getResizeCellPos } from './utils';
|
|
17
|
+
import { getResizeCellPos } from './utils/dom';
|
|
18
18
|
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
19
21
|
export function createPlugin(
|
|
20
22
|
dispatch: Dispatch<ColumnResizingPluginState>,
|
|
21
23
|
{ lastColumnResizable = true }: ColumnResizingPluginState,
|
|
@@ -23,10 +23,14 @@ export const generateColgroup = (
|
|
|
23
23
|
tableRef?: HTMLElement,
|
|
24
24
|
shouldUseIncreasedScalingPercent?: boolean,
|
|
25
25
|
isCommentEditor?: boolean,
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
28
|
) => {
|
|
27
29
|
const cols: Col[] = [];
|
|
28
30
|
const map = TableMap.get(table);
|
|
29
31
|
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
30
34
|
table.content.firstChild!.content.forEach((cell) => {
|
|
31
35
|
const colspan = cell.attrs.colspan || 1;
|
|
32
36
|
if (Array.isArray(cell.attrs.colwidth)) {
|
|
@@ -89,7 +93,11 @@ export const insertColgroupFromNode = (
|
|
|
89
93
|
shouldRemove = true,
|
|
90
94
|
shouldUseIncreasedScalingPercent = false,
|
|
91
95
|
isCommentEditor = false,
|
|
96
|
+
// Ignored via go/ees005
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
92
98
|
): HTMLCollection => {
|
|
99
|
+
// Ignored via go/ees005
|
|
100
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
93
101
|
let colgroup = tableRef?.querySelector('colgroup') as HTMLElement;
|
|
94
102
|
if (colgroup && shouldRemove) {
|
|
95
103
|
tableRef?.removeChild(colgroup);
|
|
@@ -97,7 +105,7 @@ export const insertColgroupFromNode = (
|
|
|
97
105
|
|
|
98
106
|
colgroup = renderColgroupFromNode(
|
|
99
107
|
table,
|
|
100
|
-
isTableScalingEnabled ? tableRef ?? undefined : undefined,
|
|
108
|
+
isTableScalingEnabled ? (tableRef ?? undefined) : undefined,
|
|
101
109
|
shouldUseIncreasedScalingPercent,
|
|
102
110
|
isCommentEditor,
|
|
103
111
|
);
|
|
@@ -109,6 +117,8 @@ export const insertColgroupFromNode = (
|
|
|
109
117
|
};
|
|
110
118
|
|
|
111
119
|
export const hasTableBeenResized = (table: PmNode) => {
|
|
120
|
+
// Ignored via go/ees005
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
112
122
|
return !!getFragmentBackingArray(table.content.firstChild!.content).find(
|
|
113
123
|
(cell) => cell.attrs.colwidth,
|
|
114
124
|
);
|
|
@@ -123,6 +133,8 @@ export const hasTableColumnBeenResized = hasTableBeenResized;
|
|
|
123
133
|
* @returns true if all column width is equal to tableCellMinWidth or null, false otherwise
|
|
124
134
|
*/
|
|
125
135
|
export const isMinCellWidthTable = (table: PmNode) => {
|
|
136
|
+
// Ignored via go/ees005
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
126
138
|
const cellArray = getFragmentBackingArray(table.content.firstChild!.content);
|
|
127
139
|
const isTableMinCellWidth = cellArray.every((cell) => {
|
|
128
140
|
return (
|
|
@@ -134,6 +146,8 @@ export const isMinCellWidthTable = (table: PmNode) => {
|
|
|
134
146
|
return isTableMinCellWidth;
|
|
135
147
|
};
|
|
136
148
|
|
|
149
|
+
// Ignored via go/ees005
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
137
151
|
function renderColgroupFromNode(
|
|
138
152
|
table: PmNode,
|
|
139
153
|
maybeTableRef: HTMLElement | undefined,
|
|
@@ -146,6 +160,8 @@ function renderColgroupFromNode(
|
|
|
146
160
|
...generateColgroup(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor),
|
|
147
161
|
]);
|
|
148
162
|
|
|
163
|
+
// Ignored via go/ees005
|
|
164
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
149
165
|
return rendered.dom as HTMLElement;
|
|
150
166
|
}
|
|
151
167
|
|
|
@@ -43,6 +43,8 @@ export const getCellsRefsInColumn = (
|
|
|
43
43
|
table: PMNode,
|
|
44
44
|
tableStart: number,
|
|
45
45
|
domAtPos: (pos: number) => { node: Node; offset: number },
|
|
46
|
+
// Ignored via go/ees005
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
46
48
|
): HTMLElement[] => {
|
|
47
49
|
const map = TableMap.get(table);
|
|
48
50
|
const cellsPositions = map.cellsInRect({
|
|
@@ -53,6 +55,8 @@ export const getCellsRefsInColumn = (
|
|
|
53
55
|
});
|
|
54
56
|
const cells: HTMLElement[] = [];
|
|
55
57
|
cellsPositions.forEach((pos) => {
|
|
58
|
+
// Ignored via go/ees005
|
|
59
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
56
60
|
const col = findDomRefAtPos(pos + tableStart, domAtPos) as HTMLElement;
|
|
57
61
|
if (col) {
|
|
58
62
|
cells.push(col);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { unitToNumber } from './unit-to-number';
|
|
2
2
|
|
|
3
3
|
// calculates content width of a cell
|
|
4
|
+
// Ignored via go/ees005
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
4
6
|
export function contentWidth(
|
|
5
7
|
elem: HTMLElement,
|
|
6
8
|
container: HTMLElement,
|
|
@@ -10,6 +12,8 @@ export function contentWidth(
|
|
|
10
12
|
return calcContentWidth(elem, container || elem, canvas, colWidths);
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
// Ignored via go/ees005
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
13
17
|
function calcContentWidth(
|
|
14
18
|
elem: HTMLElement,
|
|
15
19
|
container: HTMLElement,
|
|
@@ -20,6 +24,8 @@ function calcContentWidth(
|
|
|
20
24
|
let curWidth = 0;
|
|
21
25
|
|
|
22
26
|
for (let i = 0; i < elem.childNodes.length; i++) {
|
|
27
|
+
// Ignored via go/ees005
|
|
28
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
23
29
|
const child = elem.childNodes[i] as HTMLElement;
|
|
24
30
|
|
|
25
31
|
if (child.nodeType === Node.COMMENT_NODE) {
|
|
@@ -27,6 +33,8 @@ function calcContentWidth(
|
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
if (child.nodeType === Node.TEXT_NODE) {
|
|
36
|
+
// Ignored via go/ees005
|
|
37
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
30
38
|
const parent = child.parentNode as HTMLElement;
|
|
31
39
|
const parentStyle = getComputedStyle(parent);
|
|
32
40
|
let contentLength = 0;
|
|
@@ -87,6 +95,8 @@ function measureText(canvas: HTMLCanvasElement, text: string | null, font: strin
|
|
|
87
95
|
return Math.round(ctx.measureText(text || '').width);
|
|
88
96
|
}
|
|
89
97
|
|
|
98
|
+
// Ignored via go/ees005
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
90
100
|
function handlePreText(
|
|
91
101
|
canvas: HTMLCanvasElement,
|
|
92
102
|
node: HTMLElement,
|
|
@@ -95,9 +105,13 @@ function handlePreText(
|
|
|
95
105
|
): number {
|
|
96
106
|
let parent = node;
|
|
97
107
|
if (node.nodeName === 'CODE') {
|
|
108
|
+
// Ignored via go/ees005
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @atlaskit/editor/no-as-casting
|
|
98
110
|
parent = node.parentNode! as HTMLElement;
|
|
99
111
|
}
|
|
100
112
|
|
|
113
|
+
// Ignored via go/ees005
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
101
115
|
const computedStyle = getComputedStyle(parent!);
|
|
102
116
|
if (textContent && computedStyle.whiteSpace === 'pre') {
|
|
103
117
|
// If white space is pre grab the longest line in the block.
|
|
@@ -53,6 +53,8 @@ export const isClickNear = (event: MouseEvent, click: { x: number; y: number }):
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const getResizeCellPos = (view: EditorView, event: MouseEvent): number | null => {
|
|
56
|
+
// Ignored via go/ees005
|
|
57
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
56
58
|
const target = event.target as HTMLElement;
|
|
57
59
|
|
|
58
60
|
if (!containsClassName(target, ClassName.RESIZE_HANDLE_DECORATION)) {
|
|
@@ -112,6 +114,8 @@ export const syncStickyRowToTable = (tableRef?: HTMLElement | null) => {
|
|
|
112
114
|
};
|
|
113
115
|
|
|
114
116
|
const applyTableWidthToStickyRow = (tableRef: HTMLElement, headerRow: HTMLTableRowElement) => {
|
|
117
|
+
// Ignored via go/ees005
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
115
119
|
const tbody = tableRef.querySelector('tbody')!;
|
|
116
120
|
const wrapper = tableRef.parentElement;
|
|
117
121
|
|
|
@@ -65,6 +65,8 @@ export function currentColWidth(
|
|
|
65
65
|
return width;
|
|
66
66
|
}
|
|
67
67
|
// Not fixed, read current width from DOM
|
|
68
|
+
// Ignored via go/ees005
|
|
69
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
68
70
|
let domWidth = (view.domAtPos(cellPos + 1).node as HTMLElement).offsetWidth;
|
|
69
71
|
let parts = colspan || 0;
|
|
70
72
|
if (colwidth) {
|
|
@@ -29,6 +29,8 @@ export const resizeColumn = (
|
|
|
29
29
|
selectedColumns?: number[],
|
|
30
30
|
isTableScalingEnabled = false,
|
|
31
31
|
scalePercent = 1,
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
32
34
|
): ResizeState => {
|
|
33
35
|
let resizeAmount = amount;
|
|
34
36
|
|
|
@@ -94,7 +96,9 @@ export const resizeColumnAndTable = ({
|
|
|
94
96
|
resizeAmount =
|
|
95
97
|
amount < 0
|
|
96
98
|
? amount
|
|
97
|
-
:
|
|
99
|
+
: // Ignored via go/ees005
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
101
|
+
resizeAmount - (resizeState.maxSize + resizeAmount - tableContainerWidth!) / 2;
|
|
98
102
|
} else {
|
|
99
103
|
const diff = -(resizeState.tableWidth - resizeState.maxSize);
|
|
100
104
|
const rest = amount - diff;
|
|
@@ -162,7 +166,11 @@ const updateTablePreview = (
|
|
|
162
166
|
|
|
163
167
|
if (resizingItem) {
|
|
164
168
|
const newWidth = `${newTableWidth}px`;
|
|
169
|
+
// Ignored via go/ees005
|
|
170
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
165
171
|
(resizingContainer as HTMLElement).style.width = newWidth;
|
|
172
|
+
// Ignored via go/ees005
|
|
173
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
166
174
|
(resizingItem as HTMLElement).style.width = newWidth;
|
|
167
175
|
|
|
168
176
|
if (shouldChangeAlignment && alignmentContainer) {
|
|
@@ -8,6 +8,8 @@ export const growColumn = (
|
|
|
8
8
|
colIndex: number,
|
|
9
9
|
amount: number,
|
|
10
10
|
selectedColumns?: number[],
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
11
13
|
): ResizeState => {
|
|
12
14
|
// can't grow if columns don't exist or it's the last column
|
|
13
15
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
@@ -32,6 +34,8 @@ export const shrinkColumn = (
|
|
|
32
34
|
colIndex: number,
|
|
33
35
|
amount: number,
|
|
34
36
|
selectedColumns?: number[],
|
|
37
|
+
// Ignored via go/ees005
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
35
39
|
): ResizeState => {
|
|
36
40
|
// can't shrink if columns don't exist
|
|
37
41
|
if (!state.cols[colIndex]) {
|
|
@@ -115,6 +119,8 @@ enum ColType {
|
|
|
115
119
|
|
|
116
120
|
// TODO: should handle when destIdx:
|
|
117
121
|
// - is beyond the range, and then not give it back
|
|
122
|
+
// Ignored via go/ees005
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
118
124
|
function moveSpaceFrom(
|
|
119
125
|
state: ResizeState,
|
|
120
126
|
srcIdx: number,
|
|
@@ -6,7 +6,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
8
8
|
|
|
9
|
-
import { getSelectedTableInfo } from '../../utils';
|
|
9
|
+
import { getSelectedTableInfo } from '../../utils/analytics';
|
|
10
10
|
|
|
11
11
|
import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
12
12
|
import type { ColumnState } from './column-state';
|
|
@@ -117,6 +117,8 @@ export const updateColgroup = (
|
|
|
117
117
|
tableNode?: PMNode,
|
|
118
118
|
isTableScalingEnabled?: boolean,
|
|
119
119
|
scalePercent?: number,
|
|
120
|
+
// Ignored via go/ees005
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
120
122
|
): void => {
|
|
121
123
|
const cols = tableRef?.querySelectorAll('col');
|
|
122
124
|
const columnsCount = cols?.length;
|
|
@@ -326,6 +328,8 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
326
328
|
isTableScalingEnabled = false,
|
|
327
329
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
328
330
|
isCommentEditor = false,
|
|
331
|
+
// Ignored via go/ees005
|
|
332
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
329
333
|
): ResizeStateWithAnalytics | undefined => {
|
|
330
334
|
// Fail early so that we don't do complex calculations for no reason
|
|
331
335
|
const numColumnsSelected = rect.right - rect.left;
|