@atlaskit/editor-plugin-table 7.31.0 → 7.31.2
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 +17 -0
- package/dist/cjs/commands/column-resize.js +10 -8
- package/dist/cjs/commands/misc.js +4 -4
- package/dist/cjs/event-handlers.js +69 -65
- package/dist/cjs/plugin.js +52 -48
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/cjs/pm-plugins/keymap.js +18 -15
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +12 -17
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +8 -11
- package/dist/cjs/ui/FloatingDragMenu/index.js +1 -4
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -2
- package/dist/cjs/utils/decoration.js +28 -8
- package/dist/cjs/utils/drag-menu.js +3 -4
- package/dist/es2019/commands/column-resize.js +10 -8
- package/dist/es2019/commands/misc.js +4 -4
- package/dist/es2019/event-handlers.js +4 -4
- package/dist/es2019/plugin.js +12 -7
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/es2019/pm-plugins/keymap.js +7 -4
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +33 -10
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +1 -8
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +8 -9
- package/dist/es2019/ui/FloatingDragMenu/index.js +1 -3
- package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
- package/dist/es2019/utils/decoration.js +26 -9
- package/dist/es2019/utils/drag-menu.js +2 -2
- package/dist/esm/commands/column-resize.js +10 -8
- package/dist/esm/commands/misc.js +4 -4
- package/dist/esm/event-handlers.js +69 -65
- package/dist/esm/plugin.js +52 -48
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/esm/pm-plugins/keymap.js +18 -15
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +12 -17
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +8 -11
- package/dist/esm/ui/FloatingDragMenu/index.js +1 -4
- package/dist/esm/ui/FloatingDragMenu/styles.js +1 -2
- package/dist/esm/utils/decoration.js +28 -8
- package/dist/esm/utils/drag-menu.js +3 -4
- package/dist/types/commands/column-resize.d.ts +5 -2
- package/dist/types/commands/misc.d.ts +3 -2
- package/dist/types/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +1 -1
- package/dist/types/utils/decoration.d.ts +2 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +5 -2
- package/dist/types-ts4.5/commands/misc.d.ts +3 -2
- package/dist/types-ts4.5/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/decoration.d.ts +2 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +9 -5
- package/src/commands/column-resize.ts +18 -1
- package/src/commands/misc.ts +5 -0
- package/src/event-handlers.ts +22 -20
- package/src/plugin.tsx +10 -4
- package/src/pm-plugins/decorations/utils/column-resizing.ts +3 -0
- package/src/pm-plugins/keymap.ts +5 -0
- package/src/pm-plugins/main.ts +2 -1
- package/src/pm-plugins/table-resizing/event-handlers.ts +8 -1
- package/src/pm-plugins/table-resizing/plugin.ts +3 -0
- package/src/pm-plugins/view-mode-sort/index.ts +73 -34
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -5
- package/src/ui/FloatingDragMenu/DragMenu.tsx +5 -14
- package/src/ui/FloatingDragMenu/index.tsx +2 -6
- package/src/ui/FloatingDragMenu/styles.ts +4 -6
- package/src/utils/decoration.ts +39 -13
- package/src/utils/drag-menu.ts +1 -2
package/dist/esm/plugin.js
CHANGED
|
@@ -201,6 +201,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
201
201
|
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
202
202
|
dispatch = _ref2.dispatch,
|
|
203
203
|
portalProviderAPI = _ref2.portalProviderAPI,
|
|
204
|
+
nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI,
|
|
204
205
|
eventDispatcher = _ref2.eventDispatcher,
|
|
205
206
|
getIntl = _ref2.getIntl;
|
|
206
207
|
var _ref3 = options || {},
|
|
@@ -214,12 +215,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
214
215
|
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
215
216
|
isCommentEditor = _ref3.isCommentEditor,
|
|
216
217
|
isChromelessEditor = _ref3.isChromelessEditor;
|
|
217
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
218
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
218
219
|
}
|
|
219
220
|
}, {
|
|
220
221
|
name: 'tablePMColResizing',
|
|
221
222
|
plugin: function plugin(_ref4) {
|
|
222
|
-
var dispatch = _ref4.dispatch
|
|
223
|
+
var dispatch = _ref4.dispatch,
|
|
224
|
+
nodeViewPortalProviderAPI = _ref4.nodeViewPortalProviderAPI;
|
|
223
225
|
var _ref5 = options || {},
|
|
224
226
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
225
227
|
tableOptions = _ref5.tableOptions,
|
|
@@ -231,7 +233,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
231
233
|
allowColumnResizing = _pluginConfig2.allowColumnResizing;
|
|
232
234
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
233
235
|
lastColumnResizable: !fullWidthEnabled
|
|
234
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
236
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
235
237
|
}
|
|
236
238
|
}, {
|
|
237
239
|
name: 'tableEditing',
|
|
@@ -244,7 +246,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
244
246
|
{
|
|
245
247
|
name: 'tableKeymap',
|
|
246
248
|
plugin: function plugin(_ref6) {
|
|
247
|
-
var getIntl = _ref6.getIntl
|
|
249
|
+
var getIntl = _ref6.getIntl,
|
|
250
|
+
nodeViewPortalProviderAPI = _ref6.nodeViewPortalProviderAPI;
|
|
248
251
|
var _ref7 = options || {},
|
|
249
252
|
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
250
253
|
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
@@ -259,7 +262,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
259
262
|
isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
|
|
260
263
|
_ref7$tableResizingEn = _ref7.tableResizingEnabled,
|
|
261
264
|
tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
|
|
262
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
265
|
+
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
263
266
|
}
|
|
264
267
|
}, {
|
|
265
268
|
name: 'tableSelectionKeymap',
|
|
@@ -306,45 +309,46 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
306
309
|
}
|
|
307
310
|
}, {
|
|
308
311
|
name: 'tableViewModeSort',
|
|
309
|
-
plugin: function plugin() {
|
|
310
|
-
|
|
312
|
+
plugin: function plugin(_ref13) {
|
|
313
|
+
var nodeViewPortalProviderAPI = _ref13.nodeViewPortalProviderAPI;
|
|
314
|
+
return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api, nodeViewPortalProviderAPI) : undefined;
|
|
311
315
|
}
|
|
312
316
|
}, {
|
|
313
317
|
name: 'tableLocalId',
|
|
314
|
-
plugin: function plugin(
|
|
315
|
-
var dispatch =
|
|
318
|
+
plugin: function plugin(_ref14) {
|
|
319
|
+
var dispatch = _ref14.dispatch;
|
|
316
320
|
return createTableLocalIdPlugin(dispatch);
|
|
317
321
|
}
|
|
318
322
|
}, {
|
|
319
323
|
name: 'tableWidth',
|
|
320
|
-
plugin: function plugin(
|
|
324
|
+
plugin: function plugin(_ref15) {
|
|
321
325
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign, _options$isCommentEdi;
|
|
322
|
-
var dispatchAnalyticsEvent =
|
|
323
|
-
dispatch =
|
|
326
|
+
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
327
|
+
dispatch = _ref15.dispatch;
|
|
324
328
|
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, (_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, (_options$isCommentEdi = options === null || options === void 0 ? void 0 : options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
325
329
|
}
|
|
326
330
|
}, {
|
|
327
331
|
name: 'tableWidthInCommentFix',
|
|
328
|
-
plugin: function plugin(
|
|
332
|
+
plugin: function plugin(_ref16) {
|
|
329
333
|
var _options$isTableAlign2;
|
|
330
|
-
var dispatch =
|
|
334
|
+
var dispatch = _ref16.dispatch;
|
|
331
335
|
return options !== null && options !== void 0 && options.tableResizingEnabled && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$isTableAlign2 = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign2 !== void 0 ? _options$isTableAlign2 : false) : undefined;
|
|
332
336
|
}
|
|
333
337
|
},
|
|
334
338
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
335
339
|
{
|
|
336
340
|
name: 'tableOverflowAnalyticsPlugin',
|
|
337
|
-
plugin: function plugin(
|
|
341
|
+
plugin: function plugin(_ref17) {
|
|
338
342
|
var _options$tableResizin;
|
|
339
|
-
var dispatch =
|
|
340
|
-
dispatchAnalyticsEvent =
|
|
343
|
+
var dispatch = _ref17.dispatch,
|
|
344
|
+
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
341
345
|
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
|
|
342
346
|
}
|
|
343
347
|
}, {
|
|
344
348
|
name: 'tableAnalyticsPlugin',
|
|
345
|
-
plugin: function plugin(
|
|
346
|
-
var dispatch =
|
|
347
|
-
dispatchAnalyticsEvent =
|
|
349
|
+
plugin: function plugin(_ref18) {
|
|
350
|
+
var dispatch = _ref18.dispatch,
|
|
351
|
+
dispatchAnalyticsEvent = _ref18.dispatchAnalyticsEvent;
|
|
348
352
|
return createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent);
|
|
349
353
|
}
|
|
350
354
|
}, {
|
|
@@ -375,13 +379,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
375
379
|
}
|
|
376
380
|
return plugins;
|
|
377
381
|
},
|
|
378
|
-
contentComponent: function contentComponent(
|
|
382
|
+
contentComponent: function contentComponent(_ref19) {
|
|
379
383
|
var _api$featureFlags;
|
|
380
|
-
var editorView =
|
|
381
|
-
popupsMountPoint =
|
|
382
|
-
popupsBoundariesElement =
|
|
383
|
-
popupsScrollableElement =
|
|
384
|
-
dispatchAnalyticsEvent =
|
|
384
|
+
var editorView = _ref19.editorView,
|
|
385
|
+
popupsMountPoint = _ref19.popupsMountPoint,
|
|
386
|
+
popupsBoundariesElement = _ref19.popupsBoundariesElement,
|
|
387
|
+
popupsScrollableElement = _ref19.popupsScrollableElement,
|
|
388
|
+
dispatchAnalyticsEvent = _ref19.dispatchAnalyticsEvent;
|
|
385
389
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
386
390
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
387
391
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -397,32 +401,32 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
397
401
|
stickyHeadersState: stickyHeadersPluginKey,
|
|
398
402
|
dragAndDropState: dragAndDropPluginKey
|
|
399
403
|
},
|
|
400
|
-
render: function render(
|
|
401
|
-
var resizingPluginState =
|
|
402
|
-
stickyHeadersState =
|
|
403
|
-
tablePluginState =
|
|
404
|
-
tableWidthPluginState =
|
|
405
|
-
dragAndDropState =
|
|
404
|
+
render: function render(_ref20) {
|
|
405
|
+
var resizingPluginState = _ref20.tableResizingPluginState,
|
|
406
|
+
stickyHeadersState = _ref20.stickyHeadersState,
|
|
407
|
+
tablePluginState = _ref20.tablePluginState,
|
|
408
|
+
tableWidthPluginState = _ref20.tableWidthPluginState,
|
|
409
|
+
dragAndDropState = _ref20.dragAndDropState;
|
|
406
410
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
407
411
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
408
412
|
var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
|
|
409
413
|
var resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
|
|
410
414
|
var isResizing = isColumnResizing || isTableResizing;
|
|
411
415
|
var widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
|
|
412
|
-
var
|
|
413
|
-
tableNode =
|
|
414
|
-
tablePos =
|
|
415
|
-
targetCellPosition =
|
|
416
|
-
isContextualMenuOpen =
|
|
417
|
-
tableRef =
|
|
418
|
-
pluginConfig =
|
|
419
|
-
insertColumnButtonIndex =
|
|
420
|
-
insertRowButtonIndex =
|
|
421
|
-
isHeaderColumnEnabled =
|
|
422
|
-
isHeaderRowEnabled =
|
|
423
|
-
isDragAndDropEnabled =
|
|
424
|
-
tableWrapperTarget =
|
|
425
|
-
isCellMenuOpenByKeyboard =
|
|
416
|
+
var _ref21 = tablePluginState,
|
|
417
|
+
tableNode = _ref21.tableNode,
|
|
418
|
+
tablePos = _ref21.tablePos,
|
|
419
|
+
targetCellPosition = _ref21.targetCellPosition,
|
|
420
|
+
isContextualMenuOpen = _ref21.isContextualMenuOpen,
|
|
421
|
+
tableRef = _ref21.tableRef,
|
|
422
|
+
pluginConfig = _ref21.pluginConfig,
|
|
423
|
+
insertColumnButtonIndex = _ref21.insertColumnButtonIndex,
|
|
424
|
+
insertRowButtonIndex = _ref21.insertRowButtonIndex,
|
|
425
|
+
isHeaderColumnEnabled = _ref21.isHeaderColumnEnabled,
|
|
426
|
+
isHeaderRowEnabled = _ref21.isHeaderRowEnabled,
|
|
427
|
+
isDragAndDropEnabled = _ref21.isDragAndDropEnabled,
|
|
428
|
+
tableWrapperTarget = _ref21.tableWrapperTarget,
|
|
429
|
+
isCellMenuOpenByKeyboard = _ref21.isCellMenuOpenByKeyboard;
|
|
426
430
|
var allowControls = pluginConfig.allowControls;
|
|
427
431
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
428
432
|
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
@@ -515,8 +519,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
515
519
|
}));
|
|
516
520
|
},
|
|
517
521
|
pluginsOptions: {
|
|
518
|
-
quickInsert: function quickInsert(
|
|
519
|
-
var formatMessage =
|
|
522
|
+
quickInsert: function quickInsert(_ref22) {
|
|
523
|
+
var formatMessage = _ref22.formatMessage;
|
|
520
524
|
return [{
|
|
521
525
|
id: 'table',
|
|
522
526
|
title: formatMessage(messages.table),
|
|
@@ -17,13 +17,13 @@ var updateLastCellElement = function updateLastCellElement(lastCellElementsDecor
|
|
|
17
17
|
return updateDecorations(tr.doc, decorationSet, lastCellElementsDecorations, TableDecorations.LAST_CELL_ELEMENT);
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex, includeTooltip, getIntl) {
|
|
20
|
+
export var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI) {
|
|
21
21
|
return function (_ref3) {
|
|
22
22
|
var tr = _ref3.tr,
|
|
23
23
|
decorationSet = _ref3.decorationSet;
|
|
24
24
|
var _ref4 = columnEndIndex < 0 ? emptyDecorations : createResizeHandleDecoration(tr, rowEndIndex, {
|
|
25
25
|
right: columnEndIndex
|
|
26
|
-
}, includeTooltip, getIntl),
|
|
26
|
+
}, includeTooltip, getIntl, nodeViewPortalProviderAPI),
|
|
27
27
|
_ref5 = _slicedToArray(_ref4, 2),
|
|
28
28
|
columnResizesDecorations = _ref5[0],
|
|
29
29
|
lastCellElementsDecorations = _ref5[1];
|
|
@@ -7,19 +7,19 @@ import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSele
|
|
|
7
7
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
8
8
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
9
9
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
10
|
-
export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
10
|
+
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
11
11
|
var _pluginInjectionApi$a;
|
|
12
|
-
var isTableScalingEnabled = arguments.length >
|
|
13
|
-
var isTableAlignmentEnabled = arguments.length >
|
|
14
|
-
var isFullWidthEnabled = arguments.length >
|
|
15
|
-
var pluginInjectionApi = arguments.length >
|
|
16
|
-
var getIntl = arguments.length >
|
|
17
|
-
var isCellBackgroundDuplicated = arguments.length >
|
|
18
|
-
var isTableFixedColumnWidthsOptionEnabled = arguments.length >
|
|
19
|
-
var shouldUseIncreasedScalingPercent = arguments.length >
|
|
20
|
-
var isCommentEditor = arguments.length >
|
|
21
|
-
var isChromelessEditor = arguments.length >
|
|
22
|
-
var isTableResizingEnabled = arguments.length >
|
|
12
|
+
var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
13
|
+
var isTableAlignmentEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
14
|
+
var isFullWidthEnabled = arguments.length > 7 ? arguments[7] : undefined;
|
|
15
|
+
var pluginInjectionApi = arguments.length > 8 ? arguments[8] : undefined;
|
|
16
|
+
var getIntl = arguments.length > 9 ? arguments[9] : undefined;
|
|
17
|
+
var isCellBackgroundDuplicated = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
18
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
|
|
19
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 12 ? arguments[12] : undefined;
|
|
20
|
+
var isCommentEditor = arguments.length > 13 ? arguments[13] : undefined;
|
|
21
|
+
var isChromelessEditor = arguments.length > 14 ? arguments[14] : undefined;
|
|
22
|
+
var isTableResizingEnabled = arguments.length > 15 ? arguments[15] : undefined;
|
|
23
23
|
var list = {};
|
|
24
24
|
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
25
25
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
@@ -57,17 +57,20 @@ export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, d
|
|
|
57
57
|
}
|
|
58
58
|
bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing({
|
|
59
59
|
ariaNotify: ariaNotifyPlugin,
|
|
60
|
-
getIntl: getIntl
|
|
60
|
+
getIntl: getIntl,
|
|
61
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI
|
|
61
62
|
}), list);
|
|
62
63
|
bindKeymapWithCommand(moveRight.common, activateNextResizeArea({
|
|
63
64
|
direction: 1,
|
|
64
65
|
ariaNotify: ariaNotifyPlugin,
|
|
65
|
-
getIntl: getIntl
|
|
66
|
+
getIntl: getIntl,
|
|
67
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI
|
|
66
68
|
}), list);
|
|
67
69
|
bindKeymapWithCommand(moveLeft.common, activateNextResizeArea({
|
|
68
70
|
direction: -1,
|
|
69
71
|
ariaNotify: ariaNotifyPlugin,
|
|
70
|
-
getIntl: getIntl
|
|
72
|
+
getIntl: getIntl,
|
|
73
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI
|
|
71
74
|
}), list);
|
|
72
75
|
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
73
76
|
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
@@ -22,7 +22,7 @@ import { isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from '.
|
|
|
22
22
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
23
23
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
24
24
|
import { pluginKey } from './plugin-key';
|
|
25
|
-
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
25
|
+
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
26
26
|
var _accessibilityUtils;
|
|
27
27
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
28
28
|
pluginConfig: pluginConfig,
|
|
@@ -278,7 +278,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
278
278
|
blur: handleBlur,
|
|
279
279
|
mousedown: withCellTracking(handleMouseDown),
|
|
280
280
|
mouseleave: handleMouseLeave,
|
|
281
|
-
mousemove: whenTableInFocus(handleMouseMove),
|
|
281
|
+
mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI)),
|
|
282
282
|
mouseenter: handleMouseEnter,
|
|
283
283
|
mouseup: whenTableInFocus(handleMouseUp),
|
|
284
284
|
click: withCellTracking(whenTableInFocus(handleClick))
|
|
@@ -18,7 +18,7 @@ import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resize
|
|
|
18
18
|
import { TABLE_OFFSET_IN_COMMENT_EDITOR } from './utils/consts';
|
|
19
19
|
import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './utils/misc';
|
|
20
20
|
import { scaleResizeState } from './utils/resize-column';
|
|
21
|
-
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
21
|
+
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
22
22
|
var _originalTable$attrs;
|
|
23
23
|
var state = view.state,
|
|
24
24
|
dispatch = view.dispatch;
|
|
@@ -103,7 +103,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
103
103
|
|
|
104
104
|
// When we start resizing a column we need to ensure the underlying tooltip is removed from the decoration to avoid
|
|
105
105
|
// unnecessary tooltips being displayed during drag.
|
|
106
|
-
updateResizeHandleDecorations(undefined, undefined, false)(state, dispatch);
|
|
106
|
+
updateResizeHandleDecorations(nodeViewPortalProviderAPI, undefined, undefined, false)(state, dispatch);
|
|
107
107
|
|
|
108
108
|
// for new column resizing, take the current scaled version of table widths and use those as the basis for resizing
|
|
109
109
|
// implication: the scaled version of the table becomes the source of truth
|
|
@@ -8,7 +8,7 @@ import { handleMouseDown } from './event-handlers';
|
|
|
8
8
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
10
10
|
import { getResizeCellPos } from './utils';
|
|
11
|
-
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, api, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
11
|
+
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
12
12
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
13
13
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
14
14
|
return new SafePlugin({
|
|
@@ -46,7 +46,7 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
46
46
|
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
47
47
|
}
|
|
48
48
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
49
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, api, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor)) {
|
|
49
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor)) {
|
|
50
50
|
var _state = view.state,
|
|
51
51
|
_dispatch = view.dispatch;
|
|
52
52
|
return setResizeHandlePos(resizeHandlePos)(_state, _dispatch);
|
|
@@ -15,16 +15,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
15
|
import { createElement } from 'react';
|
|
16
16
|
import ReactDOM from 'react-dom';
|
|
17
17
|
import { RawIntlProvider } from 'react-intl-next';
|
|
18
|
+
import uuid from 'uuid/v4';
|
|
18
19
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
19
20
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
20
21
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
21
22
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
23
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
24
|
import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
|
|
23
25
|
import { getPluginState } from '../plugin-factory';
|
|
24
26
|
import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
|
|
25
27
|
import { tableViewModeSortPluginKey as key } from './plugin-key';
|
|
26
28
|
import { getTableElements, toggleSort } from './utils';
|
|
27
|
-
export var createPlugin = function createPlugin(api) {
|
|
29
|
+
export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI) {
|
|
28
30
|
return new SafePlugin({
|
|
29
31
|
state: {
|
|
30
32
|
init: function init() {
|
|
@@ -97,6 +99,7 @@ export var createPlugin = function createPlugin(api) {
|
|
|
97
99
|
var map = TableMap.get(tableNode);
|
|
98
100
|
var hasMergedCells = new Set(map.map).size !== map.map.length;
|
|
99
101
|
map.mapByRow[0].forEach(function (cell, index) {
|
|
102
|
+
var decorationRenderKey = uuid();
|
|
100
103
|
decs.push(Decoration.widget(cell + pos + 2, function () {
|
|
101
104
|
var _sort$tableId;
|
|
102
105
|
var element = document.createElement('div');
|
|
@@ -114,16 +117,38 @@ export var createPlugin = function createPlugin(api) {
|
|
|
114
117
|
}
|
|
115
118
|
var _getPluginState = getPluginState(oldState),
|
|
116
119
|
getIntl = _getPluginState.getIntl;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
121
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
122
|
+
return /*#__PURE__*/createElement(RawIntlProvider, {
|
|
123
|
+
value: getIntl()
|
|
124
|
+
}, /*#__PURE__*/createElement(SortingIconWrapper, {
|
|
125
|
+
isSortingAllowed: !hasMergedCells,
|
|
126
|
+
sortOrdered: sortOrdered,
|
|
127
|
+
onClick: function onClick() {},
|
|
128
|
+
onKeyDown: function onKeyDown() {},
|
|
129
|
+
api: api
|
|
130
|
+
}));
|
|
131
|
+
}, element, decorationRenderKey);
|
|
132
|
+
} else {
|
|
133
|
+
ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
|
|
134
|
+
value: getIntl()
|
|
135
|
+
}, /*#__PURE__*/createElement(SortingIconWrapper, {
|
|
136
|
+
isSortingAllowed: !hasMergedCells,
|
|
137
|
+
sortOrdered: sortOrdered,
|
|
138
|
+
onClick: function onClick() {},
|
|
139
|
+
onKeyDown: function onKeyDown() {},
|
|
140
|
+
api: api
|
|
141
|
+
})), element);
|
|
142
|
+
}
|
|
126
143
|
return element;
|
|
144
|
+
}, {
|
|
145
|
+
destroy: function destroy(node) {
|
|
146
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
147
|
+
nodeViewPortalProviderAPI.remove(decorationRenderKey);
|
|
148
|
+
} else {
|
|
149
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
127
152
|
}));
|
|
128
153
|
});
|
|
129
154
|
});
|
|
@@ -416,14 +416,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
416
416
|
});
|
|
417
417
|
_defineProperty(_assertThisInitialized(_this), "createOriginalContextMenuItems", function () {
|
|
418
418
|
var items = [];
|
|
419
|
-
var getEditorFeatureFlags = _this.props.getEditorFeatureFlags;
|
|
420
|
-
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
421
|
-
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
422
|
-
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
423
419
|
var sortColumnItems = _this.createSortColumnItems();
|
|
424
420
|
var backgroundColorItem = _this.createBackgroundColorItem();
|
|
425
421
|
var distributeColumnsItem = _this.createDistributeColumnsItem();
|
|
426
|
-
|
|
422
|
+
sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
|
|
427
423
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
428
424
|
items.push(_this.createInsertColumnItem());
|
|
429
425
|
items.push(_this.createInsertRowItem());
|
|
@@ -431,7 +427,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
431
427
|
items.push(_this.createDeleteRowItem());
|
|
432
428
|
items.push.apply(items, _toConsumableArray(_this.createMergeSplitCellItems()));
|
|
433
429
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
434
|
-
!tableSortColumnReorder && sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
|
|
435
430
|
items.push(_this.createClearCellsItem());
|
|
436
431
|
return [{
|
|
437
432
|
items: items
|
|
@@ -462,8 +457,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
462
457
|
items[1].items.push(deleteRowItem);
|
|
463
458
|
return items;
|
|
464
459
|
});
|
|
465
|
-
_defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (
|
|
466
|
-
var item =
|
|
460
|
+
_defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (_ref2) {
|
|
461
|
+
var item = _ref2.item;
|
|
467
462
|
var _this$props10 = _this.props,
|
|
468
463
|
editorView = _this$props10.editorView,
|
|
469
464
|
selectionRect = _this$props10.selectionRect,
|
|
@@ -479,11 +474,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
479
474
|
targetCellPosition = _getPluginState11.targetCellPosition,
|
|
480
475
|
_getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
|
|
481
476
|
isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
tableDuplicateCellColouring =
|
|
485
|
-
|
|
486
|
-
tableWithFixedColumnWidthsOption =
|
|
477
|
+
var _ref3 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
478
|
+
_ref3$tableDuplicateC = _ref3.tableDuplicateCellColouring,
|
|
479
|
+
tableDuplicateCellColouring = _ref3$tableDuplicateC === void 0 ? false : _ref3$tableDuplicateC,
|
|
480
|
+
_ref3$tableWithFixedC = _ref3.tableWithFixedColumnWidthsOption,
|
|
481
|
+
tableWithFixedColumnWidthsOption = _ref3$tableWithFixedC === void 0 ? false : _ref3$tableWithFixedC;
|
|
487
482
|
// context menu opened by keyboard and any item except 'background' activated
|
|
488
483
|
// or color has been chosen from color palette
|
|
489
484
|
if (isCellMenuOpenByKeyboard && (item.value.name !== 'background' || item.value.name === 'background' && _this.state.isSubmenuOpen)) {
|
|
@@ -612,8 +607,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
612
607
|
}
|
|
613
608
|
}
|
|
614
609
|
});
|
|
615
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (
|
|
616
|
-
var item =
|
|
610
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref4) {
|
|
611
|
+
var item = _ref4.item;
|
|
617
612
|
var _this$props13 = _this.props,
|
|
618
613
|
_this$props13$editorV = _this$props13.editorView,
|
|
619
614
|
state = _this$props13$editorV.state,
|
|
@@ -636,8 +631,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
636
631
|
hoverMergedCells()(state, dispatch);
|
|
637
632
|
}
|
|
638
633
|
});
|
|
639
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (
|
|
640
|
-
var item =
|
|
634
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref5) {
|
|
635
|
+
var item = _ref5.item;
|
|
641
636
|
var _this$props$editorVie = _this.props.editorView,
|
|
642
637
|
state = _this$props$editorVie.state,
|
|
643
638
|
dispatch = _this$props$editorVie.dispatch;
|
|
@@ -94,20 +94,18 @@ var MapDragMenuOptionIdToMessage = {
|
|
|
94
94
|
plural: null
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(
|
|
97
|
+
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig() {
|
|
98
98
|
var groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
|
|
99
99
|
var sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
|
|
100
|
-
|
|
100
|
+
groupedDragMenuConfig.unshift(sortColumnItems);
|
|
101
101
|
return groupedDragMenuConfig;
|
|
102
102
|
};
|
|
103
103
|
var elementBeforeIconStyles = xcss({
|
|
104
104
|
marginRight: 'space.negative.075',
|
|
105
105
|
display: 'flex'
|
|
106
106
|
});
|
|
107
|
-
var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
|
|
108
|
-
var
|
|
109
|
-
var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
|
|
110
|
-
var groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
107
|
+
var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect) {
|
|
108
|
+
var groupedDragMenuConfig = getGroupedDragMenuConfig();
|
|
111
109
|
var menuItemsArr = _toConsumableArray(Array(groupedDragMenuConfig.length)).map(function () {
|
|
112
110
|
return [];
|
|
113
111
|
});
|
|
@@ -205,7 +203,6 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
205
203
|
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
|
|
206
204
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
207
205
|
isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
|
|
208
|
-
tableSortColumnReorder = _ref.tableSortColumnReorder,
|
|
209
206
|
ariaNotifyPlugin = _ref.ariaNotifyPlugin,
|
|
210
207
|
isCommentEditor = _ref.isCommentEditor;
|
|
211
208
|
var state = editorView.state,
|
|
@@ -221,8 +218,8 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
221
218
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
222
219
|
var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
223
220
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
224
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent,
|
|
225
|
-
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage,
|
|
221
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, ariaNotifyPlugin, isCommentEditor);
|
|
222
|
+
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
226
223
|
menuItems = _convertToDropdownIte.menuItems,
|
|
227
224
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
228
225
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
@@ -271,7 +268,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
271
268
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
272
269
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
273
270
|
,
|
|
274
|
-
css: dragMenuBackgroundColorStyles(
|
|
271
|
+
css: dragMenuBackgroundColorStyles()
|
|
275
272
|
}, jsx("div", {
|
|
276
273
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
277
274
|
css: cellColourPreviewStyles(background)
|
|
@@ -469,7 +466,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
469
466
|
return null;
|
|
470
467
|
}
|
|
471
468
|
if (allowBackgroundColor) {
|
|
472
|
-
|
|
469
|
+
menuItems[1].items.unshift(createBackgroundColorMenuItem());
|
|
473
470
|
}
|
|
474
471
|
|
|
475
472
|
// If first row, add toggle for Header row, default is true
|
|
@@ -36,9 +36,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
36
36
|
_ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
|
|
37
37
|
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC,
|
|
38
38
|
_ref2$tableWithFixedC = _ref2.tableWithFixedColumnWidthsOption,
|
|
39
|
-
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC
|
|
40
|
-
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
41
|
-
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
39
|
+
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC;
|
|
42
40
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
43
41
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
44
42
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
@@ -77,7 +75,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
77
75
|
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
78
76
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
79
77
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
80
|
-
tableSortColumnReorder: tableSortColumnReorder,
|
|
81
78
|
ariaNotifyPlugin: ariaNotifyPlugin,
|
|
82
79
|
api: api,
|
|
83
80
|
isCommentEditor: isCommentEditor || false
|
|
@@ -17,8 +17,7 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
|
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
19
19
|
export var dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
|
|
20
|
-
|
|
21
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), tableSortColumnReorder ? TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT : 0, dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
20
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT, dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
22
21
|
};
|
|
23
22
|
|
|
24
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|