@atlaskit/editor-plugin-table 7.19.11 → 7.19.12
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 +16 -0
- package/dist/cjs/commands/column-resize.js +1 -1
- package/dist/cjs/commands/selection.js +25 -4
- package/dist/cjs/plugin.js +59 -56
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
- package/dist/cjs/pm-plugins/keymap.js +6 -6
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/cjs/toolbar.js +8 -5
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +5 -3
- package/dist/cjs/ui/TableFloatingControls/index.js +8 -2
- package/dist/cjs/utils/drag-menu.js +5 -1
- package/dist/es2019/commands/column-resize.js +2 -2
- package/dist/es2019/commands/selection.js +25 -4
- package/dist/es2019/plugin.js +11 -7
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +18 -3
- package/dist/es2019/pm-plugins/keymap.js +7 -7
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/es2019/toolbar.js +8 -5
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +6 -4
- package/dist/es2019/ui/TableFloatingControls/index.js +9 -3
- package/dist/es2019/utils/drag-menu.js +6 -2
- package/dist/esm/commands/column-resize.js +2 -2
- package/dist/esm/commands/selection.js +25 -4
- package/dist/esm/plugin.js +60 -57
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
- package/dist/esm/pm-plugins/keymap.js +7 -7
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/esm/toolbar.js +8 -5
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -4
- package/dist/esm/ui/TableFloatingControls/index.js +9 -3
- package/dist/esm/utils/drag-menu.js +5 -1
- package/dist/types/commands/selection.d.ts +4 -2
- package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
- package/dist/types/pm-plugins/table-selection-keymap.d.ts +3 -3
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types/utils/drag-menu.d.ts +2 -1
- package/dist/types-ts4.5/commands/selection.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/table-selection-keymap.d.ts +3 -3
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +2 -1
- package/package.json +7 -4
- package/src/commands/column-resize.ts +2 -2
- package/src/commands/selection.ts +49 -4
- package/src/plugin.tsx +8 -7
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +43 -3
- package/src/pm-plugins/keymap.ts +23 -7
- package/src/pm-plugins/main.ts +2 -2
- package/src/pm-plugins/table-selection-keymap.ts +18 -6
- package/src/toolbar.tsx +7 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +7 -0
- package/src/ui/FloatingDragMenu/index.tsx +9 -2
- package/src/ui/TableFloatingControls/index.tsx +12 -4
- package/src/utils/drag-menu.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.19.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#119559](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119559)
|
|
8
|
+
[`7c1b0299f4fba`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7c1b0299f4fba) -
|
|
9
|
+
ED-22510:Screen reader support for column/row selection and up/down movements
|
|
10
|
+
- [#119748](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119748)
|
|
11
|
+
[`643da12b73454`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/643da12b73454) -
|
|
12
|
+
[ED-24041] When element drag and drop is enabled, allow table corner control with selection for
|
|
13
|
+
nested nodes
|
|
14
|
+
- [#119589](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119589)
|
|
15
|
+
[`f1c2a87bd1e67`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f1c2a87bd1e67) -
|
|
16
|
+
[ux] Left alignment option should be disabled for default tables in fixed-width editor.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 7.19.11
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -203,7 +203,7 @@ var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeC
|
|
|
203
203
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
204
204
|
isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
|
|
205
205
|
}
|
|
206
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.
|
|
206
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent');
|
|
207
207
|
var initialResizeState = (0, _utils3.getResizeState)({
|
|
208
208
|
minWidth: _styles.tableCellMinWidth,
|
|
209
209
|
maxSize: maxSize,
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.shiftArrowUpFromTable = exports.selectRows = exports.selectColumns = exports.modASelectTable = exports.arrowRightFromTable = exports.arrowLeftFromTable = exports.TableSelectionDirection = void 0;
|
|
7
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
7
8
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
10
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
@@ -85,7 +86,7 @@ var arrowRightFromCellSelection = function arrowRightFromCellSelection(editorSel
|
|
|
85
86
|
};
|
|
86
87
|
};
|
|
87
88
|
};
|
|
88
|
-
var selectColumns = exports.selectColumns = function selectColumns(editorSelectionAPI) {
|
|
89
|
+
var selectColumns = exports.selectColumns = function selectColumns(editorSelectionAPI, ariaNotify, getIntl) {
|
|
89
90
|
return function () {
|
|
90
91
|
var triggeredByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
91
92
|
return function (state, dispatch) {
|
|
@@ -100,13 +101,23 @@ var selectColumns = exports.selectColumns = function selectColumns(editorSelecti
|
|
|
100
101
|
})(state, dispatch);
|
|
101
102
|
}
|
|
102
103
|
if (table && rect) {
|
|
103
|
-
|
|
104
|
+
var selectColumnCommand = (0, _misc.selectColumn)(rect.left, undefined, triggeredByKeyboard)(state, dispatch);
|
|
105
|
+
var map = _tableMap.TableMap.get(table.node);
|
|
106
|
+
if (ariaNotify && getIntl) {
|
|
107
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.columnSelected, {
|
|
108
|
+
index: rect.left + 1,
|
|
109
|
+
total: map.width
|
|
110
|
+
}), {
|
|
111
|
+
priority: 'important'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return selectColumnCommand;
|
|
104
115
|
}
|
|
105
116
|
return false;
|
|
106
117
|
};
|
|
107
118
|
};
|
|
108
119
|
};
|
|
109
|
-
var selectRows = exports.selectRows = function selectRows(editorSelectionAPI) {
|
|
120
|
+
var selectRows = exports.selectRows = function selectRows(editorSelectionAPI, ariaNotify, getIntl) {
|
|
110
121
|
return function () {
|
|
111
122
|
var triggeredByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
112
123
|
return function (state, dispatch) {
|
|
@@ -121,7 +132,17 @@ var selectRows = exports.selectRows = function selectRows(editorSelectionAPI) {
|
|
|
121
132
|
})(state, dispatch);
|
|
122
133
|
}
|
|
123
134
|
if (table && rect) {
|
|
124
|
-
|
|
135
|
+
var selectRowCommand = (0, _misc.selectRow)(rect.top, undefined, triggeredByKeyboard)(state, dispatch);
|
|
136
|
+
var map = _tableMap.TableMap.get(table.node);
|
|
137
|
+
if (ariaNotify && getIntl) {
|
|
138
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.rowSelected, {
|
|
139
|
+
index: rect.top + 1,
|
|
140
|
+
total: map.height
|
|
141
|
+
}), {
|
|
142
|
+
priority: 'important'
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return selectRowCommand;
|
|
125
146
|
}
|
|
126
147
|
return false;
|
|
127
148
|
};
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -59,7 +59,7 @@ var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
|
59
59
|
* from `@atlaskit/editor-core`.
|
|
60
60
|
*/
|
|
61
61
|
var tablesPlugin = function tablesPlugin(_ref) {
|
|
62
|
-
var _api$analytics, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
|
|
62
|
+
var _api$analytics, _api$accessibilityUti, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
|
|
63
63
|
var options = _ref.config,
|
|
64
64
|
api = _ref.api;
|
|
65
65
|
var editorViewRef = {
|
|
@@ -72,8 +72,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
75
|
+
var ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
|
|
75
76
|
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
76
|
-
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && isTableFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.
|
|
77
|
+
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && isTableFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent');
|
|
77
78
|
var isCellBackgroundDuplicated = (options === null || options === void 0 || (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableDuplicateCellColouring) || false;
|
|
78
79
|
return {
|
|
79
80
|
name: 'table',
|
|
@@ -209,18 +210,19 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
209
210
|
}
|
|
210
211
|
}, {
|
|
211
212
|
name: 'tableSelectionKeymap',
|
|
212
|
-
plugin: function plugin() {
|
|
213
|
-
|
|
213
|
+
plugin: function plugin(_ref8) {
|
|
214
|
+
var getIntl = _ref8.getIntl;
|
|
215
|
+
return (0, _tableSelectionKeymap.tableSelectionKeymapPlugin)(api, getIntl);
|
|
214
216
|
}
|
|
215
217
|
}, {
|
|
216
218
|
name: 'tableEditing',
|
|
217
219
|
plugin: function plugin() {
|
|
218
|
-
var
|
|
219
|
-
dragAndDropEnabled =
|
|
220
|
+
var _ref9 = options || {},
|
|
221
|
+
dragAndDropEnabled = _ref9.dragAndDropEnabled;
|
|
220
222
|
return (0, _pmPlugins.tableEditing)({
|
|
221
|
-
reportFixedTable: function reportFixedTable(
|
|
222
|
-
var tr =
|
|
223
|
-
reason =
|
|
223
|
+
reportFixedTable: function reportFixedTable(_ref10) {
|
|
224
|
+
var tr = _ref10.tr,
|
|
225
|
+
reason = _ref10.reason;
|
|
224
226
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
225
227
|
action: _analytics.TABLE_ACTION.FIXED,
|
|
226
228
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -236,53 +238,53 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
236
238
|
}
|
|
237
239
|
}, {
|
|
238
240
|
name: 'tableStickyHeaders',
|
|
239
|
-
plugin: function plugin(
|
|
240
|
-
var dispatch =
|
|
241
|
-
eventDispatcher =
|
|
241
|
+
plugin: function plugin(_ref11) {
|
|
242
|
+
var dispatch = _ref11.dispatch,
|
|
243
|
+
eventDispatcher = _ref11.eventDispatcher;
|
|
242
244
|
return options && options.tableOptions.stickyHeaders ? (0, _stickyHeaders.createPlugin)(dispatch, function () {
|
|
243
245
|
return [];
|
|
244
246
|
}) : undefined;
|
|
245
247
|
}
|
|
246
248
|
}, {
|
|
247
249
|
name: 'tableDragAndDrop',
|
|
248
|
-
plugin: function plugin(
|
|
249
|
-
var dispatch =
|
|
250
|
+
plugin: function plugin(_ref12) {
|
|
251
|
+
var dispatch = _ref12.dispatch;
|
|
250
252
|
return options !== null && options !== void 0 && options.dragAndDropEnabled ? (0, _dragAndDrop.createPlugin)(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : undefined;
|
|
251
253
|
}
|
|
252
254
|
}, {
|
|
253
255
|
name: 'tableViewModeSort',
|
|
254
256
|
plugin: function plugin() {
|
|
255
|
-
return (0, _platformFeatureFlags.
|
|
257
|
+
return api !== null && api !== void 0 && api.editorViewMode && (0, _platformFeatureFlags.fg)('platform.editor.table.live-pages-sorting_4malx') ? (0, _viewModeSort.createPlugin)(api.editorViewMode) : undefined;
|
|
256
258
|
}
|
|
257
259
|
}, {
|
|
258
260
|
name: 'tableLocalId',
|
|
259
|
-
plugin: function plugin(
|
|
260
|
-
var dispatch =
|
|
261
|
+
plugin: function plugin(_ref13) {
|
|
262
|
+
var dispatch = _ref13.dispatch;
|
|
261
263
|
return (0, _tableLocalId.createPlugin)(dispatch);
|
|
262
264
|
}
|
|
263
265
|
}, {
|
|
264
266
|
name: 'tableWidth',
|
|
265
|
-
plugin: function plugin(
|
|
267
|
+
plugin: function plugin(_ref14) {
|
|
266
268
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign;
|
|
267
|
-
var dispatchAnalyticsEvent =
|
|
268
|
-
dispatch =
|
|
269
|
+
var dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent,
|
|
270
|
+
dispatch = _ref14.dispatch;
|
|
269
271
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
270
272
|
}
|
|
271
273
|
},
|
|
272
274
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
273
275
|
{
|
|
274
276
|
name: 'tableOverflowAnalyticsPlugin',
|
|
275
|
-
plugin: function plugin(
|
|
277
|
+
plugin: function plugin(_ref15) {
|
|
276
278
|
var _options$tableResizin;
|
|
277
|
-
var dispatch =
|
|
278
|
-
dispatchAnalyticsEvent =
|
|
279
|
+
var dispatch = _ref15.dispatch,
|
|
280
|
+
dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
|
|
279
281
|
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
|
|
280
282
|
}
|
|
281
283
|
}, {
|
|
282
284
|
name: 'tableAnalyticsPlugin',
|
|
283
|
-
plugin: function plugin(
|
|
284
|
-
var dispatch =
|
|
285
|
-
dispatchAnalyticsEvent =
|
|
285
|
+
plugin: function plugin(_ref16) {
|
|
286
|
+
var dispatch = _ref16.dispatch,
|
|
287
|
+
dispatchAnalyticsEvent = _ref16.dispatchAnalyticsEvent;
|
|
286
288
|
return (0, _plugin.createPlugin)(dispatch, dispatchAnalyticsEvent);
|
|
287
289
|
}
|
|
288
290
|
}, {
|
|
@@ -313,12 +315,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
313
315
|
}
|
|
314
316
|
return plugins;
|
|
315
317
|
},
|
|
316
|
-
contentComponent: function contentComponent(
|
|
317
|
-
var editorView =
|
|
318
|
-
popupsMountPoint =
|
|
319
|
-
popupsBoundariesElement =
|
|
320
|
-
popupsScrollableElement =
|
|
321
|
-
dispatchAnalyticsEvent =
|
|
318
|
+
contentComponent: function contentComponent(_ref17) {
|
|
319
|
+
var editorView = _ref17.editorView,
|
|
320
|
+
popupsMountPoint = _ref17.popupsMountPoint,
|
|
321
|
+
popupsBoundariesElement = _ref17.popupsBoundariesElement,
|
|
322
|
+
popupsScrollableElement = _ref17.popupsScrollableElement,
|
|
323
|
+
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
322
324
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
323
325
|
component: _analytics.ACTION_SUBJECT.TABLES_PLUGIN,
|
|
324
326
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -332,35 +334,35 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
332
334
|
stickyHeadersState: _stickyHeaders.pluginKey,
|
|
333
335
|
dragAndDropState: _dragAndDrop.pluginKey
|
|
334
336
|
},
|
|
335
|
-
render: function render(
|
|
336
|
-
var resizingPluginState =
|
|
337
|
-
stickyHeadersState =
|
|
338
|
-
tablePluginState =
|
|
339
|
-
tableWidthPluginState =
|
|
340
|
-
dragAndDropState =
|
|
337
|
+
render: function render(_ref18) {
|
|
338
|
+
var resizingPluginState = _ref18.tableResizingPluginState,
|
|
339
|
+
stickyHeadersState = _ref18.stickyHeadersState,
|
|
340
|
+
tablePluginState = _ref18.tablePluginState,
|
|
341
|
+
tableWidthPluginState = _ref18.tableWidthPluginState,
|
|
342
|
+
dragAndDropState = _ref18.dragAndDropState;
|
|
341
343
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
342
344
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
343
345
|
var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
|
|
344
346
|
var resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
|
|
345
347
|
var isResizing = isColumnResizing || isTableResizing;
|
|
346
348
|
var widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
|
|
347
|
-
var
|
|
348
|
-
tableNode =
|
|
349
|
-
tablePos =
|
|
350
|
-
targetCellPosition =
|
|
351
|
-
isContextualMenuOpen =
|
|
352
|
-
tableRef =
|
|
353
|
-
pluginConfig =
|
|
354
|
-
insertColumnButtonIndex =
|
|
355
|
-
insertRowButtonIndex =
|
|
356
|
-
isHeaderColumnEnabled =
|
|
357
|
-
isHeaderRowEnabled =
|
|
358
|
-
isDragAndDropEnabled =
|
|
359
|
-
tableWrapperTarget =
|
|
360
|
-
isCellMenuOpenByKeyboard =
|
|
349
|
+
var _ref19 = tablePluginState,
|
|
350
|
+
tableNode = _ref19.tableNode,
|
|
351
|
+
tablePos = _ref19.tablePos,
|
|
352
|
+
targetCellPosition = _ref19.targetCellPosition,
|
|
353
|
+
isContextualMenuOpen = _ref19.isContextualMenuOpen,
|
|
354
|
+
tableRef = _ref19.tableRef,
|
|
355
|
+
pluginConfig = _ref19.pluginConfig,
|
|
356
|
+
insertColumnButtonIndex = _ref19.insertColumnButtonIndex,
|
|
357
|
+
insertRowButtonIndex = _ref19.insertRowButtonIndex,
|
|
358
|
+
isHeaderColumnEnabled = _ref19.isHeaderColumnEnabled,
|
|
359
|
+
isHeaderRowEnabled = _ref19.isHeaderRowEnabled,
|
|
360
|
+
isDragAndDropEnabled = _ref19.isDragAndDropEnabled,
|
|
361
|
+
tableWrapperTarget = _ref19.tableWrapperTarget,
|
|
362
|
+
isCellMenuOpenByKeyboard = _ref19.isCellMenuOpenByKeyboard;
|
|
361
363
|
var allowControls = pluginConfig.allowControls;
|
|
362
364
|
var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
363
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && (tableRef || (0, _platformFeatureFlags.
|
|
365
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard && (0, _platformFeatureFlags.fg)('platform.editor.a11y-table-context-menu_y4c9c')) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
|
|
364
366
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
365
367
|
editorView: editorView,
|
|
366
368
|
tableNode: tableNode,
|
|
@@ -416,7 +418,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
416
418
|
stickyHeaders: stickyHeader,
|
|
417
419
|
pluginConfig: pluginConfig,
|
|
418
420
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
419
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
421
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
422
|
+
ariaNotifyPlugin: ariaNotifyPlugin
|
|
420
423
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
|
|
421
424
|
editorView: editorView,
|
|
422
425
|
selection: editorView.state.selection,
|
|
@@ -441,8 +444,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
441
444
|
}));
|
|
442
445
|
},
|
|
443
446
|
pluginsOptions: {
|
|
444
|
-
quickInsert: function quickInsert(
|
|
445
|
-
var formatMessage =
|
|
447
|
+
quickInsert: function quickInsert(_ref20) {
|
|
448
|
+
var formatMessage = _ref20.formatMessage;
|
|
446
449
|
return [{
|
|
447
450
|
id: 'table',
|
|
448
451
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.moveSourceWithAnalyticsViaShortcut = exports.moveSourceWithAnalytics = exports.cloneSourceWithAnalytics = exports.clearDropTargetWithAnalytics = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
10
11
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
11
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
13
|
var _utils2 = require("../../utils");
|
|
@@ -43,7 +44,7 @@ var clearDropTargetWithAnalytics = exports.clearDropTargetWithAnalytics = functi
|
|
|
43
44
|
});
|
|
44
45
|
};
|
|
45
46
|
};
|
|
46
|
-
var moveSourceWithAnalytics = exports.moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnalyticsAPI) {
|
|
47
|
+
var moveSourceWithAnalytics = exports.moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotify, getIntl) {
|
|
47
48
|
return function (inputMethod, sourceType, sourceIndexes, targetIndex, tr) {
|
|
48
49
|
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref2) {
|
|
49
50
|
var selection = _ref2.selection;
|
|
@@ -73,12 +74,25 @@ var moveSourceWithAnalytics = exports.moveSourceWithAnalytics = function moveSou
|
|
|
73
74
|
})(editorAnalyticsAPI)(function (state, dispatch) {
|
|
74
75
|
if (dispatch) {
|
|
75
76
|
(0, _commands.moveSource)(sourceType, sourceIndexes, targetIndex, tr)(state, dispatch);
|
|
77
|
+
// Only considering single row/column movement for screen reader as only single row/column selection is supported via keyboard atm.
|
|
78
|
+
if ((inputMethod === _analytics.INPUT_METHOD.TABLE_CONTEXT_MENU || _analytics.INPUT_METHOD.SHORTCUT) && sourceIndexes.length === 1 && ariaNotify && getIntl) {
|
|
79
|
+
var direction = sourceIndexes[0] > targetIndex ? -1 : 1; // -1 for left/up , 1 for right/down
|
|
80
|
+
var _getSelectedTableInfo3 = (0, _utils2.getSelectedTableInfo)(state.selection),
|
|
81
|
+
totalRowCount = _getSelectedTableInfo3.totalRowCount,
|
|
82
|
+
totalColumnCount = _getSelectedTableInfo3.totalColumnCount;
|
|
83
|
+
ariaNotify(getIntl().formatMessage(sourceType === 'table-row' ? direction > 0 ? _messages.tableMessages.rowMovedDown : _messages.tableMessages.rowMovedUp : direction > 0 ? _messages.tableMessages.columnMovedRight : _messages.tableMessages.columnMovedLeft, {
|
|
84
|
+
index: targetIndex + 1,
|
|
85
|
+
total: sourceType === 'table-row' ? totalRowCount : totalColumnCount
|
|
86
|
+
}), {
|
|
87
|
+
priority: 'important'
|
|
88
|
+
});
|
|
89
|
+
}
|
|
76
90
|
}
|
|
77
91
|
return true;
|
|
78
92
|
});
|
|
79
93
|
};
|
|
80
94
|
};
|
|
81
|
-
var moveSourceWithAnalyticsViaShortcut = exports.moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI) {
|
|
95
|
+
var moveSourceWithAnalyticsViaShortcut = exports.moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotify, getIntl) {
|
|
82
96
|
return function (sourceType, direction) {
|
|
83
97
|
return function (state, dispatch) {
|
|
84
98
|
var selection = state.selection;
|
|
@@ -92,14 +106,14 @@ var moveSourceWithAnalyticsViaShortcut = exports.moveSourceWithAnalyticsViaShort
|
|
|
92
106
|
if (selectedIndexes.length === 0) {
|
|
93
107
|
return false;
|
|
94
108
|
}
|
|
95
|
-
var
|
|
96
|
-
totalRowCount =
|
|
97
|
-
totalColumnCount =
|
|
109
|
+
var _getSelectedTableInfo4 = (0, _utils2.getSelectedTableInfo)(selection),
|
|
110
|
+
totalRowCount = _getSelectedTableInfo4.totalRowCount,
|
|
111
|
+
totalColumnCount = _getSelectedTableInfo4.totalColumnCount;
|
|
98
112
|
if (!(0, _dragMenu.canMove)(sourceType, direction, isRow ? totalRowCount : totalColumnCount, selection, selectionRect)) {
|
|
99
113
|
return false;
|
|
100
114
|
}
|
|
101
115
|
var targetIndex = (0, _dragMenu.getTargetIndex)(selectedIndexes, direction);
|
|
102
|
-
return moveSourceWithAnalytics(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
|
|
116
|
+
return moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotify, getIntl)(_analytics.INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
|
|
103
117
|
};
|
|
104
118
|
};
|
|
105
119
|
};
|
|
@@ -108,9 +122,9 @@ var cloneSourceWithAnalytics = exports.cloneSourceWithAnalytics = function clone
|
|
|
108
122
|
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref3) {
|
|
109
123
|
var selection = _ref3.selection;
|
|
110
124
|
var direction = sourceIndexes[0] > targetIndex ? -1 : 1;
|
|
111
|
-
var
|
|
112
|
-
totalRowCount =
|
|
113
|
-
totalColumnCount =
|
|
125
|
+
var _getSelectedTableInfo5 = (0, _utils2.getSelectedTableInfo)(selection),
|
|
126
|
+
totalRowCount = _getSelectedTableInfo5.totalRowCount,
|
|
127
|
+
totalColumnCount = _getSelectedTableInfo5.totalColumnCount;
|
|
114
128
|
return {
|
|
115
129
|
action: sourceType === 'table-row' ? _analytics.TABLE_ACTION.CLONED_ROW : _analytics.TABLE_ACTION.CLONED_COLUMN,
|
|
116
130
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -38,7 +38,7 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
|
|
|
38
38
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addRowAfter.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('BOTTOM'), list);
|
|
39
39
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnBefore.common, (0, _insert.addColumnBefore)(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
40
40
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnAfter.common, (0, _insert.addColumnAfter)(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
41
|
-
if ((0, _platformFeatureFlags.
|
|
41
|
+
if ((0, _platformFeatureFlags.fg)('platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg')) {
|
|
42
42
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addRowBeforeVO.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('TOP'), list);
|
|
43
43
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addRowAfterVO.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('BOTTOM'), list);
|
|
44
44
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnBeforeVO.common, (0, _insert.addColumnBefore)(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
@@ -53,10 +53,10 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
|
|
|
53
53
|
* See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRowDown.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI)('table-row', 1), list);
|
|
57
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRowUp.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI)('table-row', -1), list);
|
|
58
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveColumnLeft.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI)('table-column', -1), list);
|
|
59
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveColumnRight.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI)('table-column', 1), list);
|
|
56
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRowDown.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', 1), list);
|
|
57
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRowUp.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', -1), list);
|
|
58
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveColumnLeft.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', -1), list);
|
|
59
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveColumnRight.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', 1), list);
|
|
60
60
|
|
|
61
61
|
// Delete row/column shortcuts
|
|
62
62
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteColumn.common, (0, _commandsWithAnalytics.deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut)(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
@@ -82,7 +82,7 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
|
|
|
82
82
|
ariaNotify: ariaNotifyPlugin,
|
|
83
83
|
getIntl: getIntl
|
|
84
84
|
}), list);
|
|
85
|
-
if ((0, _platformFeatureFlags.
|
|
85
|
+
if ((0, _platformFeatureFlags.fg)('platform.editor.a11y-table-context-menu_y4c9c')) {
|
|
86
86
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.focusToContextMenuTrigger.common, (0, _commands2.setFocusToCellMenu)(), list);
|
|
87
87
|
}
|
|
88
88
|
return (0, _keymap.keymap)(list);
|
|
@@ -206,7 +206,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
// If a partial paste of nested expand, paste only nested-expand's content */
|
|
209
|
-
if ((0, _platformFeatureFlags.
|
|
209
|
+
if ((0, _platformFeatureFlags.fg)('platform.editor.transform-slice-for-nested-expand')) {
|
|
210
210
|
slice = (0, _transforms.transformSliceToRemoveOpenNestedExpand)(slice, schema);
|
|
211
211
|
}
|
|
212
212
|
return slice;
|
|
@@ -8,12 +8,15 @@ exports.tableSelectionKeymapPlugin = tableSelectionKeymapPlugin;
|
|
|
8
8
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
9
9
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
10
|
var _selection = require("../commands/selection");
|
|
11
|
-
function tableSelectionKeymapPlugin(
|
|
11
|
+
function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
|
|
12
|
+
var _pluginInjectionApi$a;
|
|
12
13
|
var list = {};
|
|
14
|
+
var editorSelectionAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.selection;
|
|
15
|
+
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
13
16
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _selection.arrowRightFromTable)(editorSelectionAPI)(), list);
|
|
14
17
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _selection.arrowLeftFromTable)(editorSelectionAPI)(), list);
|
|
15
|
-
(0, _keymaps.bindKeymapArrayWithCommand)(_keymaps.selectColumn, (0, _selection.selectColumns)(editorSelectionAPI)(true), list);
|
|
16
|
-
(0, _keymaps.bindKeymapArrayWithCommand)(_keymaps.selectRow, (0, _selection.selectRows)(editorSelectionAPI)(true), list);
|
|
18
|
+
(0, _keymaps.bindKeymapArrayWithCommand)(_keymaps.selectColumn, (0, _selection.selectColumns)(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
|
|
19
|
+
(0, _keymaps.bindKeymapArrayWithCommand)(_keymaps.selectRow, (0, _selection.selectRows)(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
|
|
17
20
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.shiftArrowUp.common, (0, _selection.shiftArrowUpFromTable)(editorSelectionAPI)(), list);
|
|
18
21
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.selectTable.common, (0, _selection.modASelectTable)(editorSelectionAPI)(), list);
|
|
19
22
|
return (0, _keymap.keymap)(list);
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -372,7 +372,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
372
372
|
return element;
|
|
373
373
|
};
|
|
374
374
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
375
|
-
var alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) : [];
|
|
375
|
+
var alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled) : [];
|
|
376
376
|
var isCellBackgroundDuplicated = getEditorFeatureFlags().tableDuplicateCellColouring || false;
|
|
377
377
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent);
|
|
378
378
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : [];
|
|
@@ -588,7 +588,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
588
588
|
}
|
|
589
589
|
return false;
|
|
590
590
|
};
|
|
591
|
-
var getAlignmentOptionsConfig = exports.getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) {
|
|
591
|
+
var getAlignmentOptionsConfig = exports.getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
592
592
|
var formatMessage = _ref6.formatMessage;
|
|
593
593
|
var tableObject = (0, _utils3.findTable)(editorState.selection);
|
|
594
594
|
if (!tableObject) {
|
|
@@ -621,7 +621,7 @@ var getAlignmentOptionsConfig = exports.getAlignmentOptionsConfig = function get
|
|
|
621
621
|
title: formatMessage(layoutToMessages[value]),
|
|
622
622
|
selected: (0, _alignment.normaliseAlignment)(currentLayout) === value,
|
|
623
623
|
onClick: (0, _commandsWithAnalytics.setTableAlignmentWithAnalytics)(editorAnalyticsAPI)(value, currentLayout, _analytics.INPUT_METHOD.FLOATING_TB, _analytics.CHANGE_ALIGNMENT_REASON.TOOLBAR_OPTION_CHANGED)
|
|
624
|
-
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) && {
|
|
624
|
+
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) && {
|
|
625
625
|
disabled: value !== 'center'
|
|
626
626
|
});
|
|
627
627
|
});
|
|
@@ -651,7 +651,7 @@ var getSelectedAlignmentIcon = exports.getSelectedAlignmentIcon = function getSe
|
|
|
651
651
|
return icon.value === (0, _alignment.normaliseAlignment)(selectedAlignment);
|
|
652
652
|
});
|
|
653
653
|
};
|
|
654
|
-
var isLayoutOptionDisabled = exports.isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) {
|
|
654
|
+
var isLayoutOptionDisabled = exports.isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
655
655
|
var _getEditorContainerWi = getEditorContainerWidth(),
|
|
656
656
|
lineLength = _getEditorContainerWi.lineLength;
|
|
657
657
|
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(selectedNode);
|
|
@@ -663,7 +663,10 @@ var isLayoutOptionDisabled = exports.isLayoutOptionDisabled = function isLayoutO
|
|
|
663
663
|
var scalePercent = (0, _misc.getStaticTableScalingPercent)(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
|
|
664
664
|
tableContainerWidth = tableContainerWidth * scalePercent;
|
|
665
665
|
}
|
|
666
|
-
|
|
666
|
+
|
|
667
|
+
// If fixed-width editor, we disable 'left-alignment' when table width is 760px.
|
|
668
|
+
// tableContainerWidth +1 here because tableContainerWidth is 759 in fixed-width editor
|
|
669
|
+
if (selectedNode && !isFullWidthEditor && lineLength && tableContainerWidth + 1 >= lineLength) {
|
|
667
670
|
return true;
|
|
668
671
|
}
|
|
669
672
|
return false;
|
|
@@ -207,7 +207,8 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
207
207
|
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
|
|
208
208
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
209
209
|
isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
|
|
210
|
-
tableSortColumnReorder = _ref.tableSortColumnReorder
|
|
210
|
+
tableSortColumnReorder = _ref.tableSortColumnReorder,
|
|
211
|
+
ariaNotifyPlugin = _ref.ariaNotifyPlugin;
|
|
211
212
|
var state = editorView.state,
|
|
212
213
|
dispatch = editorView.dispatch;
|
|
213
214
|
var selection = state.selection;
|
|
@@ -221,7 +222,7 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
221
222
|
var selectionRect = (0, _utils2.isSelectionType)(selection, 'cell') ? (0, _utils2.getSelectionRect)(selection) : (0, _utils2.findCellRectClosestToPos)(selection.$from);
|
|
222
223
|
var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
223
224
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
224
|
-
var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
|
|
225
|
+
var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder, ariaNotifyPlugin);
|
|
225
226
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
|
|
226
227
|
menuItems = _convertToDropdownIte.menuItems,
|
|
227
228
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -27,7 +27,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
27
27
|
stickyHeaders = _ref.stickyHeaders,
|
|
28
28
|
pluginConfig = _ref.pluginConfig,
|
|
29
29
|
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
30
|
-
getEditorFeatureFlags = _ref.getEditorFeatureFlags
|
|
30
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
31
|
+
ariaNotifyPlugin = _ref.ariaNotifyPlugin;
|
|
31
32
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
@@ -44,7 +45,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
44
45
|
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC,
|
|
45
46
|
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
46
47
|
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
47
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.
|
|
48
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent');
|
|
48
49
|
return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
49
50
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
50
51
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -82,7 +83,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
82
83
|
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
83
84
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
84
85
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
85
|
-
tableSortColumnReorder: tableSortColumnReorder
|
|
86
|
+
tableSortColumnReorder: tableSortColumnReorder,
|
|
87
|
+
ariaNotifyPlugin: ariaNotifyPlugin
|
|
86
88
|
}));
|
|
87
89
|
};
|
|
88
90
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -9,9 +9,11 @@ exports.default = exports.TableFloatingControls = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
|
+
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
12
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _commands = require("../../commands");
|
|
14
15
|
var _types = require("../../types");
|
|
16
|
+
var _nodes = require("../../utils/nodes");
|
|
15
17
|
var _CornerControls = require("./CornerControls");
|
|
16
18
|
var _FloatingControlsWithSelection = require("./FloatingControlsWithSelection");
|
|
17
19
|
var _NumberColumn = _interopRequireDefault(require("./NumberColumn"));
|
|
@@ -19,6 +21,7 @@ var _RowControls = require("./RowControls");
|
|
|
19
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
23
|
var TableFloatingControls = exports.TableFloatingControls = function TableFloatingControls(_ref) {
|
|
24
|
+
var _findTable;
|
|
22
25
|
var editorView = _ref.editorView,
|
|
23
26
|
tableRef = _ref.tableRef,
|
|
24
27
|
tableNode = _ref.tableNode,
|
|
@@ -79,6 +82,9 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
79
82
|
}
|
|
80
83
|
var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
81
84
|
var wrapperClassName = isDragAndDropEnabled ? _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER : _types.TableCssClassName.ROW_CONTROLS_WRAPPER;
|
|
85
|
+
var tablePos = (_findTable = (0, _utils2.findTable)(editorView.state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos;
|
|
86
|
+
var isNested = tablePos !== undefined && (0, _nodes.isTableNested)(editorView.state, tablePos);
|
|
87
|
+
var shouldShowCornerControls = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24041') ? !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop) || isNested : !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop);
|
|
82
88
|
return (
|
|
83
89
|
/*#__PURE__*/
|
|
84
90
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -101,7 +107,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
101
107
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
102
108
|
stickyTop: stickyTop,
|
|
103
109
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
104
|
-
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
110
|
+
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowCornerControls && ((0, _platformFeatureFlags.fg)('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/_react.default.createElement(_CornerControls.DragCornerControlsWithSelection, {
|
|
105
111
|
editorView: editorView,
|
|
106
112
|
tableRef: tableRef,
|
|
107
113
|
isInDanger: isInDanger,
|
|
@@ -126,7 +132,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
126
132
|
selectRow: _selectRow,
|
|
127
133
|
selectRows: _selectRows,
|
|
128
134
|
updateCellHoverLocation: updateCellHoverLocation
|
|
129
|
-
})) : (0, _platformFeatureFlags.
|
|
135
|
+
})) : (0, _platformFeatureFlags.fg)('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/_react.default.createElement(_FloatingControlsWithSelection.FloatingControlsWithSelection, {
|
|
130
136
|
editorView: editorView,
|
|
131
137
|
tableRef: tableRef,
|
|
132
138
|
isInDanger: isInDanger,
|