@atlaskit/editor-plugin-table 17.3.7 → 17.3.9
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/pm-plugins/keymap.js +11 -5
- package/dist/cjs/pm-plugins/utils/drag-menu.js +14 -4
- package/dist/es2019/pm-plugins/keymap.js +12 -6
- package/dist/es2019/pm-plugins/utils/drag-menu.js +15 -5
- package/dist/esm/pm-plugins/keymap.js +12 -6
- package/dist/esm/pm-plugins/utils/drag-menu.js +15 -5
- package/dist/types/pm-plugins/commands/toggle.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/toggle.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 17.3.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`95a9857d9f007`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/95a9857d9f007) -
|
|
8
|
+
Replaced keymaps for moving table columns/rows in the Editor behind experiment
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 17.3.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 17.3.7
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -10,6 +10,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
10
10
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
11
11
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
12
12
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
14
|
var _commandsWithAnalytics = require("../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
14
15
|
var _commands2 = require("./commands");
|
|
15
16
|
var _columnResize = require("./commands/column-resize");
|
|
@@ -98,7 +99,8 @@ function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, e
|
|
|
98
99
|
// Ignored via go/ees005
|
|
99
100
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
100
101
|
_keymaps.addColumnAfterVO.common, (0, _insert.addColumnAfter)(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
101
|
-
if (dragAndDropEnabled) {
|
|
102
|
+
if (dragAndDropEnabled && _keymaps.moveRowDown.common && _keymaps.moveRowUp.common && _keymaps.moveColumnLeft.common && _keymaps.moveColumnRight.common) {
|
|
103
|
+
var isNewKeyMapExperiment = (0, _expValEquals.expValEquals)('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true);
|
|
102
104
|
// Move row/column shortcuts
|
|
103
105
|
/**
|
|
104
106
|
* NOTE: If the keyboard shortcut for moving rows or columns is changed, we need to update the handleKeyDown function
|
|
@@ -109,20 +111,24 @@ function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, e
|
|
|
109
111
|
|
|
110
112
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
111
113
|
// Ignored via go/ees005
|
|
114
|
+
isNewKeyMapExperiment ? _keymaps.moveRowDown.common :
|
|
112
115
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
113
|
-
_keymaps.
|
|
116
|
+
_keymaps.moveRowDownOld.common, (0, _commandsWithAnalytics.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', 1), list);
|
|
114
117
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
115
118
|
// Ignored via go/ees005
|
|
119
|
+
isNewKeyMapExperiment ? _keymaps.moveRowUp.common :
|
|
116
120
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
117
|
-
_keymaps.
|
|
121
|
+
_keymaps.moveRowUpOld.common, (0, _commandsWithAnalytics.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', -1), list);
|
|
118
122
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
119
123
|
// Ignored via go/ees005
|
|
124
|
+
isNewKeyMapExperiment ? _keymaps.moveColumnLeft.common :
|
|
120
125
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
121
|
-
_keymaps.
|
|
126
|
+
_keymaps.moveColumnLeftOld.common, (0, _commandsWithAnalytics.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', -1), list);
|
|
122
127
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
123
128
|
// Ignored via go/ees005
|
|
129
|
+
isNewKeyMapExperiment ? _keymaps.moveColumnRight.common :
|
|
124
130
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
125
|
-
_keymaps.
|
|
131
|
+
_keymaps.moveColumnRightOld.common, (0, _commandsWithAnalytics.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', 1), list);
|
|
126
132
|
|
|
127
133
|
// Delete row/column shortcuts
|
|
128
134
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
@@ -25,6 +25,7 @@ var _tableRowDelete = _interopRequireDefault(require("@atlaskit/icon/core/table-
|
|
|
25
25
|
var _tableRowMoveDown = _interopRequireDefault(require("@atlaskit/icon/core/table-row-move-down"));
|
|
26
26
|
var _tableRowMoveUp = _interopRequireDefault(require("@atlaskit/icon/core/table-row-move-up"));
|
|
27
27
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
28
29
|
var _toolbar = require("../../ui/toolbar");
|
|
29
30
|
var _commandsWithAnalytics = require("../commands/commands-with-analytics");
|
|
30
31
|
var _commandsWithAnalytics2 = require("../drag-and-drop/commands-with-analytics");
|
|
@@ -126,6 +127,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
126
127
|
},
|
|
127
128
|
keymap: _keymaps.addColumnAfter
|
|
128
129
|
}];
|
|
130
|
+
var isNewKeymapExperiment = (0, _expValEquals.expValEquals)('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true);
|
|
129
131
|
var moveOptions = direction === 'row' ? [{
|
|
130
132
|
label: 'up',
|
|
131
133
|
icon: function icon() {
|
|
@@ -134,7 +136,9 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
134
136
|
label: ''
|
|
135
137
|
});
|
|
136
138
|
},
|
|
137
|
-
keymap: _keymaps.moveRowUp
|
|
139
|
+
keymap: isNewKeymapExperiment ? _keymaps.moveRowUp :
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
141
|
+
_keymaps.moveRowUpOld,
|
|
138
142
|
canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
|
|
139
143
|
getOriginIndexes: _selection.getSelectedRowIndexes,
|
|
140
144
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -148,7 +152,9 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
148
152
|
label: ''
|
|
149
153
|
});
|
|
150
154
|
},
|
|
151
|
-
keymap: _keymaps.moveRowDown
|
|
155
|
+
keymap: isNewKeymapExperiment ? _keymaps.moveRowDown :
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
157
|
+
_keymaps.moveRowDownOld,
|
|
152
158
|
canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
|
|
153
159
|
getOriginIndexes: _selection.getSelectedRowIndexes,
|
|
154
160
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -162,7 +168,9 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
162
168
|
label: ''
|
|
163
169
|
});
|
|
164
170
|
},
|
|
165
|
-
keymap: _keymaps.moveColumnLeft
|
|
171
|
+
keymap: isNewKeymapExperiment ? _keymaps.moveColumnLeft :
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
173
|
+
_keymaps.moveColumnLeftOld,
|
|
166
174
|
canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
|
|
167
175
|
getOriginIndexes: _selection.getSelectedColumnIndexes,
|
|
168
176
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -176,7 +184,9 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
176
184
|
label: ''
|
|
177
185
|
});
|
|
178
186
|
},
|
|
179
|
-
keymap: _keymaps.moveColumnRight
|
|
187
|
+
keymap: isNewKeymapExperiment ? _keymaps.moveColumnRight :
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
189
|
+
_keymaps.moveColumnRightOld,
|
|
180
190
|
canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
|
|
181
191
|
getOriginIndexes: _selection.getSelectedColumnIndexes,
|
|
182
192
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, focusToContextMenuTrigger, increaseMediaSize, moveColumnLeft, moveColumnRight, moveDown, moveLeft, moveRight, moveRowDown, moveRowUp, moveUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, focusToContextMenuTrigger, increaseMediaSize, moveColumnLeftOld, moveColumnLeft, moveColumnRightOld, moveColumnRight, moveDown, moveLeft, moveRight, moveRowDownOld, moveRowDown, moveRowUpOld, moveRowUp, moveUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
5
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
7
8
|
import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from './commands';
|
|
8
9
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from './commands/column-resize';
|
|
@@ -81,7 +82,8 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
81
82
|
// Ignored via go/ees005
|
|
82
83
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
83
84
|
addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
84
|
-
if (dragAndDropEnabled) {
|
|
85
|
+
if (dragAndDropEnabled && moveRowDown.common && moveRowUp.common && moveColumnLeft.common && moveColumnRight.common) {
|
|
86
|
+
const isNewKeyMapExperiment = expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true);
|
|
85
87
|
// Move row/column shortcuts
|
|
86
88
|
/**
|
|
87
89
|
* NOTE: If the keyboard shortcut for moving rows or columns is changed, we need to update the handleKeyDown function
|
|
@@ -92,20 +94,24 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
92
94
|
|
|
93
95
|
bindKeymapWithCommand(
|
|
94
96
|
// Ignored via go/ees005
|
|
97
|
+
isNewKeyMapExperiment ? moveRowDown.common :
|
|
95
98
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
96
|
-
|
|
99
|
+
moveRowDownOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', 1), list);
|
|
97
100
|
bindKeymapWithCommand(
|
|
98
101
|
// Ignored via go/ees005
|
|
102
|
+
isNewKeyMapExperiment ? moveRowUp.common :
|
|
99
103
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
100
|
-
|
|
104
|
+
moveRowUpOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', -1), list);
|
|
101
105
|
bindKeymapWithCommand(
|
|
102
106
|
// Ignored via go/ees005
|
|
107
|
+
isNewKeyMapExperiment ? moveColumnLeft.common :
|
|
103
108
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
104
|
-
|
|
109
|
+
moveColumnLeftOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', -1), list);
|
|
105
110
|
bindKeymapWithCommand(
|
|
106
111
|
// Ignored via go/ees005
|
|
112
|
+
isNewKeyMapExperiment ? moveColumnRight.common :
|
|
107
113
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
108
|
-
|
|
114
|
+
moveColumnRightOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', 1), list);
|
|
109
115
|
|
|
110
116
|
// Delete row/column shortcuts
|
|
111
117
|
bindKeymapWithCommand(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeftOld, moveColumnLeft, moveColumnRightOld, moveColumnRight, moveRowDownOld, moveRowDown, moveRowUpOld, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
|
|
6
6
|
import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
|
|
7
7
|
import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
|
|
@@ -17,6 +17,7 @@ import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
|
17
17
|
import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
|
|
18
18
|
import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
21
|
import { getClosestSelectionRect } from '../../ui/toolbar';
|
|
21
22
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands/commands-with-analytics';
|
|
22
23
|
import { moveSourceWithAnalytics } from '../drag-and-drop/commands-with-analytics';
|
|
@@ -105,13 +106,16 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
105
106
|
}),
|
|
106
107
|
keymap: addColumnAfter
|
|
107
108
|
}];
|
|
109
|
+
const isNewKeymapExperiment = expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true);
|
|
108
110
|
const moveOptions = direction === 'row' ? [{
|
|
109
111
|
label: 'up',
|
|
110
112
|
icon: () => /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
111
113
|
spacing: 'spacious',
|
|
112
114
|
label: ''
|
|
113
115
|
}),
|
|
114
|
-
keymap: moveRowUp
|
|
116
|
+
keymap: isNewKeymapExperiment ? moveRowUp :
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
118
|
+
moveRowUpOld,
|
|
115
119
|
canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
|
|
116
120
|
getOriginIndexes: getSelectedRowIndexes,
|
|
117
121
|
getTargetIndex: selectionRect => selectionRect.top - 1
|
|
@@ -121,7 +125,9 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
121
125
|
spacing: 'spacious',
|
|
122
126
|
label: ''
|
|
123
127
|
}),
|
|
124
|
-
keymap: moveRowDown
|
|
128
|
+
keymap: isNewKeymapExperiment ? moveRowDown :
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
130
|
+
moveRowDownOld,
|
|
125
131
|
canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
|
|
126
132
|
getOriginIndexes: getSelectedRowIndexes,
|
|
127
133
|
getTargetIndex: selectionRect => selectionRect.bottom
|
|
@@ -131,7 +137,9 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
131
137
|
spacing: 'spacious',
|
|
132
138
|
label: ''
|
|
133
139
|
}),
|
|
134
|
-
keymap: moveColumnLeft
|
|
140
|
+
keymap: isNewKeymapExperiment ? moveColumnLeft :
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
142
|
+
moveColumnLeftOld,
|
|
135
143
|
canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
|
|
136
144
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
137
145
|
getTargetIndex: selectionRect => selectionRect.left - 1
|
|
@@ -141,7 +149,9 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
141
149
|
spacing: 'spacious',
|
|
142
150
|
label: ''
|
|
143
151
|
}),
|
|
144
|
-
keymap: moveColumnRight
|
|
152
|
+
keymap: isNewKeymapExperiment ? moveColumnRight :
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
154
|
+
moveColumnRightOld,
|
|
145
155
|
canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
|
|
146
156
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
147
157
|
getTargetIndex: selectionRect => selectionRect.right
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, focusToContextMenuTrigger, increaseMediaSize, moveColumnLeft, moveColumnRight, moveDown, moveLeft, moveRight, moveRowDown, moveRowUp, moveUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, focusToContextMenuTrigger, increaseMediaSize, moveColumnLeftOld, moveColumnLeft, moveColumnRightOld, moveColumnRight, moveDown, moveLeft, moveRight, moveRowDownOld, moveRowDown, moveRowUpOld, moveRowUp, moveUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
5
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
7
8
|
import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from './commands';
|
|
8
9
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from './commands/column-resize';
|
|
@@ -91,7 +92,8 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
91
92
|
// Ignored via go/ees005
|
|
92
93
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
93
94
|
addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
94
|
-
if (dragAndDropEnabled) {
|
|
95
|
+
if (dragAndDropEnabled && moveRowDown.common && moveRowUp.common && moveColumnLeft.common && moveColumnRight.common) {
|
|
96
|
+
var isNewKeyMapExperiment = expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true);
|
|
95
97
|
// Move row/column shortcuts
|
|
96
98
|
/**
|
|
97
99
|
* NOTE: If the keyboard shortcut for moving rows or columns is changed, we need to update the handleKeyDown function
|
|
@@ -102,20 +104,24 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
102
104
|
|
|
103
105
|
bindKeymapWithCommand(
|
|
104
106
|
// Ignored via go/ees005
|
|
107
|
+
isNewKeyMapExperiment ? moveRowDown.common :
|
|
105
108
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
106
|
-
|
|
109
|
+
moveRowDownOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', 1), list);
|
|
107
110
|
bindKeymapWithCommand(
|
|
108
111
|
// Ignored via go/ees005
|
|
112
|
+
isNewKeyMapExperiment ? moveRowUp.common :
|
|
109
113
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
110
|
-
|
|
114
|
+
moveRowUpOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', -1), list);
|
|
111
115
|
bindKeymapWithCommand(
|
|
112
116
|
// Ignored via go/ees005
|
|
117
|
+
isNewKeyMapExperiment ? moveColumnLeft.common :
|
|
113
118
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
114
|
-
|
|
119
|
+
moveColumnLeftOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', -1), list);
|
|
115
120
|
bindKeymapWithCommand(
|
|
116
121
|
// Ignored via go/ees005
|
|
122
|
+
isNewKeyMapExperiment ? moveColumnRight.common :
|
|
117
123
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
118
|
-
|
|
124
|
+
moveColumnRightOld.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', 1), list);
|
|
119
125
|
|
|
120
126
|
// Delete row/column shortcuts
|
|
121
127
|
bindKeymapWithCommand(
|
|
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeftOld, moveColumnLeft, moveColumnRightOld, moveColumnRight, moveRowDownOld, moveRowDown, moveRowUpOld, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
|
|
7
7
|
import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
|
|
8
8
|
import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
|
|
@@ -18,6 +18,7 @@ import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
|
18
18
|
import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
|
|
19
19
|
import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
|
|
20
20
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
22
|
import { getClosestSelectionRect } from '../../ui/toolbar';
|
|
22
23
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands/commands-with-analytics';
|
|
23
24
|
import { moveSourceWithAnalytics } from '../drag-and-drop/commands-with-analytics';
|
|
@@ -119,6 +120,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
119
120
|
},
|
|
120
121
|
keymap: addColumnAfter
|
|
121
122
|
}];
|
|
123
|
+
var isNewKeymapExperiment = expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true);
|
|
122
124
|
var moveOptions = direction === 'row' ? [{
|
|
123
125
|
label: 'up',
|
|
124
126
|
icon: function icon() {
|
|
@@ -127,7 +129,9 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
127
129
|
label: ''
|
|
128
130
|
});
|
|
129
131
|
},
|
|
130
|
-
keymap: moveRowUp
|
|
132
|
+
keymap: isNewKeymapExperiment ? moveRowUp :
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
134
|
+
moveRowUpOld,
|
|
131
135
|
canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
|
|
132
136
|
getOriginIndexes: getSelectedRowIndexes,
|
|
133
137
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -141,7 +145,9 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
141
145
|
label: ''
|
|
142
146
|
});
|
|
143
147
|
},
|
|
144
|
-
keymap: moveRowDown
|
|
148
|
+
keymap: isNewKeymapExperiment ? moveRowDown :
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
150
|
+
moveRowDownOld,
|
|
145
151
|
canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
|
|
146
152
|
getOriginIndexes: getSelectedRowIndexes,
|
|
147
153
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -155,7 +161,9 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
155
161
|
label: ''
|
|
156
162
|
});
|
|
157
163
|
},
|
|
158
|
-
keymap: moveColumnLeft
|
|
164
|
+
keymap: isNewKeymapExperiment ? moveColumnLeft :
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
166
|
+
moveColumnLeftOld,
|
|
159
167
|
canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
|
|
160
168
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
161
169
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -169,7 +177,9 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
169
177
|
label: ''
|
|
170
178
|
});
|
|
171
179
|
},
|
|
172
|
-
keymap: moveColumnRight
|
|
180
|
+
keymap: isNewKeymapExperiment ? moveColumnRight :
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
182
|
+
moveColumnRightOld,
|
|
173
183
|
canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
|
|
174
184
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
175
185
|
getTargetIndex: function getTargetIndex(selectionRect) {
|
|
@@ -4,7 +4,7 @@ import type { Command } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
* Table layout toggle logic
|
|
5
5
|
* default -> wide -> full-width -> default
|
|
6
6
|
*/
|
|
7
|
-
export declare const getNextLayout: (currentLayout: TableLayout) => "
|
|
7
|
+
export declare const getNextLayout: (currentLayout: TableLayout) => "default" | "full-width" | "wide";
|
|
8
8
|
export declare const toggleHeaderRow: Command;
|
|
9
9
|
export declare const toggleHeaderColumn: Command;
|
|
10
10
|
export declare const toggleNumberColumn: Command;
|
|
@@ -4,7 +4,7 @@ import type { Command } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
* Table layout toggle logic
|
|
5
5
|
* default -> wide -> full-width -> default
|
|
6
6
|
*/
|
|
7
|
-
export declare const getNextLayout: (currentLayout: TableLayout) => "
|
|
7
|
+
export declare const getNextLayout: (currentLayout: TableLayout) => "default" | "full-width" | "wide";
|
|
8
8
|
export declare const toggleHeaderRow: Command;
|
|
9
9
|
export declare const toggleHeaderColumn: Command;
|
|
10
10
|
export declare const toggleNumberColumn: Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.9",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^7.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^7.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "10.0.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "10.0.12",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^7.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^14.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^4.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
58
58
|
"@atlaskit/primitives": "^18.0.0",
|
|
59
59
|
"@atlaskit/theme": "^21.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^23.0.0",
|
|
61
61
|
"@atlaskit/toggle": "^15.2.0",
|
|
62
62
|
"@atlaskit/tokens": "^11.0.0",
|
|
63
63
|
"@atlaskit/tooltip": "^20.14.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"uuid": "^3.1.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@atlaskit/editor-common": "^111.
|
|
73
|
+
"@atlaskit/editor-common": "^111.12.0",
|
|
74
74
|
"react": "^18.2.0",
|
|
75
75
|
"react-dom": "^18.2.0",
|
|
76
76
|
"react-intl-next": "npm:react-intl@^5.18.1"
|