@atlaskit/editor-plugin-table 9.1.3 → 9.2.1
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 +23 -0
- package/dist/cjs/nodeviews/TableCell.js +0 -2
- package/dist/cjs/nodeviews/TableComponent.js +5 -5
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/cjs/nodeviews/TableContainer.js +13 -2
- package/dist/cjs/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/cjs/nodeviews/TableResizer.js +5 -10
- package/dist/cjs/nodeviews/TableRow.js +0 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -16
- package/dist/cjs/nodeviews/table.js +3 -10
- package/dist/cjs/pm-plugins/commands/column-resize.js +1 -4
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/cjs/pm-plugins/commands/insert.js +4 -19
- package/dist/cjs/pm-plugins/commands/misc.js +3 -12
- package/dist/cjs/pm-plugins/decorations/plugin.js +1 -6
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/cjs/pm-plugins/keymap.js +0 -2
- package/dist/cjs/pm-plugins/main.js +1 -6
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +0 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/cjs/pm-plugins/table-width.js +1 -6
- package/dist/cjs/pm-plugins/transforms/column-width.js +1 -4
- package/dist/cjs/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/cjs/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/cjs/pm-plugins/transforms/split.js +0 -2
- package/dist/cjs/pm-plugins/utils/alignment.js +1 -4
- package/dist/cjs/pm-plugins/utils/decoration.js +4 -16
- package/dist/cjs/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/cjs/pm-plugins/utils/nodes.js +0 -3
- package/dist/cjs/pm-plugins/utils/paste.js +4 -0
- package/dist/cjs/pm-plugins/utils/row-controls.js +1 -4
- package/dist/cjs/tablePlugin.js +1 -0
- package/dist/cjs/ui/DragHandle/index.js +55 -6
- package/dist/cjs/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +18 -6
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +61 -11
- package/dist/cjs/ui/TableFloatingControls/index.js +25 -8
- package/dist/cjs/ui/toolbar.js +3 -12
- package/dist/es2019/nodeviews/TableCell.js +0 -2
- package/dist/es2019/nodeviews/TableComponent.js +5 -5
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/es2019/nodeviews/TableContainer.js +13 -2
- package/dist/es2019/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/es2019/nodeviews/TableResizer.js +5 -10
- package/dist/es2019/nodeviews/TableRow.js +0 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -16
- package/dist/es2019/nodeviews/table.js +3 -10
- package/dist/es2019/pm-plugins/commands/column-resize.js +1 -4
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +6 -24
- package/dist/es2019/pm-plugins/commands/delete.js +1 -4
- package/dist/es2019/pm-plugins/commands/insert.js +5 -23
- package/dist/es2019/pm-plugins/commands/misc.js +3 -12
- package/dist/es2019/pm-plugins/decorations/plugin.js +1 -6
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +4 -16
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -8
- package/dist/es2019/pm-plugins/keymap.js +0 -3
- package/dist/es2019/pm-plugins/main.js +1 -6
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -11
- package/dist/es2019/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +2 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -16
- package/dist/es2019/pm-plugins/table-width.js +1 -6
- package/dist/es2019/pm-plugins/transforms/column-width.js +2 -8
- package/dist/es2019/pm-plugins/transforms/delete-columns.js +1 -4
- package/dist/es2019/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/es2019/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/es2019/pm-plugins/transforms/split.js +0 -2
- package/dist/es2019/pm-plugins/utils/alignment.js +1 -4
- package/dist/es2019/pm-plugins/utils/decoration.js +4 -16
- package/dist/es2019/pm-plugins/utils/drag-menu.js +2 -8
- package/dist/es2019/pm-plugins/utils/nodes.js +0 -3
- package/dist/es2019/pm-plugins/utils/paste.js +5 -4
- package/dist/es2019/pm-plugins/utils/row-controls.js +1 -4
- package/dist/es2019/pm-plugins/utils/snapping.js +1 -4
- package/dist/es2019/tablePlugin.js +1 -0
- package/dist/es2019/ui/DragHandle/index.js +57 -6
- package/dist/es2019/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +19 -7
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +63 -11
- package/dist/es2019/ui/TableFloatingControls/index.js +26 -10
- package/dist/es2019/ui/event-handlers.js +1 -4
- package/dist/es2019/ui/toolbar.js +9 -36
- package/dist/esm/nodeviews/TableCell.js +0 -2
- package/dist/esm/nodeviews/TableComponent.js +5 -5
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +6 -4
- package/dist/esm/nodeviews/TableContainer.js +13 -2
- package/dist/esm/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/esm/nodeviews/TableResizer.js +5 -10
- package/dist/esm/nodeviews/TableRow.js +0 -2
- package/dist/esm/nodeviews/lazy-node-views.js +4 -16
- package/dist/esm/nodeviews/table.js +3 -10
- package/dist/esm/pm-plugins/commands/column-resize.js +1 -4
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/esm/pm-plugins/commands/insert.js +4 -19
- package/dist/esm/pm-plugins/commands/misc.js +3 -12
- package/dist/esm/pm-plugins/decorations/plugin.js +1 -6
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/esm/pm-plugins/keymap.js +0 -3
- package/dist/esm/pm-plugins/main.js +1 -6
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/esm/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/esm/pm-plugins/table-width.js +1 -6
- package/dist/esm/pm-plugins/transforms/column-width.js +1 -4
- package/dist/esm/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/esm/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/esm/pm-plugins/transforms/split.js +0 -2
- package/dist/esm/pm-plugins/utils/alignment.js +1 -4
- package/dist/esm/pm-plugins/utils/decoration.js +4 -16
- package/dist/esm/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/esm/pm-plugins/utils/nodes.js +0 -3
- package/dist/esm/pm-plugins/utils/paste.js +4 -0
- package/dist/esm/pm-plugins/utils/row-controls.js +1 -4
- package/dist/esm/tablePlugin.js +1 -0
- package/dist/esm/ui/DragHandle/index.js +54 -5
- package/dist/esm/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +19 -7
- package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +61 -11
- package/dist/esm/ui/TableFloatingControls/index.js +26 -9
- package/dist/esm/ui/toolbar.js +3 -12
- package/dist/types/nodeviews/TableComponent.d.ts +3 -1
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/DragHandle/index.d.ts +21 -0
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +8 -5
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +21 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +8 -5
- package/package.json +15 -6
- package/src/nodeviews/TableCell.ts +0 -2
- package/src/nodeviews/TableComponent.tsx +8 -6
- package/src/nodeviews/TableComponentWithSharedState.tsx +4 -2
- package/src/nodeviews/TableContainer.tsx +12 -1
- package/src/nodeviews/TableNodeViewBase.ts +0 -2
- package/src/nodeviews/TableResizer.tsx +9 -5
- package/src/nodeviews/TableRow.ts +0 -2
- package/src/nodeviews/lazy-node-views.ts +0 -8
- package/src/nodeviews/table.tsx +1 -6
- package/src/pm-plugins/commands/column-resize.ts +0 -2
- package/src/pm-plugins/commands/commands-with-analytics.ts +0 -12
- package/src/pm-plugins/commands/delete.ts +0 -2
- package/src/pm-plugins/commands/insert.ts +0 -12
- package/src/pm-plugins/commands/misc.ts +0 -6
- package/src/pm-plugins/decorations/plugin.ts +0 -4
- package/src/pm-plugins/decorations/utils/column-resizing.ts +0 -2
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +0 -6
- package/src/pm-plugins/drag-and-drop/commands.ts +0 -8
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -4
- package/src/pm-plugins/keymap.ts +0 -2
- package/src/pm-plugins/main.ts +0 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +0 -2
- package/src/pm-plugins/table-resizing/plugin.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/column-state.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/content-width.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +0 -4
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +0 -8
- package/src/pm-plugins/table-width.ts +0 -4
- package/src/pm-plugins/transforms/column-width.ts +0 -4
- package/src/pm-plugins/transforms/delete-columns.ts +0 -2
- package/src/pm-plugins/transforms/fix-tables.ts +0 -8
- package/src/pm-plugins/transforms/replace-table.ts +0 -2
- package/src/pm-plugins/transforms/split.ts +0 -2
- package/src/pm-plugins/utils/alignment.ts +0 -2
- package/src/pm-plugins/utils/decoration.ts +0 -8
- package/src/pm-plugins/utils/drag-menu.ts +0 -4
- package/src/pm-plugins/utils/nodes.ts +0 -2
- package/src/pm-plugins/utils/paste.ts +4 -2
- package/src/pm-plugins/utils/row-controls.ts +0 -2
- package/src/pm-plugins/utils/snapping.ts +0 -2
- package/src/tablePlugin.tsx +1 -0
- package/src/types/index.ts +1 -0
- package/src/ui/DragHandle/index.tsx +67 -2
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -4
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +37 -20
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -4
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +86 -27
- package/src/ui/TableFloatingControls/index.tsx +55 -32
- package/src/ui/event-handlers.ts +0 -2
- package/src/ui/toolbar.tsx +0 -18
|
@@ -20,10 +20,7 @@ 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
|
|
24
|
-
// Ignored via go/ees005
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
-
) => {
|
|
23
|
+
export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) => {
|
|
27
24
|
const table = findTable(tr.selection);
|
|
28
25
|
if (!table) {
|
|
29
26
|
return [];
|
|
@@ -146,10 +143,7 @@ export const createColumnControlsDecoration = selection => {
|
|
|
146
143
|
});
|
|
147
144
|
});
|
|
148
145
|
};
|
|
149
|
-
export const updateDecorations = (node, decorationSet, decorations, key
|
|
150
|
-
// Ignored via go/ees005
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
152
|
-
) => {
|
|
146
|
+
export const updateDecorations = (node, decorationSet, decorations, key) => {
|
|
153
147
|
const filteredDecorations = filterDecorationByKey(key, decorationSet);
|
|
154
148
|
const decorationSetFiltered = decorationSet.remove(filteredDecorations);
|
|
155
149
|
return decorationSetFiltered.add(node, decorations);
|
|
@@ -235,10 +229,7 @@ const makeArray = n => Array.from(Array(n).keys());
|
|
|
235
229
|
* we will add a new class on the last item for each cell,
|
|
236
230
|
* hence the second media will receive this class `ClassName.LAST_ITEM_IN_CELL`
|
|
237
231
|
*/
|
|
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
|
-
) => {
|
|
232
|
+
export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget, includeTooltip = false, getIntl, nodeViewPortalProviderAPI) => {
|
|
242
233
|
const emptyResult = [[], []];
|
|
243
234
|
const table = findTable(tr.selection);
|
|
244
235
|
if (!table || !table.node) {
|
|
@@ -248,10 +239,7 @@ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexT
|
|
|
248
239
|
if (!map.width) {
|
|
249
240
|
return emptyResult;
|
|
250
241
|
}
|
|
251
|
-
const createResizerHandleDecoration = (cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode
|
|
252
|
-
// Ignored via go/ees005
|
|
253
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
254
|
-
) => {
|
|
242
|
+
const createResizerHandleDecoration = (cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode) => {
|
|
255
243
|
const decorationRenderKey = uuid();
|
|
256
244
|
const position = cellPos + cellNode.nodeSize - 1;
|
|
257
245
|
return Decoration.widget(position, () => {
|
|
@@ -36,10 +36,7 @@ import { getNewResizeStateFromSelectedColumns } from '../table-resizing/utils/re
|
|
|
36
36
|
import { hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
|
|
37
37
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
38
38
|
export const getTargetIndex = (selectedIndexes, direction) => Math[direction < 0 ? 'min' : 'max'](...selectedIndexes) + direction;
|
|
39
|
-
export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect
|
|
40
|
-
// Ignored via go/ees005
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
42
|
-
) => {
|
|
39
|
+
export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) => {
|
|
43
40
|
if (!selectionRect) {
|
|
44
41
|
return false;
|
|
45
42
|
}
|
|
@@ -78,10 +75,7 @@ const defaultSelectionRect = {
|
|
|
78
75
|
right: 0,
|
|
79
76
|
bottom: 0
|
|
80
77
|
};
|
|
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
|
-
) => {
|
|
78
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, ariaNotifyPlugin, isCommentEditor = false) => {
|
|
85
79
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
86
80
|
const {
|
|
87
81
|
selection
|
|
@@ -62,9 +62,6 @@ 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
|
|
68
65
|
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
69
66
|
const found = findNode(selection);
|
|
70
67
|
if (!found) {
|
|
@@ -2,6 +2,7 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
2
2
|
import { flatmap, mapChildren, mapSlice } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { flatten, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
import { getPluginState } from '../plugin-factory';
|
|
7
8
|
|
|
@@ -19,6 +20,9 @@ export const unwrapContentFromTable = maybeTable => {
|
|
|
19
20
|
maybeTable.descendants(maybeCell => {
|
|
20
21
|
if (maybeCell.type === tableCell || maybeCell.type === tableHeader) {
|
|
21
22
|
content.push(...flatten(maybeCell, false).map(child => child.node));
|
|
23
|
+
if (fg('platform_editor_nested_tables_paste_dupe_fix')) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
27
|
return true;
|
|
24
28
|
});
|
|
@@ -30,10 +34,7 @@ export const unwrapContentFromTable = maybeTable => {
|
|
|
30
34
|
// Flattens nested tables after a given nesting depth
|
|
31
35
|
// If this looks familiar, it's a heavily modified version of `mapFragment` which has been
|
|
32
36
|
// adjusted to support tracking nesting depth. This wasn't possible by using `mapFragment` directly
|
|
33
|
-
const unwrapNestedTables = (content, schema, unwrapNestDepth, currentNestDepth = 0
|
|
34
|
-
// Ignored via go/ees005
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
36
|
-
) => {
|
|
37
|
+
const unwrapNestedTables = (content, schema, unwrapNestDepth, currentNestDepth = 0) => {
|
|
37
38
|
const flattenNested = (node, tableDepth) => {
|
|
38
39
|
if (node.type === schema.nodes.table) {
|
|
39
40
|
if (tableDepth >= unwrapNestDepth) {
|
|
@@ -74,10 +74,7 @@ export const getRowsParams = rowsHeights => {
|
|
|
74
74
|
}
|
|
75
75
|
return rows;
|
|
76
76
|
};
|
|
77
|
-
export const getRowClassNames = (index, selection, hoveredRows = [], isInDanger, isResizing
|
|
78
|
-
// Ignored via go/ees005
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
80
|
-
) => {
|
|
77
|
+
export const getRowClassNames = (index, selection, hoveredRows = [], isInDanger, isResizing) => {
|
|
81
78
|
const classNames = [];
|
|
82
79
|
if (isRowSelected(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
|
|
83
80
|
classNames.push(ClassName.HOVERED_CELL_ACTIVE);
|
|
@@ -31,10 +31,7 @@ export const defaultTablePreserveSnappingWidths = (lengthOffset, editorContainer
|
|
|
31
31
|
/**
|
|
32
32
|
* Returns keys of guidelines that are closest to the table and within the snapGap
|
|
33
33
|
*/
|
|
34
|
-
export const findClosestSnap = (currentWidth, snapWidths, guidelines, snapGap = 0, tolerance = 0
|
|
35
|
-
// Ignored via go/ees005
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
37
|
-
) => {
|
|
34
|
+
export const findClosestSnap = (currentWidth, snapWidths, guidelines, snapGap = 0, tolerance = 0) => {
|
|
38
35
|
const closestGapIndex = snapWidths.reduce((prev, curr, index) => Math.abs(curr - currentWidth) < Math.abs(snapWidths[prev] - currentWidth) ? index : prev, 0);
|
|
39
36
|
const gap = Math.abs(snapWidths[closestGapIndex] - currentWidth);
|
|
40
37
|
if (gap < snapGap) {
|
|
@@ -98,6 +98,7 @@ const tablesPlugin = ({
|
|
|
98
98
|
isTableResizing: tableWidthResizingPluginState === null || tableWidthResizingPluginState === void 0 ? void 0 : tableWidthResizingPluginState.resizing,
|
|
99
99
|
isInDanger: tablePluginState.isInDanger,
|
|
100
100
|
hoveredRows: tablePluginState.hoveredRows,
|
|
101
|
+
hoveredColumns: tablePluginState.hoveredColumns,
|
|
101
102
|
hoveredCell: tablePluginState.hoveredCell,
|
|
102
103
|
isTableHovered: tablePluginState.isTableHovered,
|
|
103
104
|
isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/no-html-button */
|
|
2
|
+
|
|
1
3
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
4
|
import classnames from 'classnames';
|
|
3
5
|
import ReactDOM from 'react-dom';
|
|
4
6
|
import { injectIntl } from 'react-intl-next';
|
|
5
7
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
8
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
9
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
10
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
11
|
import { findTable, TableMap } from '@atlaskit/editor-tables';
|
|
@@ -32,7 +35,9 @@ const DragHandleComponent = ({
|
|
|
32
35
|
editorView,
|
|
33
36
|
intl: {
|
|
34
37
|
formatMessage
|
|
35
|
-
}
|
|
38
|
+
},
|
|
39
|
+
hoveredColumns,
|
|
40
|
+
hoveredRows
|
|
36
41
|
}) => {
|
|
37
42
|
const dragHandleDivRef = useRef(null);
|
|
38
43
|
const [previewContainer, setPreviewContainer] = useState(null);
|
|
@@ -42,10 +47,14 @@ const DragHandleComponent = ({
|
|
|
42
47
|
selection
|
|
43
48
|
}
|
|
44
49
|
} = editorView;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
if (hoveredColumns === undefined || hoveredRows === undefined) {
|
|
51
|
+
const {
|
|
52
|
+
hoveredColumns: hoveredColumnsState,
|
|
53
|
+
hoveredRows: hoveredRowsState
|
|
54
|
+
} = getPluginState(state);
|
|
55
|
+
hoveredColumns = hoveredColumnsState;
|
|
56
|
+
hoveredRows = hoveredRowsState;
|
|
57
|
+
}
|
|
49
58
|
const {
|
|
50
59
|
isDragMenuOpen = false
|
|
51
60
|
} = getDnDPluginState(state);
|
|
@@ -239,4 +248,46 @@ const DragHandleComponent = ({
|
|
|
239
248
|
height: previewHeight
|
|
240
249
|
}), previewContainer));
|
|
241
250
|
};
|
|
242
|
-
|
|
251
|
+
const DragHandleComponentWithSharedState = ({
|
|
252
|
+
isDragMenuTarget,
|
|
253
|
+
tableLocalId,
|
|
254
|
+
direction,
|
|
255
|
+
appearance,
|
|
256
|
+
indexes,
|
|
257
|
+
forceDefaultHandle,
|
|
258
|
+
previewHeight,
|
|
259
|
+
previewWidth,
|
|
260
|
+
onMouseOver,
|
|
261
|
+
onMouseOut,
|
|
262
|
+
toggleDragMenu,
|
|
263
|
+
hoveredCell,
|
|
264
|
+
onClick,
|
|
265
|
+
editorView,
|
|
266
|
+
intl,
|
|
267
|
+
api
|
|
268
|
+
}) => {
|
|
269
|
+
const {
|
|
270
|
+
tableState
|
|
271
|
+
} = useSharedPluginState(api, ['table']);
|
|
272
|
+
return /*#__PURE__*/React.createElement(DragHandleComponent, {
|
|
273
|
+
isDragMenuTarget: isDragMenuTarget,
|
|
274
|
+
tableLocalId: tableLocalId,
|
|
275
|
+
direction: direction,
|
|
276
|
+
appearance: appearance,
|
|
277
|
+
indexes: indexes,
|
|
278
|
+
forceDefaultHandle: forceDefaultHandle,
|
|
279
|
+
previewWidth: previewWidth,
|
|
280
|
+
previewHeight: previewHeight,
|
|
281
|
+
onMouseOver: onMouseOver,
|
|
282
|
+
onMouseOut: onMouseOut,
|
|
283
|
+
toggleDragMenu: toggleDragMenu,
|
|
284
|
+
hoveredCell: hoveredCell,
|
|
285
|
+
onClick: onClick,
|
|
286
|
+
editorView: editorView,
|
|
287
|
+
intl: intl,
|
|
288
|
+
hoveredColumns: tableState === null || tableState === void 0 ? void 0 : tableState.hoveredColumns,
|
|
289
|
+
hoveredRows: tableState === null || tableState === void 0 ? void 0 : tableState.hoveredRows
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
export const DragHandle = injectIntl(DragHandleComponent);
|
|
293
|
+
export const DragHandleWithSharedState = injectIntl(DragHandleComponentWithSharedState);
|
|
@@ -32,9 +32,6 @@ function getRowOptions(index, isDragAndDropEnabled) {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
// Ignored via go/ees005
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
38
35
|
function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDropEnabled) {
|
|
39
36
|
const options = {
|
|
40
37
|
alignX: 'end',
|
|
@@ -80,9 +77,6 @@ function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDr
|
|
|
80
77
|
}
|
|
81
78
|
return options;
|
|
82
79
|
}
|
|
83
|
-
|
|
84
|
-
// Ignored via go/ees005
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
86
80
|
function getPopupOptions(direction, index, hasNumberedColumns, isDragAndDropEnabled, tableContainer) {
|
|
87
81
|
switch (direction) {
|
|
88
82
|
case 'column':
|
|
@@ -12,7 +12,7 @@ import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
|
12
12
|
import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
13
13
|
import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
|
|
14
14
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
15
|
-
import { DragHandle } from '../../DragHandle';
|
|
15
|
+
import { DragHandle, DragHandleWithSharedState } from '../../DragHandle';
|
|
16
16
|
const getSelectedColumns = selection => {
|
|
17
17
|
if (selection instanceof CellSelection && selection.isColSelection()) {
|
|
18
18
|
const rect = getSelectionRect(selection);
|
|
@@ -33,7 +33,6 @@ export const ColumnControls = ({
|
|
|
33
33
|
isInDanger,
|
|
34
34
|
rowHeights,
|
|
35
35
|
colWidths,
|
|
36
|
-
hasHeaderColumn,
|
|
37
36
|
isTableHovered,
|
|
38
37
|
tableContainerWidth,
|
|
39
38
|
isNumberColumnEnabled,
|
|
@@ -138,10 +137,7 @@ export const ColumnControls = ({
|
|
|
138
137
|
var _getScrollOffset;
|
|
139
138
|
columnControlsRef.current.scrollLeft = (_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0;
|
|
140
139
|
}
|
|
141
|
-
const generateHandleByType = (type, appearance, gridColumn, indexes
|
|
142
|
-
// Ignored via go/ees005
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
144
|
-
) => {
|
|
140
|
+
const generateHandleByType = (type, appearance, gridColumn, indexes) => {
|
|
145
141
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
146
142
|
const isHover = type === 'hover';
|
|
147
143
|
const isPlaceholder = appearance === 'placeholder';
|
|
@@ -172,7 +168,23 @@ export const ColumnControls = ({
|
|
|
172
168
|
position: 'relative'
|
|
173
169
|
},
|
|
174
170
|
"data-testid": `table-floating-column-${isHover ? colIndex : isPlaceholder ? appearance : selectedColIndexes[0]}-drag-handle`
|
|
175
|
-
}, /*#__PURE__*/React.createElement(
|
|
171
|
+
}, fg('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/React.createElement(DragHandleWithSharedState, {
|
|
172
|
+
isDragMenuTarget: !isHover,
|
|
173
|
+
direction: "column",
|
|
174
|
+
tableLocalId: localId || '',
|
|
175
|
+
indexes: indexes,
|
|
176
|
+
hoveredCell: hoveredCell,
|
|
177
|
+
previewWidth: previewWidth,
|
|
178
|
+
forceDefaultHandle: !isHover,
|
|
179
|
+
previewHeight: previewHeight,
|
|
180
|
+
appearance: appearance,
|
|
181
|
+
onClick: handleClick,
|
|
182
|
+
onMouseOver: handleMouseOver,
|
|
183
|
+
onMouseOut: handleMouseOut,
|
|
184
|
+
toggleDragMenu: toggleDragMenuHandler,
|
|
185
|
+
editorView: editorView,
|
|
186
|
+
api: api
|
|
187
|
+
}) : /*#__PURE__*/React.createElement(DragHandle, {
|
|
176
188
|
isDragMenuTarget: !isHover,
|
|
177
189
|
direction: "column",
|
|
178
190
|
tableLocalId: localId || '',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { getColumnsWidths } from '../../pm-plugins/utils/column-controls';
|
|
6
5
|
import { containsHeaderColumn } from '../../pm-plugins/utils/nodes';
|
|
7
6
|
import { getRowHeights } from '../../pm-plugins/utils/row-controls';
|
|
@@ -99,7 +98,7 @@ const TableFloatingColumnControls = ({
|
|
|
99
98
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
100
99
|
isDragging: isDragging,
|
|
101
100
|
getScrollOffset: getScrollOffset,
|
|
102
|
-
api:
|
|
101
|
+
api: fg('platform_editor_table_use_shared_state_hook_fg') ? api : undefined
|
|
103
102
|
}), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
104
103
|
tableRef: tableRef,
|
|
105
104
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
3
|
import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
8
9
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
9
10
|
import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
@@ -12,7 +13,7 @@ import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-cont
|
|
|
12
13
|
import { getSelectedRowIndexes } from '../../../pm-plugins/utils/selection';
|
|
13
14
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
14
15
|
import { dropTargetExtendedWidth } from '../../consts';
|
|
15
|
-
import { DragHandle } from '../../DragHandle';
|
|
16
|
+
import { DragHandle, DragHandleWithSharedState } from '../../DragHandle';
|
|
16
17
|
import RowDropTarget from '../RowDropTarget';
|
|
17
18
|
const getSelectedRows = selection => {
|
|
18
19
|
if (selection instanceof CellSelection && selection.isRowSelection()) {
|
|
@@ -24,7 +25,7 @@ const getSelectedRows = selection => {
|
|
|
24
25
|
}
|
|
25
26
|
return [];
|
|
26
27
|
};
|
|
27
|
-
const
|
|
28
|
+
export const DragControls = ({
|
|
28
29
|
tableRef,
|
|
29
30
|
tableNode,
|
|
30
31
|
tableWidth,
|
|
@@ -37,14 +38,16 @@ const DragControlsComponent = ({
|
|
|
37
38
|
hoverRows,
|
|
38
39
|
selectRow,
|
|
39
40
|
selectRows,
|
|
40
|
-
updateCellHoverLocation
|
|
41
|
+
updateCellHoverLocation,
|
|
42
|
+
api,
|
|
43
|
+
selection
|
|
41
44
|
}) => {
|
|
42
45
|
var _tableNode$attrs$loca, _tableNode$attrs;
|
|
43
46
|
const [isDragging, setIsDragging] = useState(false);
|
|
44
47
|
const rowHeights = getRowHeights(tableRef);
|
|
45
48
|
const rowsParams = getRowsParams(rowHeights);
|
|
46
49
|
const heights = rowHeights.map(height => `${height - 1}px`).join(' ');
|
|
47
|
-
const selectedRowIndexes = getSelectedRows(editorView.state.selection);
|
|
50
|
+
const selectedRowIndexes = getSelectedRows(selection !== null && selection !== void 0 ? selection : editorView.state.selection);
|
|
48
51
|
const currentNodeLocalId = (_tableNode$attrs$loca = tableNode === null || tableNode === void 0 ? void 0 : (_tableNode$attrs = tableNode.attrs) === null || _tableNode$attrs === void 0 ? void 0 : _tableNode$attrs.localId) !== null && _tableNode$attrs$loca !== void 0 ? _tableNode$attrs$loca : '';
|
|
49
52
|
useEffect(() => {
|
|
50
53
|
return monitorForElements({
|
|
@@ -128,10 +131,7 @@ const DragControlsComponent = ({
|
|
|
128
131
|
selectRows(selectedRowIndexes);
|
|
129
132
|
}
|
|
130
133
|
}, [rowIndex, selectRow, selectRows, selectedRowIndexes]);
|
|
131
|
-
const generateHandleByType = (type, appearance, gridRow, indexes
|
|
132
|
-
// Ignored via go/ees005
|
|
133
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
134
|
-
) => {
|
|
134
|
+
const generateHandleByType = (type, appearance, gridRow, indexes) => {
|
|
135
135
|
const isHover = type === 'hover';
|
|
136
136
|
const previewHeight = rowHeights.reduce((sum, v, i) => sum + v * (indexes.includes(i) ? 1 : 0), 0);
|
|
137
137
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -155,7 +155,23 @@ const DragControlsComponent = ({
|
|
|
155
155
|
pointerEvents: 'none'
|
|
156
156
|
},
|
|
157
157
|
"data-testid": `table-floating-row-${isHover ? rowIndex : selectedRowIndexes[0]}-drag-handle`
|
|
158
|
-
}, /*#__PURE__*/React.createElement(
|
|
158
|
+
}, fg('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/React.createElement(DragHandleWithSharedState, {
|
|
159
|
+
isDragMenuTarget: !isHover,
|
|
160
|
+
direction: "row",
|
|
161
|
+
tableLocalId: currentNodeLocalId,
|
|
162
|
+
indexes: indexes,
|
|
163
|
+
forceDefaultHandle: !isHover,
|
|
164
|
+
previewWidth: tableWidth,
|
|
165
|
+
previewHeight: previewHeight,
|
|
166
|
+
appearance: appearance,
|
|
167
|
+
hoveredCell: hoveredCell,
|
|
168
|
+
onClick: handleClick,
|
|
169
|
+
onMouseOver: handleMouseOver,
|
|
170
|
+
onMouseOut: handleMouseOut,
|
|
171
|
+
toggleDragMenu: toggleDragMenuHandler,
|
|
172
|
+
editorView: editorView,
|
|
173
|
+
api: api
|
|
174
|
+
}) : /*#__PURE__*/React.createElement(DragHandle, {
|
|
159
175
|
isDragMenuTarget: !isHover,
|
|
160
176
|
direction: "row",
|
|
161
177
|
tableLocalId: currentNodeLocalId,
|
|
@@ -259,4 +275,40 @@ const DragControlsComponent = ({
|
|
|
259
275
|
}))), rowHandles())
|
|
260
276
|
);
|
|
261
277
|
};
|
|
262
|
-
export const
|
|
278
|
+
export const DragControlsWithSelection = ({
|
|
279
|
+
editorView,
|
|
280
|
+
tableRef,
|
|
281
|
+
tableNode,
|
|
282
|
+
tableWidth,
|
|
283
|
+
tableActive,
|
|
284
|
+
hoveredCell,
|
|
285
|
+
isInDanger,
|
|
286
|
+
isTableHovered,
|
|
287
|
+
isResizing,
|
|
288
|
+
hoverRows,
|
|
289
|
+
selectRow,
|
|
290
|
+
selectRows,
|
|
291
|
+
updateCellHoverLocation,
|
|
292
|
+
api
|
|
293
|
+
}) => {
|
|
294
|
+
const {
|
|
295
|
+
selectionState
|
|
296
|
+
} = useSharedPluginState(api, ['selection']);
|
|
297
|
+
return /*#__PURE__*/React.createElement(DragControls, {
|
|
298
|
+
editorView: editorView,
|
|
299
|
+
tableRef: tableRef,
|
|
300
|
+
tableNode: tableNode,
|
|
301
|
+
tableWidth: tableWidth,
|
|
302
|
+
tableActive: tableActive,
|
|
303
|
+
hoveredCell: hoveredCell,
|
|
304
|
+
isInDanger: isInDanger,
|
|
305
|
+
isTableHovered: isTableHovered,
|
|
306
|
+
isResizing: isResizing,
|
|
307
|
+
hoverRows: hoverRows,
|
|
308
|
+
selectRow: selectRow,
|
|
309
|
+
selectRows: selectRows,
|
|
310
|
+
updateCellHoverLocation: updateCellHoverLocation,
|
|
311
|
+
api: api,
|
|
312
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
313
|
+
});
|
|
314
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
3
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
6
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../pm-plugins/commands';
|
|
7
7
|
import { isTableNested } from '../../pm-plugins/utils/nodes';
|
|
@@ -11,7 +11,8 @@ import { DragCornerControls, DragCornerControlsWithSelection } from './CornerCon
|
|
|
11
11
|
import { FloatingControlsWithSelection } from './FloatingControlsWithSelection';
|
|
12
12
|
import NumberColumn from './NumberColumn';
|
|
13
13
|
import { RowControls } from './RowControls/ClassicControls';
|
|
14
|
-
import { DragControls } from './RowControls/DragControls';
|
|
14
|
+
import { DragControls, DragControlsWithSelection } from './RowControls/DragControls';
|
|
15
|
+
// Row controls
|
|
15
16
|
export const TableFloatingControls = ({
|
|
16
17
|
editorView,
|
|
17
18
|
tableRef,
|
|
@@ -81,9 +82,6 @@ export const TableFloatingControls = ({
|
|
|
81
82
|
hoverCell(rowIndex, 0)(state, dispatch);
|
|
82
83
|
}
|
|
83
84
|
}, [editorView, tableActive]);
|
|
84
|
-
const {
|
|
85
|
-
featureFlagsState
|
|
86
|
-
} = useSharedPluginState(api, ['featureFlags']);
|
|
87
85
|
if (!tableRef) {
|
|
88
86
|
return null;
|
|
89
87
|
}
|
|
@@ -93,7 +91,7 @@ export const TableFloatingControls = ({
|
|
|
93
91
|
// Ignored via go/ees005
|
|
94
92
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
95
93
|
const isNested = tablePos !== undefined && isTableNested(editorView.state, tablePos);
|
|
96
|
-
const shouldShowCornerControls =
|
|
94
|
+
const shouldShowCornerControls = isNested && !editorExperiment('nested-dnd', true);
|
|
97
95
|
return (
|
|
98
96
|
/*#__PURE__*/
|
|
99
97
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -114,18 +112,36 @@ export const TableFloatingControls = ({
|
|
|
114
112
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
115
113
|
stickyTop: stickyTop,
|
|
116
114
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
117
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
115
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowCornerControls && /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
118
116
|
editorView: editorView,
|
|
119
117
|
tableRef: tableRef,
|
|
120
118
|
isInDanger: isInDanger,
|
|
121
119
|
isResizing: isResizing,
|
|
122
120
|
api: api
|
|
123
|
-
})
|
|
121
|
+
}), /*#__PURE__*/React.createElement(DragControlsWithSelection, {
|
|
122
|
+
tableRef: tableRef,
|
|
123
|
+
tableNode: tableNode,
|
|
124
|
+
hoveredCell: hoveredCell,
|
|
125
|
+
isTableHovered: isTableHovered,
|
|
126
|
+
editorView: editorView,
|
|
127
|
+
tableActive: tableActive,
|
|
128
|
+
isInDanger: isInDanger,
|
|
129
|
+
isResizing: isResizing
|
|
130
|
+
// Ignored via go/ees005
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
132
|
+
,
|
|
133
|
+
tableWidth: tableWrapperWidth,
|
|
134
|
+
hoverRows: _hoverRows,
|
|
135
|
+
selectRow: _selectRow,
|
|
136
|
+
selectRows: _selectRows,
|
|
137
|
+
updateCellHoverLocation: updateCellHoverLocation,
|
|
138
|
+
api: api
|
|
139
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowCornerControls && /*#__PURE__*/React.createElement(DragCornerControls, {
|
|
124
140
|
editorView: editorView,
|
|
125
141
|
tableRef: tableRef,
|
|
126
142
|
isInDanger: isInDanger,
|
|
127
143
|
isResizing: isResizing
|
|
128
|
-
})
|
|
144
|
+
}), /*#__PURE__*/React.createElement(DragControls, {
|
|
129
145
|
tableRef: tableRef,
|
|
130
146
|
tableNode: tableNode,
|
|
131
147
|
hoveredCell: hoveredCell,
|
|
@@ -142,7 +158,7 @@ export const TableFloatingControls = ({
|
|
|
142
158
|
selectRow: _selectRow,
|
|
143
159
|
selectRows: _selectRows,
|
|
144
160
|
updateCellHoverLocation: updateCellHoverLocation
|
|
145
|
-
})) :
|
|
161
|
+
}))) : fg('platform_editor_table_use_shared_state_hook_fg') ? /*#__PURE__*/React.createElement(FloatingControlsWithSelection, {
|
|
146
162
|
editorView: editorView,
|
|
147
163
|
tableRef: tableRef,
|
|
148
164
|
isInDanger: isInDanger,
|
|
@@ -384,10 +384,7 @@ export function handleTripleClick(view, pos) {
|
|
|
384
384
|
}
|
|
385
385
|
return false;
|
|
386
386
|
}
|
|
387
|
-
export const handleCut = (oldTr, oldState, newState, api, editorAnalyticsAPI, editorView, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false
|
|
388
|
-
// Ignored via go/ees005
|
|
389
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
390
|
-
) => {
|
|
387
|
+
export const handleCut = (oldTr, oldState, newState, api, editorAnalyticsAPI, editorView, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => {
|
|
391
388
|
const oldSelection = oldState.tr.selection;
|
|
392
389
|
let {
|
|
393
390
|
tr
|