@atlaskit/editor-plugin-table 7.2.2 → 7.3.0
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 +14 -0
- package/dist/cjs/commands/column-resize.js +115 -45
- package/dist/cjs/commands/go-to-next-cell.js +7 -11
- package/dist/cjs/commands/misc.js +3 -2
- package/dist/cjs/commands/selection.js +3 -3
- package/dist/cjs/event-handlers.js +38 -25
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -19
- package/dist/cjs/pm-plugins/keymap.js +1 -0
- package/dist/cjs/pm-plugins/main.js +43 -9
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +37 -7
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +20 -6
- package/dist/cjs/reducer.js +5 -2
- package/dist/cjs/utils/drag-menu.js +37 -23
- package/dist/cjs/utils/merged-cells.js +66 -1
- package/dist/es2019/commands/column-resize.js +100 -35
- package/dist/es2019/commands/go-to-next-cell.js +7 -9
- package/dist/es2019/commands/misc.js +3 -2
- package/dist/es2019/commands/selection.js +5 -5
- package/dist/es2019/event-handlers.js +17 -3
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
- package/dist/es2019/pm-plugins/keymap.js +3 -2
- package/dist/es2019/pm-plugins/main.js +41 -5
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +37 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +16 -1
- package/dist/es2019/reducer.js +5 -2
- package/dist/es2019/utils/drag-menu.js +38 -14
- package/dist/es2019/utils/merged-cells.js +73 -0
- package/dist/esm/commands/column-resize.js +105 -35
- package/dist/esm/commands/go-to-next-cell.js +7 -11
- package/dist/esm/commands/misc.js +3 -2
- package/dist/esm/commands/selection.js +5 -5
- package/dist/esm/event-handlers.js +38 -25
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
- package/dist/esm/pm-plugins/keymap.js +3 -2
- package/dist/esm/pm-plugins/main.js +38 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +34 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +15 -1
- package/dist/esm/reducer.js +5 -2
- package/dist/esm/utils/drag-menu.js +36 -22
- package/dist/esm/utils/merged-cells.js +65 -0
- package/dist/types/commands/column-resize.d.ts +2 -0
- package/dist/types/commands/misc.d.ts +1 -1
- package/dist/types/types.d.ts +16 -0
- package/dist/types/utils/drag-menu.d.ts +4 -1
- package/dist/types/utils/merged-cells.d.ts +2 -0
- package/dist/types-ts4.5/commands/column-resize.d.ts +2 -0
- package/dist/types-ts4.5/commands/misc.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +16 -0
- package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -1
- package/dist/types-ts4.5/utils/merged-cells.d.ts +2 -0
- package/package.json +10 -17
- package/src/commands/column-resize.ts +155 -40
- package/src/commands/go-to-next-cell.ts +6 -15
- package/src/commands/misc.ts +2 -0
- package/src/commands/selection.ts +5 -5
- package/src/event-handlers.ts +21 -4
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -32
- package/src/pm-plugins/keymap.ts +3 -0
- package/src/pm-plugins/main.ts +47 -2
- package/src/pm-plugins/table-resizing/event-handlers.ts +33 -5
- package/src/pm-plugins/table-resizing/plugin.ts +18 -1
- package/src/reducer.ts +5 -2
- package/src/types.ts +16 -0
- package/src/utils/drag-menu.ts +94 -20
- package/src/utils/merged-cells.ts +78 -0
- package/tsconfig.dev.json +0 -69
- package/tsconfig.json +2 -877
- package/examples/99-testing.tsx +0 -140
- package/examples/config.jsonc +0 -14
- package/src/__tests__/unit/analytics.ts +0 -888
- package/src/__tests__/unit/collab.ts +0 -93
- package/src/__tests__/unit/commands/go-to-next-cell.ts +0 -173
- package/src/__tests__/unit/commands/insert.ts +0 -137
- package/src/__tests__/unit/commands/misc.ts +0 -185
- package/src/__tests__/unit/commands/sort.ts +0 -128
- package/src/__tests__/unit/commands.ts +0 -745
- package/src/__tests__/unit/copy-button.ts +0 -22
- package/src/__tests__/unit/copy-paste.ts +0 -677
- package/src/__tests__/unit/event-handlers/index.ts +0 -125
- package/src/__tests__/unit/event-handlers.ts +0 -296
- package/src/__tests__/unit/fix-tables.ts +0 -164
- package/src/__tests__/unit/get-toolbar-config.ts +0 -127
- package/src/__tests__/unit/handlers.ts +0 -98
- package/src/__tests__/unit/hover-selection.ts +0 -230
- package/src/__tests__/unit/index-with-fake-timers.ts +0 -111
- package/src/__tests__/unit/index.ts +0 -912
- package/src/__tests__/unit/layout.ts +0 -146
- package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +0 -162
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +0 -280
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +0 -525
- package/src/__tests__/unit/nodeviews/cell.ts +0 -132
- package/src/__tests__/unit/nodeviews/table.ts +0 -129
- package/src/__tests__/unit/pm-plugins/analytics.ts +0 -327
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +0 -94
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +0 -176
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +0 -211
- package/src/__tests__/unit/pm-plugins/main.ts +0 -214
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -101
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +0 -562
- package/src/__tests__/unit/pm-plugins/table-local-id.ts +0 -507
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +0 -269
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +0 -192
- package/src/__tests__/unit/pm-plugins/table-resizing/utils/resize-state.ts +0 -33
- package/src/__tests__/unit/pm-plugins/table-width.ts +0 -292
- package/src/__tests__/unit/sort-column.ts +0 -399
- package/src/__tests__/unit/toolbar.ts +0 -512
- package/src/__tests__/unit/transforms/delete-columns.ts +0 -597
- package/src/__tests__/unit/transforms/delete-rows.ts +0 -620
- package/src/__tests__/unit/transforms/merging.ts +0 -392
- package/src/__tests__/unit/ui/ContextualMenu.tsx +0 -71
- package/src/__tests__/unit/ui/CornerControls.tsx +0 -99
- package/src/__tests__/unit/ui/DeleteButton.tsx +0 -38
- package/src/__tests__/unit/ui/FixedButton.tsx +0 -217
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +0 -123
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +0 -68
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +0 -178
- package/src/__tests__/unit/ui/FloatingDragMenu.tsx +0 -511
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +0 -322
- package/src/__tests__/unit/ui/NumberColumn.tsx +0 -146
- package/src/__tests__/unit/ui/RowControls.tsx +0 -294
- package/src/__tests__/unit/ui/RowDragControls.tsx +0 -129
- package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +0 -189
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +0 -118
- package/src/__tests__/unit/undo-redo.ts +0 -220
- package/src/__tests__/unit/utils/analytics.ts +0 -98
- package/src/__tests__/unit/utils/collapse.ts +0 -57
- package/src/__tests__/unit/utils/column-controls.ts +0 -205
- package/src/__tests__/unit/utils/dom.ts +0 -180
- package/src/__tests__/unit/utils/merged-cells.ts +0 -156
- package/src/__tests__/unit/utils/nodes.ts +0 -79
- package/src/__tests__/unit/utils/row-controls.ts +0 -195
- package/src/__tests__/unit/utils/table.ts +0 -96
- package/src/__tests__/unit/utils.ts +0 -670
- package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +0 -5228
- package/src/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -20272
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +0 -3
- package/src/__tests__/visual-regression/cell-options-menu.ts +0 -101
- package/src/__tests__/visual-regression/copy-button.ts +0 -181
- package/src/__tests__/visual-regression/index.ts +0 -62
- package/src/__tests__/visual-regression/sticky-header.ts +0 -61
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#63203](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63203) [`2bf8f7ffabfd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2bf8f7ffabfd) - ECA11Y-194: Stop keyboard column resizing when table updated or lost focus
|
|
8
|
+
|
|
9
|
+
## 7.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572) [`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) - Upgrading @atlaskit/editor-prosemirror dependency
|
|
14
|
+
- [#70707](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70707) [`01c10b920070`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01c10b920070) - [ux] Move options in drag menu now have disabled state when target has merged cells.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 7.2.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -3,30 +3,66 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.initiateKeyboardColumnResizing = exports.changeColumnWidthByStep = exports.activateNextResizeArea = void 0;
|
|
6
|
+
exports.stopKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = exports.changeColumnWidthByStep = exports.activateNextResizeArea = void 0;
|
|
7
7
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
8
8
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
9
9
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
-
var
|
|
12
|
-
var _utils2 = require("../pm-plugins/
|
|
11
|
+
var _plugin = require("../pm-plugins/decorations/plugin");
|
|
12
|
+
var _utils2 = require("../pm-plugins/decorations/utils");
|
|
13
|
+
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
14
|
+
var _pluginFactory2 = require("../pm-plugins/table-resizing/plugin-factory");
|
|
15
|
+
var _pluginKey = require("../pm-plugins/table-resizing/plugin-key");
|
|
16
|
+
var _utils3 = require("../pm-plugins/table-resizing/utils");
|
|
13
17
|
var _transforms = require("../transforms");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
18
|
+
var _types = require("../types");
|
|
19
|
+
var _utils4 = require("../utils");
|
|
20
|
+
var getTablePluginCommand = function getTablePluginCommand(actionPayload, originalTr) {
|
|
21
|
+
return (0, _pluginFactory.createCommand)(function () {
|
|
22
|
+
return actionPayload;
|
|
23
|
+
}, function (tr) {
|
|
24
|
+
return (originalTr || tr).setMeta('addToHistory', false);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
16
27
|
var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos) {
|
|
17
28
|
return function (state, dispatch) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
var customTr = state.tr;
|
|
30
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
31
|
+
allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
|
|
32
|
+
getIntl = _getPluginState.getIntl;
|
|
33
|
+
var fakeDispatch = function fakeDispatch(tr) {
|
|
34
|
+
customTr = tr;
|
|
35
|
+
};
|
|
36
|
+
if (!allowColumnResizing) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
var decorationsWithWidget = (0, _utils2.buildColumnResizingDecorations)(rowIndex, columnIndex, true, getIntl)({
|
|
40
|
+
tr: customTr,
|
|
41
|
+
decorationSet: (0, _plugin.getDecorations)(state)
|
|
42
|
+
});
|
|
43
|
+
var decorationsWithWidgetAndHandle = (0, _utils4.updateDecorations)(customTr.doc, decorationsWithWidget, (0, _utils4.createColumnLineResize)(state.selection, {
|
|
22
44
|
right: columnIndex
|
|
23
|
-
})
|
|
24
|
-
(
|
|
45
|
+
}), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
|
|
46
|
+
getTablePluginCommand({
|
|
47
|
+
type: 'START_KEYBOARD_COLUMN_RESIZE',
|
|
48
|
+
data: {
|
|
49
|
+
resizeHandleRowIndex: rowIndex,
|
|
50
|
+
resizeHandleColumnIndex: columnIndex,
|
|
51
|
+
resizeHandleIncludeTooltip: true,
|
|
52
|
+
isKeyboardResize: true,
|
|
53
|
+
decorationSet: decorationsWithWidgetAndHandle
|
|
54
|
+
}
|
|
55
|
+
}, customTr)(state, fakeDispatch);
|
|
56
|
+
customTr.setMeta(_pluginKey.pluginKey, {
|
|
25
57
|
type: 'SET_RESIZE_HANDLE_POSITION',
|
|
26
58
|
data: {
|
|
27
59
|
resizeHandlePos: nextResizeHandlePos
|
|
28
60
|
}
|
|
29
|
-
})
|
|
61
|
+
});
|
|
62
|
+
if (dispatch) {
|
|
63
|
+
dispatch(customTr);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
30
66
|
return false;
|
|
31
67
|
};
|
|
32
68
|
};
|
|
@@ -38,32 +74,19 @@ var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = fu
|
|
|
38
74
|
var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
|
|
39
75
|
var cell = (0, _utils.findCellClosestToPos)(selection.$from);
|
|
40
76
|
if (selectionRect && cell && view) {
|
|
41
|
-
|
|
42
|
-
var width = (0, _utils2.currentColWidth)(view, cell.pos, cellAttrs);
|
|
43
|
-
updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
44
|
-
(0, _pluginFactory.createCommand)({
|
|
45
|
-
type: 'SET_DRAGGING',
|
|
46
|
-
data: {
|
|
47
|
-
dragging: {
|
|
48
|
-
startX: 0,
|
|
49
|
-
startWidth: width
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
})(state, dispatch);
|
|
53
|
-
return true;
|
|
77
|
+
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
54
78
|
}
|
|
55
79
|
return false;
|
|
56
80
|
};
|
|
57
81
|
var activateNextResizeArea = exports.activateNextResizeArea = function activateNextResizeArea(direction) {
|
|
58
|
-
return function (state, dispatch) {
|
|
82
|
+
return function (state, dispatch, view) {
|
|
59
83
|
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
60
84
|
return false;
|
|
61
85
|
}
|
|
62
|
-
var _ref = (0,
|
|
63
|
-
resizeHandlePos = _ref.resizeHandlePos
|
|
64
|
-
dragging = _ref.dragging;
|
|
86
|
+
var _ref = (0, _pluginFactory2.getPluginState)(state) || {},
|
|
87
|
+
resizeHandlePos = _ref.resizeHandlePos;
|
|
65
88
|
// If No resizing has initiated, skip to regular handler
|
|
66
|
-
if (!resizeHandlePos
|
|
89
|
+
if (!resizeHandlePos) {
|
|
67
90
|
return false;
|
|
68
91
|
}
|
|
69
92
|
var selection = state.selection;
|
|
@@ -88,31 +111,35 @@ var activateNextResizeArea = exports.activateNextResizeArea = function activateN
|
|
|
88
111
|
// we are somewhere in between the side columns of the table
|
|
89
112
|
var offset = $nextCell.pos - $nextCell.start(-1);
|
|
90
113
|
var rectForNextCell = tableMap.findCell(offset);
|
|
91
|
-
updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch);
|
|
114
|
+
return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch, view);
|
|
92
115
|
} else {
|
|
93
116
|
// current position is in the one of the side columns of the table(left or right)
|
|
94
117
|
if (currentCellRect.left === 0) {
|
|
95
118
|
var lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
|
|
96
119
|
var $lastCell = state.doc.resolve(lastCellInCurrentRow);
|
|
97
|
-
updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch);
|
|
120
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch, view);
|
|
98
121
|
} else if (tableMap.width === currentCellRect.right) {
|
|
99
122
|
var firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
|
|
100
123
|
var _$nextCell = state.doc.resolve(firsCellInCurrentRow);
|
|
101
|
-
updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
|
|
124
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
|
|
102
125
|
}
|
|
103
126
|
}
|
|
104
|
-
return
|
|
127
|
+
return false;
|
|
105
128
|
};
|
|
106
129
|
};
|
|
107
130
|
var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeColumnWidthByStep(stepSize, getEditorContainerWidth) {
|
|
108
131
|
return function (state, dispatch, view) {
|
|
132
|
+
var customTr = state.tr;
|
|
133
|
+
var fakeDispatch = function fakeDispatch(tr) {
|
|
134
|
+
customTr = tr;
|
|
135
|
+
};
|
|
109
136
|
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
110
137
|
return false;
|
|
111
138
|
}
|
|
112
|
-
var _getTableResizingPlug = (0,
|
|
113
|
-
resizeHandlePos = _getTableResizingPlug.resizeHandlePos
|
|
114
|
-
|
|
115
|
-
if (!view || !resizeHandlePos || !
|
|
139
|
+
var _getTableResizingPlug = (0, _pluginFactory2.getPluginState)(state),
|
|
140
|
+
resizeHandlePos = _getTableResizingPlug.resizeHandlePos;
|
|
141
|
+
var cell = (0, _utils.findCellClosestToPos)(state.selection.$from);
|
|
142
|
+
if (!view || !resizeHandlePos || !cell) {
|
|
116
143
|
return false;
|
|
117
144
|
}
|
|
118
145
|
var $cell = state.doc.resolve(resizeHandlePos);
|
|
@@ -125,14 +152,25 @@ var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeC
|
|
|
125
152
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
126
153
|
dom = dom.closest('table');
|
|
127
154
|
}
|
|
128
|
-
var
|
|
155
|
+
var cellAttrs = cell === null || cell === void 0 ? void 0 : cell.node.attrs;
|
|
156
|
+
var width = (0, _utils3.currentColWidth)(view, cell === null || cell === void 0 ? void 0 : cell.pos, cellAttrs);
|
|
157
|
+
(0, _pluginFactory2.createCommand)({
|
|
158
|
+
type: 'SET_DRAGGING',
|
|
159
|
+
data: {
|
|
160
|
+
dragging: {
|
|
161
|
+
startX: 0,
|
|
162
|
+
startWidth: width
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
})(state, fakeDispatch);
|
|
166
|
+
var maxSize = (0, _utils3.getTableMaxWidth)({
|
|
129
167
|
table: originalTable,
|
|
130
168
|
tableStart: tableStartPosition,
|
|
131
169
|
state: state,
|
|
132
170
|
layout: originalTable.attrs.layout,
|
|
133
171
|
getEditorContainerWidth: getEditorContainerWidth
|
|
134
172
|
});
|
|
135
|
-
var initialResizeState = (0,
|
|
173
|
+
var initialResizeState = (0, _utils3.getResizeState)({
|
|
136
174
|
minWidth: _styles.tableCellMinWidth,
|
|
137
175
|
maxSize: maxSize,
|
|
138
176
|
table: originalTable,
|
|
@@ -140,16 +178,48 @@ var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeC
|
|
|
140
178
|
start: tableStartPosition,
|
|
141
179
|
domAtPos: domAtPos
|
|
142
180
|
});
|
|
143
|
-
(0,
|
|
181
|
+
(0, _utils3.updateControls)()(state);
|
|
144
182
|
var selectionRect = (0, _utils.getSelectionRect)(state.selection);
|
|
145
|
-
var selectedColumns = selectionRect ? (0,
|
|
183
|
+
var selectedColumns = selectionRect ? (0, _utils4.getSelectedColumnIndexes)(selectionRect) : [];
|
|
146
184
|
// only selected (or selected - 1) columns should be distributed
|
|
147
185
|
var resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
|
|
148
|
-
var newResizeState = (0,
|
|
149
|
-
|
|
186
|
+
var newResizeState = (0, _utils3.resizeColumn)(initialResizeState, colIndex, stepSize, dom, resizingSelectedColumns ? selectedColumns : undefined);
|
|
187
|
+
customTr = (0, _transforms.updateColumnWidths)(newResizeState, originalTable, tableStartPosition)(customTr);
|
|
150
188
|
if (dispatch) {
|
|
151
|
-
dispatch(
|
|
189
|
+
dispatch(customTr);
|
|
152
190
|
}
|
|
153
191
|
return true;
|
|
154
192
|
};
|
|
193
|
+
};
|
|
194
|
+
var stopKeyboardColumnResizing = exports.stopKeyboardColumnResizing = function stopKeyboardColumnResizing(originalTr) {
|
|
195
|
+
return function (state, dispatch) {
|
|
196
|
+
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
var customTr = originalTr || state.tr;
|
|
200
|
+
var fakeDispatch = function fakeDispatch(tr) {
|
|
201
|
+
customTr = tr;
|
|
202
|
+
};
|
|
203
|
+
var decorationWithoutWidget = (0, _utils2.clearColumnResizingDecorations)()({
|
|
204
|
+
tr: customTr,
|
|
205
|
+
decorationSet: (0, _plugin.getDecorations)(state)
|
|
206
|
+
});
|
|
207
|
+
var decorationWithoutWidgetAndHandle = (0, _utils4.updateDecorations)(customTr.doc, decorationWithoutWidget, [], _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
|
|
208
|
+
getTablePluginCommand({
|
|
209
|
+
type: 'STOP_KEYBOARD_COLUMN_RESIZE',
|
|
210
|
+
data: {
|
|
211
|
+
decorationSet: decorationWithoutWidgetAndHandle
|
|
212
|
+
}
|
|
213
|
+
}, customTr)(state, fakeDispatch);
|
|
214
|
+
(0, _pluginFactory2.createCommand)({
|
|
215
|
+
type: 'STOP_RESIZING'
|
|
216
|
+
}, function () {
|
|
217
|
+
return customTr.setMeta('scrollIntoView', false);
|
|
218
|
+
})(state, fakeDispatch);
|
|
219
|
+
if (dispatch) {
|
|
220
|
+
dispatch(customTr);
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
224
|
+
};
|
|
155
225
|
};
|
|
@@ -10,29 +10,25 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
|
10
10
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _commandsWithAnalytics = require("../commands-with-analytics");
|
|
13
|
-
var _pluginFactory = require("../pm-plugins/
|
|
14
|
-
var
|
|
13
|
+
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
14
|
+
var _columnResize = require("./column-resize");
|
|
15
15
|
// #region Constants
|
|
16
16
|
|
|
17
17
|
var TAB_FORWARD_DIRECTION = 1;
|
|
18
18
|
var TAB_BACKWARD_DIRECTION = -1;
|
|
19
19
|
var goToNextCell = exports.goToNextCell = function goToNextCell(editorAnalyticsAPI) {
|
|
20
20
|
return function (direction) {
|
|
21
|
-
return function (state, dispatch) {
|
|
21
|
+
return function (state, dispatch, view) {
|
|
22
22
|
var table = (0, _utils2.findTable)(state.selection);
|
|
23
23
|
if (!table) {
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
26
26
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
27
|
-
var
|
|
28
|
-
var isColumnResizing =
|
|
27
|
+
var _getPluginState;
|
|
28
|
+
var isColumnResizing = (_getPluginState = (0, _pluginFactory.getPluginState)(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
|
|
29
29
|
if (isColumnResizing) {
|
|
30
|
-
(0,
|
|
31
|
-
|
|
32
|
-
}, function (originalTr) {
|
|
33
|
-
return (state.tr || originalTr).setMeta('scrollIntoView', false);
|
|
34
|
-
})(state, dispatch);
|
|
35
|
-
(0, _hover.hideResizeHandleLine)()(state, dispatch);
|
|
30
|
+
(0, _columnResize.stopKeyboardColumnResizing)()(state, dispatch, view);
|
|
31
|
+
return true;
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
34
|
var map = _tableMap.TableMap.get(table.node);
|
|
@@ -454,7 +454,7 @@ var hideInsertColumnOrRowButton = exports.hideInsertColumnOrRowButton = function
|
|
|
454
454
|
return tr.setMeta('addToHistory', false);
|
|
455
455
|
});
|
|
456
456
|
};
|
|
457
|
-
var addResizeHandleDecorations = exports.addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
|
|
457
|
+
var addResizeHandleDecorations = exports.addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, isKeyboardResize) {
|
|
458
458
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
459
459
|
var tableNode = (0, _utils2.findTable)(state.selection);
|
|
460
460
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -472,7 +472,8 @@ var addResizeHandleDecorations = exports.addResizeHandleDecorations = function a
|
|
|
472
472
|
}),
|
|
473
473
|
resizeHandleRowIndex: rowIndex,
|
|
474
474
|
resizeHandleColumnIndex: columnIndex,
|
|
475
|
-
resizeHandleIncludeTooltip: includeTooltip
|
|
475
|
+
resizeHandleIncludeTooltip: includeTooltip,
|
|
476
|
+
isKeyboardResize: isKeyboardResize || false
|
|
476
477
|
}
|
|
477
478
|
};
|
|
478
479
|
}, function (tr) {
|
|
@@ -11,7 +11,7 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
|
11
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
13
|
var _misc = require("../commands/misc");
|
|
14
|
-
var _pluginFactory = require("../pm-plugins/
|
|
14
|
+
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
15
15
|
var _toolbar = require("../toolbar");
|
|
16
16
|
var TableSelectionDirection = exports.TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
|
|
17
17
|
TableSelectionDirection["TopToBottom"] = "TopToBottom";
|
|
@@ -203,7 +203,7 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
|
|
|
203
203
|
var isColumnResizing = false;
|
|
204
204
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
205
205
|
var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
|
|
206
|
-
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.
|
|
206
|
+
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
|
|
207
207
|
}
|
|
208
208
|
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
|
|
209
209
|
// + 3 for: row, cell & paragraph nodes
|
|
@@ -237,7 +237,7 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
|
|
|
237
237
|
var isColumnResizing = false;
|
|
238
238
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
239
239
|
var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
|
|
240
|
-
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.
|
|
240
|
+
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
|
|
241
241
|
}
|
|
242
242
|
if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
|
|
243
243
|
// + 3 for: row, cell & paragraph nodes
|
|
@@ -14,6 +14,7 @@ var _state5 = require("@atlaskit/editor-prosemirror/state");
|
|
|
14
14
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
15
15
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
16
16
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
18
|
var _commands = require("./commands");
|
|
18
19
|
var _pluginFactory = require("./pm-plugins/drag-and-drop/plugin-factory");
|
|
19
20
|
var _pluginFactory2 = require("./pm-plugins/plugin-factory");
|
|
@@ -172,15 +173,25 @@ var handleMouseOut = exports.handleMouseOut = function handleMouseOut(view, mous
|
|
|
172
173
|
if ((0, _utils3.isResizeHandleDecoration)(target) && !(0, _utils3.isResizeHandleDecoration)(relatedTarget)) {
|
|
173
174
|
var _state2 = view.state,
|
|
174
175
|
_dispatch3 = view.dispatch;
|
|
175
|
-
|
|
176
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
177
|
+
var _getPluginState2 = (0, _pluginFactory2.getPluginState)(_state2),
|
|
178
|
+
isKeyboardResize = _getPluginState2.isKeyboardResize;
|
|
179
|
+
if (isKeyboardResize) {
|
|
180
|
+
// no need to hide decoration if column resizing started by keyboard
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
return (0, _commands.hideResizeHandleLine)()(_state2, _dispatch3);
|
|
184
|
+
} else {
|
|
185
|
+
return (0, _commands.hideResizeHandleLine)()(_state2, _dispatch3);
|
|
186
|
+
}
|
|
176
187
|
}
|
|
177
188
|
return false;
|
|
178
189
|
};
|
|
179
190
|
var handleMouseEnter = exports.handleMouseEnter = function handleMouseEnter(view, mouseEvent) {
|
|
180
191
|
var state = view.state,
|
|
181
192
|
dispatch = view.dispatch;
|
|
182
|
-
var
|
|
183
|
-
isTableHovered =
|
|
193
|
+
var _getPluginState3 = (0, _pluginFactory2.getPluginState)(state),
|
|
194
|
+
isTableHovered = _getPluginState3.isTableHovered;
|
|
184
195
|
if (!isTableHovered) {
|
|
185
196
|
return (0, _commands.setTableHovered)(true)(state, dispatch);
|
|
186
197
|
}
|
|
@@ -192,11 +203,11 @@ var handleMouseLeave = exports.handleMouseLeave = function handleMouseLeave(view
|
|
|
192
203
|
}
|
|
193
204
|
var state = view.state,
|
|
194
205
|
dispatch = view.dispatch;
|
|
195
|
-
var
|
|
196
|
-
insertColumnButtonIndex =
|
|
197
|
-
insertRowButtonIndex =
|
|
198
|
-
isDragAndDropEnabled =
|
|
199
|
-
isTableHovered =
|
|
206
|
+
var _getPluginState4 = (0, _pluginFactory2.getPluginState)(state),
|
|
207
|
+
insertColumnButtonIndex = _getPluginState4.insertColumnButtonIndex,
|
|
208
|
+
insertRowButtonIndex = _getPluginState4.insertRowButtonIndex,
|
|
209
|
+
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled,
|
|
210
|
+
isTableHovered = _getPluginState4.isTableHovered;
|
|
200
211
|
if (isTableHovered) {
|
|
201
212
|
if (isDragAndDropEnabled) {
|
|
202
213
|
var _getDragDropPluginSta = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -229,9 +240,9 @@ var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, e
|
|
|
229
240
|
if ((0, _utils3.isColumnControlsDecorations)(element) || (0, _utils3.isDragColumnFloatingInsertDot)(element)) {
|
|
230
241
|
var state = view.state,
|
|
231
242
|
dispatch = view.dispatch;
|
|
232
|
-
var
|
|
233
|
-
insertColumnButtonIndex =
|
|
234
|
-
isDragAndDropEnabled =
|
|
243
|
+
var _getPluginState5 = (0, _pluginFactory2.getPluginState)(state),
|
|
244
|
+
insertColumnButtonIndex = _getPluginState5.insertColumnButtonIndex,
|
|
245
|
+
isDragAndDropEnabled = _getPluginState5.isDragAndDropEnabled;
|
|
235
246
|
var _getColumnOrRowIndex9 = (0, _utils3.getColumnOrRowIndex)(element),
|
|
236
247
|
_getColumnOrRowIndex10 = (0, _slicedToArray2.default)(_getColumnOrRowIndex9, 2),
|
|
237
248
|
startIndex = _getColumnOrRowIndex10[0],
|
|
@@ -244,8 +255,8 @@ var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, e
|
|
|
244
255
|
if ((0, _utils3.isRowControlsButton)(element) || (0, _utils3.isDragRowFloatingInsertDot)(element)) {
|
|
245
256
|
var _state3 = view.state,
|
|
246
257
|
_dispatch4 = view.dispatch;
|
|
247
|
-
var
|
|
248
|
-
insertRowButtonIndex =
|
|
258
|
+
var _getPluginState6 = (0, _pluginFactory2.getPluginState)(_state3),
|
|
259
|
+
insertRowButtonIndex = _getPluginState6.insertRowButtonIndex;
|
|
249
260
|
var _getColumnOrRowIndex11 = (0, _utils3.getColumnOrRowIndex)(element),
|
|
250
261
|
_getColumnOrRowIndex12 = (0, _slicedToArray2.default)(_getColumnOrRowIndex11, 2),
|
|
251
262
|
_startIndex3 = _getColumnOrRowIndex12[0],
|
|
@@ -260,19 +271,21 @@ var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, e
|
|
|
260
271
|
if (_positionColumn !== null) {
|
|
261
272
|
var _state4 = view.state,
|
|
262
273
|
_dispatch5 = view.dispatch;
|
|
263
|
-
var
|
|
264
|
-
resizeHandleColumnIndex =
|
|
265
|
-
resizeHandleRowIndex =
|
|
274
|
+
var _getPluginState7 = (0, _pluginFactory2.getPluginState)(_state4),
|
|
275
|
+
resizeHandleColumnIndex = _getPluginState7.resizeHandleColumnIndex,
|
|
276
|
+
resizeHandleRowIndex = _getPluginState7.resizeHandleRowIndex;
|
|
277
|
+
var isKeyboardResize = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz') ? (0, _pluginFactory2.getPluginState)(_state4).isKeyboardResize : false;
|
|
266
278
|
var tableCell = (0, _utils.closestElement)(element, 'td, th');
|
|
267
279
|
var cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
268
280
|
var rect = (0, _utils2.findCellRectClosestToPos)(_state4.doc.resolve(cellStartPosition));
|
|
269
281
|
if (rect) {
|
|
270
282
|
var columnEndIndexTarget = _positionColumn === 'left' ? rect.left : rect.right;
|
|
271
283
|
var rowIndexTarget = rect.top;
|
|
272
|
-
if (columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !(0, _utils3.hasResizeHandler)({
|
|
284
|
+
if ((columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !(0, _utils3.hasResizeHandler)({
|
|
273
285
|
target: element,
|
|
274
286
|
columnEndIndexTarget: columnEndIndexTarget
|
|
275
|
-
}))
|
|
287
|
+
})) && !isKeyboardResize // if initiated by keyboard don't need to react on hover for other resize sliders
|
|
288
|
+
) {
|
|
276
289
|
return (0, _commands.addResizeHandleDecorations)(rowIndexTarget, columnEndIndexTarget, true)(_state4, _dispatch5);
|
|
277
290
|
}
|
|
278
291
|
}
|
|
@@ -337,8 +350,8 @@ var handleCut = exports.handleCut = function handleCut(oldTr, oldState, newState
|
|
|
337
350
|
if (isTableSelected) {
|
|
338
351
|
tr = (0, _utils2.removeTable)(tr);
|
|
339
352
|
} else if (tr.selection.isRowSelection()) {
|
|
340
|
-
var
|
|
341
|
-
isHeaderRowRequired =
|
|
353
|
+
var _getPluginState8 = (0, _pluginFactory2.getPluginState)(newState),
|
|
354
|
+
isHeaderRowRequired = _getPluginState8.pluginConfig.isHeaderRowRequired;
|
|
342
355
|
tr = (0, _transforms.deleteRows)(rect, isHeaderRowRequired)(tr);
|
|
343
356
|
} else if (tr.selection.isColSelection()) {
|
|
344
357
|
tr = (0, _transforms.deleteColumns)(rect, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(oldState), editorView)(tr);
|
|
@@ -350,8 +363,8 @@ var handleCut = exports.handleCut = function handleCut(oldTr, oldState, newState
|
|
|
350
363
|
return tr;
|
|
351
364
|
};
|
|
352
365
|
var isTableInFocus = exports.isTableInFocus = function isTableInFocus(view) {
|
|
353
|
-
var
|
|
354
|
-
return !!((
|
|
366
|
+
var _getPluginState9, _getResizePluginState;
|
|
367
|
+
return !!((_getPluginState9 = (0, _pluginFactory2.getPluginState)(view.state)) !== null && _getPluginState9 !== void 0 && _getPluginState9.tableNode) && !((_getResizePluginState = (0, _pluginFactory3.getPluginState)(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
|
|
355
368
|
};
|
|
356
369
|
var whenTableInFocus = exports.whenTableInFocus = function whenTableInFocus(eventHandler, elementContentRects) {
|
|
357
370
|
return function (view, mouseEvent) {
|
|
@@ -365,9 +378,9 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
365
378
|
var _tableElement$dataset;
|
|
366
379
|
var target = mouseEvent.target;
|
|
367
380
|
var maybeTableCell = (0, _utils.isElementInTableCell)(target);
|
|
368
|
-
var
|
|
369
|
-
tableNode =
|
|
370
|
-
tableRef =
|
|
381
|
+
var _getPluginState10 = (0, _pluginFactory2.getPluginState)(view.state),
|
|
382
|
+
tableNode = _getPluginState10.tableNode,
|
|
383
|
+
tableRef = _getPluginState10.tableRef;
|
|
371
384
|
var tableElement = (0, _utils.closestElement)(target, 'table');
|
|
372
385
|
|
|
373
386
|
// hover will only trigger if target localId is the same with selected localId
|
|
@@ -11,6 +11,7 @@ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
|
11
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
12
|
var _utils2 = require("../../utils");
|
|
13
13
|
var _analytics2 = require("../../utils/analytics");
|
|
14
|
+
var _dragMenu = require("../../utils/drag-menu");
|
|
14
15
|
var _commands = require("./commands");
|
|
15
16
|
var clearDropTargetWithAnalytics = exports.clearDropTargetWithAnalytics = function clearDropTargetWithAnalytics(editorAnalyticsAPI) {
|
|
16
17
|
return function (inputMethod, sourceType, sourceIndexes, status, tr) {
|
|
@@ -91,30 +92,13 @@ var moveSourceWithAnalyticsViaShortcut = exports.moveSourceWithAnalyticsViaShort
|
|
|
91
92
|
if (selectedIndexes.length === 0) {
|
|
92
93
|
return false;
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
-
// const sourceIndex = selectedIndexes[0];
|
|
96
|
-
// we can move only by one row/column
|
|
97
|
-
// 'direction' can only be 1 (for right or down) or -1 (for left or up)
|
|
98
|
-
var targetIndex = Math[direction < 0 ? 'min' : 'max'].apply(Math, (0, _toConsumableArray2.default)(selectedIndexes)) + direction;
|
|
99
|
-
|
|
100
|
-
// We can move only if targetIndex is a positive number and is not higher than the total number of rows/columns.
|
|
101
95
|
var _getSelectedTableInfo3 = (0, _utils2.getSelectedTableInfo)(selection),
|
|
102
96
|
totalRowCount = _getSelectedTableInfo3.totalRowCount,
|
|
103
97
|
totalColumnCount = _getSelectedTableInfo3.totalColumnCount;
|
|
104
|
-
|
|
105
|
-
if (!isValidTargetIndex) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// We can move only if there are no merged cells in the source or target row/column
|
|
110
|
-
var hasMergedCellsInSource = isRow ? (0, _utils2.hasMergedCellsInRow)(selectedIndexes)(selection) : (0, _utils2.hasMergedCellsInColumn)(selectedIndexes)(selection);
|
|
111
|
-
if (hasMergedCellsInSource) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
var hasMergedCellsInTarget = isRow ? (0, _utils2.hasMergedCellsInRow)(targetIndex)(selection) : (0, _utils2.hasMergedCellsInColumn)(targetIndex)(selection);
|
|
115
|
-
if (hasMergedCellsInTarget) {
|
|
98
|
+
if (!(0, _dragMenu.canMove)(sourceType, direction, isRow ? totalRowCount : totalColumnCount, selection, selectionRect)) {
|
|
116
99
|
return false;
|
|
117
100
|
}
|
|
101
|
+
var targetIndex = (0, _dragMenu.getTargetIndex)(selectedIndexes, direction);
|
|
118
102
|
return moveSourceWithAnalytics(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
|
|
119
103
|
};
|
|
120
104
|
};
|
|
@@ -57,6 +57,7 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
|
|
|
57
57
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _columnResize.activateNextResizeArea)(-1), list);
|
|
58
58
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.decreaseMediaSize.common, (0, _columnResize.changeColumnWidthByStep)(-10, getEditorContainerWidth), list);
|
|
59
59
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.increaseMediaSize.common, (0, _columnResize.changeColumnWidthByStep)(10, getEditorContainerWidth), list);
|
|
60
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, (0, _columnResize.stopKeyboardColumnResizing)(), list);
|
|
60
61
|
}
|
|
61
62
|
return (0, _keymap.keymap)(list);
|
|
62
63
|
}
|