@atlaskit/editor-plugin-table 22.2.17 → 22.2.19
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 +15 -0
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +92 -171
- package/dist/cjs/ui/FloatingContextualMenu/index.js +3 -4
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +3 -3
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +7 -17
- package/dist/cjs/ui/FloatingInsertButton/getPopupOptions.js +7 -9
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -2
- package/dist/cjs/ui/common-styles.js +1 -2
- package/dist/cjs/ui/consts.js +1 -2
- package/dist/cjs/ui/ui-styles.js +14 -19
- package/dist/es2019/types/index.js +0 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +36 -131
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -5
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +4 -24
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +7 -17
- package/dist/es2019/ui/FloatingInsertButton/getPopupOptions.js +8 -10
- package/dist/es2019/ui/FloatingInsertButton/index.js +3 -2
- package/dist/es2019/ui/common-styles.js +2 -5
- package/dist/es2019/ui/consts.js +0 -1
- package/dist/es2019/ui/ui-styles.js +2 -13
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +93 -172
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -5
- package/dist/esm/ui/FloatingContextualMenu/styles.js +4 -4
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +7 -17
- package/dist/esm/ui/FloatingInsertButton/getPopupOptions.js +8 -10
- package/dist/esm/ui/FloatingInsertButton/index.js +3 -2
- package/dist/esm/ui/common-styles.js +1 -2
- package/dist/esm/ui/consts.js +0 -1
- package/dist/esm/ui/ui-styles.js +15 -20
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -4
- package/dist/types/ui/FloatingContextualMenu/styles.d.ts +1 -1
- package/dist/types/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
- package/dist/types/ui/consts.d.ts +0 -1
- package/dist/types/ui/ui-styles.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -4
- package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
- package/dist/types-ts4.5/ui/consts.d.ts +0 -1
- package/dist/types-ts4.5/ui/ui-styles.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs mahual remediation */
|
|
2
2
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { tableCellBorderWidth, tableMarginTop
|
|
4
|
+
import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { TableCssClassName as ClassName } from '../types';
|
|
7
7
|
import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, dragTableInsertColumnButtonSize, insertLineWidth, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
@@ -272,7 +272,7 @@ export const DeleteButton = () => css`
|
|
|
272
272
|
cursor: pointer;
|
|
273
273
|
}
|
|
274
274
|
`;
|
|
275
|
-
export const OverflowShadow =
|
|
275
|
+
export const OverflowShadow = () => css`
|
|
276
276
|
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
277
277
|
display: block;
|
|
278
278
|
height: calc(100% - ${tableMarginTop}px);
|
|
@@ -302,22 +302,11 @@ export const OverflowShadow = isDragAndDropEnabled => css`
|
|
|
302
302
|
left: calc(100% - ${tableOverflowShadowWidthWide}px);
|
|
303
303
|
}
|
|
304
304
|
.${ClassName.WITH_CONTROLS} {
|
|
305
|
-
${overflowShadowWidhoutDnD(isDragAndDropEnabled)}
|
|
306
305
|
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
307
306
|
border-left: 1px solid ${tableBorderColor};
|
|
308
307
|
}
|
|
309
308
|
}
|
|
310
309
|
`;
|
|
311
|
-
const overflowShadowWidhoutDnD = isDragAndDropEnabled => {
|
|
312
|
-
if (!isDragAndDropEnabled) {
|
|
313
|
-
return css`
|
|
314
|
-
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
315
|
-
height: calc(100% - ${tableMarginTopWithControl}px);
|
|
316
|
-
top: ${tableMarginTopWithControl}px;
|
|
317
|
-
}
|
|
318
|
-
`;
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
310
|
export const OverflowShadowLessPadding = tableOverflowShadowWidth => css`
|
|
322
311
|
.${ClassName.TABLE_LEFT_SHADOW}, .${ClassName.TABLE_RIGHT_SHADOW} {
|
|
323
312
|
width: ${tableOverflowShadowWidth}px;
|
package/dist/esm/types/index.js
CHANGED
|
@@ -137,7 +137,6 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
137
137
|
CONTEXTUAL_MENU_BUTTON_WRAP: "".concat(tablePrefixSelector, "-contextual-menu-button-wrap"),
|
|
138
138
|
CONTEXTUAL_MENU_BUTTON: "".concat(tablePrefixSelector, "-contextual-menu-button"),
|
|
139
139
|
CONTEXTUAL_MENU_BUTTON_FIXED: "".concat(tablePrefixSelector, "-contextual-menu-button-fixed"),
|
|
140
|
-
CONTEXTUAL_MENU_ICON: "".concat(tablePrefixSelector, "-contextual-submenu-icon"),
|
|
141
140
|
CONTEXTUAL_MENU_ICON_SMALL: "".concat(tablePrefixSelector, "-contextual-submenu-icon-small"),
|
|
142
141
|
// come from prosemirror-table
|
|
143
142
|
SELECTED_CELL: 'selectedCell',
|
|
@@ -52,9 +52,12 @@ import { canMergeCells } from '../../pm-plugins/transforms/merge';
|
|
|
52
52
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../../pm-plugins/utils/selection';
|
|
53
53
|
import { getMergedCellsPositions } from '../../pm-plugins/utils/table';
|
|
54
54
|
import { TableCssClassName as ClassName } from '../../types';
|
|
55
|
-
import { colorPalletteColumns,
|
|
55
|
+
import { colorPalletteColumns, contextualMenuDropdownWidthDnD } from '../consts';
|
|
56
56
|
import { cellColourPreviewStyles } from './styles';
|
|
57
57
|
var arrowsList = new Set(!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? ['ArrowRight', 'ArrowLeft'] : ['ArrowRight']);
|
|
58
|
+
var dropdownMenuSection = {
|
|
59
|
+
hasSeparator: true
|
|
60
|
+
};
|
|
58
61
|
var elementBeforeIconStyles = xcss({
|
|
59
62
|
marginRight: 'space.negative.075',
|
|
60
63
|
display: 'flex'
|
|
@@ -116,8 +119,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
116
119
|
isCellMenuOpenByKeyboard = _this$props.isCellMenuOpenByKeyboard;
|
|
117
120
|
var isSubmenuOpen = _this.state.isSubmenuOpen;
|
|
118
121
|
var _getPluginState = getPluginState(editorView.state),
|
|
119
|
-
targetCellPosition = _getPluginState.targetCellPosition
|
|
120
|
-
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
122
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
121
123
|
if (allowBackgroundColor) {
|
|
122
124
|
var _node$attrs, _node$attrs2;
|
|
123
125
|
var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
@@ -129,17 +131,17 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
129
131
|
var selectedRowIndex = selectedRowAndColumnFromPalette.selectedRowIndex;
|
|
130
132
|
var selectedColumnIndex = selectedRowAndColumnFromPalette.selectedColumnIndex;
|
|
131
133
|
return {
|
|
132
|
-
content:
|
|
134
|
+
content: formatMessage(messages.backgroundColor),
|
|
133
135
|
value: {
|
|
134
136
|
name: 'background'
|
|
135
137
|
},
|
|
136
|
-
elemBefore:
|
|
138
|
+
elemBefore: jsx(Box, {
|
|
137
139
|
xcss: elementBeforeIconStyles
|
|
138
140
|
}, jsx(PaintBucketIcon, {
|
|
139
141
|
color: "currentColor",
|
|
140
142
|
spacing: "spacious",
|
|
141
143
|
label: formatMessage(messages.backgroundColor)
|
|
142
|
-
}))
|
|
144
|
+
})),
|
|
143
145
|
elemAfter:
|
|
144
146
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
145
147
|
jsx("div", {
|
|
@@ -149,7 +151,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
149
151
|
css: cellColourPreviewStyles(background)
|
|
150
152
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
151
153
|
,
|
|
152
|
-
className:
|
|
154
|
+
className: ClassName.CONTEXTUAL_MENU_ICON_SMALL
|
|
153
155
|
}), isSubmenuOpen && jsx("div", {
|
|
154
156
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
155
157
|
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
@@ -209,10 +211,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
209
211
|
var _this$props2 = _this.props,
|
|
210
212
|
allowMergeCells = _this$props2.allowMergeCells,
|
|
211
213
|
state = _this$props2.editorView.state,
|
|
212
|
-
formatMessage = _this$props2.intl.formatMessage
|
|
213
|
-
editorView = _this$props2.editorView;
|
|
214
|
-
var _getPluginState2 = getPluginState(editorView.state),
|
|
215
|
-
isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled;
|
|
214
|
+
formatMessage = _this$props2.intl.formatMessage;
|
|
216
215
|
if (allowMergeCells) {
|
|
217
216
|
return [{
|
|
218
217
|
content: formatMessage(messages.mergeCells),
|
|
@@ -220,37 +219,33 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
220
219
|
name: 'merge'
|
|
221
220
|
},
|
|
222
221
|
isDisabled: !canMergeCells(state.tr),
|
|
223
|
-
elemBefore:
|
|
222
|
+
elemBefore: jsx(Box, {
|
|
224
223
|
xcss: elementBeforeIconStyles
|
|
225
224
|
}, jsx(TableCellMergeIcon, {
|
|
226
225
|
color: "currentColor",
|
|
227
226
|
spacing: "spacious",
|
|
228
227
|
label: formatMessage(messages.mergeCells)
|
|
229
|
-
}))
|
|
228
|
+
}))
|
|
230
229
|
}, {
|
|
231
230
|
content: formatMessage(messages.splitCell),
|
|
232
231
|
value: {
|
|
233
232
|
name: 'split'
|
|
234
233
|
},
|
|
235
234
|
isDisabled: !splitCell(state),
|
|
236
|
-
elemBefore:
|
|
235
|
+
elemBefore: jsx(Box, {
|
|
237
236
|
xcss: elementBeforeIconStyles
|
|
238
237
|
}, jsx(TableCellSplitIcon, {
|
|
239
238
|
color: "currentColor",
|
|
240
239
|
spacing: "spacious",
|
|
241
240
|
label: formatMessage(messages.splitCell)
|
|
242
|
-
}))
|
|
241
|
+
}))
|
|
243
242
|
}];
|
|
244
243
|
}
|
|
245
244
|
return [];
|
|
246
245
|
});
|
|
247
246
|
_defineProperty(_this, "createInsertColumnItem", function () {
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
editorView = _this$props3.editorView;
|
|
251
|
-
var _getPluginState3 = getPluginState(editorView.state),
|
|
252
|
-
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
|
|
253
|
-
var content = formatMessage(isDragAndDropEnabled ? messages.addColumnRight : messages.insertColumn);
|
|
247
|
+
var formatMessage = _this.props.intl.formatMessage;
|
|
248
|
+
var content = formatMessage(messages.addColumnRight);
|
|
254
249
|
return {
|
|
255
250
|
content: content,
|
|
256
251
|
value: {
|
|
@@ -260,7 +255,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
260
255
|
elemAfter: jsx("div", {
|
|
261
256
|
css: shortcutStyle
|
|
262
257
|
}, tooltip(addColumnAfter)),
|
|
263
|
-
elemBefore:
|
|
258
|
+
elemBefore:
|
|
264
259
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
265
260
|
jsx(Box, {
|
|
266
261
|
xcss: elementBeforeIconStyles
|
|
@@ -268,17 +263,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
268
263
|
color: "currentColor",
|
|
269
264
|
spacing: "spacious",
|
|
270
265
|
label: formatMessage(messages.addColumnRight)
|
|
271
|
-
}))
|
|
266
|
+
})),
|
|
272
267
|
'aria-label': tooltip(addColumnAfter, String(content))
|
|
273
268
|
};
|
|
274
269
|
});
|
|
275
270
|
_defineProperty(_this, "createInsertRowItem", function () {
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
editorView = _this$props4.editorView;
|
|
279
|
-
var _getPluginState4 = getPluginState(editorView.state),
|
|
280
|
-
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
281
|
-
var content = formatMessage(isDragAndDropEnabled ? messages.addRowBelow : messages.insertRow);
|
|
271
|
+
var formatMessage = _this.props.intl.formatMessage;
|
|
272
|
+
var content = formatMessage(messages.addRowBelow);
|
|
282
273
|
return {
|
|
283
274
|
content: content,
|
|
284
275
|
value: {
|
|
@@ -288,23 +279,20 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
288
279
|
elemAfter: jsx("div", {
|
|
289
280
|
css: shortcutStyle
|
|
290
281
|
}, tooltip(addRowAfter)),
|
|
291
|
-
elemBefore:
|
|
282
|
+
elemBefore: jsx(Box, {
|
|
292
283
|
xcss: elementBeforeIconStyles
|
|
293
284
|
}, jsx(TableRowAddBelowIcon, {
|
|
294
285
|
color: "currentColor",
|
|
295
286
|
spacing: "spacious",
|
|
296
287
|
label: formatMessage(messages.addRowBelow)
|
|
297
|
-
}))
|
|
288
|
+
})),
|
|
298
289
|
'aria-label': tooltip(addRowAfter, String(content))
|
|
299
290
|
};
|
|
300
291
|
});
|
|
301
292
|
_defineProperty(_this, "createClearCellsItem", function () {
|
|
302
|
-
var _this$
|
|
303
|
-
selectionRect = _this$
|
|
304
|
-
formatMessage = _this$
|
|
305
|
-
editorView = _this$props5.editorView;
|
|
306
|
-
var _getPluginState5 = getPluginState(editorView.state),
|
|
307
|
-
isDragAndDropEnabled = _getPluginState5.isDragAndDropEnabled;
|
|
293
|
+
var _this$props3 = _this.props,
|
|
294
|
+
selectionRect = _this$props3.selectionRect,
|
|
295
|
+
formatMessage = _this$props3.intl.formatMessage;
|
|
308
296
|
var top = selectionRect.top,
|
|
309
297
|
bottom = selectionRect.bottom,
|
|
310
298
|
right = selectionRect.right,
|
|
@@ -323,7 +311,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
323
311
|
elemAfter: jsx("div", {
|
|
324
312
|
css: shortcutStyle
|
|
325
313
|
}, tooltip(backspace)),
|
|
326
|
-
elemBefore:
|
|
314
|
+
elemBefore: jsx(Box, {
|
|
327
315
|
xcss: elementBeforeIconStyles
|
|
328
316
|
}, jsx(TableCellClearIcon, {
|
|
329
317
|
color: "currentColor",
|
|
@@ -331,17 +319,14 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
331
319
|
label: formatMessage(messages.clearCells, {
|
|
332
320
|
0: Math.max(noOfColumns, noOfRows)
|
|
333
321
|
})
|
|
334
|
-
}))
|
|
322
|
+
})),
|
|
335
323
|
'aria-label': tooltip(backspace, String(content))
|
|
336
324
|
};
|
|
337
325
|
});
|
|
338
326
|
_defineProperty(_this, "createDeleteColumnItem", function () {
|
|
339
|
-
var _this$
|
|
340
|
-
selectionRect = _this$
|
|
341
|
-
formatMessage = _this$
|
|
342
|
-
editorView = _this$props6.editorView;
|
|
343
|
-
var _getPluginState6 = getPluginState(editorView.state),
|
|
344
|
-
isDragAndDropEnabled = _getPluginState6.isDragAndDropEnabled;
|
|
327
|
+
var _this$props4 = _this.props,
|
|
328
|
+
selectionRect = _this$props4.selectionRect,
|
|
329
|
+
formatMessage = _this$props4.intl.formatMessage;
|
|
345
330
|
var right = selectionRect.right,
|
|
346
331
|
left = selectionRect.left;
|
|
347
332
|
var noOfColumns = right - left;
|
|
@@ -352,7 +337,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
352
337
|
value: {
|
|
353
338
|
name: 'delete_column'
|
|
354
339
|
},
|
|
355
|
-
elemBefore:
|
|
340
|
+
elemBefore: jsx(Box, {
|
|
356
341
|
xcss: elementBeforeIconStyles
|
|
357
342
|
}, jsx(TableColumnDeleteIcon, {
|
|
358
343
|
color: "currentColor",
|
|
@@ -360,16 +345,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
360
345
|
label: formatMessage(messages.removeColumns, {
|
|
361
346
|
0: noOfColumns
|
|
362
347
|
})
|
|
363
|
-
}))
|
|
348
|
+
}))
|
|
364
349
|
};
|
|
365
350
|
});
|
|
366
351
|
_defineProperty(_this, "createDeleteRowItem", function () {
|
|
367
|
-
var _this$
|
|
368
|
-
selectionRect = _this$
|
|
369
|
-
formatMessage = _this$
|
|
370
|
-
editorView = _this$props7.editorView;
|
|
371
|
-
var _getPluginState7 = getPluginState(editorView.state),
|
|
372
|
-
isDragAndDropEnabled = _getPluginState7.isDragAndDropEnabled;
|
|
352
|
+
var _this$props5 = _this.props,
|
|
353
|
+
selectionRect = _this$props5.selectionRect,
|
|
354
|
+
formatMessage = _this$props5.intl.formatMessage;
|
|
373
355
|
var bottom = selectionRect.bottom,
|
|
374
356
|
top = selectionRect.top;
|
|
375
357
|
var noOfRows = bottom - top;
|
|
@@ -380,7 +362,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
380
362
|
value: {
|
|
381
363
|
name: 'delete_row'
|
|
382
364
|
},
|
|
383
|
-
elemBefore:
|
|
365
|
+
elemBefore: jsx(Box, {
|
|
384
366
|
xcss: elementBeforeIconStyles
|
|
385
367
|
}, jsx(TableRowDeleteIcon, {
|
|
386
368
|
color: "currentColor",
|
|
@@ -388,20 +370,20 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
388
370
|
label: formatMessage(messages.removeRows, {
|
|
389
371
|
0: noOfRows
|
|
390
372
|
})
|
|
391
|
-
}))
|
|
373
|
+
}))
|
|
392
374
|
};
|
|
393
375
|
});
|
|
394
376
|
_defineProperty(_this, "createDistributeColumnsItemInternal", function (partialMenuItem) {
|
|
395
377
|
var _newResizeState$chang;
|
|
396
|
-
var _this$
|
|
397
|
-
selectionRect = _this$
|
|
398
|
-
editorView = _this$
|
|
399
|
-
getEditorContainerWidth = _this$
|
|
400
|
-
getEditorFeatureFlags = _this$
|
|
401
|
-
formatMessage = _this$
|
|
402
|
-
var
|
|
403
|
-
|
|
404
|
-
isTableScalingEnabled =
|
|
378
|
+
var _this$props6 = _this.props,
|
|
379
|
+
selectionRect = _this$props6.selectionRect,
|
|
380
|
+
editorView = _this$props6.editorView,
|
|
381
|
+
getEditorContainerWidth = _this$props6.getEditorContainerWidth,
|
|
382
|
+
getEditorFeatureFlags = _this$props6.getEditorFeatureFlags,
|
|
383
|
+
formatMessage = _this$props6.intl.formatMessage;
|
|
384
|
+
var _getPluginState2 = getPluginState(editorView.state),
|
|
385
|
+
_getPluginState2$isTa = _getPluginState2.isTableScalingEnabled,
|
|
386
|
+
isTableScalingEnabled = _getPluginState2$isTa === void 0 ? false : _getPluginState2$isTa;
|
|
405
387
|
var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
406
388
|
_ref$tableWithFixedCo = _ref.tableWithFixedColumnWidthsOption,
|
|
407
389
|
tableWithFixedColumnWidthsOption = _ref$tableWithFixedCo === void 0 ? false : _ref$tableWithFixedCo;
|
|
@@ -415,62 +397,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
415
397
|
isDisabled: !wouldChange
|
|
416
398
|
}, partialMenuItem);
|
|
417
399
|
});
|
|
418
|
-
_defineProperty(_this, "
|
|
419
|
-
var editorView = _this.props.editorView;
|
|
420
|
-
var _getPluginState9 = getPluginState(editorView.state),
|
|
421
|
-
isDragAndDropEnabled = _getPluginState9.isDragAndDropEnabled,
|
|
422
|
-
allowDistributeColumns = _getPluginState9.pluginConfig.allowDistributeColumns;
|
|
423
|
-
if (allowDistributeColumns && !isDragAndDropEnabled) {
|
|
424
|
-
return _this.createDistributeColumnsItemInternal();
|
|
425
|
-
}
|
|
426
|
-
return null;
|
|
427
|
-
});
|
|
428
|
-
_defineProperty(_this, "createSortColumnItems", function () {
|
|
429
|
-
var _this$props9 = _this.props,
|
|
430
|
-
formatMessage = _this$props9.intl.formatMessage,
|
|
431
|
-
editorView = _this$props9.editorView,
|
|
432
|
-
allowColumnSorting = _this$props9.allowColumnSorting;
|
|
433
|
-
var _getPluginState0 = getPluginState(editorView.state),
|
|
434
|
-
isDragAndDropEnabled = _getPluginState0.isDragAndDropEnabled;
|
|
435
|
-
if (allowColumnSorting && !isDragAndDropEnabled) {
|
|
436
|
-
var hasMergedCellsInTable = getMergedCellsPositions(editorView.state.tr).length > 0;
|
|
437
|
-
var warning = hasMergedCellsInTable ? {
|
|
438
|
-
tooltipDescription: formatMessage(messages.canNotSortTable),
|
|
439
|
-
isDisabled: true
|
|
440
|
-
} : {};
|
|
441
|
-
return [_objectSpread({
|
|
442
|
-
content: formatMessage(messages.sortColumnASC),
|
|
443
|
-
value: {
|
|
444
|
-
name: 'sort_column_asc'
|
|
445
|
-
}
|
|
446
|
-
}, warning), _objectSpread({
|
|
447
|
-
content: formatMessage(messages.sortColumnDESC),
|
|
448
|
-
value: {
|
|
449
|
-
name: 'sort_column_desc'
|
|
450
|
-
}
|
|
451
|
-
}, warning)];
|
|
452
|
-
}
|
|
453
|
-
return null;
|
|
454
|
-
});
|
|
455
|
-
_defineProperty(_this, "createOriginalContextMenuItems", function () {
|
|
456
|
-
var items = [];
|
|
457
|
-
var sortColumnItems = _this.createSortColumnItems();
|
|
458
|
-
var backgroundColorItem = _this.createBackgroundColorItem();
|
|
459
|
-
var distributeColumnsItem = _this.createDistributeColumnsItem();
|
|
460
|
-
sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
|
|
461
|
-
backgroundColorItem && items.push(backgroundColorItem);
|
|
462
|
-
items.push(_this.createInsertColumnItem());
|
|
463
|
-
items.push(_this.createInsertRowItem());
|
|
464
|
-
items.push(_this.createDeleteColumnItem());
|
|
465
|
-
items.push(_this.createDeleteRowItem());
|
|
466
|
-
items.push.apply(items, _toConsumableArray(_this.createMergeSplitCellItems()));
|
|
467
|
-
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
468
|
-
items.push(_this.createClearCellsItem());
|
|
469
|
-
return [{
|
|
470
|
-
items: items
|
|
471
|
-
}];
|
|
472
|
-
});
|
|
473
|
-
_defineProperty(_this, "createNewContextMenuItems", function () {
|
|
400
|
+
_defineProperty(_this, "createContextMenuItems", function () {
|
|
474
401
|
var _items$0$items;
|
|
475
402
|
var backgroundColorItem = _this.createBackgroundColorItem();
|
|
476
403
|
var mergeSplitCellItems = _this.createMergeSplitCellItems();
|
|
@@ -500,21 +427,21 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
500
427
|
});
|
|
501
428
|
_defineProperty(_this, "onMenuItemActivated", function (_ref2) {
|
|
502
429
|
var item = _ref2.item;
|
|
503
|
-
var _this$
|
|
504
|
-
editorView = _this$
|
|
505
|
-
selectionRect = _this$
|
|
506
|
-
editorAnalyticsAPI = _this$
|
|
507
|
-
getEditorContainerWidth = _this$
|
|
508
|
-
getEditorFeatureFlags = _this$
|
|
509
|
-
isCellMenuOpenByKeyboard = _this$
|
|
510
|
-
isCommentEditor = _this$
|
|
430
|
+
var _this$props7 = _this.props,
|
|
431
|
+
editorView = _this$props7.editorView,
|
|
432
|
+
selectionRect = _this$props7.selectionRect,
|
|
433
|
+
editorAnalyticsAPI = _this$props7.editorAnalyticsAPI,
|
|
434
|
+
getEditorContainerWidth = _this$props7.getEditorContainerWidth,
|
|
435
|
+
getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
|
|
436
|
+
isCellMenuOpenByKeyboard = _this$props7.isCellMenuOpenByKeyboard,
|
|
437
|
+
isCommentEditor = _this$props7.isCommentEditor;
|
|
511
438
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
512
439
|
var state = editorView.state,
|
|
513
440
|
dispatch = editorView.dispatch;
|
|
514
|
-
var
|
|
515
|
-
targetCellPosition =
|
|
516
|
-
|
|
517
|
-
isTableScalingEnabled =
|
|
441
|
+
var _getPluginState3 = getPluginState(state),
|
|
442
|
+
targetCellPosition = _getPluginState3.targetCellPosition,
|
|
443
|
+
_getPluginState3$isTa = _getPluginState3.isTableScalingEnabled,
|
|
444
|
+
isTableScalingEnabled = _getPluginState3$isTa === void 0 ? false : _getPluginState3$isTa;
|
|
518
445
|
var _ref3 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
519
446
|
_ref3$tableWithFixedC = _ref3.tableWithFixedColumnWidthsOption,
|
|
520
447
|
tableWithFixedColumnWidthsOption = _ref3$tableWithFixedC === void 0 ? false : _ref3$tableWithFixedC;
|
|
@@ -578,8 +505,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
578
505
|
_this.toggleOpen();
|
|
579
506
|
break;
|
|
580
507
|
case 'delete_row':
|
|
581
|
-
var
|
|
582
|
-
isHeaderRowRequired =
|
|
508
|
+
var _getPluginState4 = getPluginState(state),
|
|
509
|
+
isHeaderRowRequired = _getPluginState4.pluginConfig.isHeaderRowRequired;
|
|
583
510
|
deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(state, dispatch);
|
|
584
511
|
_this.toggleOpen();
|
|
585
512
|
break;
|
|
@@ -607,11 +534,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
607
534
|
}
|
|
608
535
|
});
|
|
609
536
|
_defineProperty(_this, "toggleOpen", function () {
|
|
610
|
-
var _this$
|
|
611
|
-
isOpen = _this$
|
|
612
|
-
_this$
|
|
613
|
-
state = _this$
|
|
614
|
-
dispatch = _this$
|
|
537
|
+
var _this$props8 = _this.props,
|
|
538
|
+
isOpen = _this$props8.isOpen,
|
|
539
|
+
_this$props8$editorVi = _this$props8.editorView,
|
|
540
|
+
state = _this$props8$editorVi.state,
|
|
541
|
+
dispatch = _this$props8$editorVi.dispatch;
|
|
615
542
|
toggleContextualMenu()(state, dispatch);
|
|
616
543
|
if (!isOpen) {
|
|
617
544
|
_this.setState({
|
|
@@ -620,12 +547,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
620
547
|
}
|
|
621
548
|
});
|
|
622
549
|
_defineProperty(_this, "handleOpenChange", function (payload) {
|
|
623
|
-
var _this$
|
|
624
|
-
_this$
|
|
625
|
-
state = _this$
|
|
626
|
-
dispatch = _this$
|
|
627
|
-
dom = _this$
|
|
628
|
-
isCellMenuOpenByKeyboard = _this$
|
|
550
|
+
var _this$props9 = _this.props,
|
|
551
|
+
_this$props9$editorVi = _this$props9.editorView,
|
|
552
|
+
state = _this$props9$editorVi.state,
|
|
553
|
+
dispatch = _this$props9$editorVi.dispatch,
|
|
554
|
+
dom = _this$props9$editorVi.dom,
|
|
555
|
+
isCellMenuOpenByKeyboard = _this$props9.isCellMenuOpenByKeyboard;
|
|
629
556
|
if (payload) {
|
|
630
557
|
var event = payload.event;
|
|
631
558
|
if (event && event instanceof KeyboardEvent) {
|
|
@@ -664,11 +591,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
664
591
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
665
592
|
_defineProperty(_this, "handleItemMouseEnter", function (_ref4) {
|
|
666
593
|
var item = _ref4.item;
|
|
667
|
-
var _this$
|
|
668
|
-
_this$
|
|
669
|
-
state = _this$
|
|
670
|
-
dispatch = _this$
|
|
671
|
-
selectionRect = _this$
|
|
594
|
+
var _this$props0 = _this.props,
|
|
595
|
+
_this$props0$editorVi = _this$props0.editorView,
|
|
596
|
+
state = _this$props0$editorVi.state,
|
|
597
|
+
dispatch = _this$props0$editorVi.dispatch,
|
|
598
|
+
selectionRect = _this$props0.selectionRect;
|
|
672
599
|
if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
|
|
673
600
|
if (item.value.name === 'background') {
|
|
674
601
|
if (!_this.state.isSubmenuOpen) {
|
|
@@ -712,10 +639,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
712
639
|
}
|
|
713
640
|
});
|
|
714
641
|
_defineProperty(_this, "setColor", function (color) {
|
|
715
|
-
var _this$
|
|
716
|
-
editorView = _this$
|
|
717
|
-
editorAnalyticsAPI = _this$
|
|
718
|
-
isCellMenuOpenByKeyboard = _this$
|
|
642
|
+
var _this$props1 = _this.props,
|
|
643
|
+
editorView = _this$props1.editorView,
|
|
644
|
+
editorAnalyticsAPI = _this$props1.editorAnalyticsAPI,
|
|
645
|
+
isCellMenuOpenByKeyboard = _this$props1.isCellMenuOpenByKeyboard;
|
|
719
646
|
var state = editorView.state,
|
|
720
647
|
dispatch = editorView.dispatch,
|
|
721
648
|
dom = editorView.dom;
|
|
@@ -753,26 +680,22 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
753
680
|
}, {
|
|
754
681
|
key: "componentDidUpdate",
|
|
755
682
|
value: function componentDidUpdate() {
|
|
756
|
-
var
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen) {
|
|
683
|
+
var _getPluginState5 = getPluginState(this.props.editorView.state),
|
|
684
|
+
isContextualMenuOpen = _getPluginState5.isContextualMenuOpen;
|
|
685
|
+
if (this.props.isDragMenuOpen && isContextualMenuOpen) {
|
|
760
686
|
toggleContextualMenu()(this.props.editorView.state, this.props.editorView.dispatch);
|
|
761
687
|
}
|
|
762
688
|
}
|
|
763
689
|
}, {
|
|
764
690
|
key: "render",
|
|
765
691
|
value: function render() {
|
|
766
|
-
var _this$
|
|
767
|
-
isOpen = _this$
|
|
768
|
-
offset = _this$
|
|
769
|
-
boundariesElement = _this$
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
var _getPluginState12 = getPluginState(editorView.state),
|
|
774
|
-
isDragAndDropEnabled = _getPluginState12.isDragAndDropEnabled;
|
|
775
|
-
var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
692
|
+
var _this$props10 = this.props,
|
|
693
|
+
isOpen = _this$props10.isOpen,
|
|
694
|
+
offset = _this$props10.offset,
|
|
695
|
+
boundariesElement = _this$props10.boundariesElement,
|
|
696
|
+
isCellMenuOpenByKeyboard = _this$props10.isCellMenuOpenByKeyboard,
|
|
697
|
+
api = _this$props10.api;
|
|
698
|
+
var items = this.createContextMenuItems();
|
|
776
699
|
var isOpenAllowed = false;
|
|
777
700
|
isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
|
|
778
701
|
return jsx(UserIntentPopupWrapper, {
|
|
@@ -798,7 +721,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
798
721
|
onMouseEnter: this.handleItemMouseEnter,
|
|
799
722
|
onMouseLeave: this.handleItemMouseLeave,
|
|
800
723
|
fitHeight: 188,
|
|
801
|
-
fitWidth:
|
|
724
|
+
fitWidth: contextualMenuDropdownWidthDnD
|
|
802
725
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
803
726
|
,
|
|
804
727
|
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
@@ -806,9 +729,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
806
729
|
},
|
|
807
730
|
boundariesElement: boundariesElement,
|
|
808
731
|
offset: offset,
|
|
809
|
-
section:
|
|
810
|
-
hasSeparator: true
|
|
811
|
-
} : undefined,
|
|
732
|
+
section: dropdownMenuSection,
|
|
812
733
|
allowEnterDefaultBehavior: this.state.isSubmenuOpen
|
|
813
734
|
})));
|
|
814
735
|
}
|
|
@@ -9,7 +9,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
9
9
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
12
|
-
import {
|
|
12
|
+
import { contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
13
13
|
|
|
14
14
|
// Ignored via go/ees005
|
|
15
15
|
// eslint-disable-next-line import/no-named-as-default
|
|
@@ -35,8 +35,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
35
35
|
|
|
36
36
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
37
37
|
var _getPluginState = getPluginState(editorView.state),
|
|
38
|
-
targetCellPosition = _getPluginState.targetCellPosition
|
|
39
|
-
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
38
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
40
39
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
41
40
|
return null;
|
|
42
41
|
}
|
|
@@ -65,7 +64,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
65
64
|
boundariesElement: boundariesElement,
|
|
66
65
|
scrollableElement: scrollableElement,
|
|
67
66
|
fitHeight: tablePopupMenuFitHeight,
|
|
68
|
-
fitWidth:
|
|
67
|
+
fitWidth: contextualMenuDropdownWidthDnD
|
|
69
68
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
70
69
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
71
70
|
,
|
|
@@ -76,7 +75,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
76
75
|
offset: [-7, 0],
|
|
77
76
|
stick: true
|
|
78
77
|
}, jsx("div", {
|
|
79
|
-
css: tablePopupStyles(
|
|
78
|
+
css: tablePopupStyles()
|
|
80
79
|
}, jsx(ContextualMenu, {
|
|
81
80
|
editorView: editorView
|
|
82
81
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -4,7 +4,7 @@ var _templateObject;
|
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
6
6
|
import { TableCssClassName as ClassName } from '../../types';
|
|
7
|
-
import {
|
|
7
|
+
import { contextualMenuDropdownWidthDnD } from '../consts';
|
|
8
8
|
export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
9
9
|
return css({
|
|
10
10
|
'&::before': {
|
|
@@ -13,8 +13,8 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
export var tablePopupStyles = function tablePopupStyles(
|
|
17
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
16
|
+
export var tablePopupStyles = function tablePopupStyles(
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
18
18
|
) {
|
|
19
|
-
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: 0;\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:
|
|
19
|
+
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: 0;\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.CONTEXTUAL_SUBMENU, "var(--ds-radius-small, 3px)", "var(--ds-surface-overlay, #FFFFFF)", "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)", contextualMenuDropdownWidthDnD, "var(--ds-space-100, 8px)", ClassName.CONTEXTUAL_MENU_ICON_SMALL, tableBackgroundBorderColor, "var(--ds-radius-small, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, #292A2E)");
|
|
20
20
|
};
|