@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/cjs/plugin.js
CHANGED
|
@@ -92,7 +92,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
92
92
|
isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
|
|
93
93
|
// IMPORTANT: Need to continue to pass tableNode to control re-renders
|
|
94
94
|
// TableComponent listens for node attribute changes to update colgroups
|
|
95
|
-
tableNode: tablePluginState.tableNode
|
|
95
|
+
tableNode: tablePluginState.tableNode,
|
|
96
|
+
widthToWidest: tablePluginState.widthToWidest
|
|
96
97
|
};
|
|
97
98
|
},
|
|
98
99
|
actions: {
|
|
@@ -175,14 +176,15 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
175
176
|
// plugin as it is currently swallowing backspace events inside tables
|
|
176
177
|
{
|
|
177
178
|
name: 'tableKeymap',
|
|
178
|
-
plugin: function plugin() {
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
plugin: function plugin(_ref6) {
|
|
180
|
+
var getIntl = _ref6.getIntl;
|
|
181
|
+
var _ref7 = options || {},
|
|
182
|
+
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
183
|
+
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
184
|
+
isTableScalingEnabled = _ref7$isTableScalingE === void 0 ? false : _ref7$isTableScalingE,
|
|
185
|
+
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
186
|
+
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable;
|
|
187
|
+
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled, api, getIntl);
|
|
186
188
|
}
|
|
187
189
|
}, {
|
|
188
190
|
name: 'tableSelectionKeymap',
|
|
@@ -192,12 +194,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
192
194
|
}, {
|
|
193
195
|
name: 'tableEditing',
|
|
194
196
|
plugin: function plugin() {
|
|
195
|
-
var
|
|
196
|
-
dragAndDropEnabled =
|
|
197
|
+
var _ref8 = options || {},
|
|
198
|
+
dragAndDropEnabled = _ref8.dragAndDropEnabled;
|
|
197
199
|
return (0, _pmPlugins.tableEditing)({
|
|
198
|
-
reportFixedTable: function reportFixedTable(
|
|
199
|
-
var tr =
|
|
200
|
-
reason =
|
|
200
|
+
reportFixedTable: function reportFixedTable(_ref9) {
|
|
201
|
+
var tr = _ref9.tr,
|
|
202
|
+
reason = _ref9.reason;
|
|
201
203
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
202
204
|
action: _analytics.TABLE_ACTION.FIXED,
|
|
203
205
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -213,48 +215,48 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
213
215
|
}
|
|
214
216
|
}, {
|
|
215
217
|
name: 'tableStickyHeaders',
|
|
216
|
-
plugin: function plugin(
|
|
217
|
-
var dispatch =
|
|
218
|
-
eventDispatcher =
|
|
218
|
+
plugin: function plugin(_ref10) {
|
|
219
|
+
var dispatch = _ref10.dispatch,
|
|
220
|
+
eventDispatcher = _ref10.eventDispatcher;
|
|
219
221
|
return options && options.tableOptions.stickyHeaders ? (0, _stickyHeaders.createPlugin)(dispatch, function () {
|
|
220
222
|
return [];
|
|
221
223
|
}) : undefined;
|
|
222
224
|
}
|
|
223
225
|
}, {
|
|
224
226
|
name: 'tableDragAndDrop',
|
|
225
|
-
plugin: function plugin(
|
|
226
|
-
var dispatch =
|
|
227
|
+
plugin: function plugin(_ref11) {
|
|
228
|
+
var dispatch = _ref11.dispatch;
|
|
227
229
|
return options !== null && options !== void 0 && options.dragAndDropEnabled ? (0, _dragAndDrop.createPlugin)(dispatch, editorAnalyticsAPI) : undefined;
|
|
228
230
|
}
|
|
229
231
|
}, {
|
|
230
232
|
name: 'tableLocalId',
|
|
231
|
-
plugin: function plugin(
|
|
232
|
-
var dispatch =
|
|
233
|
+
plugin: function plugin(_ref12) {
|
|
234
|
+
var dispatch = _ref12.dispatch;
|
|
233
235
|
return (0, _tableLocalId.createPlugin)(dispatch);
|
|
234
236
|
}
|
|
235
237
|
}, {
|
|
236
238
|
name: 'tableWidth',
|
|
237
|
-
plugin: function plugin(
|
|
239
|
+
plugin: function plugin(_ref13) {
|
|
238
240
|
var _options$fullWidthEna;
|
|
239
|
-
var dispatchAnalyticsEvent =
|
|
240
|
-
dispatch =
|
|
241
|
+
var dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent,
|
|
242
|
+
dispatch = _ref13.dispatch;
|
|
241
243
|
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) : undefined;
|
|
242
244
|
}
|
|
243
245
|
},
|
|
244
246
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
245
247
|
{
|
|
246
248
|
name: 'tableOverflowAnalyticsPlugin',
|
|
247
|
-
plugin: function plugin(
|
|
249
|
+
plugin: function plugin(_ref14) {
|
|
248
250
|
var _options$tableResizin;
|
|
249
|
-
var dispatch =
|
|
250
|
-
dispatchAnalyticsEvent =
|
|
251
|
+
var dispatch = _ref14.dispatch,
|
|
252
|
+
dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent;
|
|
251
253
|
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);
|
|
252
254
|
}
|
|
253
255
|
}, {
|
|
254
256
|
name: 'tableAnalyticsPlugin',
|
|
255
|
-
plugin: function plugin(
|
|
256
|
-
var dispatch =
|
|
257
|
-
dispatchAnalyticsEvent =
|
|
257
|
+
plugin: function plugin(_ref15) {
|
|
258
|
+
var dispatch = _ref15.dispatch,
|
|
259
|
+
dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
|
|
258
260
|
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.analytics-plugin-moved-event') ? (0, _plugin.createPlugin)(dispatch, dispatchAnalyticsEvent) : undefined;
|
|
259
261
|
}
|
|
260
262
|
}, {
|
|
@@ -285,12 +287,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
285
287
|
}
|
|
286
288
|
return plugins;
|
|
287
289
|
},
|
|
288
|
-
contentComponent: function contentComponent(
|
|
289
|
-
var editorView =
|
|
290
|
-
popupsMountPoint =
|
|
291
|
-
popupsBoundariesElement =
|
|
292
|
-
popupsScrollableElement =
|
|
293
|
-
dispatchAnalyticsEvent =
|
|
290
|
+
contentComponent: function contentComponent(_ref16) {
|
|
291
|
+
var editorView = _ref16.editorView,
|
|
292
|
+
popupsMountPoint = _ref16.popupsMountPoint,
|
|
293
|
+
popupsBoundariesElement = _ref16.popupsBoundariesElement,
|
|
294
|
+
popupsScrollableElement = _ref16.popupsScrollableElement,
|
|
295
|
+
dispatchAnalyticsEvent = _ref16.dispatchAnalyticsEvent;
|
|
294
296
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
295
297
|
component: _analytics.ACTION_SUBJECT.TABLES_PLUGIN,
|
|
296
298
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -304,30 +306,30 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
304
306
|
stickyHeadersState: _stickyHeaders.pluginKey,
|
|
305
307
|
dragAndDropState: _dragAndDrop.pluginKey
|
|
306
308
|
},
|
|
307
|
-
render: function render(
|
|
308
|
-
var resizingPluginState =
|
|
309
|
-
stickyHeadersState =
|
|
310
|
-
tablePluginState =
|
|
311
|
-
tableWidthPluginState =
|
|
312
|
-
dragAndDropState =
|
|
309
|
+
render: function render(_ref17) {
|
|
310
|
+
var resizingPluginState = _ref17.tableResizingPluginState,
|
|
311
|
+
stickyHeadersState = _ref17.stickyHeadersState,
|
|
312
|
+
tablePluginState = _ref17.tablePluginState,
|
|
313
|
+
tableWidthPluginState = _ref17.tableWidthPluginState,
|
|
314
|
+
dragAndDropState = _ref17.dragAndDropState;
|
|
313
315
|
var state = editorView.state;
|
|
314
316
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
315
317
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
316
318
|
var isResizing = isColumnResizing || isTableResizing;
|
|
317
|
-
var
|
|
318
|
-
tableNode =
|
|
319
|
-
tablePos =
|
|
320
|
-
targetCellPosition =
|
|
321
|
-
isContextualMenuOpen =
|
|
322
|
-
layout =
|
|
323
|
-
tableRef =
|
|
324
|
-
pluginConfig =
|
|
325
|
-
insertColumnButtonIndex =
|
|
326
|
-
insertRowButtonIndex =
|
|
327
|
-
isHeaderColumnEnabled =
|
|
328
|
-
isHeaderRowEnabled =
|
|
329
|
-
isDragAndDropEnabled =
|
|
330
|
-
tableWrapperTarget =
|
|
319
|
+
var _ref18 = tablePluginState,
|
|
320
|
+
tableNode = _ref18.tableNode,
|
|
321
|
+
tablePos = _ref18.tablePos,
|
|
322
|
+
targetCellPosition = _ref18.targetCellPosition,
|
|
323
|
+
isContextualMenuOpen = _ref18.isContextualMenuOpen,
|
|
324
|
+
layout = _ref18.layout,
|
|
325
|
+
tableRef = _ref18.tableRef,
|
|
326
|
+
pluginConfig = _ref18.pluginConfig,
|
|
327
|
+
insertColumnButtonIndex = _ref18.insertColumnButtonIndex,
|
|
328
|
+
insertRowButtonIndex = _ref18.insertRowButtonIndex,
|
|
329
|
+
isHeaderColumnEnabled = _ref18.isHeaderColumnEnabled,
|
|
330
|
+
isHeaderRowEnabled = _ref18.isHeaderRowEnabled,
|
|
331
|
+
isDragAndDropEnabled = _ref18.isDragAndDropEnabled,
|
|
332
|
+
tableWrapperTarget = _ref18.tableWrapperTarget;
|
|
331
333
|
var allowControls = pluginConfig.allowControls;
|
|
332
334
|
var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
333
335
|
var LayoutContent = options && !options.tableResizingEnabled && (0, _utils2.isLayoutSupported)(state) && options.breakoutEnabled ? /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
|
|
@@ -408,8 +410,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
408
410
|
}));
|
|
409
411
|
},
|
|
410
412
|
pluginsOptions: {
|
|
411
|
-
quickInsert: function quickInsert(
|
|
412
|
-
var formatMessage =
|
|
413
|
+
quickInsert: function quickInsert(_ref19) {
|
|
414
|
+
var formatMessage = _ref19.formatMessage;
|
|
413
415
|
return [{
|
|
414
416
|
id: 'table',
|
|
415
417
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -28,11 +28,15 @@ var createTableWithAnalytics = function createTableWithAnalytics(isTableScalingE
|
|
|
28
28
|
})(editorAnalyticsAPI)((0, _commands2.createTable)(isTableScalingEnabled, isFullWidthModeEnabled));
|
|
29
29
|
};
|
|
30
30
|
function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
31
|
+
var _pluginInjectionApi$a;
|
|
31
32
|
var isTableScalingEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
32
33
|
var isFullWidthEnabled = arguments.length > 4 ? arguments[4] : undefined;
|
|
34
|
+
var pluginInjectionApi = arguments.length > 5 ? arguments[5] : undefined;
|
|
35
|
+
var getIntl = arguments.length > 6 ? arguments[6] : undefined;
|
|
33
36
|
var list = {};
|
|
34
|
-
|
|
35
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.
|
|
37
|
+
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
38
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.nextCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
39
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.previousCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
36
40
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.toggleTable.common, createTableWithAnalytics(isTableScalingEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
37
41
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, (0, _commands.chainCommands)((0, _commandsWithAnalytics.deleteTableIfSelectedWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), (0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)), list);
|
|
38
42
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, _commands2.moveCursorBackward, list);
|
|
@@ -61,12 +65,26 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
|
|
|
61
65
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteRow.common, (0, _commandsWithAnalytics.deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut)(editorAnalyticsAPI), list);
|
|
62
66
|
}
|
|
63
67
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
64
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.startColumnResizing.common, _columnResize.initiateKeyboardColumnResizing
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.
|
|
69
|
-
|
|
68
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.startColumnResizing.common, (0, _columnResize.initiateKeyboardColumnResizing)({
|
|
69
|
+
ariaNotify: ariaNotifyPlugin,
|
|
70
|
+
getIntl: getIntl
|
|
71
|
+
}), list);
|
|
72
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _columnResize.activateNextResizeArea)({
|
|
73
|
+
direction: 1,
|
|
74
|
+
ariaNotify: ariaNotifyPlugin,
|
|
75
|
+
getIntl: getIntl
|
|
76
|
+
}), list);
|
|
77
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _columnResize.activateNextResizeArea)({
|
|
78
|
+
direction: -1,
|
|
79
|
+
ariaNotify: ariaNotifyPlugin,
|
|
80
|
+
getIntl: getIntl
|
|
81
|
+
}), list);
|
|
82
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.decreaseMediaSize.common, (0, _commandsWithAnalytics.changeColumnWidthByStepWithAnalytics)(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, _analytics.INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
83
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.increaseMediaSize.common, (0, _commandsWithAnalytics.changeColumnWidthByStepWithAnalytics)(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, _analytics.INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
84
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, (0, _columnResize.stopKeyboardColumnResizing)({
|
|
85
|
+
ariaNotify: ariaNotifyPlugin,
|
|
86
|
+
getIntl: getIntl
|
|
87
|
+
}), list);
|
|
70
88
|
}
|
|
71
89
|
return (0, _keymap.keymap)(list);
|
|
72
90
|
}
|
|
@@ -33,6 +33,7 @@ var _pluginKey = require("./plugin-key");
|
|
|
33
33
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
34
34
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
35
|
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) {
|
|
36
|
+
var _accessibilityUtils;
|
|
36
37
|
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
37
38
|
pluginConfig: pluginConfig,
|
|
38
39
|
isTableHovered: false,
|
|
@@ -53,6 +54,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
53
54
|
// Used to prevent invalid table cell spans being reported more than once per editor/document
|
|
54
55
|
var invalidTableIds = [];
|
|
55
56
|
var editorViewRef = null;
|
|
57
|
+
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_accessibilityUtils = pluginInjectionApi.accessibilityUtils) === null || _accessibilityUtils === void 0 ? void 0 : _accessibilityUtils.actions.ariaNotify;
|
|
56
58
|
var getCurrentEditorState = function getCurrentEditorState() {
|
|
57
59
|
var editorView = editorViewRef;
|
|
58
60
|
if (!editorView) {
|
|
@@ -114,7 +116,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
114
116
|
}
|
|
115
117
|
var tableNode = (0, _utils3.findTable)(state.selection);
|
|
116
118
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
117
|
-
// when cursor leaves the table we need to stop column resizing
|
|
119
|
+
// when keyboard cursor leaves the table we need to stop column resizing
|
|
118
120
|
var pluginPrevState = (0, _pluginFactory.getPluginState)(prevState);
|
|
119
121
|
var isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
|
|
120
122
|
if (isStopKeyboardColumResizing) {
|
|
@@ -126,11 +128,17 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
126
128
|
// Add/delete row
|
|
127
129
|
tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
|
|
128
130
|
// Jump to another table
|
|
129
|
-
(0, _columnResize.stopKeyboardColumnResizing)(
|
|
131
|
+
(0, _columnResize.stopKeyboardColumnResizing)({
|
|
132
|
+
ariaNotify: ariaNotifyPlugin,
|
|
133
|
+
getIntl: getIntl
|
|
134
|
+
})(state, dispatch);
|
|
130
135
|
}
|
|
131
136
|
} else if (!tableNode) {
|
|
132
137
|
// selection outside of table
|
|
133
|
-
(0, _columnResize.stopKeyboardColumnResizing)(
|
|
138
|
+
(0, _columnResize.stopKeyboardColumnResizing)({
|
|
139
|
+
ariaNotify: ariaNotifyPlugin,
|
|
140
|
+
getIntl: getIntl
|
|
141
|
+
})(state, dispatch);
|
|
134
142
|
}
|
|
135
143
|
}
|
|
136
144
|
}
|
|
@@ -237,7 +245,10 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
237
245
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
238
246
|
isKeyboardResize = _getPluginState.isKeyboardResize;
|
|
239
247
|
if (isKeyboardResize) {
|
|
240
|
-
(0, _columnResize.stopKeyboardColumnResizing)(
|
|
248
|
+
(0, _columnResize.stopKeyboardColumnResizing)({
|
|
249
|
+
ariaNotify: ariaNotifyPlugin,
|
|
250
|
+
getIntl: getIntl
|
|
251
|
+
})(state, dispatch);
|
|
241
252
|
return false;
|
|
242
253
|
}
|
|
243
254
|
}
|
|
@@ -129,7 +129,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
129
129
|
/** if column resize had started via keyboard but continued by mouse
|
|
130
130
|
* or mouse pointer leaves the table but mouse button still pressed
|
|
131
131
|
*/
|
|
132
|
-
return (0, _columnResize.stopKeyboardColumnResizing)()(state, dispatch, view);
|
|
132
|
+
return (0, _columnResize.stopKeyboardColumnResizing)({})(state, dispatch, view);
|
|
133
133
|
} else {
|
|
134
134
|
return (0, _commands.stopResizing)()(state, dispatch);
|
|
135
135
|
}
|
|
@@ -190,7 +190,9 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
190
190
|
/** if column resize had started via keyboard but continued by mouse
|
|
191
191
|
* or mouse pointer leaves the table but mouse button still pressed
|
|
192
192
|
*/
|
|
193
|
-
return (0, _columnResize.stopKeyboardColumnResizing)(
|
|
193
|
+
return (0, _columnResize.stopKeyboardColumnResizing)({
|
|
194
|
+
originalTr: tr
|
|
195
|
+
})(state, dispatch, view);
|
|
194
196
|
} else {
|
|
195
197
|
return (0, _commands.stopResizing)(tr)(state, dispatch);
|
|
196
198
|
}
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -22,7 +22,6 @@ var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
|
22
22
|
var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-three-equal"));
|
|
23
23
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
24
24
|
var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
|
|
25
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
25
|
var _commands = require("./commands");
|
|
27
26
|
var _commandsWithAnalytics = require("./commands-with-analytics");
|
|
28
27
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
@@ -65,7 +64,7 @@ var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMen
|
|
|
65
64
|
disabled: !state.canCollapseTable,
|
|
66
65
|
hidden: !config.allowCollapse
|
|
67
66
|
}];
|
|
68
|
-
if (state.isDragAndDropEnabled
|
|
67
|
+
if (state.isDragAndDropEnabled) {
|
|
69
68
|
return {
|
|
70
69
|
id: 'editor.table.tableOptions',
|
|
71
70
|
type: 'dropdown',
|
|
@@ -301,6 +300,7 @@ var getClosestSelectionOrTableRect = exports.getClosestSelectionOrTableRect = fu
|
|
|
301
300
|
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) {
|
|
302
301
|
return function (config) {
|
|
303
302
|
return function (state, intl) {
|
|
303
|
+
var _tableObject$node$att, _tableObject$node;
|
|
304
304
|
var tableObject = (0, _utils3.findTable)(state.selection);
|
|
305
305
|
var pluginState = (0, _pluginFactory.getPluginState)(state);
|
|
306
306
|
var resizeState = _tableResizing.pluginKey.getState(state);
|
|
@@ -310,7 +310,8 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
310
310
|
var isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
|
|
311
311
|
var isTableScalingEnabled = pluginState.isTableScalingEnabled,
|
|
312
312
|
widthToWidest = pluginState.widthToWidest;
|
|
313
|
-
|
|
313
|
+
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 : '';
|
|
314
|
+
if (isTableScalingEnabled && isWidthResizing && widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId]) {
|
|
314
315
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
315
316
|
stickyScrollbar = _getEditorFeatureFlag.stickyScrollbar;
|
|
316
317
|
var nodeType = state.schema.nodes.table;
|
|
@@ -362,7 +363,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
362
363
|
var cellItems;
|
|
363
364
|
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled);
|
|
364
365
|
var columnSettingsItems;
|
|
365
|
-
columnSettingsItems = pluginState.isDragAndDropEnabled
|
|
366
|
+
columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled) : [];
|
|
366
367
|
var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
|
|
367
368
|
|
|
368
369
|
// Check if we need to show confirm dialog for delete button
|
|
@@ -164,8 +164,8 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
164
164
|
// 16px here because it's the size of drag handle button's large side
|
|
165
165
|
width: isRow ? "var(--ds-space-200, 16px)" // 16px here because it's the size of drag handle button's large side
|
|
166
166
|
: "calc(100% - ".concat(_consts.dragTableInsertColumnButtonSize, "px)"),
|
|
167
|
-
left: isRow ?
|
|
168
|
-
bottom: isColumn ?
|
|
167
|
+
left: isRow ? "var(--ds-space-050, 4px)" : undefined,
|
|
168
|
+
bottom: isColumn ? "var(--ds-space-0, 0px)" : undefined,
|
|
169
169
|
alignSelf: isColumn ? 'none' : 'center',
|
|
170
170
|
zIndex: isColumn ? '-1' : 'auto'
|
|
171
171
|
},
|
|
@@ -31,7 +31,9 @@ var DragPreview = exports.DragPreview = function DragPreview(_ref) {
|
|
|
31
31
|
}, /*#__PURE__*/_react.default.createElement(_DragInMotionIcon.DragInMotionIcon, {
|
|
32
32
|
style: {
|
|
33
33
|
position: 'absolute',
|
|
34
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
34
35
|
marginLeft: "".concat(marginLeft, "px"),
|
|
36
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
35
37
|
marginTop: "".concat(marginTop, "px"),
|
|
36
38
|
transform: transform
|
|
37
39
|
}
|
|
@@ -102,25 +102,29 @@ var FixedButton = exports.FixedButton = function FixedButton(_ref2) {
|
|
|
102
102
|
ref: observerTargetRef,
|
|
103
103
|
style: {
|
|
104
104
|
position: 'absolute',
|
|
105
|
-
top:
|
|
106
|
-
left:
|
|
107
|
-
width: "
|
|
108
|
-
|
|
105
|
+
top: "var(--ds-space-0, 0px)",
|
|
106
|
+
left: "var(--ds-space-0, 0px)",
|
|
107
|
+
width: "var(--ds-space-250, 20px)",
|
|
108
|
+
// BUTTON_WIDTH
|
|
109
|
+
height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
|
|
109
110
|
}
|
|
110
111
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
111
112
|
ref: fixedButtonRef,
|
|
112
113
|
style: {
|
|
113
114
|
position: 'fixed',
|
|
115
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
114
116
|
top: stickyHeader.top + stickyHeader.padding + offset * 2,
|
|
115
117
|
zIndex: _editorSharedStyles.akEditorTableCellOnStickyHeaderZIndex,
|
|
118
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
116
119
|
left: calcLeftPos({
|
|
117
120
|
buttonWidth: BUTTON_WIDTH,
|
|
118
121
|
cellRectLeft: targetCellRect.left,
|
|
119
122
|
cellRefWidth: targetCellRef.clientWidth,
|
|
120
123
|
offset: offset
|
|
121
124
|
}),
|
|
122
|
-
width: "
|
|
123
|
-
|
|
125
|
+
width: "var(--ds-space-250, 20px)",
|
|
126
|
+
// BUTTON_WIDTH
|
|
127
|
+
height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
|
|
124
128
|
},
|
|
125
129
|
className: _types.TableCssClassName.CONTEXTUAL_MENU_BUTTON_FIXED
|
|
126
130
|
}, children)), mountTo);
|
|
@@ -85,11 +85,11 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
85
85
|
var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
86
86
|
var background = (0, _editorPalette.hexToEditorBackgroundPaletteColor)((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
|
|
87
87
|
return {
|
|
88
|
-
content: isDragAndDropEnabled
|
|
88
|
+
content: isDragAndDropEnabled ? formatMessage(_messages.tableMessages.backgroundColor) : formatMessage(_messages.tableMessages.cellBackground),
|
|
89
89
|
value: {
|
|
90
90
|
name: 'background'
|
|
91
91
|
},
|
|
92
|
-
elemBefore: isDragAndDropEnabled
|
|
92
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
93
93
|
css: _styles2.elementBeforeIconStyles
|
|
94
94
|
}, (0, _react2.jsx)(_backgroundColor.default, {
|
|
95
95
|
label: formatMessage(_messages.tableMessages.backgroundColor),
|
|
@@ -99,7 +99,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
99
99
|
className: _styles.DropdownMenuSharedCssClassName.SUBMENU
|
|
100
100
|
}, (0, _react2.jsx)("div", {
|
|
101
101
|
css: (0, _styles2.cellColourPreviewStyles)(background),
|
|
102
|
-
className: isDragAndDropEnabled
|
|
102
|
+
className: isDragAndDropEnabled ? _types.TableCssClassName.CONTEXTUAL_MENU_ICON_SMALL : _types.TableCssClassName.CONTEXTUAL_MENU_ICON
|
|
103
103
|
}), isSubmenuOpen && (0, _react2.jsx)("div", {
|
|
104
104
|
className: _types.TableCssClassName.CONTEXTUAL_SUBMENU,
|
|
105
105
|
ref: _this.handleSubMenuRef
|
|
@@ -131,7 +131,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
131
131
|
name: 'merge'
|
|
132
132
|
},
|
|
133
133
|
isDisabled: !(0, _transforms.canMergeCells)(state.tr),
|
|
134
|
-
elemBefore: isDragAndDropEnabled
|
|
134
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
135
135
|
css: _styles2.elementBeforeIconStyles
|
|
136
136
|
}, (0, _react2.jsx)(_icons.MergeCellsIcon, null)) : undefined
|
|
137
137
|
}, {
|
|
@@ -140,7 +140,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
140
140
|
name: 'split'
|
|
141
141
|
},
|
|
142
142
|
isDisabled: !(0, _utils2.splitCell)(state),
|
|
143
|
-
elemBefore: isDragAndDropEnabled
|
|
143
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
144
144
|
css: _styles2.elementBeforeIconStyles
|
|
145
145
|
}, (0, _react2.jsx)(_icons.SplitCellIcon, null)) : undefined
|
|
146
146
|
}];
|
|
@@ -154,14 +154,14 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
154
154
|
var _getPluginState3 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
155
155
|
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
|
|
156
156
|
return {
|
|
157
|
-
content: formatMessage(isDragAndDropEnabled
|
|
157
|
+
content: formatMessage(isDragAndDropEnabled ? _messages.tableMessages.addColumnRight : _messages.tableMessages.insertColumn),
|
|
158
158
|
value: {
|
|
159
159
|
name: 'insert_column'
|
|
160
160
|
},
|
|
161
161
|
elemAfter: (0, _react2.jsx)("div", {
|
|
162
162
|
css: _shortcut.shortcutStyle
|
|
163
163
|
}, (0, _keymaps.tooltip)(_keymaps.addColumnAfter)),
|
|
164
|
-
elemBefore: isDragAndDropEnabled
|
|
164
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
165
165
|
css: _styles2.elementBeforeIconStyles
|
|
166
166
|
}, (0, _react2.jsx)(_icons.AddColRightIcon, null)) : undefined
|
|
167
167
|
};
|
|
@@ -173,14 +173,14 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
173
173
|
var _getPluginState4 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
174
174
|
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
175
175
|
return {
|
|
176
|
-
content: formatMessage(isDragAndDropEnabled
|
|
176
|
+
content: formatMessage(isDragAndDropEnabled ? _messages.tableMessages.addRowBelow : _messages.tableMessages.insertRow),
|
|
177
177
|
value: {
|
|
178
178
|
name: 'insert_row'
|
|
179
179
|
},
|
|
180
180
|
elemAfter: (0, _react2.jsx)("div", {
|
|
181
181
|
css: _shortcut.shortcutStyle
|
|
182
182
|
}, (0, _keymaps.tooltip)(_keymaps.addRowAfter)),
|
|
183
|
-
elemBefore: isDragAndDropEnabled
|
|
183
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
184
184
|
css: _styles2.elementBeforeIconStyles
|
|
185
185
|
}, (0, _react2.jsx)(_icons.AddRowBelowIcon, null)) : undefined
|
|
186
186
|
};
|
|
@@ -208,7 +208,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
208
208
|
elemAfter: (0, _react2.jsx)("div", {
|
|
209
209
|
css: _shortcut.shortcutStyle
|
|
210
210
|
}, (0, _keymaps.tooltip)(_keymaps.backspace)),
|
|
211
|
-
elemBefore: isDragAndDropEnabled
|
|
211
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
212
212
|
css: _styles2.elementBeforeIconStyles
|
|
213
213
|
}, (0, _react2.jsx)(_crossCircle.default, {
|
|
214
214
|
label: formatMessage(_messages.tableMessages.clearCells, {
|
|
@@ -234,7 +234,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
234
234
|
value: {
|
|
235
235
|
name: 'delete_column'
|
|
236
236
|
},
|
|
237
|
-
elemBefore: isDragAndDropEnabled
|
|
237
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
238
238
|
css: _styles2.elementBeforeIconStyles
|
|
239
239
|
}, (0, _react2.jsx)(_remove.default, {
|
|
240
240
|
label: formatMessage(_messages.tableMessages.removeColumns, {
|
|
@@ -260,7 +260,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
260
260
|
value: {
|
|
261
261
|
name: 'delete_row'
|
|
262
262
|
},
|
|
263
|
-
elemBefore: isDragAndDropEnabled
|
|
263
|
+
elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
|
|
264
264
|
css: _styles2.elementBeforeIconStyles
|
|
265
265
|
}, (0, _react2.jsx)(_remove.default, {
|
|
266
266
|
label: formatMessage(_messages.tableMessages.removeRows, {
|
|
@@ -278,7 +278,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
278
278
|
var _getPluginState8 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
279
279
|
isDragAndDropEnabled = _getPluginState8.isDragAndDropEnabled,
|
|
280
280
|
allowDistributeColumns = _getPluginState8.pluginConfig.allowDistributeColumns;
|
|
281
|
-
if (allowDistributeColumns &&
|
|
281
|
+
if (allowDistributeColumns && !isDragAndDropEnabled) {
|
|
282
282
|
var _newResizeState$chang;
|
|
283
283
|
var _getPluginState9 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
284
284
|
_getPluginState9$isTa = _getPluginState9.isTableScalingEnabled,
|
|
@@ -302,7 +302,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
302
302
|
allowColumnSorting = _this$props9.allowColumnSorting;
|
|
303
303
|
var _getPluginState10 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
304
304
|
isDragAndDropEnabled = _getPluginState10.isDragAndDropEnabled;
|
|
305
|
-
if (allowColumnSorting &&
|
|
305
|
+
if (allowColumnSorting && !isDragAndDropEnabled) {
|
|
306
306
|
var hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(editorView.state.tr).length > 0;
|
|
307
307
|
var warning = hasMergedCellsInTable ? {
|
|
308
308
|
tooltipDescription: formatMessage(_messages.tableMessages.canNotSortTable),
|
|
@@ -520,7 +520,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
520
520
|
editorView = _this$props14.editorView;
|
|
521
521
|
var _getPluginState14 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
522
522
|
isDragAndDropEnabled = _getPluginState14.isDragAndDropEnabled;
|
|
523
|
-
var items = isDragAndDropEnabled
|
|
523
|
+
var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
524
524
|
return (0, _react2.jsx)("div", {
|
|
525
525
|
"data-testid": "table-cell-contextual-menu",
|
|
526
526
|
onMouseLeave: this.closeSubmenu
|
|
@@ -543,7 +543,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
543
543
|
fitWidth: isDragAndDropEnabled ? _consts.contextualMenuDropdownWidthDnD : _consts.contextualMenuDropdownWidth,
|
|
544
544
|
boundariesElement: boundariesElement,
|
|
545
545
|
offset: offset,
|
|
546
|
-
section: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.
|
|
546
|
+
section: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.menu.group-items') ? {
|
|
547
547
|
hasSeparator: true
|
|
548
548
|
} : undefined
|
|
549
549
|
}));
|
|
@@ -210,8 +210,10 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
210
210
|
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", {
|
|
211
211
|
style: {
|
|
212
212
|
position: 'fixed',
|
|
213
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
213
214
|
top: pos.top,
|
|
214
215
|
zIndex: _consts.stickyRowZIndex,
|
|
216
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
215
217
|
left: rect.left + (pos.left || 0) - (this.state.selectionType === 'column' ? this.state.scrollLeft : 0) - (this.props.isNumberColumnEnabled ? _editorSharedStyles.akEditorTableNumberColumnWidth : 0)
|
|
216
218
|
}
|
|
217
219
|
}, button), mountTo);
|
|
@@ -448,20 +448,20 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
448
448
|
if (!menuItems) {
|
|
449
449
|
return null;
|
|
450
450
|
}
|
|
451
|
-
if (allowBackgroundColor
|
|
451
|
+
if (allowBackgroundColor) {
|
|
452
452
|
menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
// If first row, add toggle for Header row, default is true
|
|
456
456
|
// If first column, add toggle for Header column, default is false
|
|
457
|
-
if (
|
|
457
|
+
if (index === 0) {
|
|
458
458
|
menuItems.push({
|
|
459
459
|
items: [createHeaderRowColumnMenuItem(direction)]
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
// All rows, add toggle for numbered rows, default is false
|
|
464
|
-
if (
|
|
464
|
+
if (direction === 'row') {
|
|
465
465
|
index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
|
|
466
466
|
items: [createRowNumbersMenuItem()]
|
|
467
467
|
});
|