@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import { cloneColumn, cloneRow, moveColumn, moveRow } from '@atlaskit/editor-tables/utils';
|
|
3
3
|
import { TableDecorations } from '../../types';
|
|
4
|
-
import { createColumnInsertLine, createRowInsertLine, updateDecorations } from '../utils';
|
|
4
|
+
import { createColumnInsertLine, createRowInsertLine, updateDecorations } from '../utils/decoration';
|
|
5
5
|
import { DragAndDropActionType } from './actions';
|
|
6
6
|
import { DropTargetType } from './consts';
|
|
7
7
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
@@ -12,7 +12,10 @@ const getDecorations = state => {
|
|
|
12
12
|
return ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet) || DecorationSet.empty;
|
|
13
13
|
};
|
|
14
14
|
const updatePluginStateDecorations = (state, decorations, key) => updateDecorations(state.doc, getDecorations(state), decorations, key);
|
|
15
|
-
export const setDropTarget = (type, index, hasMergedCells, tr
|
|
15
|
+
export const setDropTarget = (type, index, hasMergedCells, tr
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
18
|
+
) => createCommand(state => {
|
|
16
19
|
const {
|
|
17
20
|
dropTargetType,
|
|
18
21
|
dropTargetIndex
|
|
@@ -50,7 +53,10 @@ export const clearDropTarget = tr => createCommand(state => {
|
|
|
50
53
|
}
|
|
51
54
|
};
|
|
52
55
|
}, originalTr => (tr || originalTr).setMeta('addToHistory', false));
|
|
53
|
-
export const moveSource = (sourceType, sourceIndexes, targetIndex, tr
|
|
56
|
+
export const moveSource = (sourceType, sourceIndexes, targetIndex, tr
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
59
|
+
) => createCommand(state => {
|
|
54
60
|
return {
|
|
55
61
|
type: DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
56
62
|
data: {
|
|
@@ -67,7 +73,10 @@ export const moveSource = (sourceType, sourceIndexes, targetIndex, tr) => create
|
|
|
67
73
|
selectAfterMove: true
|
|
68
74
|
})(nextTr);
|
|
69
75
|
});
|
|
70
|
-
export const toggleDragMenu = (isDragMenuOpen, direction, index, trigger = 'mouse'
|
|
76
|
+
export const toggleDragMenu = (isDragMenuOpen, direction, index, trigger = 'mouse'
|
|
77
|
+
// Ignored via go/ees005
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
79
|
+
) => createCommand(state => {
|
|
71
80
|
let {
|
|
72
81
|
isDragMenuOpen: previousOpenState,
|
|
73
82
|
dragMenuDirection: previousDragMenuDirection,
|
|
@@ -101,7 +110,10 @@ export const toggleDragMenu = (isDragMenuOpen, direction, index, trigger = 'mous
|
|
|
101
110
|
}, tr => {
|
|
102
111
|
return tr.setMeta('addToHistory', false);
|
|
103
112
|
});
|
|
104
|
-
export const cloneSource = (sourceType, sourceIndexes, targetIndex, targetDirection, tr
|
|
113
|
+
export const cloneSource = (sourceType, sourceIndexes, targetIndex, targetDirection, tr
|
|
114
|
+
// Ignored via go/ees005
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
116
|
+
) => createCommand(state => {
|
|
105
117
|
return {
|
|
106
118
|
type: DragAndDropActionType.CLEAR_DROP_TARGET,
|
|
107
119
|
data: {
|
|
@@ -8,8 +8,9 @@ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
|
8
8
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
9
9
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
10
10
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
11
|
-
import { insertColgroupFromNode } from '../table-resizing/utils';
|
|
12
|
-
import { findNearestCellIndexToPoint
|
|
11
|
+
import { insertColgroupFromNode } from '../table-resizing/utils/colgroup';
|
|
12
|
+
import { findNearestCellIndexToPoint } from '../utils/dom';
|
|
13
|
+
import { hasMergedCellsInBetween } from '../utils/merged-cells';
|
|
13
14
|
import { DragAndDropActionType } from './actions';
|
|
14
15
|
import { clearDropTarget, setDropTarget, toggleDragMenu } from './commands';
|
|
15
16
|
import { clearDropTargetWithAnalytics, cloneSourceWithAnalytics, moveSourceWithAnalytics } from './commands-with-analytics';
|
|
@@ -17,7 +18,10 @@ import { DropTargetType } from './consts';
|
|
|
17
18
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
18
19
|
import { pluginKey } from './plugin-key';
|
|
19
20
|
import { getDraggableDataFromEvent } from './utils/monitor';
|
|
20
|
-
const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor
|
|
21
|
+
const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
|
+
) => {
|
|
21
25
|
const editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
22
26
|
const rowAutoScrollers = editorPageScrollContainer ? [monitorForElements({
|
|
23
27
|
canMonitor({
|
|
@@ -30,13 +34,19 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
30
34
|
},
|
|
31
35
|
onDragStart() {
|
|
32
36
|
// auto scroller doesn't work when scroll-behavior: smooth is set, this monitor temporarily removes it via inline styles
|
|
37
|
+
// Ignored via go/ees005
|
|
38
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
33
39
|
editorPageScrollContainer.style.setProperty('scroll-behavior', 'unset');
|
|
34
40
|
},
|
|
35
41
|
onDrop() {
|
|
36
42
|
// 'null' will remove the inline style
|
|
43
|
+
// Ignored via go/ees005
|
|
44
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
37
45
|
editorPageScrollContainer.style.setProperty('scroll-behavior', null);
|
|
38
46
|
}
|
|
39
47
|
}), autoScrollForElements({
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
40
50
|
element: editorPageScrollContainer,
|
|
41
51
|
canScroll: ({
|
|
42
52
|
source
|
|
@@ -184,7 +194,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
184
194
|
}
|
|
185
195
|
}));
|
|
186
196
|
};
|
|
187
|
-
export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
197
|
+
export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false
|
|
198
|
+
// Ignored via go/ees005
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
200
|
+
) => {
|
|
188
201
|
return new SafePlugin({
|
|
189
202
|
state: createPluginState(dispatch, state => ({
|
|
190
203
|
decorationSet: DecorationSet.empty,
|
|
@@ -290,7 +303,10 @@ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled
|
|
|
290
303
|
return true;
|
|
291
304
|
}
|
|
292
305
|
}
|
|
293
|
-
const isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'
|
|
306
|
+
const isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'
|
|
307
|
+
// Ignored via go/ees005
|
|
308
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
309
|
+
].includes((_ref = event.target || null) === null || _ref === void 0 ? void 0 : _ref.id);
|
|
294
310
|
const keysToTrap = ['Enter', ' '];
|
|
295
311
|
const {
|
|
296
312
|
isDragMenuOpen = false
|
|
@@ -7,7 +7,7 @@ import { isTextInput } from '@atlaskit/editor-common/utils';
|
|
|
7
7
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
9
9
|
import { defaultTableSelection } from './default-table-selection';
|
|
10
|
-
import { pluginKey as tableResizingPluginKey } from './table-resizing';
|
|
10
|
+
import { pluginKey as tableResizingPluginKey } from './table-resizing/plugin-key';
|
|
11
11
|
import { isTableCollapsible } from './utils/collapse';
|
|
12
12
|
import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled } from './utils/nodes';
|
|
13
13
|
const nextTableSorting = (tr, table) => {
|
|
@@ -9,13 +9,25 @@ import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from './commands
|
|
|
9
9
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from './commands/column-resize';
|
|
10
10
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from './commands/commands-with-analytics';
|
|
11
11
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable, insertTableWithNestingSupport } from './commands/insert';
|
|
12
|
+
|
|
13
|
+
// Ignored via go/ees005
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
15
|
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
13
16
|
var _pluginInjectionApi$a;
|
|
14
17
|
const list = {};
|
|
15
18
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
16
|
-
bindKeymapWithCommand(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
bindKeymapWithCommand(
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22
|
+
nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
23
|
+
bindKeymapWithCommand(
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
|
+
previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
27
|
+
bindKeymapWithCommand(
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
30
|
+
toggleTable.common, fg('platform_editor_use_nested_table_pm_nodes') ? editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
19
31
|
isTableScalingEnabled,
|
|
20
32
|
isTableAlignmentEnabled,
|
|
21
33
|
isFullWidthModeEnabled: !!isFullWidthEnabled,
|
|
@@ -31,18 +43,47 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
31
43
|
},
|
|
32
44
|
eventType: EVENT_TYPE.TRACK
|
|
33
45
|
})) : createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled), list);
|
|
34
|
-
bindKeymapWithCommand(
|
|
46
|
+
bindKeymapWithCommand(
|
|
47
|
+
// Ignored via go/ees005
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
|
+
backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
50
|
+
// Ignored via go/ees005
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
52
|
bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
|
|
36
53
|
|
|
37
54
|
// Add row/column shortcuts
|
|
38
|
-
bindKeymapWithCommand(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
bindKeymapWithCommand(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
bindKeymapWithCommand(
|
|
56
|
+
// Ignored via go/ees005
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
58
|
+
addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
59
|
+
bindKeymapWithCommand(
|
|
60
|
+
// Ignored via go/ees005
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
62
|
+
addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
63
|
+
bindKeymapWithCommand(
|
|
64
|
+
// Ignored via go/ees005
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
66
|
+
addColumnBefore.common, addColumnBeforeCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
67
|
+
bindKeymapWithCommand(
|
|
68
|
+
// Ignored via go/ees005
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
70
|
+
addColumnAfter.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
71
|
+
bindKeymapWithCommand(
|
|
72
|
+
// Ignored via go/ees005
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
74
|
+
addRowBeforeVO.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
75
|
+
bindKeymapWithCommand(
|
|
76
|
+
// Ignored via go/ees005
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
78
|
+
addRowAfterVO.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
79
|
+
bindKeymapWithCommand(
|
|
80
|
+
// Ignored via go/ees005
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
|
+
addColumnBeforeVO.common, addColumnBeforeCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
83
|
+
bindKeymapWithCommand(
|
|
84
|
+
// Ignored via go/ees005
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
86
|
+
addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
46
87
|
if (dragAndDropEnabled) {
|
|
47
88
|
// Move row/column shortcuts
|
|
48
89
|
/**
|
|
@@ -52,38 +93,77 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
52
93
|
* See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
|
|
53
94
|
*/
|
|
54
95
|
|
|
55
|
-
bindKeymapWithCommand(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
96
|
+
bindKeymapWithCommand(
|
|
97
|
+
// Ignored via go/ees005
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
99
|
+
moveRowDown.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', 1), list);
|
|
100
|
+
bindKeymapWithCommand(
|
|
101
|
+
// Ignored via go/ees005
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
+
moveRowUp.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', -1), list);
|
|
104
|
+
bindKeymapWithCommand(
|
|
105
|
+
// Ignored via go/ees005
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
107
|
+
moveColumnLeft.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', -1), list);
|
|
108
|
+
bindKeymapWithCommand(
|
|
109
|
+
// Ignored via go/ees005
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
111
|
+
moveColumnRight.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', 1), list);
|
|
59
112
|
|
|
60
113
|
// Delete row/column shortcuts
|
|
61
|
-
bindKeymapWithCommand(
|
|
62
|
-
|
|
114
|
+
bindKeymapWithCommand(
|
|
115
|
+
// Ignored via go/ees005
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
117
|
+
deleteColumn.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
118
|
+
bindKeymapWithCommand(
|
|
119
|
+
// Ignored via go/ees005
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
121
|
+
deleteRow.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
63
122
|
}
|
|
64
|
-
bindKeymapWithCommand(
|
|
123
|
+
bindKeymapWithCommand(
|
|
124
|
+
// Ignored via go/ees005
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
126
|
+
startColumnResizing.common, initiateKeyboardColumnResizing({
|
|
65
127
|
ariaNotify: ariaNotifyPlugin,
|
|
66
128
|
getIntl: getIntl,
|
|
67
129
|
nodeViewPortalProviderAPI
|
|
68
130
|
}), list);
|
|
69
|
-
bindKeymapWithCommand(
|
|
131
|
+
bindKeymapWithCommand(
|
|
132
|
+
// Ignored via go/ees005
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
134
|
+
moveRight.common, activateNextResizeArea({
|
|
70
135
|
direction: 1,
|
|
71
136
|
ariaNotify: ariaNotifyPlugin,
|
|
72
137
|
getIntl: getIntl,
|
|
73
138
|
nodeViewPortalProviderAPI
|
|
74
139
|
}), list);
|
|
75
|
-
bindKeymapWithCommand(
|
|
140
|
+
bindKeymapWithCommand(
|
|
141
|
+
// Ignored via go/ees005
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
143
|
+
moveLeft.common, activateNextResizeArea({
|
|
76
144
|
direction: -1,
|
|
77
145
|
ariaNotify: ariaNotifyPlugin,
|
|
78
146
|
getIntl: getIntl,
|
|
79
147
|
nodeViewPortalProviderAPI
|
|
80
148
|
}), list);
|
|
81
|
-
bindKeymapWithCommand(
|
|
82
|
-
|
|
83
|
-
|
|
149
|
+
bindKeymapWithCommand(
|
|
150
|
+
// Ignored via go/ees005
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
152
|
+
decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
153
|
+
bindKeymapWithCommand(
|
|
154
|
+
// Ignored via go/ees005
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
156
|
+
increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
157
|
+
bindKeymapWithCommand(
|
|
158
|
+
// Ignored via go/ees005
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
160
|
+
escape.common, stopKeyboardColumnResizing({
|
|
84
161
|
ariaNotify: ariaNotifyPlugin,
|
|
85
162
|
getIntl: getIntl
|
|
86
163
|
}), list);
|
|
164
|
+
|
|
165
|
+
// Ignored via go/ees005
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
87
167
|
bindKeymapWithCommand(focusToContextMenuTrigger.common, setFocusToCellMenu(), list);
|
|
88
168
|
return keymap(list);
|
|
89
169
|
}
|
|
@@ -17,10 +17,14 @@ import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor,
|
|
|
17
17
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
18
18
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
19
19
|
import { pluginKey } from './plugin-key';
|
|
20
|
-
import { fixTables
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
20
|
+
import { fixTables } from './transforms/fix-tables';
|
|
21
|
+
import { replaceSelectedTable } from './transforms/replace-table';
|
|
22
|
+
import { findControlsHoverDecoration } from './utils/decoration';
|
|
23
|
+
import { transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, transformSliceToRemoveNestedTables, isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from './utils/paste';
|
|
24
|
+
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
27
|
+
) => {
|
|
24
28
|
var _accessibilityUtils;
|
|
25
29
|
const state = createPluginState(dispatch, {
|
|
26
30
|
pluginConfig,
|
|
@@ -100,7 +104,10 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
100
104
|
if (pluginState.editorHasFocus) {
|
|
101
105
|
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
102
106
|
if (parent) {
|
|
103
|
-
tableRef =
|
|
107
|
+
tableRef =
|
|
108
|
+
// Ignored via go/ees005
|
|
109
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
110
|
+
parent.querySelector('table') || undefined;
|
|
104
111
|
}
|
|
105
112
|
const tableNode = findTable(state.selection);
|
|
106
113
|
// when keyboard cursor leaves the table we need to stop column resizing
|
|
@@ -218,6 +225,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
218
225
|
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
219
226
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
220
227
|
if (browser.chrome && event.target) {
|
|
228
|
+
// Ignored via go/ees005
|
|
229
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
221
230
|
const targetClassList = event.target.classList;
|
|
222
231
|
if (targetClassList.contains(ClassName.CONTROLS_BUTTON) || targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON) || targetClassList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE)) {
|
|
223
232
|
return true;
|
|
@@ -235,6 +244,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
235
244
|
const maybeTr = closestElement(domRef, 'tr');
|
|
236
245
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
237
246
|
},
|
|
247
|
+
// Ignored via go/ees005
|
|
248
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
238
249
|
handleTextInput: (view, _from, _to, text) => {
|
|
239
250
|
const {
|
|
240
251
|
state,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
3
3
|
import { META_KEYS } from '../table-analytics';
|
|
4
|
-
import { updateColumnWidths } from '../transforms';
|
|
4
|
+
import { updateColumnWidths } from '../transforms/column-width';
|
|
5
5
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
6
|
-
import {
|
|
6
|
+
import { isClickNear } from './utils/dom';
|
|
7
|
+
import { evenAllColumnsWidths } from './utils/resize-state';
|
|
7
8
|
export const evenColumns = ({
|
|
8
9
|
resizeState,
|
|
9
10
|
table,
|
|
@@ -6,16 +6,21 @@ import { stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
|
6
6
|
import { updateResizeHandleDecorations } from '../commands/misc';
|
|
7
7
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
8
8
|
import { META_KEYS } from '../table-analytics';
|
|
9
|
-
import { updateColumnWidths } from '../transforms';
|
|
10
|
-
import { getSelectedColumnIndexes, isTableNested } from '../utils';
|
|
9
|
+
import { updateColumnWidths } from '../transforms/column-width';
|
|
11
10
|
import { ALIGN_CENTER, ALIGN_START, shouldChangeAlignmentToCenterResized } from '../utils/alignment';
|
|
11
|
+
import { isTableNested } from '../utils/nodes';
|
|
12
|
+
import { getSelectedColumnIndexes } from '../utils/selection';
|
|
12
13
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
14
|
import { getPluginState } from './plugin-factory';
|
|
14
|
-
import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, resizeColumnAndTable, updateControls } from './utils';
|
|
15
15
|
import { TABLE_OFFSET_IN_COMMENT_EDITOR } from './utils/consts';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
16
|
+
import { updateControls } from './utils/dom';
|
|
17
|
+
import { currentColWidth, getTableMaxWidth, pointsAtCell, getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './utils/misc';
|
|
18
|
+
import { resizeColumn, resizeColumnAndTable, scaleResizeState } from './utils/resize-column';
|
|
19
|
+
import { getResizeState } from './utils/resize-state';
|
|
20
|
+
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
23
|
+
) => {
|
|
19
24
|
var _originalTable$attrs;
|
|
20
25
|
const {
|
|
21
26
|
state,
|
|
@@ -96,6 +101,9 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
96
101
|
finish(event);
|
|
97
102
|
return true;
|
|
98
103
|
}
|
|
104
|
+
|
|
105
|
+
// Ignored via go/ees005
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
99
107
|
const width = currentColWidth(view, localResizeHandlePos, cell.attrs);
|
|
100
108
|
setDragging({
|
|
101
109
|
startX: event.clientX,
|
|
@@ -118,7 +126,11 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
118
126
|
});
|
|
119
127
|
}
|
|
120
128
|
function finish(event) {
|
|
129
|
+
// Ignored via go/ees005
|
|
130
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
121
131
|
window.removeEventListener('mouseup', finish);
|
|
132
|
+
// Ignored via go/ees005
|
|
133
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
122
134
|
window.removeEventListener('mousemove', move);
|
|
123
135
|
const {
|
|
124
136
|
clientX
|
|
@@ -296,6 +308,8 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
296
308
|
// const tablePos = state.doc.resolve(start).start(-1);
|
|
297
309
|
const tableDepth = state.doc.resolve(tablePos).depth;
|
|
298
310
|
const map = TableMap.get(table);
|
|
311
|
+
// Ignored via go/ees005
|
|
312
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
299
313
|
const colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter.attrs.colspan - 1;
|
|
300
314
|
let shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
301
315
|
const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || isTableScalingEnabled && isCommentEditor;
|
|
@@ -321,7 +335,12 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
321
335
|
}
|
|
322
336
|
updateControls()(state);
|
|
323
337
|
}
|
|
338
|
+
|
|
339
|
+
// Ignored via go/ees005
|
|
340
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
324
341
|
window.addEventListener('mouseup', finish);
|
|
342
|
+
// Ignored via go/ees005
|
|
343
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
325
344
|
window.addEventListener('mousemove', move);
|
|
326
345
|
return true;
|
|
327
346
|
};
|
|
@@ -6,7 +6,10 @@ import { setResizeHandlePos } from './commands';
|
|
|
6
6
|
import { handleMouseDown } from './event-handlers';
|
|
7
7
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
8
8
|
import { pluginKey } from './plugin-key';
|
|
9
|
-
import { getResizeCellPos } from './utils';
|
|
9
|
+
import { getResizeCellPos } from './utils/dom';
|
|
10
|
+
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
13
|
export function createPlugin(dispatch, {
|
|
11
14
|
lastColumnResizable = true
|
|
12
15
|
}, getEditorContainerWidth, getEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
@@ -11,9 +11,15 @@ import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from '.
|
|
|
11
11
|
* overflow.
|
|
12
12
|
*/
|
|
13
13
|
export const getColWidthFix = (colwidth, tableColumnCount) => colwidth - 1 / tableColumnCount;
|
|
14
|
-
export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor
|
|
14
|
+
export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor
|
|
15
|
+
// Ignored via go/ees005
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
|
+
) => {
|
|
15
18
|
const cols = [];
|
|
16
19
|
const map = TableMap.get(table);
|
|
20
|
+
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
17
23
|
table.content.firstChild.content.forEach(cell => {
|
|
18
24
|
const colspan = cell.attrs.colspan || 1;
|
|
19
25
|
if (Array.isArray(cell.attrs.colwidth)) {
|
|
@@ -56,7 +62,12 @@ export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPerce
|
|
|
56
62
|
});
|
|
57
63
|
return cols;
|
|
58
64
|
};
|
|
59
|
-
export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled = false, shouldRemove = true, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
65
|
+
export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled = false, shouldRemove = true, shouldUseIncreasedScalingPercent = false, isCommentEditor = false
|
|
66
|
+
// Ignored via go/ees005
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
68
|
+
) => {
|
|
69
|
+
// Ignored via go/ees005
|
|
70
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
60
71
|
let colgroup = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelector('colgroup');
|
|
61
72
|
if (colgroup && shouldRemove) {
|
|
62
73
|
tableRef === null || tableRef === void 0 ? void 0 : tableRef.removeChild(colgroup);
|
|
@@ -68,6 +79,8 @@ export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled =
|
|
|
68
79
|
return colgroup.children;
|
|
69
80
|
};
|
|
70
81
|
export const hasTableBeenResized = table => {
|
|
82
|
+
// Ignored via go/ees005
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
71
84
|
return !!getFragmentBackingArray(table.content.firstChild.content).find(cell => cell.attrs.colwidth);
|
|
72
85
|
};
|
|
73
86
|
export const hasTableColumnBeenResized = hasTableBeenResized;
|
|
@@ -79,14 +92,22 @@ export const hasTableColumnBeenResized = hasTableBeenResized;
|
|
|
79
92
|
* @returns true if all column width is equal to tableCellMinWidth or null, false otherwise
|
|
80
93
|
*/
|
|
81
94
|
export const isMinCellWidthTable = table => {
|
|
95
|
+
// Ignored via go/ees005
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
97
|
const cellArray = getFragmentBackingArray(table.content.firstChild.content);
|
|
83
98
|
const isTableMinCellWidth = cellArray.every(cell => {
|
|
84
99
|
return cell.attrs.colwidth && cell.attrs.colwidth[0] === tableCellMinWidth || cell.attrs.colwidth === null;
|
|
85
100
|
});
|
|
86
101
|
return isTableMinCellWidth;
|
|
87
102
|
};
|
|
103
|
+
|
|
104
|
+
// Ignored via go/ees005
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
88
106
|
function renderColgroupFromNode(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
89
107
|
const rendered = DOMSerializer.renderSpec(document, ['colgroup', {}, ...generateColgroup(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor)]);
|
|
108
|
+
|
|
109
|
+
// Ignored via go/ees005
|
|
110
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
90
111
|
return rendered.dom;
|
|
91
112
|
}
|
|
92
113
|
export const getColgroupChildrenLength = table => {
|
|
@@ -20,7 +20,10 @@ export const getFreeSpace = state => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// Returns DOM refs of all cells in a column by `columnIndex`
|
|
23
|
-
export const getCellsRefsInColumn = (columnIndex, table, tableStart, domAtPos
|
|
23
|
+
export const getCellsRefsInColumn = (columnIndex, table, tableStart, domAtPos
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
+
) => {
|
|
24
27
|
const map = TableMap.get(table);
|
|
25
28
|
const cellsPositions = map.cellsInRect({
|
|
26
29
|
left: columnIndex,
|
|
@@ -30,6 +33,8 @@ export const getCellsRefsInColumn = (columnIndex, table, tableStart, domAtPos) =
|
|
|
30
33
|
});
|
|
31
34
|
const cells = [];
|
|
32
35
|
cellsPositions.forEach(pos => {
|
|
36
|
+
// Ignored via go/ees005
|
|
37
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
33
38
|
const col = findDomRefAtPos(pos + tableStart, domAtPos);
|
|
34
39
|
if (col) {
|
|
35
40
|
cells.push(col);
|
|
@@ -1,18 +1,27 @@
|
|
|
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(elem, container, colWidths = [], canvas = document.createElement('canvas')) {
|
|
5
7
|
return calcContentWidth(elem, container || elem, canvas, colWidths);
|
|
6
8
|
}
|
|
9
|
+
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
7
12
|
function calcContentWidth(elem, container, canvas, colWidths) {
|
|
8
13
|
const flowWidths = [];
|
|
9
14
|
let curWidth = 0;
|
|
10
15
|
for (let i = 0; i < elem.childNodes.length; i++) {
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
11
18
|
const child = elem.childNodes[i];
|
|
12
19
|
if (child.nodeType === Node.COMMENT_NODE) {
|
|
13
20
|
continue;
|
|
14
21
|
}
|
|
15
22
|
if (child.nodeType === Node.TEXT_NODE) {
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
16
25
|
const parent = child.parentNode;
|
|
17
26
|
const parentStyle = getComputedStyle(parent);
|
|
18
27
|
let contentLength = 0;
|
|
@@ -66,11 +75,19 @@ function measureText(canvas, text, font) {
|
|
|
66
75
|
}
|
|
67
76
|
return Math.round(ctx.measureText(text || '').width);
|
|
68
77
|
}
|
|
78
|
+
|
|
79
|
+
// Ignored via go/ees005
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
69
81
|
function handlePreText(canvas, node, textContent, font) {
|
|
70
82
|
let parent = node;
|
|
71
83
|
if (node.nodeName === 'CODE') {
|
|
84
|
+
// Ignored via go/ees005
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @atlaskit/editor/no-as-casting
|
|
72
86
|
parent = node.parentNode;
|
|
73
87
|
}
|
|
88
|
+
|
|
89
|
+
// Ignored via go/ees005
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
74
91
|
const computedStyle = getComputedStyle(parent);
|
|
75
92
|
if (textContent && computedStyle.whiteSpace === 'pre') {
|
|
76
93
|
// If white space is pre grab the longest line in the block.
|
|
@@ -41,6 +41,8 @@ export const isClickNear = (event, click) => {
|
|
|
41
41
|
return dx * dx + dy * dy < 100;
|
|
42
42
|
};
|
|
43
43
|
export const getResizeCellPos = (view, event) => {
|
|
44
|
+
// Ignored via go/ees005
|
|
45
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
44
46
|
const target = event.target;
|
|
45
47
|
if (!containsClassName(target, ClassName.RESIZE_HANDLE_DECORATION)) {
|
|
46
48
|
return null;
|
|
@@ -81,6 +83,8 @@ export const syncStickyRowToTable = tableRef => {
|
|
|
81
83
|
applyTableWidthToStickyRow(tableRef, headerRow);
|
|
82
84
|
};
|
|
83
85
|
const applyTableWidthToStickyRow = (tableRef, headerRow) => {
|
|
86
|
+
// Ignored via go/ees005
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
84
88
|
const tbody = tableRef.querySelector('tbody');
|
|
85
89
|
const wrapper = tableRef.parentElement;
|
|
86
90
|
if (tbody && wrapper) {
|
|
@@ -35,6 +35,8 @@ export function currentColWidth(view, cellPos, {
|
|
|
35
35
|
return width;
|
|
36
36
|
}
|
|
37
37
|
// Not fixed, read current width from DOM
|
|
38
|
+
// Ignored via go/ees005
|
|
39
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
38
40
|
let domWidth = view.domAtPos(cellPos + 1).node.offsetWidth;
|
|
39
41
|
let parts = colspan || 0;
|
|
40
42
|
if (colwidth) {
|