@atlaskit/editor-plugin-table 7.6.3 → 7.6.5
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 +13 -0
- package/dist/cjs/commands/column-resize.js +62 -16
- package/dist/cjs/commands/go-to-next-cell.js +5 -2
- package/dist/cjs/commands/misc.js +3 -2
- package/dist/cjs/commands-with-analytics.js +8 -2
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/cjs/nodeviews/TableComponent.js +8 -6
- package/dist/cjs/nodeviews/TableContainer.js +32 -20
- package/dist/cjs/nodeviews/TableResizer.js +40 -28
- package/dist/cjs/plugin.js +60 -58
- package/dist/cjs/pm-plugins/keymap.js +26 -8
- package/dist/cjs/pm-plugins/main.js +15 -4
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/cjs/toolbar.js +5 -4
- package/dist/cjs/ui/DragHandle/index.js +2 -2
- package/dist/cjs/ui/DragPreview/index.js +2 -0
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/cjs/ui/LayoutButton/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/cjs/ui/common-styles.js +4 -0
- package/dist/cjs/ui/ui-styles.js +93 -37
- package/dist/cjs/utils/guidelines.js +1 -1
- package/dist/es2019/commands/column-resize.js +53 -4
- package/dist/es2019/commands/go-to-next-cell.js +5 -2
- package/dist/es2019/commands/misc.js +6 -2
- package/dist/es2019/commands-with-analytics.js +8 -2
- package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/es2019/nodeviews/TableComponent.js +9 -7
- package/dist/es2019/nodeviews/TableContainer.js +17 -3
- package/dist/es2019/nodeviews/TableResizer.js +27 -17
- package/dist/es2019/plugin.js +6 -3
- package/dist/es2019/pm-plugins/keymap.js +25 -9
- package/dist/es2019/pm-plugins/main.js +15 -4
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/es2019/toolbar.js +5 -4
- package/dist/es2019/ui/DragHandle/index.js +2 -2
- package/dist/es2019/ui/DragPreview/index.js +2 -0
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +20 -27
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/es2019/ui/LayoutButton/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/es2019/ui/common-styles.js +4 -0
- package/dist/es2019/ui/ui-styles.js +66 -70
- package/dist/es2019/utils/guidelines.js +1 -1
- package/dist/esm/commands/column-resize.js +62 -16
- package/dist/esm/commands/go-to-next-cell.js +5 -2
- package/dist/esm/commands/misc.js +3 -2
- package/dist/esm/commands-with-analytics.js +8 -2
- package/dist/esm/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/esm/nodeviews/TableComponent.js +9 -7
- package/dist/esm/nodeviews/TableContainer.js +32 -20
- package/dist/esm/nodeviews/TableResizer.js +41 -29
- package/dist/esm/plugin.js +60 -58
- package/dist/esm/pm-plugins/keymap.js +26 -8
- package/dist/esm/pm-plugins/main.js +15 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/esm/toolbar.js +5 -4
- package/dist/esm/ui/DragHandle/index.js +2 -2
- package/dist/esm/ui/DragPreview/index.js +2 -0
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/esm/ui/LayoutButton/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/esm/ui/common-styles.js +4 -0
- package/dist/esm/ui/ui-styles.js +93 -37
- package/dist/esm/utils/guidelines.js +1 -1
- package/dist/types/commands/column-resize.d.ts +23 -4
- package/dist/types/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types/commands/misc.d.ts +2 -1
- package/dist/types/commands-with-analytics.d.ts +2 -1
- package/dist/types/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types/pm-plugins/keymap.d.ts +3 -1
- package/dist/types/types.d.ts +13 -3
- package/dist/types-ts4.5/commands/column-resize.d.ts +23 -4
- package/dist/types-ts4.5/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types-ts4.5/commands/misc.d.ts +2 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -1
- package/dist/types-ts4.5/types.d.ts +13 -3
- package/package.json +3 -6
- package/src/commands/column-resize.ts +105 -29
- package/src/commands/go-to-next-cell.ts +10 -2
- package/src/commands/misc.ts +6 -3
- package/src/commands-with-analytics.ts +11 -5
- package/src/nodeviews/ExternalDropTargets.tsx +2 -0
- package/src/nodeviews/TableComponent.tsx +14 -16
- package/src/nodeviews/TableContainer.tsx +18 -3
- package/src/nodeviews/TableResizer.tsx +35 -21
- package/src/plugin.tsx +4 -1
- package/src/pm-plugins/keymap.ts +44 -6
- package/src/pm-plugins/main.ts +18 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +6 -2
- package/src/toolbar.tsx +20 -19
- package/src/types.ts +14 -2
- package/src/ui/DragHandle/index.tsx +2 -2
- package/src/ui/DragPreview/index.tsx +2 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +9 -6
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +66 -112
- package/src/ui/FloatingDeleteButton/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -12
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +19 -28
- package/src/ui/FloatingInsertButton/InsertButton.tsx +1 -0
- package/src/ui/LayoutButton/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +3 -0
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -1
- package/src/ui/common-styles.ts +2 -0
- package/src/ui/ui-styles.ts +90 -79
- package/src/utils/guidelines.ts +5 -4
package/dist/esm/plugin.js
CHANGED
|
@@ -85,7 +85,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
85
85
|
isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
|
|
86
86
|
// IMPORTANT: Need to continue to pass tableNode to control re-renders
|
|
87
87
|
// TableComponent listens for node attribute changes to update colgroups
|
|
88
|
-
tableNode: tablePluginState.tableNode
|
|
88
|
+
tableNode: tablePluginState.tableNode,
|
|
89
|
+
widthToWidest: tablePluginState.widthToWidest
|
|
89
90
|
};
|
|
90
91
|
},
|
|
91
92
|
actions: {
|
|
@@ -168,14 +169,15 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
168
169
|
// plugin as it is currently swallowing backspace events inside tables
|
|
169
170
|
{
|
|
170
171
|
name: 'tableKeymap',
|
|
171
|
-
plugin: function plugin() {
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
plugin: function plugin(_ref6) {
|
|
173
|
+
var getIntl = _ref6.getIntl;
|
|
174
|
+
var _ref7 = options || {},
|
|
175
|
+
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
176
|
+
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
177
|
+
isTableScalingEnabled = _ref7$isTableScalingE === void 0 ? false : _ref7$isTableScalingE,
|
|
178
|
+
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
179
|
+
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable;
|
|
180
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled, api, getIntl);
|
|
179
181
|
}
|
|
180
182
|
}, {
|
|
181
183
|
name: 'tableSelectionKeymap',
|
|
@@ -185,12 +187,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
185
187
|
}, {
|
|
186
188
|
name: 'tableEditing',
|
|
187
189
|
plugin: function plugin() {
|
|
188
|
-
var
|
|
189
|
-
dragAndDropEnabled =
|
|
190
|
+
var _ref8 = options || {},
|
|
191
|
+
dragAndDropEnabled = _ref8.dragAndDropEnabled;
|
|
190
192
|
return tableEditing({
|
|
191
|
-
reportFixedTable: function reportFixedTable(
|
|
192
|
-
var tr =
|
|
193
|
-
reason =
|
|
193
|
+
reportFixedTable: function reportFixedTable(_ref9) {
|
|
194
|
+
var tr = _ref9.tr,
|
|
195
|
+
reason = _ref9.reason;
|
|
194
196
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
195
197
|
action: TABLE_ACTION.FIXED,
|
|
196
198
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -206,48 +208,48 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
206
208
|
}
|
|
207
209
|
}, {
|
|
208
210
|
name: 'tableStickyHeaders',
|
|
209
|
-
plugin: function plugin(
|
|
210
|
-
var dispatch =
|
|
211
|
-
eventDispatcher =
|
|
211
|
+
plugin: function plugin(_ref10) {
|
|
212
|
+
var dispatch = _ref10.dispatch,
|
|
213
|
+
eventDispatcher = _ref10.eventDispatcher;
|
|
212
214
|
return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, function () {
|
|
213
215
|
return [];
|
|
214
216
|
}) : undefined;
|
|
215
217
|
}
|
|
216
218
|
}, {
|
|
217
219
|
name: 'tableDragAndDrop',
|
|
218
|
-
plugin: function plugin(
|
|
219
|
-
var dispatch =
|
|
220
|
+
plugin: function plugin(_ref11) {
|
|
221
|
+
var dispatch = _ref11.dispatch;
|
|
220
222
|
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI) : undefined;
|
|
221
223
|
}
|
|
222
224
|
}, {
|
|
223
225
|
name: 'tableLocalId',
|
|
224
|
-
plugin: function plugin(
|
|
225
|
-
var dispatch =
|
|
226
|
+
plugin: function plugin(_ref12) {
|
|
227
|
+
var dispatch = _ref12.dispatch;
|
|
226
228
|
return createTableLocalIdPlugin(dispatch);
|
|
227
229
|
}
|
|
228
230
|
}, {
|
|
229
231
|
name: 'tableWidth',
|
|
230
|
-
plugin: function plugin(
|
|
232
|
+
plugin: function plugin(_ref13) {
|
|
231
233
|
var _options$fullWidthEna;
|
|
232
|
-
var dispatchAnalyticsEvent =
|
|
233
|
-
dispatch =
|
|
234
|
+
var dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent,
|
|
235
|
+
dispatch = _ref13.dispatch;
|
|
234
236
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
235
237
|
}
|
|
236
238
|
},
|
|
237
239
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
238
240
|
{
|
|
239
241
|
name: 'tableOverflowAnalyticsPlugin',
|
|
240
|
-
plugin: function plugin(
|
|
242
|
+
plugin: function plugin(_ref14) {
|
|
241
243
|
var _options$tableResizin;
|
|
242
|
-
var dispatch =
|
|
243
|
-
dispatchAnalyticsEvent =
|
|
244
|
+
var dispatch = _ref14.dispatch,
|
|
245
|
+
dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent;
|
|
244
246
|
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
|
|
245
247
|
}
|
|
246
248
|
}, {
|
|
247
249
|
name: 'tableAnalyticsPlugin',
|
|
248
|
-
plugin: function plugin(
|
|
249
|
-
var dispatch =
|
|
250
|
-
dispatchAnalyticsEvent =
|
|
250
|
+
plugin: function plugin(_ref15) {
|
|
251
|
+
var dispatch = _ref15.dispatch,
|
|
252
|
+
dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
|
|
251
253
|
return getBooleanFF('platform.editor.table.analytics-plugin-moved-event') ? createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent) : undefined;
|
|
252
254
|
}
|
|
253
255
|
}, {
|
|
@@ -278,12 +280,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
278
280
|
}
|
|
279
281
|
return plugins;
|
|
280
282
|
},
|
|
281
|
-
contentComponent: function contentComponent(
|
|
282
|
-
var editorView =
|
|
283
|
-
popupsMountPoint =
|
|
284
|
-
popupsBoundariesElement =
|
|
285
|
-
popupsScrollableElement =
|
|
286
|
-
dispatchAnalyticsEvent =
|
|
283
|
+
contentComponent: function contentComponent(_ref16) {
|
|
284
|
+
var editorView = _ref16.editorView,
|
|
285
|
+
popupsMountPoint = _ref16.popupsMountPoint,
|
|
286
|
+
popupsBoundariesElement = _ref16.popupsBoundariesElement,
|
|
287
|
+
popupsScrollableElement = _ref16.popupsScrollableElement,
|
|
288
|
+
dispatchAnalyticsEvent = _ref16.dispatchAnalyticsEvent;
|
|
287
289
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
288
290
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
289
291
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -297,30 +299,30 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
297
299
|
stickyHeadersState: stickyHeadersPluginKey,
|
|
298
300
|
dragAndDropState: dragAndDropPluginKey
|
|
299
301
|
},
|
|
300
|
-
render: function render(
|
|
301
|
-
var resizingPluginState =
|
|
302
|
-
stickyHeadersState =
|
|
303
|
-
tablePluginState =
|
|
304
|
-
tableWidthPluginState =
|
|
305
|
-
dragAndDropState =
|
|
302
|
+
render: function render(_ref17) {
|
|
303
|
+
var resizingPluginState = _ref17.tableResizingPluginState,
|
|
304
|
+
stickyHeadersState = _ref17.stickyHeadersState,
|
|
305
|
+
tablePluginState = _ref17.tablePluginState,
|
|
306
|
+
tableWidthPluginState = _ref17.tableWidthPluginState,
|
|
307
|
+
dragAndDropState = _ref17.dragAndDropState;
|
|
306
308
|
var state = editorView.state;
|
|
307
309
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
308
310
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
309
311
|
var isResizing = isColumnResizing || isTableResizing;
|
|
310
|
-
var
|
|
311
|
-
tableNode =
|
|
312
|
-
tablePos =
|
|
313
|
-
targetCellPosition =
|
|
314
|
-
isContextualMenuOpen =
|
|
315
|
-
layout =
|
|
316
|
-
tableRef =
|
|
317
|
-
pluginConfig =
|
|
318
|
-
insertColumnButtonIndex =
|
|
319
|
-
insertRowButtonIndex =
|
|
320
|
-
isHeaderColumnEnabled =
|
|
321
|
-
isHeaderRowEnabled =
|
|
322
|
-
isDragAndDropEnabled =
|
|
323
|
-
tableWrapperTarget =
|
|
312
|
+
var _ref18 = tablePluginState,
|
|
313
|
+
tableNode = _ref18.tableNode,
|
|
314
|
+
tablePos = _ref18.tablePos,
|
|
315
|
+
targetCellPosition = _ref18.targetCellPosition,
|
|
316
|
+
isContextualMenuOpen = _ref18.isContextualMenuOpen,
|
|
317
|
+
layout = _ref18.layout,
|
|
318
|
+
tableRef = _ref18.tableRef,
|
|
319
|
+
pluginConfig = _ref18.pluginConfig,
|
|
320
|
+
insertColumnButtonIndex = _ref18.insertColumnButtonIndex,
|
|
321
|
+
insertRowButtonIndex = _ref18.insertRowButtonIndex,
|
|
322
|
+
isHeaderColumnEnabled = _ref18.isHeaderColumnEnabled,
|
|
323
|
+
isHeaderRowEnabled = _ref18.isHeaderRowEnabled,
|
|
324
|
+
isDragAndDropEnabled = _ref18.isDragAndDropEnabled,
|
|
325
|
+
tableWrapperTarget = _ref18.tableWrapperTarget;
|
|
324
326
|
var allowControls = pluginConfig.allowControls;
|
|
325
327
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
326
328
|
var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
@@ -401,8 +403,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
401
403
|
}));
|
|
402
404
|
},
|
|
403
405
|
pluginsOptions: {
|
|
404
|
-
quickInsert: function quickInsert(
|
|
405
|
-
var formatMessage =
|
|
406
|
+
quickInsert: function quickInsert(_ref19) {
|
|
407
|
+
var formatMessage = _ref19.formatMessage;
|
|
406
408
|
return [{
|
|
407
409
|
id: 'table',
|
|
408
410
|
title: formatMessage(messages.table),
|
|
@@ -21,11 +21,15 @@ var createTableWithAnalytics = function createTableWithAnalytics(isTableScalingE
|
|
|
21
21
|
})(editorAnalyticsAPI)(createTable(isTableScalingEnabled, isFullWidthModeEnabled));
|
|
22
22
|
};
|
|
23
23
|
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
24
|
+
var _pluginInjectionApi$a;
|
|
24
25
|
var isTableScalingEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
25
26
|
var isFullWidthEnabled = arguments.length > 4 ? arguments[4] : undefined;
|
|
27
|
+
var pluginInjectionApi = arguments.length > 5 ? arguments[5] : undefined;
|
|
28
|
+
var getIntl = arguments.length > 6 ? arguments[6] : undefined;
|
|
26
29
|
var list = {};
|
|
27
|
-
|
|
28
|
-
bindKeymapWithCommand(
|
|
30
|
+
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
31
|
+
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
32
|
+
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
29
33
|
bindKeymapWithCommand(toggleTable.common, createTableWithAnalytics(isTableScalingEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
30
34
|
bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
31
35
|
bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
|
|
@@ -54,12 +58,26 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
54
58
|
bindKeymapWithCommand(deleteRow.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
|
|
55
59
|
}
|
|
56
60
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
57
|
-
bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
bindKeymapWithCommand(
|
|
62
|
-
|
|
61
|
+
bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing({
|
|
62
|
+
ariaNotify: ariaNotifyPlugin,
|
|
63
|
+
getIntl: getIntl
|
|
64
|
+
}), list);
|
|
65
|
+
bindKeymapWithCommand(moveRight.common, activateNextResizeArea({
|
|
66
|
+
direction: 1,
|
|
67
|
+
ariaNotify: ariaNotifyPlugin,
|
|
68
|
+
getIntl: getIntl
|
|
69
|
+
}), list);
|
|
70
|
+
bindKeymapWithCommand(moveLeft.common, activateNextResizeArea({
|
|
71
|
+
direction: -1,
|
|
72
|
+
ariaNotify: ariaNotifyPlugin,
|
|
73
|
+
getIntl: getIntl
|
|
74
|
+
}), list);
|
|
75
|
+
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
76
|
+
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
77
|
+
bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing({
|
|
78
|
+
ariaNotify: ariaNotifyPlugin,
|
|
79
|
+
getIntl: getIntl
|
|
80
|
+
}), list);
|
|
63
81
|
}
|
|
64
82
|
return keymap(list);
|
|
65
83
|
}
|
|
@@ -26,6 +26,7 @@ import { defaultHoveredCell, defaultTableSelection } from './default-table-selec
|
|
|
26
26
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
27
27
|
import { pluginKey } from './plugin-key';
|
|
28
28
|
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) {
|
|
29
|
+
var _accessibilityUtils;
|
|
29
30
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
30
31
|
pluginConfig: pluginConfig,
|
|
31
32
|
isTableHovered: false,
|
|
@@ -46,6 +47,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
46
47
|
// Used to prevent invalid table cell spans being reported more than once per editor/document
|
|
47
48
|
var invalidTableIds = [];
|
|
48
49
|
var editorViewRef = null;
|
|
50
|
+
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_accessibilityUtils = pluginInjectionApi.accessibilityUtils) === null || _accessibilityUtils === void 0 ? void 0 : _accessibilityUtils.actions.ariaNotify;
|
|
49
51
|
var getCurrentEditorState = function getCurrentEditorState() {
|
|
50
52
|
var editorView = editorViewRef;
|
|
51
53
|
if (!editorView) {
|
|
@@ -107,7 +109,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
107
109
|
}
|
|
108
110
|
var tableNode = findTable(state.selection);
|
|
109
111
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
110
|
-
// when cursor leaves the table we need to stop column resizing
|
|
112
|
+
// when keyboard cursor leaves the table we need to stop column resizing
|
|
111
113
|
var pluginPrevState = getPluginState(prevState);
|
|
112
114
|
var isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
|
|
113
115
|
if (isStopKeyboardColumResizing) {
|
|
@@ -119,11 +121,17 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
119
121
|
// Add/delete row
|
|
120
122
|
tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
|
|
121
123
|
// Jump to another table
|
|
122
|
-
stopKeyboardColumnResizing(
|
|
124
|
+
stopKeyboardColumnResizing({
|
|
125
|
+
ariaNotify: ariaNotifyPlugin,
|
|
126
|
+
getIntl: getIntl
|
|
127
|
+
})(state, dispatch);
|
|
123
128
|
}
|
|
124
129
|
} else if (!tableNode) {
|
|
125
130
|
// selection outside of table
|
|
126
|
-
stopKeyboardColumnResizing(
|
|
131
|
+
stopKeyboardColumnResizing({
|
|
132
|
+
ariaNotify: ariaNotifyPlugin,
|
|
133
|
+
getIntl: getIntl
|
|
134
|
+
})(state, dispatch);
|
|
127
135
|
}
|
|
128
136
|
}
|
|
129
137
|
}
|
|
@@ -230,7 +238,10 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
230
238
|
var _getPluginState = getPluginState(state),
|
|
231
239
|
isKeyboardResize = _getPluginState.isKeyboardResize;
|
|
232
240
|
if (isKeyboardResize) {
|
|
233
|
-
stopKeyboardColumnResizing(
|
|
241
|
+
stopKeyboardColumnResizing({
|
|
242
|
+
ariaNotify: ariaNotifyPlugin,
|
|
243
|
+
getIntl: getIntl
|
|
244
|
+
})(state, dispatch);
|
|
234
245
|
return false;
|
|
235
246
|
}
|
|
236
247
|
}
|
|
@@ -123,7 +123,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
123
123
|
/** if column resize had started via keyboard but continued by mouse
|
|
124
124
|
* or mouse pointer leaves the table but mouse button still pressed
|
|
125
125
|
*/
|
|
126
|
-
return stopKeyboardColumnResizing()(state, dispatch, view);
|
|
126
|
+
return stopKeyboardColumnResizing({})(state, dispatch, view);
|
|
127
127
|
} else {
|
|
128
128
|
return stopResizing()(state, dispatch);
|
|
129
129
|
}
|
|
@@ -184,7 +184,9 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
184
184
|
/** if column resize had started via keyboard but continued by mouse
|
|
185
185
|
* or mouse pointer leaves the table but mouse button still pressed
|
|
186
186
|
*/
|
|
187
|
-
return stopKeyboardColumnResizing(
|
|
187
|
+
return stopKeyboardColumnResizing({
|
|
188
|
+
originalTr: tr
|
|
189
|
+
})(state, dispatch, view);
|
|
188
190
|
} else {
|
|
189
191
|
return stopResizing(tr)(state, dispatch);
|
|
190
192
|
}
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -15,7 +15,6 @@ import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType,
|
|
|
15
15
|
import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
16
16
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
17
17
|
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
18
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
18
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from './commands';
|
|
20
19
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
|
|
21
20
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
@@ -54,7 +53,7 @@ export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _
|
|
|
54
53
|
disabled: !state.canCollapseTable,
|
|
55
54
|
hidden: !config.allowCollapse
|
|
56
55
|
}];
|
|
57
|
-
if (state.isDragAndDropEnabled
|
|
56
|
+
if (state.isDragAndDropEnabled) {
|
|
58
57
|
return {
|
|
59
58
|
id: 'editor.table.tableOptions',
|
|
60
59
|
type: 'dropdown',
|
|
@@ -290,6 +289,7 @@ export var getClosestSelectionOrTableRect = function getClosestSelectionOrTableR
|
|
|
290
289
|
export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) {
|
|
291
290
|
return function (config) {
|
|
292
291
|
return function (state, intl) {
|
|
292
|
+
var _tableObject$node$att, _tableObject$node;
|
|
293
293
|
var tableObject = findTable(state.selection);
|
|
294
294
|
var pluginState = getPluginState(state);
|
|
295
295
|
var resizeState = tableResizingPluginKey.getState(state);
|
|
@@ -299,7 +299,8 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
299
299
|
var isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
|
|
300
300
|
var isTableScalingEnabled = pluginState.isTableScalingEnabled,
|
|
301
301
|
widthToWidest = pluginState.widthToWidest;
|
|
302
|
-
|
|
302
|
+
var currentTableNodeLocalId = (_tableObject$node$att = tableObject === null || tableObject === void 0 || (_tableObject$node = tableObject.node) === null || _tableObject$node === void 0 || (_tableObject$node = _tableObject$node.attrs) === null || _tableObject$node === void 0 ? void 0 : _tableObject$node.localId) !== null && _tableObject$node$att !== void 0 ? _tableObject$node$att : '';
|
|
303
|
+
if (isTableScalingEnabled && isWidthResizing && widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId]) {
|
|
303
304
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
304
305
|
stickyScrollbar = _getEditorFeatureFlag.stickyScrollbar;
|
|
305
306
|
var nodeType = state.schema.nodes.table;
|
|
@@ -351,7 +352,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
351
352
|
var cellItems;
|
|
352
353
|
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled);
|
|
353
354
|
var columnSettingsItems;
|
|
354
|
-
columnSettingsItems = pluginState.isDragAndDropEnabled
|
|
355
|
+
columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled) : [];
|
|
355
356
|
var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
|
|
356
357
|
|
|
357
358
|
// Check if we need to show confirm dialog for delete button
|
|
@@ -154,8 +154,8 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
154
154
|
// 16px here because it's the size of drag handle button's large side
|
|
155
155
|
width: isRow ? "var(--ds-space-200, 16px)" // 16px here because it's the size of drag handle button's large side
|
|
156
156
|
: "calc(100% - ".concat(dragTableInsertColumnButtonSize, "px)"),
|
|
157
|
-
left: isRow ?
|
|
158
|
-
bottom: isColumn ?
|
|
157
|
+
left: isRow ? "var(--ds-space-050, 4px)" : undefined,
|
|
158
|
+
bottom: isColumn ? "var(--ds-space-0, 0px)" : undefined,
|
|
159
159
|
alignSelf: isColumn ? 'none' : 'center',
|
|
160
160
|
zIndex: isColumn ? '-1' : 'auto'
|
|
161
161
|
},
|
|
@@ -24,7 +24,9 @@ export var DragPreview = function DragPreview(_ref) {
|
|
|
24
24
|
}, /*#__PURE__*/React.createElement(DragInMotionIcon, {
|
|
25
25
|
style: {
|
|
26
26
|
position: 'absolute',
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
27
28
|
marginLeft: "".concat(marginLeft, "px"),
|
|
29
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
28
30
|
marginTop: "".concat(marginTop, "px"),
|
|
29
31
|
transform: transform
|
|
30
32
|
}
|
|
@@ -92,25 +92,29 @@ export var FixedButton = function FixedButton(_ref2) {
|
|
|
92
92
|
ref: observerTargetRef,
|
|
93
93
|
style: {
|
|
94
94
|
position: 'absolute',
|
|
95
|
-
top:
|
|
96
|
-
left:
|
|
97
|
-
width: "
|
|
98
|
-
|
|
95
|
+
top: "var(--ds-space-0, 0px)",
|
|
96
|
+
left: "var(--ds-space-0, 0px)",
|
|
97
|
+
width: "var(--ds-space-250, 20px)",
|
|
98
|
+
// BUTTON_WIDTH
|
|
99
|
+
height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
|
|
99
100
|
}
|
|
100
101
|
}, /*#__PURE__*/React.createElement("div", {
|
|
101
102
|
ref: fixedButtonRef,
|
|
102
103
|
style: {
|
|
103
104
|
position: 'fixed',
|
|
105
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
104
106
|
top: stickyHeader.top + stickyHeader.padding + offset * 2,
|
|
105
107
|
zIndex: akEditorTableCellOnStickyHeaderZIndex,
|
|
108
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
106
109
|
left: calcLeftPos({
|
|
107
110
|
buttonWidth: BUTTON_WIDTH,
|
|
108
111
|
cellRectLeft: targetCellRect.left,
|
|
109
112
|
cellRefWidth: targetCellRef.clientWidth,
|
|
110
113
|
offset: offset
|
|
111
114
|
}),
|
|
112
|
-
width: "
|
|
113
|
-
|
|
115
|
+
width: "var(--ds-space-250, 20px)",
|
|
116
|
+
// BUTTON_WIDTH
|
|
117
|
+
height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
|
|
114
118
|
},
|
|
115
119
|
className: ClassName.CONTEXTUAL_MENU_BUTTON_FIXED
|
|
116
120
|
}, children)), mountTo);
|
|
@@ -80,11 +80,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
80
80
|
var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
81
81
|
var background = hexToEditorBackgroundPaletteColor((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
|
|
82
82
|
return {
|
|
83
|
-
content: isDragAndDropEnabled
|
|
83
|
+
content: isDragAndDropEnabled ? formatMessage(messages.backgroundColor) : formatMessage(messages.cellBackground),
|
|
84
84
|
value: {
|
|
85
85
|
name: 'background'
|
|
86
86
|
},
|
|
87
|
-
elemBefore: isDragAndDropEnabled
|
|
87
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
88
88
|
css: elementBeforeIconStyles
|
|
89
89
|
}, jsx(EditorBackgroundColorIcon, {
|
|
90
90
|
label: formatMessage(messages.backgroundColor),
|
|
@@ -94,7 +94,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
94
94
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
95
95
|
}, jsx("div", {
|
|
96
96
|
css: cellColourPreviewStyles(background),
|
|
97
|
-
className: isDragAndDropEnabled
|
|
97
|
+
className: isDragAndDropEnabled ? ClassName.CONTEXTUAL_MENU_ICON_SMALL : ClassName.CONTEXTUAL_MENU_ICON
|
|
98
98
|
}), isSubmenuOpen && jsx("div", {
|
|
99
99
|
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
100
100
|
ref: _this.handleSubMenuRef
|
|
@@ -126,7 +126,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
126
126
|
name: 'merge'
|
|
127
127
|
},
|
|
128
128
|
isDisabled: !canMergeCells(state.tr),
|
|
129
|
-
elemBefore: isDragAndDropEnabled
|
|
129
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
130
130
|
css: elementBeforeIconStyles
|
|
131
131
|
}, jsx(MergeCellsIcon, null)) : undefined
|
|
132
132
|
}, {
|
|
@@ -135,7 +135,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
135
135
|
name: 'split'
|
|
136
136
|
},
|
|
137
137
|
isDisabled: !splitCell(state),
|
|
138
|
-
elemBefore: isDragAndDropEnabled
|
|
138
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
139
139
|
css: elementBeforeIconStyles
|
|
140
140
|
}, jsx(SplitCellIcon, null)) : undefined
|
|
141
141
|
}];
|
|
@@ -149,14 +149,14 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
149
149
|
var _getPluginState3 = getPluginState(editorView.state),
|
|
150
150
|
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
|
|
151
151
|
return {
|
|
152
|
-
content: formatMessage(isDragAndDropEnabled
|
|
152
|
+
content: formatMessage(isDragAndDropEnabled ? messages.addColumnRight : messages.insertColumn),
|
|
153
153
|
value: {
|
|
154
154
|
name: 'insert_column'
|
|
155
155
|
},
|
|
156
156
|
elemAfter: jsx("div", {
|
|
157
157
|
css: shortcutStyle
|
|
158
158
|
}, tooltip(addColumnAfter)),
|
|
159
|
-
elemBefore: isDragAndDropEnabled
|
|
159
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
160
160
|
css: elementBeforeIconStyles
|
|
161
161
|
}, jsx(AddColRightIcon, null)) : undefined
|
|
162
162
|
};
|
|
@@ -168,14 +168,14 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
168
168
|
var _getPluginState4 = getPluginState(editorView.state),
|
|
169
169
|
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
170
170
|
return {
|
|
171
|
-
content: formatMessage(isDragAndDropEnabled
|
|
171
|
+
content: formatMessage(isDragAndDropEnabled ? messages.addRowBelow : messages.insertRow),
|
|
172
172
|
value: {
|
|
173
173
|
name: 'insert_row'
|
|
174
174
|
},
|
|
175
175
|
elemAfter: jsx("div", {
|
|
176
176
|
css: shortcutStyle
|
|
177
177
|
}, tooltip(addRowAfter)),
|
|
178
|
-
elemBefore: isDragAndDropEnabled
|
|
178
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
179
179
|
css: elementBeforeIconStyles
|
|
180
180
|
}, jsx(AddRowBelowIcon, null)) : undefined
|
|
181
181
|
};
|
|
@@ -203,7 +203,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
203
203
|
elemAfter: jsx("div", {
|
|
204
204
|
css: shortcutStyle
|
|
205
205
|
}, tooltip(backspace)),
|
|
206
|
-
elemBefore: isDragAndDropEnabled
|
|
206
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
207
207
|
css: elementBeforeIconStyles
|
|
208
208
|
}, jsx(CrossCircleIcon, {
|
|
209
209
|
label: formatMessage(messages.clearCells, {
|
|
@@ -229,7 +229,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
229
229
|
value: {
|
|
230
230
|
name: 'delete_column'
|
|
231
231
|
},
|
|
232
|
-
elemBefore: isDragAndDropEnabled
|
|
232
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
233
233
|
css: elementBeforeIconStyles
|
|
234
234
|
}, jsx(RemoveIcon, {
|
|
235
235
|
label: formatMessage(messages.removeColumns, {
|
|
@@ -255,7 +255,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
255
255
|
value: {
|
|
256
256
|
name: 'delete_row'
|
|
257
257
|
},
|
|
258
|
-
elemBefore: isDragAndDropEnabled
|
|
258
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
259
259
|
css: elementBeforeIconStyles
|
|
260
260
|
}, jsx(RemoveIcon, {
|
|
261
261
|
label: formatMessage(messages.removeRows, {
|
|
@@ -273,7 +273,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
273
273
|
var _getPluginState8 = getPluginState(editorView.state),
|
|
274
274
|
isDragAndDropEnabled = _getPluginState8.isDragAndDropEnabled,
|
|
275
275
|
allowDistributeColumns = _getPluginState8.pluginConfig.allowDistributeColumns;
|
|
276
|
-
if (allowDistributeColumns &&
|
|
276
|
+
if (allowDistributeColumns && !isDragAndDropEnabled) {
|
|
277
277
|
var _newResizeState$chang;
|
|
278
278
|
var _getPluginState9 = getPluginState(editorView.state),
|
|
279
279
|
_getPluginState9$isTa = _getPluginState9.isTableScalingEnabled,
|
|
@@ -297,7 +297,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
297
297
|
allowColumnSorting = _this$props9.allowColumnSorting;
|
|
298
298
|
var _getPluginState10 = getPluginState(editorView.state),
|
|
299
299
|
isDragAndDropEnabled = _getPluginState10.isDragAndDropEnabled;
|
|
300
|
-
if (allowColumnSorting &&
|
|
300
|
+
if (allowColumnSorting && !isDragAndDropEnabled) {
|
|
301
301
|
var hasMergedCellsInTable = getMergedCellsPositions(editorView.state.tr).length > 0;
|
|
302
302
|
var warning = hasMergedCellsInTable ? {
|
|
303
303
|
tooltipDescription: formatMessage(messages.canNotSortTable),
|
|
@@ -515,7 +515,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
515
515
|
editorView = _this$props14.editorView;
|
|
516
516
|
var _getPluginState14 = getPluginState(editorView.state),
|
|
517
517
|
isDragAndDropEnabled = _getPluginState14.isDragAndDropEnabled;
|
|
518
|
-
var items = isDragAndDropEnabled
|
|
518
|
+
var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
519
519
|
return jsx("div", {
|
|
520
520
|
"data-testid": "table-cell-contextual-menu",
|
|
521
521
|
onMouseLeave: this.closeSubmenu
|
|
@@ -538,7 +538,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
538
538
|
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
|
|
539
539
|
boundariesElement: boundariesElement,
|
|
540
540
|
offset: offset,
|
|
541
|
-
section: isDragAndDropEnabled && getBooleanFF('platform.editor.
|
|
541
|
+
section: isDragAndDropEnabled && getBooleanFF('platform.editor.menu.group-items') ? {
|
|
542
542
|
hasSeparator: true
|
|
543
543
|
} : undefined
|
|
544
544
|
}));
|
|
@@ -199,8 +199,10 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
199
199
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
200
200
|
style: {
|
|
201
201
|
position: 'fixed',
|
|
202
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
202
203
|
top: pos.top,
|
|
203
204
|
zIndex: stickyRowZIndex,
|
|
205
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
204
206
|
left: rect.left + (pos.left || 0) - (this.state.selectionType === 'column' ? this.state.scrollLeft : 0) - (this.props.isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0)
|
|
205
207
|
}
|
|
206
208
|
}, button), mountTo);
|
|
@@ -437,20 +437,20 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
437
437
|
if (!menuItems) {
|
|
438
438
|
return null;
|
|
439
439
|
}
|
|
440
|
-
if (allowBackgroundColor
|
|
440
|
+
if (allowBackgroundColor) {
|
|
441
441
|
menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
// If first row, add toggle for Header row, default is true
|
|
445
445
|
// If first column, add toggle for Header column, default is false
|
|
446
|
-
if (
|
|
446
|
+
if (index === 0) {
|
|
447
447
|
menuItems.push({
|
|
448
448
|
items: [createHeaderRowColumnMenuItem(direction)]
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
// All rows, add toggle for numbered rows, default is false
|
|
453
|
-
if (
|
|
453
|
+
if (direction === 'row') {
|
|
454
454
|
index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
|
|
455
455
|
items: [createRowNumbersMenuItem()]
|
|
456
456
|
});
|