@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
|
@@ -6,7 +6,10 @@ import { ALIGN_CENTER, ALIGN_START, shouldChangeAlignmentToCenterResized } from
|
|
|
6
6
|
import { getTableScalingPercent } from './misc';
|
|
7
7
|
import { growColumn, shrinkColumn, updateAffectedColumn } from './resize-logic';
|
|
8
8
|
import { updateColgroup } from './resize-state';
|
|
9
|
-
export const resizeColumn = (resizeState, colIndex, amount, tableRef, tableNode, selectedColumns, isTableScalingEnabled = false, scalePercent = 1
|
|
9
|
+
export const resizeColumn = (resizeState, colIndex, amount, tableRef, tableNode, selectedColumns, isTableScalingEnabled = false, scalePercent = 1
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
|
+
) => {
|
|
10
13
|
let resizeAmount = amount;
|
|
11
14
|
if (isTableScalingEnabled) {
|
|
12
15
|
resizeAmount = amount / scalePercent;
|
|
@@ -37,7 +40,10 @@ export const resizeColumnAndTable = ({
|
|
|
37
40
|
if (willTableHitEditorEdge || willResizedTableStayInOverflow) {
|
|
38
41
|
var _tableRef$closest;
|
|
39
42
|
const tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
|
|
40
|
-
resizeAmount = amount < 0 ? amount :
|
|
43
|
+
resizeAmount = amount < 0 ? amount :
|
|
44
|
+
// Ignored via go/ees005
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
46
|
+
resizeAmount - (resizeState.maxSize + resizeAmount - tableContainerWidth) / 2;
|
|
41
47
|
} else {
|
|
42
48
|
const diff = -(resizeState.tableWidth - resizeState.maxSize);
|
|
43
49
|
const rest = amount - diff;
|
|
@@ -74,7 +80,11 @@ const updateTablePreview = (tableRef, newTableWidth, shouldChangeAlignment) => {
|
|
|
74
80
|
const alignmentContainer = resizingContainer === null || resizingContainer === void 0 ? void 0 : resizingContainer.parentElement;
|
|
75
81
|
if (resizingItem) {
|
|
76
82
|
const newWidth = `${newTableWidth}px`;
|
|
83
|
+
// Ignored via go/ees005
|
|
84
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
77
85
|
resizingContainer.style.width = newWidth;
|
|
86
|
+
// Ignored via go/ees005
|
|
87
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
78
88
|
resizingItem.style.width = newWidth;
|
|
79
89
|
if (shouldChangeAlignment && alignmentContainer) {
|
|
80
90
|
alignmentContainer.style.justifyContent = ALIGN_CENTER;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { getFreeSpace } from './column-state';
|
|
2
2
|
import { bulkColumnsResize, getTotalWidth } from './resize-state';
|
|
3
|
-
export const growColumn = (state, colIndex, amount, selectedColumns
|
|
3
|
+
export const growColumn = (state, colIndex, amount, selectedColumns
|
|
4
|
+
// Ignored via go/ees005
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
6
|
+
) => {
|
|
4
7
|
// can't grow if columns don't exist or it's the last column
|
|
5
8
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
6
9
|
return state;
|
|
@@ -16,7 +19,10 @@ export const growColumn = (state, colIndex, amount, selectedColumns) => {
|
|
|
16
19
|
}
|
|
17
20
|
return newState;
|
|
18
21
|
};
|
|
19
|
-
export const shrinkColumn = (state, colIndex, amount, selectedColumns
|
|
22
|
+
export const shrinkColumn = (state, colIndex, amount, selectedColumns
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
|
+
) => {
|
|
20
26
|
// can't shrink if columns don't exist
|
|
21
27
|
if (!state.cols[colIndex]) {
|
|
22
28
|
return state;
|
|
@@ -85,6 +91,8 @@ var ColType = /*#__PURE__*/function (ColType) {
|
|
|
85
91
|
return ColType;
|
|
86
92
|
}(ColType || {}); // TODO: should handle when destIdx:
|
|
87
93
|
// - is beyond the range, and then not give it back
|
|
94
|
+
// Ignored via go/ees005
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
88
96
|
function moveSpaceFrom(state, srcIdx, destIdx, amount, useFreeSpace = true) {
|
|
89
97
|
const srcCol = state.cols[srcIdx];
|
|
90
98
|
const destCol = state.cols[destIdx];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { getSelectedTableInfo } from '../../utils';
|
|
4
|
+
import { getSelectedTableInfo } from '../../utils/analytics';
|
|
5
5
|
import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
6
6
|
import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
|
|
7
7
|
import { syncStickyRowToTable } from './dom';
|
|
@@ -78,7 +78,10 @@ export const getResizeState = ({
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
// updates Colgroup DOM node with new widths
|
|
81
|
-
export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled, scalePercent
|
|
81
|
+
export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled, scalePercent
|
|
82
|
+
// Ignored via go/ees005
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
84
|
+
) => {
|
|
82
85
|
const cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
|
|
83
86
|
const columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
84
87
|
/**
|
|
@@ -272,7 +275,10 @@ const normaliseTableLayout = input => {
|
|
|
272
275
|
return 'default';
|
|
273
276
|
}
|
|
274
277
|
};
|
|
275
|
-
export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, getEditorContainerWidth, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
278
|
+
export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, getEditorContainerWidth, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
279
|
+
// Ignored via go/ees005
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
281
|
+
) => {
|
|
276
282
|
// Fail early so that we don't do complex calculations for no reason
|
|
277
283
|
const numColumnsSelected = rect.right - rect.left;
|
|
278
284
|
if (numColumnsSelected <= 1) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { updateColumnWidths } from '../../transforms';
|
|
5
|
-
import { getTableWidth } from '../../utils';
|
|
4
|
+
import { updateColumnWidths } from '../../transforms/column-width';
|
|
5
|
+
import { getTableWidth } from '../../utils/nodes';
|
|
6
6
|
import { getLayoutSize } from '../utils/misc';
|
|
7
7
|
import { reduceSpace } from '../utils/resize-logic';
|
|
8
8
|
import { adjustColumnsWidths, getResizeState, getTotalWidth, updateColgroup } from '../utils/resize-state';
|
|
@@ -10,7 +10,10 @@ import { hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
|
10
10
|
import { syncStickyRowToTable } from './dom';
|
|
11
11
|
// Base function to trigger the actual scale on a table node.
|
|
12
12
|
// Will only resize/scale if a table has been previously resized.
|
|
13
|
-
const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
13
|
+
const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
16
|
+
) => {
|
|
14
17
|
const {
|
|
15
18
|
node,
|
|
16
19
|
containerWidth,
|
|
@@ -54,7 +57,10 @@ const scale = (tableRef, options, domAtPos, isTableScalingEnabledOnCurrentTable
|
|
|
54
57
|
});
|
|
55
58
|
return scaleTableTo(resizeState, newWidth);
|
|
56
59
|
};
|
|
57
|
-
const scaleWithParent = (tableRef, parentWidth, table, start, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
60
|
+
const scaleWithParent = (tableRef, parentWidth, table, start, domAtPos, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
61
|
+
// Ignored via go/ees005
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
63
|
+
) => {
|
|
58
64
|
const resizeState = getResizeState({
|
|
59
65
|
minWidth: tableCellMinWidth,
|
|
60
66
|
maxSize: parentWidth,
|
|
@@ -99,7 +105,10 @@ export function scaleTableTo(state, maxSize) {
|
|
|
99
105
|
}
|
|
100
106
|
return adjustColumnsWidths(newState, maxSize);
|
|
101
107
|
}
|
|
102
|
-
export const previewScaleTable = (tableRef, options, domAtPos, isTableScalingEnabled = false, isTableWithFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
108
|
+
export const previewScaleTable = (tableRef, options, domAtPos, isTableScalingEnabled = false, isTableWithFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
109
|
+
// Ignored via go/ees005
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
111
|
+
) => {
|
|
103
112
|
const {
|
|
104
113
|
node,
|
|
105
114
|
start,
|
|
@@ -134,7 +143,10 @@ export const previewScaleTable = (tableRef, options, domAtPos, isTableScalingEna
|
|
|
134
143
|
};
|
|
135
144
|
|
|
136
145
|
// Scale the table to meet new requirements (col, layout change etc)
|
|
137
|
-
export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
146
|
+
export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabledOnCurrentTable = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
147
|
+
// Ignored via go/ees005
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
149
|
+
) => tr => {
|
|
138
150
|
if (!tableRef) {
|
|
139
151
|
return tr;
|
|
140
152
|
}
|
|
@@ -6,11 +6,23 @@ export function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
|
|
|
6
6
|
const list = {};
|
|
7
7
|
const editorSelectionAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.selection;
|
|
8
8
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
9
|
+
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9
12
|
bindKeymapWithCommand(moveRight.common, arrowRightFromTable(editorSelectionAPI)(), list);
|
|
13
|
+
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
16
|
bindKeymapWithCommand(moveLeft.common, arrowLeftFromTable(editorSelectionAPI)(), list);
|
|
11
17
|
bindKeymapArrayWithCommand(selectColumn, selectColumns(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
|
|
12
18
|
bindKeymapArrayWithCommand(selectRow, selectRows(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
|
|
19
|
+
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13
22
|
bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
|
|
23
|
+
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
26
|
bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
|
|
15
27
|
return keymap(list);
|
|
16
28
|
}
|
|
@@ -9,10 +9,13 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
9
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
11
11
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
12
|
-
import { TABLE_MAX_WIDTH } from './table-resizing/utils';
|
|
12
|
+
import { TABLE_MAX_WIDTH } from './table-resizing/utils/consts';
|
|
13
13
|
import { ALIGN_START } from './utils/alignment';
|
|
14
14
|
export const pluginKey = new PluginKey('tableWidthPlugin');
|
|
15
|
-
const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor
|
|
15
|
+
const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
18
|
+
) => {
|
|
16
19
|
return new SafePlugin({
|
|
17
20
|
key: pluginKey,
|
|
18
21
|
state: {
|
|
@@ -114,6 +117,8 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTabl
|
|
|
114
117
|
}
|
|
115
118
|
if (referentialityTr) {
|
|
116
119
|
referentialityTr.steps.forEach(step => {
|
|
120
|
+
// Ignored via go/ees005
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
117
122
|
step.getMap().forEach((_, __, newStart, newEnd) => {
|
|
118
123
|
newState.doc.nodesBetween(newStart, newEnd, (node, pos) => {
|
|
119
124
|
if (node.type === table) {
|
|
@@ -2,11 +2,10 @@ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
|
2
2
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { isMinCellWidthTable, hasTableBeenResized } from '../table-resizing/utils/colgroup';
|
|
6
|
+
import { getTableContainerElementWidth, getTableElementWidth } from '../table-resizing/utils/misc';
|
|
7
7
|
import { getResizeState } from '../table-resizing/utils/resize-state';
|
|
8
8
|
import { scaleTableTo } from '../table-resizing/utils/scale-table';
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* Given a new ResizeState object, create a transaction that replaces and updates the table node based on new state.
|
|
12
11
|
* @param resizeState
|
|
@@ -14,7 +13,10 @@ import { scaleTableTo } from '../table-resizing/utils/scale-table';
|
|
|
14
13
|
* @param start
|
|
15
14
|
* @returns
|
|
16
15
|
*/
|
|
17
|
-
export const updateColumnWidths = (resizeState, table, start, api
|
|
16
|
+
export const updateColumnWidths = (resizeState, table, start, api
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
19
|
+
) => tr => {
|
|
18
20
|
const map = TableMap.get(table);
|
|
19
21
|
const updatedCellsAttrs = {};
|
|
20
22
|
const steps = [];
|
|
@@ -32,6 +34,8 @@ export const updateColumnWidths = (resizeState, table, start, api) => tr => {
|
|
|
32
34
|
const mapIndex = rowIndex * map.width + columnIndex;
|
|
33
35
|
const cellPos = map.map[mapIndex];
|
|
34
36
|
const attrs = updatedCellsAttrs[cellPos] || {
|
|
37
|
+
// Ignored via go/ees005
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
39
|
...table.nodeAt(cellPos).attrs
|
|
36
40
|
};
|
|
37
41
|
const colspan = attrs.colspan || 1;
|
|
@@ -100,7 +104,10 @@ export const updateColumnWidths = (resizeState, table, start, api) => tr => {
|
|
|
100
104
|
* @param view
|
|
101
105
|
* @returns Updated transaction with rescaled columns for a given table
|
|
102
106
|
*/
|
|
103
|
-
export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, api, isCommentEditor = false
|
|
107
|
+
export const rescaleColumns = (isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, api, isCommentEditor = false
|
|
108
|
+
// Ignored via go/ees005
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
110
|
+
) => (table, view) => tr => {
|
|
104
111
|
if (!view) {
|
|
105
112
|
return tr;
|
|
106
113
|
}
|
|
@@ -24,6 +24,8 @@ const deleteColumnsCustomStep = rect => tr => {
|
|
|
24
24
|
for (let i = rect.left; i < rect.right; i++) {
|
|
25
25
|
const step = AddColumnStep.create(originalDoc, table.pos, i, true);
|
|
26
26
|
deletedColumns.push(i);
|
|
27
|
+
// Ignored via go/ees005
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
29
|
tr.step(step.map(tr.mapping.slice(mapStart)));
|
|
28
30
|
}
|
|
29
31
|
const tablePosResult = tr.mapping.mapResult(table.pos);
|
|
@@ -192,7 +194,10 @@ function fixRowSpans(table) {
|
|
|
192
194
|
}
|
|
193
195
|
return table.type.createChecked(table.attrs, rows, table.marks);
|
|
194
196
|
}
|
|
195
|
-
export const deleteColumns = (rect, allowCustomStep, api, view, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
197
|
+
export const deleteColumns = (rect, allowCustomStep, api, view, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
198
|
+
// Ignored via go/ees005
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
200
|
+
) => tr => {
|
|
196
201
|
let updatedTr = tr;
|
|
197
202
|
updatedTr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
198
203
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.DELETED_COLUMN
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import { calculateColumnWidth,
|
|
3
|
+
import { calculateColumnWidth, getCellsRefsInColumn } from '../table-resizing/utils/column-state';
|
|
4
|
+
import { contentWidth } from '../table-resizing/utils/content-width';
|
|
5
|
+
import { getLayoutSize } from '../table-resizing/utils/misc';
|
|
4
6
|
const validateTableCellNodeAttrs = ({
|
|
5
7
|
colspan,
|
|
6
8
|
rowspan,
|
|
@@ -34,7 +36,10 @@ const validateTableCellNodeAttrs = ({
|
|
|
34
36
|
//
|
|
35
37
|
// This row only spans two columns, yet it contains widths for 3.
|
|
36
38
|
// We remove the third width here, assumed duplicate content.
|
|
37
|
-
export const removeExtraneousColumnWidths = (node, basePos, tr, reportInvalidTableCellSpanAttrs
|
|
39
|
+
export const removeExtraneousColumnWidths = (node, basePos, tr, reportInvalidTableCellSpanAttrs
|
|
40
|
+
// Ignored via go/ees005
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
42
|
+
) => {
|
|
38
43
|
let hasProblems = false;
|
|
39
44
|
tr = replaceCells(tr, node, basePos, cell => {
|
|
40
45
|
const {
|
|
@@ -87,7 +92,10 @@ export const fixTables = (tr, reportInvalidTableCellSpanAttrs) => {
|
|
|
87
92
|
//
|
|
88
93
|
// We use this when migrating TinyMCE tables for Confluence, for example:
|
|
89
94
|
// https://pug.jira-dev.com/wiki/spaces/AEC/pages/3362882215/How+do+we+map+TinyMCE+tables+to+Fabric+tables
|
|
90
|
-
export const fixAutoSizedTable = (view, tableNode, tableRef, tablePos, opts
|
|
95
|
+
export const fixAutoSizedTable = (view, tableNode, tableRef, tablePos, opts
|
|
96
|
+
// Ignored via go/ees005
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
98
|
+
) => {
|
|
91
99
|
let {
|
|
92
100
|
tr
|
|
93
101
|
} = view.state;
|
|
@@ -130,6 +138,9 @@ const getLayoutBasedOnWidth = totalWidth => {
|
|
|
130
138
|
return 'default';
|
|
131
139
|
}
|
|
132
140
|
};
|
|
141
|
+
|
|
142
|
+
// Ignored via go/ees005
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
133
144
|
function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
134
145
|
const row = tableRef.querySelector('tr');
|
|
135
146
|
if (!row) {
|
|
@@ -143,6 +154,8 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
|
143
154
|
const colIdx = col + span;
|
|
144
155
|
const cells = getCellsRefsInColumn(colIdx, tableNode, tableStart, domAtPos);
|
|
145
156
|
const colWidth = calculateColumnWidth(cells, (_, col) => {
|
|
157
|
+
// Ignored via go/ees005
|
|
158
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
146
159
|
return contentWidth(col, tableRef).width;
|
|
147
160
|
});
|
|
148
161
|
cols[colIdx] = Math.max(colWidth, tableCellMinWidth);
|
|
@@ -152,7 +165,10 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
|
152
165
|
}
|
|
153
166
|
|
|
154
167
|
// TODO: move to prosemirror-utils
|
|
155
|
-
const replaceCells = (tr, table, tablePos, modifyCell
|
|
168
|
+
const replaceCells = (tr, table, tablePos, modifyCell
|
|
169
|
+
// Ignored via go/ees005
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
171
|
+
) => {
|
|
156
172
|
const rows = [];
|
|
157
173
|
let modifiedCells = 0;
|
|
158
174
|
for (let rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
|
|
@@ -12,7 +12,12 @@ export function mergeCells(tr) {
|
|
|
12
12
|
if (!(selection instanceof CellSelection) || !canMergeCells(tr)) {
|
|
13
13
|
return tr;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
15
18
|
const rect = getSelectionRect(selection);
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16
21
|
const table = findTable(selection);
|
|
17
22
|
const map = TableMap.get(table.node);
|
|
18
23
|
const seen = [];
|
|
@@ -58,6 +63,8 @@ export function mergeCells(tr) {
|
|
|
58
63
|
rowspan
|
|
59
64
|
}, cell.attrs.colspan, rect.right - rect.left - cell.attrs.colspan);
|
|
60
65
|
const newCell = content === Fragment.empty ? cell.type.createAndFill(attrs, content, cell.marks) : cell.type.createChecked(attrs, content, cell.marks);
|
|
66
|
+
// Ignored via go/ees005
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
61
68
|
rowCells.push(newCell);
|
|
62
69
|
} else if (selectedCells.indexOf(cellPos) === -1) {
|
|
63
70
|
// if its one of the selected cells, but not the merged cell, we get rid of it
|
|
@@ -2,8 +2,11 @@ import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-commo
|
|
|
2
2
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
5
|
-
import { getSelectedTableInfo } from '../utils';
|
|
6
|
-
export const replaceSelectedTable = (state, content, inputMethod, editorAnalyticsAPI
|
|
5
|
+
import { getSelectedTableInfo } from '../utils/analytics';
|
|
6
|
+
export const replaceSelectedTable = (state, content, inputMethod, editorAnalyticsAPI
|
|
7
|
+
// Ignored via go/ees005
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
9
|
+
) => {
|
|
7
10
|
if (isTableSelected(state.selection)) {
|
|
8
11
|
const table = findTable(state.selection);
|
|
9
12
|
if (table) {
|
|
@@ -7,6 +7,8 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
7
7
|
* @param columnStart - Start of the rect included (rect.left)
|
|
8
8
|
* @param columnEnd - End of the rect not included (rect.right)
|
|
9
9
|
*/
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
12
|
export function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
11
13
|
let mapStart = tr.mapping.maps.length;
|
|
12
14
|
const table = tr.doc.nodeAt(tablePos);
|
|
@@ -48,7 +50,10 @@ export function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
|
48
50
|
for (let i = 0; i < colspan; i++) {
|
|
49
51
|
let mapping = tr.mapping.slice(mapStart);
|
|
50
52
|
const cellPos = map.positionAt(cellRowIndex, column + i, table);
|
|
51
|
-
tr.insert(mapping.map(cellPos + tableStart),
|
|
53
|
+
tr.insert(mapping.map(cellPos + tableStart),
|
|
54
|
+
// Ignored via go/ees005
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
|
+
cellNode.type.createAndFill({
|
|
52
57
|
...baseAttrs,
|
|
53
58
|
colwidth: colwidth ? [colwidth[i]] : undefined
|
|
54
59
|
}));
|
|
@@ -11,4 +11,7 @@ export const normaliseAlignment = layout => layout === ALIGN_CENTER || layout ==
|
|
|
11
11
|
/**
|
|
12
12
|
* We don't want to switch alignment in Full-width editor
|
|
13
13
|
*/
|
|
14
|
-
export const shouldChangeAlignmentToCenterResized = (isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth
|
|
14
|
+
export const shouldChangeAlignmentToCenterResized = (isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth
|
|
15
|
+
// Ignored via go/ees005
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
|
+
) => Boolean(isTableAlignmentEnabled && tableNode && tableNode.attrs.layout === ALIGN_START && lineLength && updatedTableWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH);
|
|
@@ -2,8 +2,8 @@ import { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
4
|
import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
5
|
-
import { hasTableBeenResized } from '../table-resizing/utils';
|
|
6
|
-
import { getTableWidth } from './
|
|
5
|
+
import { hasTableBeenResized } from '../table-resizing/utils/colgroup';
|
|
6
|
+
import { getTableWidth } from './nodes';
|
|
7
7
|
export function getSelectedTableInfo(selection) {
|
|
8
8
|
let map;
|
|
9
9
|
let totalRowCount = 0;
|
|
@@ -19,8 +19,12 @@ export const getColumnsWidths = view => {
|
|
|
19
19
|
});
|
|
20
20
|
for (let i = 0; i < map.width; i++) {
|
|
21
21
|
if (!map.isCellMergedTopLeft(0, i)) {
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22
24
|
const node = table.node.nodeAt(map.map[i]);
|
|
23
25
|
const pos = map.map[i] + table.start;
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
24
28
|
const cellRef = findDomRefAtPos(pos, domAtPos);
|
|
25
29
|
const rect = cellRef.getBoundingClientRect();
|
|
26
30
|
widths[i] = (rect ? rect.width : cellRef.offsetWidth) + 1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
2
|
-
import { TABLE_MAX_WIDTH } from '../table-resizing/utils';
|
|
2
|
+
import { TABLE_MAX_WIDTH } from '../table-resizing/utils/consts';
|
|
3
3
|
const NESTED_TABLE_DEFAULT_ROWS = 2;
|
|
4
4
|
const NESTED_TABLE_DEFAULT_COLS = 2;
|
|
5
5
|
export const createTableWithWidth = ({
|
|
@@ -20,7 +20,10 @@ export const createCellHoverDecoration = cells => cells.map(cell => Decoration.n
|
|
|
20
20
|
}, {
|
|
21
21
|
key: TableDecorations.CELL_CONTROLS_HOVER
|
|
22
22
|
}));
|
|
23
|
-
export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected
|
|
23
|
+
export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
+
) => {
|
|
24
27
|
const table = findTable(tr.selection);
|
|
25
28
|
if (!table) {
|
|
26
29
|
return [];
|
|
@@ -84,7 +87,10 @@ export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnab
|
|
|
84
87
|
key = TableDecorations.TABLE_CONTROLS_HOVER;
|
|
85
88
|
break;
|
|
86
89
|
}
|
|
87
|
-
return Decoration.node(pos,
|
|
90
|
+
return Decoration.node(pos,
|
|
91
|
+
// Ignored via go/ees005
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
93
|
+
pos + cell.nodeSize, {
|
|
88
94
|
class: classes.join(' ')
|
|
89
95
|
}, {
|
|
90
96
|
key
|
|
@@ -105,7 +111,10 @@ export const createColumnSelectedDecoration = tr => {
|
|
|
105
111
|
const cellPositions = map.cellsInRect(rect);
|
|
106
112
|
return cellPositions.map((pos, index) => {
|
|
107
113
|
const cell = doc.nodeAt(pos + table.start);
|
|
108
|
-
return Decoration.node(pos + table.start,
|
|
114
|
+
return Decoration.node(pos + table.start,
|
|
115
|
+
// Ignored via go/ees005
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
117
|
+
pos + table.start + cell.nodeSize, {
|
|
109
118
|
class: ClassName.COLUMN_SELECTED
|
|
110
119
|
}, {
|
|
111
120
|
key: `${TableDecorations.COLUMN_SELECTED}_${index}`
|
|
@@ -137,7 +146,10 @@ export const createColumnControlsDecoration = selection => {
|
|
|
137
146
|
});
|
|
138
147
|
});
|
|
139
148
|
};
|
|
140
|
-
export const updateDecorations = (node, decorationSet, decorations, key
|
|
149
|
+
export const updateDecorations = (node, decorationSet, decorations, key
|
|
150
|
+
// Ignored via go/ees005
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
152
|
+
) => {
|
|
141
153
|
const filteredDecorations = filterDecorationByKey(key, decorationSet);
|
|
142
154
|
const decorationSetFiltered = decorationSet.remove(filteredDecorations);
|
|
143
155
|
return decorationSetFiltered.add(node, decorations);
|
|
@@ -223,7 +235,10 @@ const makeArray = n => Array.from(Array(n).keys());
|
|
|
223
235
|
* we will add a new class on the last item for each cell,
|
|
224
236
|
* hence the second media will receive this class `ClassName.LAST_ITEM_IN_CELL`
|
|
225
237
|
*/
|
|
226
|
-
export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget, includeTooltip = false, getIntl, nodeViewPortalProviderAPI
|
|
238
|
+
export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget, includeTooltip = false, getIntl, nodeViewPortalProviderAPI
|
|
239
|
+
// Ignored via go/ees005
|
|
240
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
241
|
+
) => {
|
|
227
242
|
const emptyResult = [[], []];
|
|
228
243
|
const table = findTable(tr.selection);
|
|
229
244
|
if (!table || !table.node) {
|
|
@@ -233,7 +248,10 @@ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexT
|
|
|
233
248
|
if (!map.width) {
|
|
234
249
|
return emptyResult;
|
|
235
250
|
}
|
|
236
|
-
const createResizerHandleDecoration = (cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode
|
|
251
|
+
const createResizerHandleDecoration = (cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode
|
|
252
|
+
// Ignored via go/ees005
|
|
253
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
254
|
+
) => {
|
|
237
255
|
const decorationRenderKey = uuid();
|
|
238
256
|
const position = cellPos + cellNode.nodeSize - 1;
|
|
239
257
|
return Decoration.widget(position, () => {
|
|
@@ -166,7 +166,11 @@ export const findNearestCellIndexToPoint = (x, y) => {
|
|
|
166
166
|
return undefined;
|
|
167
167
|
}
|
|
168
168
|
return {
|
|
169
|
+
// Ignored via go/ees005
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
169
171
|
row: row.rowIndex,
|
|
172
|
+
// Ignored via go/ees005
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
170
174
|
col: cell.cellIndex
|
|
171
175
|
};
|
|
172
176
|
};
|
|
@@ -24,7 +24,10 @@ import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three
|
|
|
24
24
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
25
25
|
import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
|
|
26
26
|
import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
|
|
27
|
-
import { AddColLeftIcon
|
|
27
|
+
import { AddColLeftIcon } from '../../ui/icons/AddColLeftIcon';
|
|
28
|
+
import { AddColRightIcon } from '../../ui/icons/AddColRightIcon';
|
|
29
|
+
import { AddRowAboveIcon } from '../../ui/icons/AddRowAboveIcon';
|
|
30
|
+
import { AddRowBelowIcon } from '../../ui/icons/AddRowBelowIcon';
|
|
28
31
|
import { getClosestSelectionRect } from '../../ui/toolbar';
|
|
29
32
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands/commands-with-analytics';
|
|
30
33
|
import { moveSourceWithAnalytics } from '../drag-and-drop/commands-with-analytics';
|
|
@@ -33,7 +36,10 @@ import { getNewResizeStateFromSelectedColumns } from '../table-resizing/utils/re
|
|
|
33
36
|
import { hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
|
|
34
37
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
35
38
|
export const getTargetIndex = (selectedIndexes, direction) => Math[direction < 0 ? 'min' : 'max'](...selectedIndexes) + direction;
|
|
36
|
-
export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect
|
|
39
|
+
export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect
|
|
40
|
+
// Ignored via go/ees005
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
42
|
+
) => {
|
|
37
43
|
if (!selectionRect) {
|
|
38
44
|
return false;
|
|
39
45
|
}
|
|
@@ -72,7 +78,10 @@ const defaultSelectionRect = {
|
|
|
72
78
|
right: 0,
|
|
73
79
|
bottom: 0
|
|
74
80
|
};
|
|
75
|
-
export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, ariaNotifyPlugin, isCommentEditor = false
|
|
81
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, ariaNotifyPlugin, isCommentEditor = false
|
|
82
|
+
// Ignored via go/ees005
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
84
|
+
) => {
|
|
76
85
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
77
86
|
const {
|
|
78
87
|
selection
|
|
@@ -247,7 +256,13 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
247
256
|
onClick: (state, dispatch) => {
|
|
248
257
|
if (canMove) {
|
|
249
258
|
requestAnimationFrame(() => {
|
|
250
|
-
moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`,
|
|
259
|
+
moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`,
|
|
260
|
+
// Ignored via go/ees005
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
262
|
+
getOriginIndexes(selectionRect),
|
|
263
|
+
// Ignored via go/ees005
|
|
264
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
265
|
+
getTargetIndex(selectionRect))(editorView.state, editorView.dispatch);
|
|
251
266
|
});
|
|
252
267
|
return true;
|
|
253
268
|
}
|
|
@@ -62,6 +62,9 @@ export const tablesHaveDifferentNoOfRows = (currentTable, previousTable) => {
|
|
|
62
62
|
const currentMap = TableMap.get(currentTable);
|
|
63
63
|
return prevMap.height !== currentMap.height;
|
|
64
64
|
};
|
|
65
|
+
|
|
66
|
+
// Ignored via go/ees005
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
65
68
|
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
66
69
|
const found = findNode(selection);
|
|
67
70
|
if (!found) {
|
|
@@ -30,7 +30,10 @@ export const unwrapContentFromTable = maybeTable => {
|
|
|
30
30
|
// Flattens nested tables after a given nesting depth
|
|
31
31
|
// If this looks familiar, it's a heavily modified version of `mapFragment` which has been
|
|
32
32
|
// adjusted to support tracking nesting depth. This wasn't possible by using `mapFragment` directly
|
|
33
|
-
const unwrapNestedTables = (content, schema, unwrapNestDepth, currentNestDepth = 0
|
|
33
|
+
const unwrapNestedTables = (content, schema, unwrapNestDepth, currentNestDepth = 0
|
|
34
|
+
// Ignored via go/ees005
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
36
|
+
) => {
|
|
34
37
|
const flattenNested = (node, tableDepth) => {
|
|
35
38
|
if (node.type === schema.nodes.table) {
|
|
36
39
|
if (tableDepth >= unwrapNestDepth) {
|
|
@@ -169,7 +172,10 @@ export const transformSliceToRemoveOpenTable = (slice, schema) => {
|
|
|
169
172
|
// starts and ends inside of a cell
|
|
170
173
|
slice.openStart >= 4 && slice.openEnd >= 4 &&
|
|
171
174
|
// slice is a table node
|
|
172
|
-
slice.content.childCount === 1 &&
|
|
175
|
+
slice.content.childCount === 1 &&
|
|
176
|
+
// Ignored via go/ees005
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
178
|
+
slice.content.firstChild.type === schema.nodes.table) {
|
|
173
179
|
var _slice$content$firstC2, _slice$content$firstC3, _slice$content$firstC4, _slice$content$firstC5, _slice$content$firstC6;
|
|
174
180
|
// prosemirror-view has a bug that it duplicates table entry when selecting multiple paragraphs in a table cell.
|
|
175
181
|
// https://github.com/ProseMirror/prosemirror/issues/1270
|
|
@@ -74,7 +74,10 @@ export const getRowsParams = rowsHeights => {
|
|
|
74
74
|
}
|
|
75
75
|
return rows;
|
|
76
76
|
};
|
|
77
|
-
export const getRowClassNames = (index, selection, hoveredRows = [], isInDanger, isResizing
|
|
77
|
+
export const getRowClassNames = (index, selection, hoveredRows = [], isInDanger, isResizing
|
|
78
|
+
// Ignored via go/ees005
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
80
|
+
) => {
|
|
78
81
|
const classNames = [];
|
|
79
82
|
if (isRowSelected(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
|
|
80
83
|
classNames.push(ClassName.HOVERED_CELL_ACTIVE);
|