@atlaskit/editor-plugin-table 13.0.8 → 13.1.0
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/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +8 -4
- package/dist/cjs/ui/toolbar.js +13 -10
- package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +8 -4
- package/dist/es2019/ui/toolbar.js +13 -10
- package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +8 -4
- package/dist/esm/ui/toolbar.js +13 -10
- package/dist/types/tablePluginType.d.ts +3 -1
- package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +2 -1
- package/dist/types-ts4.5/tablePluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +2 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 13.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
|
|
8
|
+
[ux] ED-29120 add a new config option for default editor preset
|
|
9
|
+
(`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
|
|
10
|
+
for editors that can't be excluded at the experiment level.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 13.0.8
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -21,16 +21,19 @@ var containerStyles = (0, _primitives.xcss)({
|
|
|
21
21
|
});
|
|
22
22
|
var FloatingAlignmentButtons = exports.FloatingAlignmentButtons = function FloatingAlignmentButtons(_ref) {
|
|
23
23
|
var alignmentButtons = _ref.alignmentButtons,
|
|
24
|
-
dispatchCommand = _ref.dispatchCommand
|
|
24
|
+
dispatchCommand = _ref.dispatchCommand,
|
|
25
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
25
26
|
return (0, _react.jsx)(_primitives.Box, {
|
|
26
27
|
xcss: containerStyles
|
|
27
28
|
}, (0, _react.jsx)(_button.ButtonGroup, null, alignmentButtons.map(function (item, idx) {
|
|
28
29
|
switch (item.type) {
|
|
29
30
|
case 'separator':
|
|
31
|
+
return (0, _react.jsx)(_ui.FloatingToolbarSeparator
|
|
30
32
|
// Ignored via go/ees005
|
|
31
33
|
// eslint-disable-next-line react/no-array-index-key
|
|
32
|
-
|
|
33
|
-
key: idx
|
|
34
|
+
, {
|
|
35
|
+
key: idx,
|
|
36
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
34
37
|
});
|
|
35
38
|
case 'button':
|
|
36
39
|
// Ignored via go/ees005
|
|
@@ -49,7 +52,8 @@ var FloatingAlignmentButtons = exports.FloatingAlignmentButtons = function Float
|
|
|
49
52
|
disabled: item.disabled,
|
|
50
53
|
onClick: function onClick() {
|
|
51
54
|
dispatchCommand(item.onClick);
|
|
52
|
-
}
|
|
55
|
+
},
|
|
56
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
})));
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -374,7 +374,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
374
374
|
var isTableScalingEnabled = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || false;
|
|
375
375
|
var nodeType = state.schema.nodes.table;
|
|
376
376
|
var toolbarTitle = 'Table floating controls';
|
|
377
|
-
var
|
|
377
|
+
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
378
378
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
379
379
|
var _api$editorViewMode;
|
|
380
380
|
var isDragHandleMenuOpened = false;
|
|
@@ -430,10 +430,10 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
430
430
|
return element;
|
|
431
431
|
};
|
|
432
432
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
433
|
-
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
433
|
+
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
434
434
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
435
435
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
436
|
-
var colorPicker = !
|
|
436
|
+
var colorPicker = !areAnyNewToolbarFlagsEnabled ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
437
437
|
|
|
438
438
|
// Check if we need to show confirm dialog for delete button
|
|
439
439
|
var confirmDialog;
|
|
@@ -512,12 +512,12 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
512
512
|
},
|
|
513
513
|
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex + 1,
|
|
514
514
|
// Place the context menu slightly above the others
|
|
515
|
-
items: [menu].concat((0, _toConsumableArray2.default)(!
|
|
515
|
+
items: [menu].concat((0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), (0, _toConsumableArray2.default)(alignmentMenu), (0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), (0, _toConsumableArray2.default)(cellItems), (0, _toConsumableArray2.default)(columnSettingsItems), (0, _toConsumableArray2.default)(colorPicker), (0, _toConsumableArray2.default)(!areAnyNewToolbarFlagsEnabled ? [{
|
|
516
516
|
type: 'extensions-placeholder',
|
|
517
517
|
separator: 'end'
|
|
518
518
|
}, copyButton, {
|
|
519
519
|
type: 'separator'
|
|
520
|
-
}, deleteButton] : [
|
|
520
|
+
}, deleteButton] : [areAnyNewToolbarFlagsEnabled && {
|
|
521
521
|
type: 'separator',
|
|
522
522
|
fullHeight: true
|
|
523
523
|
}, {
|
|
@@ -544,10 +544,11 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
544
544
|
dropdownOptions: dropdownOptions,
|
|
545
545
|
disabled: function disabled(key) {
|
|
546
546
|
return isNestedTable && ['referentiality:connections', 'chart:insert-chart'].includes(key);
|
|
547
|
-
}
|
|
547
|
+
},
|
|
548
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
548
549
|
});
|
|
549
550
|
}
|
|
550
|
-
}].concat((0, _toConsumableArray2.default)(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider && !
|
|
551
|
+
}].concat((0, _toConsumableArray2.default)(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider && !areAnyNewToolbarFlagsEnabled ? [{
|
|
551
552
|
type: 'separator'
|
|
552
553
|
}] : []), [_objectSpread({
|
|
553
554
|
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
@@ -650,7 +651,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
650
651
|
disabled: !wouldChange
|
|
651
652
|
});
|
|
652
653
|
}
|
|
653
|
-
if (items.length !== 0 && !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
|
|
654
|
+
if (items.length !== 0 && !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
|
|
654
655
|
items.push({
|
|
655
656
|
type: 'separator'
|
|
656
657
|
});
|
|
@@ -720,7 +721,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
720
721
|
}
|
|
721
722
|
return false;
|
|
722
723
|
};
|
|
723
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) {
|
|
724
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, isFullWidthEditor, isCommentEditor) {
|
|
724
725
|
var formatMessage = _ref6.formatMessage;
|
|
725
726
|
var tableObject = (0, _utils3.findTable)(editorState.selection);
|
|
726
727
|
if (!tableObject) {
|
|
@@ -777,7 +778,9 @@ var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
|
777
778
|
alignmentButtons: alignmentButtons
|
|
778
779
|
// Ignored via go/ees005
|
|
779
780
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
780
|
-
}, props
|
|
781
|
+
}, props, {
|
|
782
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
783
|
+
}));
|
|
781
784
|
},
|
|
782
785
|
width: 74,
|
|
783
786
|
height: 32
|
|
@@ -13,17 +13,20 @@ const containerStyles = xcss({
|
|
|
13
13
|
});
|
|
14
14
|
export const FloatingAlignmentButtons = ({
|
|
15
15
|
alignmentButtons,
|
|
16
|
-
dispatchCommand
|
|
16
|
+
dispatchCommand,
|
|
17
|
+
areAnyNewToolbarFlagsEnabled
|
|
17
18
|
}) => {
|
|
18
19
|
return jsx(Box, {
|
|
19
20
|
xcss: containerStyles
|
|
20
21
|
}, jsx(ButtonGroup, null, alignmentButtons.map((item, idx) => {
|
|
21
22
|
switch (item.type) {
|
|
22
23
|
case 'separator':
|
|
24
|
+
return jsx(FloatingToolbarSeparator
|
|
23
25
|
// Ignored via go/ees005
|
|
24
26
|
// eslint-disable-next-line react/no-array-index-key
|
|
25
|
-
|
|
26
|
-
key: idx
|
|
27
|
+
, {
|
|
28
|
+
key: idx,
|
|
29
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
27
30
|
});
|
|
28
31
|
case 'button':
|
|
29
32
|
// Ignored via go/ees005
|
|
@@ -42,7 +45,8 @@ export const FloatingAlignmentButtons = ({
|
|
|
42
45
|
disabled: item.disabled,
|
|
43
46
|
onClick: () => {
|
|
44
47
|
dispatchCommand(item.onClick);
|
|
45
|
-
}
|
|
48
|
+
},
|
|
49
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
})));
|
|
@@ -354,7 +354,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
354
354
|
const isTableScalingEnabled = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || false;
|
|
355
355
|
const nodeType = state.schema.nodes.table;
|
|
356
356
|
const toolbarTitle = 'Table floating controls';
|
|
357
|
-
const
|
|
357
|
+
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
358
358
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
359
359
|
var _api$editorViewMode, _api$editorViewMode$s;
|
|
360
360
|
let isDragHandleMenuOpened = false;
|
|
@@ -409,10 +409,10 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
409
409
|
return element;
|
|
410
410
|
};
|
|
411
411
|
const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
412
|
-
const alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
412
|
+
const alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
413
413
|
const cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
414
414
|
const columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
415
|
-
const colorPicker = !
|
|
415
|
+
const colorPicker = !areAnyNewToolbarFlagsEnabled ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
416
416
|
|
|
417
417
|
// Check if we need to show confirm dialog for delete button
|
|
418
418
|
let confirmDialog;
|
|
@@ -482,12 +482,12 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
482
482
|
},
|
|
483
483
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
484
484
|
// Place the context menu slightly above the others
|
|
485
|
-
items: [menu, ...(!
|
|
485
|
+
items: [menu, ...(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), ...alignmentMenu, ...(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), ...cellItems, ...columnSettingsItems, ...colorPicker, ...(!areAnyNewToolbarFlagsEnabled ? [{
|
|
486
486
|
type: 'extensions-placeholder',
|
|
487
487
|
separator: 'end'
|
|
488
488
|
}, copyButton, {
|
|
489
489
|
type: 'separator'
|
|
490
|
-
}, deleteButton] : [
|
|
490
|
+
}, deleteButton] : [areAnyNewToolbarFlagsEnabled && {
|
|
491
491
|
type: 'separator',
|
|
492
492
|
fullHeight: true
|
|
493
493
|
}, {
|
|
@@ -514,10 +514,11 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
514
514
|
dropdownOptions: dropdownOptions,
|
|
515
515
|
disabled: key => {
|
|
516
516
|
return isNestedTable && ['referentiality:connections', 'chart:insert-chart'].includes(key);
|
|
517
|
-
}
|
|
517
|
+
},
|
|
518
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
518
519
|
});
|
|
519
520
|
}
|
|
520
|
-
}, ...(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider && !
|
|
521
|
+
}, ...(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider && !areAnyNewToolbarFlagsEnabled ? [{
|
|
521
522
|
type: 'separator'
|
|
522
523
|
}] : []), {
|
|
523
524
|
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
@@ -606,7 +607,7 @@ const getColumnSettingItems = (editorState, editorView, {
|
|
|
606
607
|
disabled: !wouldChange
|
|
607
608
|
});
|
|
608
609
|
}
|
|
609
|
-
if (items.length !== 0 && !areToolbarFlagsEnabled()) {
|
|
610
|
+
if (items.length !== 0 && !areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
|
|
610
611
|
items.push({
|
|
611
612
|
type: 'separator'
|
|
612
613
|
});
|
|
@@ -674,7 +675,7 @@ const highlightColumnsHandler = (state, dispatch) => {
|
|
|
674
675
|
};
|
|
675
676
|
const getAlignmentOptionsConfig = (editorState, {
|
|
676
677
|
formatMessage
|
|
677
|
-
}, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) => {
|
|
678
|
+
}, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, isFullWidthEditor, isCommentEditor) => {
|
|
678
679
|
const tableObject = findTable(editorState.selection);
|
|
679
680
|
if (!tableObject) {
|
|
680
681
|
return [];
|
|
@@ -729,7 +730,9 @@ const getAlignmentOptionsConfig = (editorState, {
|
|
|
729
730
|
alignmentButtons: alignmentButtons
|
|
730
731
|
// Ignored via go/ees005
|
|
731
732
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
732
|
-
}, props
|
|
733
|
+
}, props, {
|
|
734
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
735
|
+
}));
|
|
733
736
|
},
|
|
734
737
|
width: 74,
|
|
735
738
|
height: 32
|
|
@@ -13,16 +13,19 @@ var containerStyles = xcss({
|
|
|
13
13
|
});
|
|
14
14
|
export var FloatingAlignmentButtons = function FloatingAlignmentButtons(_ref) {
|
|
15
15
|
var alignmentButtons = _ref.alignmentButtons,
|
|
16
|
-
dispatchCommand = _ref.dispatchCommand
|
|
16
|
+
dispatchCommand = _ref.dispatchCommand,
|
|
17
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
17
18
|
return jsx(Box, {
|
|
18
19
|
xcss: containerStyles
|
|
19
20
|
}, jsx(ButtonGroup, null, alignmentButtons.map(function (item, idx) {
|
|
20
21
|
switch (item.type) {
|
|
21
22
|
case 'separator':
|
|
23
|
+
return jsx(FloatingToolbarSeparator
|
|
22
24
|
// Ignored via go/ees005
|
|
23
25
|
// eslint-disable-next-line react/no-array-index-key
|
|
24
|
-
|
|
25
|
-
key: idx
|
|
26
|
+
, {
|
|
27
|
+
key: idx,
|
|
28
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
26
29
|
});
|
|
27
30
|
case 'button':
|
|
28
31
|
// Ignored via go/ees005
|
|
@@ -41,7 +44,8 @@ export var FloatingAlignmentButtons = function FloatingAlignmentButtons(_ref) {
|
|
|
41
44
|
disabled: item.disabled,
|
|
42
45
|
onClick: function onClick() {
|
|
43
46
|
dispatchCommand(item.onClick);
|
|
44
|
-
}
|
|
47
|
+
},
|
|
48
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
})));
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -367,7 +367,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
367
367
|
var isTableScalingEnabled = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || false;
|
|
368
368
|
var nodeType = state.schema.nodes.table;
|
|
369
369
|
var toolbarTitle = 'Table floating controls';
|
|
370
|
-
var
|
|
370
|
+
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
371
371
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
372
372
|
var _api$editorViewMode;
|
|
373
373
|
var isDragHandleMenuOpened = false;
|
|
@@ -423,10 +423,10 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
423
423
|
return element;
|
|
424
424
|
};
|
|
425
425
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
426
|
-
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
426
|
+
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
427
427
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
428
428
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
429
|
-
var colorPicker = !
|
|
429
|
+
var colorPicker = !areAnyNewToolbarFlagsEnabled ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
430
430
|
|
|
431
431
|
// Check if we need to show confirm dialog for delete button
|
|
432
432
|
var confirmDialog;
|
|
@@ -505,12 +505,12 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
505
505
|
},
|
|
506
506
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
507
507
|
// Place the context menu slightly above the others
|
|
508
|
-
items: [menu].concat(_toConsumableArray(!
|
|
508
|
+
items: [menu].concat(_toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), _toConsumableArray(alignmentMenu), _toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), _toConsumableArray(cellItems), _toConsumableArray(columnSettingsItems), _toConsumableArray(colorPicker), _toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [{
|
|
509
509
|
type: 'extensions-placeholder',
|
|
510
510
|
separator: 'end'
|
|
511
511
|
}, copyButton, {
|
|
512
512
|
type: 'separator'
|
|
513
|
-
}, deleteButton] : [
|
|
513
|
+
}, deleteButton] : [areAnyNewToolbarFlagsEnabled && {
|
|
514
514
|
type: 'separator',
|
|
515
515
|
fullHeight: true
|
|
516
516
|
}, {
|
|
@@ -537,10 +537,11 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
537
537
|
dropdownOptions: dropdownOptions,
|
|
538
538
|
disabled: function disabled(key) {
|
|
539
539
|
return isNestedTable && ['referentiality:connections', 'chart:insert-chart'].includes(key);
|
|
540
|
-
}
|
|
540
|
+
},
|
|
541
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
541
542
|
});
|
|
542
543
|
}
|
|
543
|
-
}].concat(_toConsumableArray(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider && !
|
|
544
|
+
}].concat(_toConsumableArray(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider && !areAnyNewToolbarFlagsEnabled ? [{
|
|
544
545
|
type: 'separator'
|
|
545
546
|
}] : []), [_objectSpread({
|
|
546
547
|
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
@@ -643,7 +644,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
643
644
|
disabled: !wouldChange
|
|
644
645
|
});
|
|
645
646
|
}
|
|
646
|
-
if (items.length !== 0 && !areToolbarFlagsEnabled()) {
|
|
647
|
+
if (items.length !== 0 && !areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
|
|
647
648
|
items.push({
|
|
648
649
|
type: 'separator'
|
|
649
650
|
});
|
|
@@ -713,7 +714,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
713
714
|
}
|
|
714
715
|
return false;
|
|
715
716
|
};
|
|
716
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) {
|
|
717
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, editorView, shouldUseIncreasedScalingPercent, areAnyNewToolbarFlagsEnabled, isFullWidthEditor, isCommentEditor) {
|
|
717
718
|
var formatMessage = _ref6.formatMessage;
|
|
718
719
|
var tableObject = findTable(editorState.selection);
|
|
719
720
|
if (!tableObject) {
|
|
@@ -770,7 +771,9 @@ var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
|
770
771
|
alignmentButtons: alignmentButtons
|
|
771
772
|
// Ignored via go/ees005
|
|
772
773
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
773
|
-
}, props
|
|
774
|
+
}, props, {
|
|
775
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
776
|
+
}));
|
|
774
777
|
},
|
|
775
778
|
width: 74,
|
|
776
779
|
height: 32
|
|
@@ -11,6 +11,7 @@ import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
|
11
11
|
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
12
12
|
import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode';
|
|
13
13
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
14
|
+
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
14
15
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
15
16
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
16
17
|
import type { PluginConfig, TableSharedState } from './types';
|
|
@@ -53,7 +54,8 @@ export type TablePluginDependencies = [
|
|
|
53
54
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
54
55
|
OptionalPlugin<ExtensionPlugin>,
|
|
55
56
|
OptionalPlugin<InteractionPlugin>,
|
|
56
|
-
OptionalPlugin<UserIntentPlugin
|
|
57
|
+
OptionalPlugin<UserIntentPlugin>,
|
|
58
|
+
OptionalPlugin<ToolbarPlugin>
|
|
57
59
|
];
|
|
58
60
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
59
61
|
actions: TablePluginActions;
|
|
@@ -6,7 +6,8 @@ import { jsx } from '@emotion/react';
|
|
|
6
6
|
import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
7
7
|
type Props = {
|
|
8
8
|
alignmentButtons: FloatingToolbarItem<Command>[];
|
|
9
|
+
areAnyNewToolbarFlagsEnabled: boolean;
|
|
9
10
|
dispatchCommand: (command: Command) => void;
|
|
10
11
|
};
|
|
11
|
-
export declare const FloatingAlignmentButtons: ({ alignmentButtons, dispatchCommand }: Props) => jsx.JSX.Element;
|
|
12
|
+
export declare const FloatingAlignmentButtons: ({ alignmentButtons, dispatchCommand, areAnyNewToolbarFlagsEnabled }: Props) => jsx.JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -11,6 +11,7 @@ import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
|
11
11
|
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
12
12
|
import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode';
|
|
13
13
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
14
|
+
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
14
15
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
15
16
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
16
17
|
import type { PluginConfig, TableSharedState } from './types';
|
|
@@ -53,7 +54,8 @@ export type TablePluginDependencies = [
|
|
|
53
54
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
54
55
|
OptionalPlugin<ExtensionPlugin>,
|
|
55
56
|
OptionalPlugin<InteractionPlugin>,
|
|
56
|
-
OptionalPlugin<UserIntentPlugin
|
|
57
|
+
OptionalPlugin<UserIntentPlugin>,
|
|
58
|
+
OptionalPlugin<ToolbarPlugin>
|
|
57
59
|
];
|
|
58
60
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
59
61
|
actions: TablePluginActions;
|
|
@@ -6,7 +6,8 @@ import { jsx } from '@emotion/react';
|
|
|
6
6
|
import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
7
7
|
type Props = {
|
|
8
8
|
alignmentButtons: FloatingToolbarItem<Command>[];
|
|
9
|
+
areAnyNewToolbarFlagsEnabled: boolean;
|
|
9
10
|
dispatchCommand: (command: Command) => void;
|
|
10
11
|
};
|
|
11
|
-
export declare const FloatingAlignmentButtons: ({ alignmentButtons, dispatchCommand }: Props) => jsx.JSX.Element;
|
|
12
|
+
export declare const FloatingAlignmentButtons: ({ alignmentButtons, dispatchCommand, areAnyNewToolbarFlagsEnabled }: Props) => jsx.JSX.Element;
|
|
12
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^6.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^1.0.0",
|
|
44
44
|
"@atlaskit/editor-plugin-selection": "^4.0.0",
|
|
45
|
+
"@atlaskit/editor-plugin-toolbar": "^1.2.0",
|
|
45
46
|
"@atlaskit/editor-plugin-user-intent": "^2.0.0",
|
|
46
47
|
"@atlaskit/editor-plugin-width": "^5.0.0",
|
|
47
48
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
@@ -55,12 +56,12 @@
|
|
|
55
56
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
56
57
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
57
58
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
58
|
-
"@atlaskit/primitives": "^14.
|
|
59
|
+
"@atlaskit/primitives": "^14.14.0",
|
|
59
60
|
"@atlaskit/react-ufo": "^4.5.0",
|
|
60
61
|
"@atlaskit/theme": "^20.0.0",
|
|
61
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^12.8.0",
|
|
62
63
|
"@atlaskit/toggle": "^15.1.0",
|
|
63
|
-
"@atlaskit/tokens": "^6.
|
|
64
|
+
"@atlaskit/tokens": "^6.3.0",
|
|
64
65
|
"@atlaskit/tooltip": "^20.4.0",
|
|
65
66
|
"@babel/runtime": "^7.0.0",
|
|
66
67
|
"@emotion/react": "^11.7.1",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"uuid": "^3.1.0"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^108.
|
|
75
|
+
"@atlaskit/editor-common": "^108.6.0",
|
|
75
76
|
"react": "^18.2.0",
|
|
76
77
|
"react-dom": "^18.2.0",
|
|
77
78
|
"react-intl-next": "npm:react-intl@^5.18.1"
|