@atlaskit/editor-plugin-media 14.1.1 → 14.2.1
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/ui/toolbar/index.js +31 -21
- package/dist/cjs/ui/toolbar/mediaInline.js +17 -13
- package/dist/es2019/ui/toolbar/index.js +21 -16
- package/dist/es2019/ui/toolbar/mediaInline.js +15 -12
- package/dist/esm/ui/toolbar/index.js +31 -21
- package/dist/esm/ui/toolbar/mediaInline.js +17 -13
- package/package.json +14 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 14.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 14.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`fe857f3a8f72b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fe857f3a8f72b) -
|
|
14
|
+
Gate media toolbar separator changes behind cc-maui-toolbar-separators-update feature flag
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 14.1.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -295,6 +295,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
295
295
|
hoverDecoration = _ref3.hoverDecoration;
|
|
296
296
|
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
297
297
|
var disableDownloadButton = (0, _utils2.getIsDownloadDisabledByDataSecurityPolicy)(pluginState);
|
|
298
|
+
var mauiToolbarSeparatorsUpdateEnabled = (0, _platformFeatureFlags.fg)('cc-maui-toolbar-separators-update') && areAnyNewToolbarFlagsEnabled;
|
|
298
299
|
if ((0, _imageBorder.shouldShowImageBorder)(state)) {
|
|
299
300
|
toolbarButtons.push({
|
|
300
301
|
type: 'custom',
|
|
@@ -386,7 +387,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
386
387
|
addLayoutDropdownToToolbar();
|
|
387
388
|
} else {
|
|
388
389
|
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
|
|
389
|
-
if (layoutButtons.length) {
|
|
390
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
390
391
|
toolbarButtons.push({
|
|
391
392
|
type: 'separator'
|
|
392
393
|
});
|
|
@@ -449,17 +450,18 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
449
450
|
type: 'separator'
|
|
450
451
|
});
|
|
451
452
|
} else {
|
|
453
|
+
var _toolbarButtons;
|
|
452
454
|
var switchFromBlockToInline = (0, _utils2.getMediaSingleAndMediaInlineSwitcherDropdown)('block', intl, pluginInjectionApi, hasCaption);
|
|
453
|
-
toolbarButtons.push(switchFromBlockToInline, {
|
|
455
|
+
(_toolbarButtons = toolbarButtons).push.apply(_toolbarButtons, [switchFromBlockToInline].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
454
456
|
type: 'separator',
|
|
455
457
|
fullHeight: true
|
|
456
|
-
});
|
|
458
|
+
}])));
|
|
457
459
|
}
|
|
458
460
|
}
|
|
459
461
|
}
|
|
460
462
|
|
|
461
463
|
// A separator is needed regardless switcher is enabled or not
|
|
462
|
-
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) {
|
|
464
|
+
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
463
465
|
toolbarButtons.push({
|
|
464
466
|
type: 'separator',
|
|
465
467
|
fullHeight: true
|
|
@@ -630,7 +632,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
630
632
|
}
|
|
631
633
|
}
|
|
632
634
|
if (isViewOnly) {
|
|
633
|
-
|
|
635
|
+
var _toolbarButtons2;
|
|
636
|
+
(_toolbarButtons2 = toolbarButtons).push.apply(_toolbarButtons2, [{
|
|
634
637
|
id: 'editor.media.image.download',
|
|
635
638
|
type: 'button',
|
|
636
639
|
icon: _download.default,
|
|
@@ -641,10 +644,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
641
644
|
disabled: disableDownloadButton,
|
|
642
645
|
title: intl.formatMessage(_mediaUi.messages.download),
|
|
643
646
|
supportsViewMode: true
|
|
644
|
-
}, {
|
|
647
|
+
}].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
645
648
|
type: 'separator',
|
|
646
649
|
supportsViewMode: true
|
|
647
|
-
});
|
|
650
|
+
}])));
|
|
648
651
|
}
|
|
649
652
|
if (!areAnyNewToolbarFlagsEnabled) {
|
|
650
653
|
var _pluginInjectionApi$a8;
|
|
@@ -685,14 +688,15 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
685
688
|
items.push(removeButton);
|
|
686
689
|
return items;
|
|
687
690
|
} else {
|
|
691
|
+
var _toolbarButtons6;
|
|
688
692
|
// Preview Support
|
|
689
693
|
if (allowAdvancedToolBarOptions && allowImagePreview) {
|
|
690
694
|
var _mediaNode2$attrs;
|
|
691
695
|
var _selectedMediaSingleNode3 = (0, _utils2.getSelectedMediaSingle)(state);
|
|
692
696
|
var _mediaNode2 = _selectedMediaSingleNode3 === null || _selectedMediaSingleNode3 === void 0 ? void 0 : _selectedMediaSingleNode3.node.content.firstChild;
|
|
693
697
|
if (!(0, _mediaSingle.isVideo)(_mediaNode2 === null || _mediaNode2 === void 0 || (_mediaNode2$attrs = _mediaNode2.attrs) === null || _mediaNode2$attrs === void 0 ? void 0 : _mediaNode2$attrs.__fileMimeType)) {
|
|
694
|
-
var _pluginInjectionApi$c3;
|
|
695
|
-
toolbarButtons.push({
|
|
698
|
+
var _toolbarButtons3, _pluginInjectionApi$c3;
|
|
699
|
+
(_toolbarButtons3 = toolbarButtons).push.apply(_toolbarButtons3, [{
|
|
696
700
|
id: 'editor.media.viewer',
|
|
697
701
|
testId: 'file-preview-toolbar-button',
|
|
698
702
|
type: 'button',
|
|
@@ -707,10 +711,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
707
711
|
},
|
|
708
712
|
disabled: (0, _editorPluginConnectivity.isOfflineMode)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.sharedState) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.mode),
|
|
709
713
|
supportsViewMode: true
|
|
710
|
-
}, {
|
|
714
|
+
}].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
711
715
|
type: 'separator',
|
|
712
716
|
supportsViewMode: true
|
|
713
|
-
});
|
|
717
|
+
}])));
|
|
714
718
|
}
|
|
715
719
|
}
|
|
716
720
|
if (allowAdvancedToolBarOptions && allowImageEditing && (0, _expValEquals.expValEquals)('platform_editor_add_image_editing', 'isEnabled', true)) {
|
|
@@ -722,7 +726,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
722
726
|
// Disable image editing for gifs as CropperJS does not support gif editing
|
|
723
727
|
var _isGif = (_mediaNode3 === null || _mediaNode3 === void 0 || (_mediaNode3$attrs2 = _mediaNode3.attrs) === null || _mediaNode3$attrs2 === void 0 ? void 0 : _mediaNode3$attrs2.__fileMimeType) === 'image/gif';
|
|
724
728
|
if (!(0, _mediaSingle.isVideo)(_mediaNode3 === null || _mediaNode3 === void 0 || (_mediaNode3$attrs3 = _mediaNode3.attrs) === null || _mediaNode3$attrs3 === void 0 ? void 0 : _mediaNode3$attrs3.__fileMimeType) && !_isExternal && !_isGif) {
|
|
725
|
-
|
|
729
|
+
var _toolbarButtons4;
|
|
730
|
+
(_toolbarButtons4 = toolbarButtons).push.apply(_toolbarButtons4, [{
|
|
726
731
|
id: 'editor.media.edit',
|
|
727
732
|
testId: 'image-edit-toolbar-button',
|
|
728
733
|
type: 'button',
|
|
@@ -736,21 +741,22 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
736
741
|
})) !== null && _handleShowImageEdito2 !== void 0 ? _handleShowImageEdito2 : false;
|
|
737
742
|
},
|
|
738
743
|
supportsViewMode: false
|
|
739
|
-
}, {
|
|
744
|
+
}].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
740
745
|
type: 'separator',
|
|
741
746
|
supportsViewMode: false
|
|
742
|
-
});
|
|
747
|
+
}])));
|
|
743
748
|
}
|
|
744
749
|
}
|
|
745
750
|
|
|
746
751
|
// open link
|
|
747
752
|
if (allowLinking && (0, _linking3.shouldShowMediaLinkToolbar)(state) && mediaLinkingState && mediaLinkingState.editable) {
|
|
748
|
-
|
|
753
|
+
var _toolbarButtons5;
|
|
754
|
+
(_toolbarButtons5 = toolbarButtons).push.apply(_toolbarButtons5, [(0, _linking3.getOpenLinkToolbarButtonOption)(intl, mediaLinkingState, pluginInjectionApi)].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
749
755
|
type: 'separator',
|
|
750
756
|
supportsViewMode: true
|
|
751
|
-
});
|
|
757
|
+
}])));
|
|
752
758
|
}
|
|
753
|
-
isViewOnly && toolbarButtons.push({
|
|
759
|
+
isViewOnly && (_toolbarButtons6 = toolbarButtons).push.apply(_toolbarButtons6, [{
|
|
754
760
|
type: 'copy-button',
|
|
755
761
|
items: [{
|
|
756
762
|
state: state,
|
|
@@ -758,12 +764,14 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
758
764
|
nodeType: mediaSingle
|
|
759
765
|
}],
|
|
760
766
|
supportsViewMode: true
|
|
761
|
-
}, {
|
|
767
|
+
}].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
762
768
|
type: 'separator',
|
|
763
769
|
supportsViewMode: true
|
|
764
|
-
});
|
|
770
|
+
}])));
|
|
765
771
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
766
|
-
|
|
772
|
+
if (!mauiToolbarSeparatorsUpdateEnabled) {
|
|
773
|
+
(0, _utils2.updateToFullHeightSeparator)(toolbarButtons);
|
|
774
|
+
}
|
|
767
775
|
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience));
|
|
768
776
|
}
|
|
769
777
|
return toolbarButtons;
|
|
@@ -892,7 +900,9 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
892
900
|
}
|
|
893
901
|
if (!mediaPluginState.isResizing && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
894
902
|
var _pluginInjectionApi$a0, _pluginInjectionApi$a1, _pluginInjectionApi$a10;
|
|
895
|
-
(0,
|
|
903
|
+
if (!(0, _platformFeatureFlags.fg)('cc-maui-toolbar-separators-update')) {
|
|
904
|
+
(0, _utils2.updateToFullHeightSeparator)(items);
|
|
905
|
+
}
|
|
896
906
|
var showReplaceOption = !isViewOnly && mediaPluginState.allowsUploads && (0, _expValEquals.expValEquals)('platform_editor_inline_media_replacement', 'isEnabled', true) && selectedNodeType === mediaSingle;
|
|
897
907
|
var customOptions = [].concat((0, _toConsumableArray2.default)((0, _linking3.getLinkingDropdownOptions)(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly)), (0, _toConsumableArray2.default)((0, _altText2.getAltTextDropdownOption)(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a0 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a0 === void 0 ? void 0 : _pluginInjectionApi$a0.actions)), (0, _toConsumableArray2.default)((0, _pixelResizing2.getResizeDropdownOption)(options, state, intl.formatMessage, selectedNodeType)));
|
|
898
908
|
if (customOptions.length) {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.generateMediaInlineFloatingToolbar = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -20,6 +21,7 @@ var _imageInline = _interopRequireDefault(require("@atlaskit/icon/core/image-inl
|
|
|
20
21
|
var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
|
|
21
22
|
var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-card"));
|
|
22
23
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
24
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
25
|
var _linking = require("../../pm-plugins/commands/linking");
|
|
24
26
|
var _linking2 = require("../../pm-plugins/linking");
|
|
25
27
|
var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
|
|
@@ -48,6 +50,7 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
48
50
|
}
|
|
49
51
|
var items = [];
|
|
50
52
|
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
53
|
+
var mauiToolbarSeparatorsUpdateEnabled = (0, _platformFeatureFlags.fg)('cc-maui-toolbar-separators-update') && areAnyNewToolbarFlagsEnabled;
|
|
51
54
|
var preview = _objectSpread({
|
|
52
55
|
id: 'editor.media.viewer',
|
|
53
56
|
testId: 'file-preview-toolbar-button',
|
|
@@ -167,16 +170,16 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
167
170
|
});
|
|
168
171
|
}
|
|
169
172
|
};
|
|
170
|
-
items.push(switcherDropdown, {
|
|
173
|
+
items.push.apply(items, [switcherDropdown].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
171
174
|
type: 'separator',
|
|
172
175
|
fullHeight: true
|
|
173
|
-
}, download, {
|
|
176
|
+
}]), [download], (0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
174
177
|
type: 'separator',
|
|
175
178
|
supportsViewMode: true
|
|
176
|
-
}, preview, {
|
|
179
|
+
}]), [preview], (0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
177
180
|
type: 'separator',
|
|
178
181
|
fullHeight: true
|
|
179
|
-
});
|
|
182
|
+
}])));
|
|
180
183
|
}
|
|
181
184
|
return items;
|
|
182
185
|
};
|
|
@@ -193,6 +196,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
193
196
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
194
197
|
allowLinking = options.allowLinking,
|
|
195
198
|
allowImagePreview = options.allowImagePreview;
|
|
199
|
+
var mauiToolbarSeparatorsUpdateEnabled = (0, _platformFeatureFlags.fg)('cc-maui-toolbar-separators-update') && isEditorControlsEnabled;
|
|
196
200
|
if ((0, _imageBorder.shouldShowImageBorder)(state)) {
|
|
197
201
|
inlineImageItems.push({
|
|
198
202
|
type: 'custom',
|
|
@@ -317,21 +321,21 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
317
321
|
});
|
|
318
322
|
} else {
|
|
319
323
|
var switchFromInlineToBlock = (0, _utils.getMediaSingleAndMediaInlineSwitcherDropdown)('inline', intl, pluginInjectionApi);
|
|
320
|
-
inlineImageItems.push(switchFromInlineToBlock, {
|
|
324
|
+
inlineImageItems.push.apply(inlineImageItems, [switchFromInlineToBlock].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
321
325
|
type: 'separator',
|
|
322
326
|
fullHeight: true
|
|
323
|
-
});
|
|
327
|
+
}])));
|
|
324
328
|
if (isViewOnly) {
|
|
325
|
-
inlineImageItems.push(download, {
|
|
329
|
+
inlineImageItems.push.apply(inlineImageItems, [download].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
326
330
|
type: 'separator',
|
|
327
331
|
supportsViewMode: true
|
|
328
|
-
});
|
|
332
|
+
}])));
|
|
329
333
|
}
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
//Image Preview
|
|
333
337
|
if (allowImagePreview) {
|
|
334
|
-
inlineImageItems.push({
|
|
338
|
+
inlineImageItems.push.apply(inlineImageItems, [{
|
|
335
339
|
id: 'editor.media.viewer',
|
|
336
340
|
testId: 'file-preview-toolbar-button',
|
|
337
341
|
type: 'button',
|
|
@@ -345,18 +349,18 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
345
349
|
})) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
|
|
346
350
|
},
|
|
347
351
|
supportsViewMode: true
|
|
348
|
-
}, {
|
|
352
|
+
}].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
349
353
|
type: 'separator',
|
|
350
354
|
supportsViewMode: true
|
|
351
|
-
});
|
|
355
|
+
}])));
|
|
352
356
|
}
|
|
353
357
|
|
|
354
358
|
// open link
|
|
355
359
|
if (allowLinking && (0, _linking3.shouldShowMediaLinkToolbar)(state) && mediaLinkingState && mediaLinkingState.editable && isEditorControlsEnabled) {
|
|
356
|
-
inlineImageItems.push((0, _linking3.getOpenLinkToolbarButtonOption)(intl, mediaLinkingState, pluginInjectionApi), {
|
|
360
|
+
inlineImageItems.push.apply(inlineImageItems, [(0, _linking3.getOpenLinkToolbarButtonOption)(intl, mediaLinkingState, pluginInjectionApi)].concat((0, _toConsumableArray2.default)(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
357
361
|
type: 'separator',
|
|
358
362
|
supportsViewMode: true
|
|
359
|
-
});
|
|
363
|
+
}])));
|
|
360
364
|
}
|
|
361
365
|
if (isViewOnly && !isEditorControlsEnabled) {
|
|
362
366
|
inlineImageItems.push(download, {
|
|
@@ -286,6 +286,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
286
286
|
} = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {};
|
|
287
287
|
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
288
288
|
const disableDownloadButton = getIsDownloadDisabledByDataSecurityPolicy(pluginState);
|
|
289
|
+
const mauiToolbarSeparatorsUpdateEnabled = fg('cc-maui-toolbar-separators-update') && areAnyNewToolbarFlagsEnabled;
|
|
289
290
|
if (shouldShowImageBorder(state)) {
|
|
290
291
|
toolbarButtons.push({
|
|
291
292
|
type: 'custom',
|
|
@@ -379,7 +380,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
379
380
|
addLayoutDropdownToToolbar();
|
|
380
381
|
} else {
|
|
381
382
|
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
382
|
-
if (layoutButtons.length) {
|
|
383
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
383
384
|
toolbarButtons.push({
|
|
384
385
|
type: 'separator'
|
|
385
386
|
});
|
|
@@ -439,16 +440,16 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
439
440
|
});
|
|
440
441
|
} else {
|
|
441
442
|
const switchFromBlockToInline = getMediaSingleAndMediaInlineSwitcherDropdown('block', intl, pluginInjectionApi, hasCaption);
|
|
442
|
-
toolbarButtons.push(switchFromBlockToInline, {
|
|
443
|
+
toolbarButtons.push(switchFromBlockToInline, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
443
444
|
type: 'separator',
|
|
444
445
|
fullHeight: true
|
|
445
|
-
});
|
|
446
|
+
}]));
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
}
|
|
449
450
|
|
|
450
451
|
// A separator is needed regardless switcher is enabled or not
|
|
451
|
-
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) {
|
|
452
|
+
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
452
453
|
toolbarButtons.push({
|
|
453
454
|
type: 'separator',
|
|
454
455
|
fullHeight: true
|
|
@@ -640,10 +641,10 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
640
641
|
disabled: disableDownloadButton,
|
|
641
642
|
title: intl.formatMessage(messages.download),
|
|
642
643
|
supportsViewMode: true
|
|
643
|
-
}, {
|
|
644
|
+
}, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
644
645
|
type: 'separator',
|
|
645
646
|
supportsViewMode: true
|
|
646
|
-
});
|
|
647
|
+
}]));
|
|
647
648
|
}
|
|
648
649
|
if (!areAnyNewToolbarFlagsEnabled) {
|
|
649
650
|
var _pluginInjectionApi$a8;
|
|
@@ -706,10 +707,10 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
706
707
|
},
|
|
707
708
|
disabled: isOfflineMode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : (_pluginInjectionApi$c8 = _pluginInjectionApi$c7.sharedState) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : (_pluginInjectionApi$c9 = _pluginInjectionApi$c8.currentState()) === null || _pluginInjectionApi$c9 === void 0 ? void 0 : _pluginInjectionApi$c9.mode),
|
|
708
709
|
supportsViewMode: true
|
|
709
|
-
}, {
|
|
710
|
+
}, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
710
711
|
type: 'separator',
|
|
711
712
|
supportsViewMode: true
|
|
712
|
-
});
|
|
713
|
+
}]));
|
|
713
714
|
}
|
|
714
715
|
}
|
|
715
716
|
if (allowAdvancedToolBarOptions && allowImageEditing && expValEquals('platform_editor_add_image_editing', 'isEnabled', true)) {
|
|
@@ -735,19 +736,19 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
735
736
|
})) !== null && _handleShowImageEdito2 !== void 0 ? _handleShowImageEdito2 : false;
|
|
736
737
|
},
|
|
737
738
|
supportsViewMode: false
|
|
738
|
-
}, {
|
|
739
|
+
}, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
739
740
|
type: 'separator',
|
|
740
741
|
supportsViewMode: false
|
|
741
|
-
});
|
|
742
|
+
}]));
|
|
742
743
|
}
|
|
743
744
|
}
|
|
744
745
|
|
|
745
746
|
// open link
|
|
746
747
|
if (allowLinking && shouldShowMediaLinkToolbar(state) && mediaLinkingState && mediaLinkingState.editable) {
|
|
747
|
-
toolbarButtons.push(getOpenLinkToolbarButtonOption(intl, mediaLinkingState, pluginInjectionApi), {
|
|
748
|
+
toolbarButtons.push(getOpenLinkToolbarButtonOption(intl, mediaLinkingState, pluginInjectionApi), ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
748
749
|
type: 'separator',
|
|
749
750
|
supportsViewMode: true
|
|
750
|
-
});
|
|
751
|
+
}]));
|
|
751
752
|
}
|
|
752
753
|
isViewOnly && toolbarButtons.push({
|
|
753
754
|
type: 'copy-button',
|
|
@@ -757,12 +758,14 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
757
758
|
nodeType: mediaSingle
|
|
758
759
|
}],
|
|
759
760
|
supportsViewMode: true
|
|
760
|
-
}, {
|
|
761
|
+
}, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
761
762
|
type: 'separator',
|
|
762
763
|
supportsViewMode: true
|
|
763
|
-
});
|
|
764
|
+
}]));
|
|
764
765
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
765
|
-
|
|
766
|
+
if (!mauiToolbarSeparatorsUpdateEnabled) {
|
|
767
|
+
updateToFullHeightSeparator(toolbarButtons);
|
|
768
|
+
}
|
|
766
769
|
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience));
|
|
767
770
|
}
|
|
768
771
|
return toolbarButtons;
|
|
@@ -895,7 +898,9 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
895
898
|
}
|
|
896
899
|
if (!mediaPluginState.isResizing && areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
897
900
|
var _pluginInjectionApi$a0, _pluginInjectionApi$a1, _pluginInjectionApi$a10;
|
|
898
|
-
|
|
901
|
+
if (!fg('cc-maui-toolbar-separators-update')) {
|
|
902
|
+
updateToFullHeightSeparator(items);
|
|
903
|
+
}
|
|
899
904
|
const showReplaceOption = !isViewOnly && mediaPluginState.allowsUploads && expValEquals('platform_editor_inline_media_replacement', 'isEnabled', true) && selectedNodeType === mediaSingle;
|
|
900
905
|
const customOptions = [...getLinkingDropdownOptions(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly), ...getAltTextDropdownOption(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a0 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a0 === void 0 ? void 0 : _pluginInjectionApi$a0.actions), ...getResizeDropdownOption(options, state, intl.formatMessage, selectedNodeType)];
|
|
901
906
|
if (customOptions.length) {
|
|
@@ -11,6 +11,7 @@ import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
|
11
11
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
12
12
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
13
13
|
import { messages } from '@atlaskit/media-ui';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
15
16
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
16
17
|
import { currentMediaOrInlineNodeBorderMark } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -37,6 +38,7 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
37
38
|
}
|
|
38
39
|
const items = [];
|
|
39
40
|
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
41
|
+
const mauiToolbarSeparatorsUpdateEnabled = fg('cc-maui-toolbar-separators-update') && areAnyNewToolbarFlagsEnabled;
|
|
40
42
|
const preview = {
|
|
41
43
|
id: 'editor.media.viewer',
|
|
42
44
|
testId: 'file-preview-toolbar-button',
|
|
@@ -152,16 +154,16 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
152
154
|
spacing: "spacious"
|
|
153
155
|
})
|
|
154
156
|
};
|
|
155
|
-
items.push(switcherDropdown, {
|
|
157
|
+
items.push(switcherDropdown, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
156
158
|
type: 'separator',
|
|
157
159
|
fullHeight: true
|
|
158
|
-
}, download, {
|
|
160
|
+
}]), download, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
159
161
|
type: 'separator',
|
|
160
162
|
supportsViewMode: true
|
|
161
|
-
}, preview, {
|
|
163
|
+
}]), preview, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
162
164
|
type: 'separator',
|
|
163
165
|
fullHeight: true
|
|
164
|
-
});
|
|
166
|
+
}]));
|
|
165
167
|
}
|
|
166
168
|
return items;
|
|
167
169
|
};
|
|
@@ -181,6 +183,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
181
183
|
allowLinking,
|
|
182
184
|
allowImagePreview
|
|
183
185
|
} = options;
|
|
186
|
+
const mauiToolbarSeparatorsUpdateEnabled = fg('cc-maui-toolbar-separators-update') && isEditorControlsEnabled;
|
|
184
187
|
if (shouldShowImageBorder(state)) {
|
|
185
188
|
inlineImageItems.push({
|
|
186
189
|
type: 'custom',
|
|
@@ -309,15 +312,15 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
309
312
|
});
|
|
310
313
|
} else {
|
|
311
314
|
const switchFromInlineToBlock = getMediaSingleAndMediaInlineSwitcherDropdown('inline', intl, pluginInjectionApi);
|
|
312
|
-
inlineImageItems.push(switchFromInlineToBlock, {
|
|
315
|
+
inlineImageItems.push(switchFromInlineToBlock, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
313
316
|
type: 'separator',
|
|
314
317
|
fullHeight: true
|
|
315
|
-
});
|
|
318
|
+
}]));
|
|
316
319
|
if (isViewOnly) {
|
|
317
|
-
inlineImageItems.push(download, {
|
|
320
|
+
inlineImageItems.push(download, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
318
321
|
type: 'separator',
|
|
319
322
|
supportsViewMode: true
|
|
320
|
-
});
|
|
323
|
+
}]));
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
326
|
|
|
@@ -337,18 +340,18 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
337
340
|
})) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
|
|
338
341
|
},
|
|
339
342
|
supportsViewMode: true
|
|
340
|
-
}, {
|
|
343
|
+
}, ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
341
344
|
type: 'separator',
|
|
342
345
|
supportsViewMode: true
|
|
343
|
-
});
|
|
346
|
+
}]));
|
|
344
347
|
}
|
|
345
348
|
|
|
346
349
|
// open link
|
|
347
350
|
if (allowLinking && shouldShowMediaLinkToolbar(state) && mediaLinkingState && mediaLinkingState.editable && isEditorControlsEnabled) {
|
|
348
|
-
inlineImageItems.push(getOpenLinkToolbarButtonOption(intl, mediaLinkingState, pluginInjectionApi), {
|
|
351
|
+
inlineImageItems.push(getOpenLinkToolbarButtonOption(intl, mediaLinkingState, pluginInjectionApi), ...(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
349
352
|
type: 'separator',
|
|
350
353
|
supportsViewMode: true
|
|
351
|
-
});
|
|
354
|
+
}]));
|
|
352
355
|
}
|
|
353
356
|
if (isViewOnly && !isEditorControlsEnabled) {
|
|
354
357
|
inlineImageItems.push(download, {
|
|
@@ -286,6 +286,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
286
286
|
hoverDecoration = _ref3.hoverDecoration;
|
|
287
287
|
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
288
288
|
var disableDownloadButton = getIsDownloadDisabledByDataSecurityPolicy(pluginState);
|
|
289
|
+
var mauiToolbarSeparatorsUpdateEnabled = fg('cc-maui-toolbar-separators-update') && areAnyNewToolbarFlagsEnabled;
|
|
289
290
|
if (shouldShowImageBorder(state)) {
|
|
290
291
|
toolbarButtons.push({
|
|
291
292
|
type: 'custom',
|
|
@@ -377,7 +378,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
377
378
|
addLayoutDropdownToToolbar();
|
|
378
379
|
} else {
|
|
379
380
|
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
|
|
380
|
-
if (layoutButtons.length) {
|
|
381
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
381
382
|
toolbarButtons.push({
|
|
382
383
|
type: 'separator'
|
|
383
384
|
});
|
|
@@ -440,17 +441,18 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
440
441
|
type: 'separator'
|
|
441
442
|
});
|
|
442
443
|
} else {
|
|
444
|
+
var _toolbarButtons;
|
|
443
445
|
var switchFromBlockToInline = getMediaSingleAndMediaInlineSwitcherDropdown('block', intl, pluginInjectionApi, hasCaption);
|
|
444
|
-
toolbarButtons.push(
|
|
446
|
+
(_toolbarButtons = toolbarButtons).push.apply(_toolbarButtons, [switchFromBlockToInline].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
445
447
|
type: 'separator',
|
|
446
448
|
fullHeight: true
|
|
447
|
-
});
|
|
449
|
+
}])));
|
|
448
450
|
}
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
453
|
|
|
452
454
|
// A separator is needed regardless switcher is enabled or not
|
|
453
|
-
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) {
|
|
455
|
+
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
454
456
|
toolbarButtons.push({
|
|
455
457
|
type: 'separator',
|
|
456
458
|
fullHeight: true
|
|
@@ -621,7 +623,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
621
623
|
}
|
|
622
624
|
}
|
|
623
625
|
if (isViewOnly) {
|
|
624
|
-
|
|
626
|
+
var _toolbarButtons2;
|
|
627
|
+
(_toolbarButtons2 = toolbarButtons).push.apply(_toolbarButtons2, [{
|
|
625
628
|
id: 'editor.media.image.download',
|
|
626
629
|
type: 'button',
|
|
627
630
|
icon: DownloadIcon,
|
|
@@ -632,10 +635,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
632
635
|
disabled: disableDownloadButton,
|
|
633
636
|
title: intl.formatMessage(messages.download),
|
|
634
637
|
supportsViewMode: true
|
|
635
|
-
}
|
|
638
|
+
}].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
636
639
|
type: 'separator',
|
|
637
640
|
supportsViewMode: true
|
|
638
|
-
});
|
|
641
|
+
}])));
|
|
639
642
|
}
|
|
640
643
|
if (!areAnyNewToolbarFlagsEnabled) {
|
|
641
644
|
var _pluginInjectionApi$a8;
|
|
@@ -676,14 +679,15 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
676
679
|
items.push(removeButton);
|
|
677
680
|
return items;
|
|
678
681
|
} else {
|
|
682
|
+
var _toolbarButtons6;
|
|
679
683
|
// Preview Support
|
|
680
684
|
if (allowAdvancedToolBarOptions && allowImagePreview) {
|
|
681
685
|
var _mediaNode2$attrs;
|
|
682
686
|
var _selectedMediaSingleNode3 = getSelectedMediaSingle(state);
|
|
683
687
|
var _mediaNode2 = _selectedMediaSingleNode3 === null || _selectedMediaSingleNode3 === void 0 ? void 0 : _selectedMediaSingleNode3.node.content.firstChild;
|
|
684
688
|
if (!isVideo(_mediaNode2 === null || _mediaNode2 === void 0 || (_mediaNode2$attrs = _mediaNode2.attrs) === null || _mediaNode2$attrs === void 0 ? void 0 : _mediaNode2$attrs.__fileMimeType)) {
|
|
685
|
-
var _pluginInjectionApi$c3;
|
|
686
|
-
toolbarButtons.push({
|
|
689
|
+
var _toolbarButtons3, _pluginInjectionApi$c3;
|
|
690
|
+
(_toolbarButtons3 = toolbarButtons).push.apply(_toolbarButtons3, [{
|
|
687
691
|
id: 'editor.media.viewer',
|
|
688
692
|
testId: 'file-preview-toolbar-button',
|
|
689
693
|
type: 'button',
|
|
@@ -698,10 +702,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
698
702
|
},
|
|
699
703
|
disabled: isOfflineMode(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.sharedState) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.mode),
|
|
700
704
|
supportsViewMode: true
|
|
701
|
-
}
|
|
705
|
+
}].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
702
706
|
type: 'separator',
|
|
703
707
|
supportsViewMode: true
|
|
704
|
-
});
|
|
708
|
+
}])));
|
|
705
709
|
}
|
|
706
710
|
}
|
|
707
711
|
if (allowAdvancedToolBarOptions && allowImageEditing && expValEquals('platform_editor_add_image_editing', 'isEnabled', true)) {
|
|
@@ -713,7 +717,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
713
717
|
// Disable image editing for gifs as CropperJS does not support gif editing
|
|
714
718
|
var _isGif = (_mediaNode3 === null || _mediaNode3 === void 0 || (_mediaNode3$attrs2 = _mediaNode3.attrs) === null || _mediaNode3$attrs2 === void 0 ? void 0 : _mediaNode3$attrs2.__fileMimeType) === 'image/gif';
|
|
715
719
|
if (!isVideo(_mediaNode3 === null || _mediaNode3 === void 0 || (_mediaNode3$attrs3 = _mediaNode3.attrs) === null || _mediaNode3$attrs3 === void 0 ? void 0 : _mediaNode3$attrs3.__fileMimeType) && !_isExternal && !_isGif) {
|
|
716
|
-
|
|
720
|
+
var _toolbarButtons4;
|
|
721
|
+
(_toolbarButtons4 = toolbarButtons).push.apply(_toolbarButtons4, [{
|
|
717
722
|
id: 'editor.media.edit',
|
|
718
723
|
testId: 'image-edit-toolbar-button',
|
|
719
724
|
type: 'button',
|
|
@@ -727,21 +732,22 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
727
732
|
})) !== null && _handleShowImageEdito2 !== void 0 ? _handleShowImageEdito2 : false;
|
|
728
733
|
},
|
|
729
734
|
supportsViewMode: false
|
|
730
|
-
}
|
|
735
|
+
}].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
731
736
|
type: 'separator',
|
|
732
737
|
supportsViewMode: false
|
|
733
|
-
});
|
|
738
|
+
}])));
|
|
734
739
|
}
|
|
735
740
|
}
|
|
736
741
|
|
|
737
742
|
// open link
|
|
738
743
|
if (allowLinking && shouldShowMediaLinkToolbar(state) && mediaLinkingState && mediaLinkingState.editable) {
|
|
739
|
-
|
|
744
|
+
var _toolbarButtons5;
|
|
745
|
+
(_toolbarButtons5 = toolbarButtons).push.apply(_toolbarButtons5, [getOpenLinkToolbarButtonOption(intl, mediaLinkingState, pluginInjectionApi)].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
740
746
|
type: 'separator',
|
|
741
747
|
supportsViewMode: true
|
|
742
|
-
});
|
|
748
|
+
}])));
|
|
743
749
|
}
|
|
744
|
-
isViewOnly && toolbarButtons.push({
|
|
750
|
+
isViewOnly && (_toolbarButtons6 = toolbarButtons).push.apply(_toolbarButtons6, [{
|
|
745
751
|
type: 'copy-button',
|
|
746
752
|
items: [{
|
|
747
753
|
state: state,
|
|
@@ -749,12 +755,14 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
749
755
|
nodeType: mediaSingle
|
|
750
756
|
}],
|
|
751
757
|
supportsViewMode: true
|
|
752
|
-
}
|
|
758
|
+
}].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
753
759
|
type: 'separator',
|
|
754
760
|
supportsViewMode: true
|
|
755
|
-
});
|
|
761
|
+
}])));
|
|
756
762
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
757
|
-
|
|
763
|
+
if (!mauiToolbarSeparatorsUpdateEnabled) {
|
|
764
|
+
updateToFullHeightSeparator(toolbarButtons);
|
|
765
|
+
}
|
|
758
766
|
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience));
|
|
759
767
|
}
|
|
760
768
|
return toolbarButtons;
|
|
@@ -883,7 +891,9 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
883
891
|
}
|
|
884
892
|
if (!mediaPluginState.isResizing && areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
885
893
|
var _pluginInjectionApi$a0, _pluginInjectionApi$a1, _pluginInjectionApi$a10;
|
|
886
|
-
|
|
894
|
+
if (!fg('cc-maui-toolbar-separators-update')) {
|
|
895
|
+
updateToFullHeightSeparator(items);
|
|
896
|
+
}
|
|
887
897
|
var showReplaceOption = !isViewOnly && mediaPluginState.allowsUploads && expValEquals('platform_editor_inline_media_replacement', 'isEnabled', true) && selectedNodeType === mediaSingle;
|
|
888
898
|
var customOptions = [].concat(_toConsumableArray(getLinkingDropdownOptions(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly)), _toConsumableArray(getAltTextDropdownOption(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a0 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a0 === void 0 ? void 0 : _pluginInjectionApi$a0.actions)), _toConsumableArray(getResizeDropdownOption(options, state, intl.formatMessage, selectedNodeType)));
|
|
889
899
|
if (customOptions.length) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -14,6 +15,7 @@ import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
|
14
15
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
15
16
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
16
17
|
import { messages } from '@atlaskit/media-ui';
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
19
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
18
20
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
19
21
|
import { currentMediaOrInlineNodeBorderMark } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -39,6 +41,7 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
39
41
|
}
|
|
40
42
|
var items = [];
|
|
41
43
|
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
44
|
+
var mauiToolbarSeparatorsUpdateEnabled = fg('cc-maui-toolbar-separators-update') && areAnyNewToolbarFlagsEnabled;
|
|
42
45
|
var preview = _objectSpread({
|
|
43
46
|
id: 'editor.media.viewer',
|
|
44
47
|
testId: 'file-preview-toolbar-button',
|
|
@@ -158,16 +161,16 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
158
161
|
});
|
|
159
162
|
}
|
|
160
163
|
};
|
|
161
|
-
items.push(
|
|
164
|
+
items.push.apply(items, [switcherDropdown].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
162
165
|
type: 'separator',
|
|
163
166
|
fullHeight: true
|
|
164
|
-
}, download, {
|
|
167
|
+
}]), [download], _toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
165
168
|
type: 'separator',
|
|
166
169
|
supportsViewMode: true
|
|
167
|
-
}, preview, {
|
|
170
|
+
}]), [preview], _toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
168
171
|
type: 'separator',
|
|
169
172
|
fullHeight: true
|
|
170
|
-
});
|
|
173
|
+
}])));
|
|
171
174
|
}
|
|
172
175
|
return items;
|
|
173
176
|
};
|
|
@@ -184,6 +187,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
184
187
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
185
188
|
allowLinking = options.allowLinking,
|
|
186
189
|
allowImagePreview = options.allowImagePreview;
|
|
190
|
+
var mauiToolbarSeparatorsUpdateEnabled = fg('cc-maui-toolbar-separators-update') && isEditorControlsEnabled;
|
|
187
191
|
if (shouldShowImageBorder(state)) {
|
|
188
192
|
inlineImageItems.push({
|
|
189
193
|
type: 'custom',
|
|
@@ -308,21 +312,21 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
308
312
|
});
|
|
309
313
|
} else {
|
|
310
314
|
var switchFromInlineToBlock = getMediaSingleAndMediaInlineSwitcherDropdown('inline', intl, pluginInjectionApi);
|
|
311
|
-
inlineImageItems.push(
|
|
315
|
+
inlineImageItems.push.apply(inlineImageItems, [switchFromInlineToBlock].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
312
316
|
type: 'separator',
|
|
313
317
|
fullHeight: true
|
|
314
|
-
});
|
|
318
|
+
}])));
|
|
315
319
|
if (isViewOnly) {
|
|
316
|
-
inlineImageItems.push(
|
|
320
|
+
inlineImageItems.push.apply(inlineImageItems, [download].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
317
321
|
type: 'separator',
|
|
318
322
|
supportsViewMode: true
|
|
319
|
-
});
|
|
323
|
+
}])));
|
|
320
324
|
}
|
|
321
325
|
}
|
|
322
326
|
|
|
323
327
|
//Image Preview
|
|
324
328
|
if (allowImagePreview) {
|
|
325
|
-
inlineImageItems.push({
|
|
329
|
+
inlineImageItems.push.apply(inlineImageItems, [{
|
|
326
330
|
id: 'editor.media.viewer',
|
|
327
331
|
testId: 'file-preview-toolbar-button',
|
|
328
332
|
type: 'button',
|
|
@@ -336,18 +340,18 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
336
340
|
})) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
|
|
337
341
|
},
|
|
338
342
|
supportsViewMode: true
|
|
339
|
-
}
|
|
343
|
+
}].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
340
344
|
type: 'separator',
|
|
341
345
|
supportsViewMode: true
|
|
342
|
-
});
|
|
346
|
+
}])));
|
|
343
347
|
}
|
|
344
348
|
|
|
345
349
|
// open link
|
|
346
350
|
if (allowLinking && shouldShowMediaLinkToolbar(state) && mediaLinkingState && mediaLinkingState.editable && isEditorControlsEnabled) {
|
|
347
|
-
inlineImageItems.push(getOpenLinkToolbarButtonOption(intl, mediaLinkingState, pluginInjectionApi)
|
|
351
|
+
inlineImageItems.push.apply(inlineImageItems, [getOpenLinkToolbarButtonOption(intl, mediaLinkingState, pluginInjectionApi)].concat(_toConsumableArray(mauiToolbarSeparatorsUpdateEnabled ? [] : [{
|
|
348
352
|
type: 'separator',
|
|
349
353
|
supportsViewMode: true
|
|
350
|
-
});
|
|
354
|
+
}])));
|
|
351
355
|
}
|
|
352
356
|
if (isViewOnly && !isEditorControlsEnabled) {
|
|
353
357
|
inlineImageItems.push(download, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.2.1",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/editor-plugin-focus": "^11.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-grid": "^12.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-guideline": "^12.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
39
|
+
"@atlaskit/editor-plugin-interaction": "^22.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-selection": "^12.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-toolbar": "^9.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-width": "^13.0.0",
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
46
46
|
"@atlaskit/form": "^16.0.0",
|
|
47
47
|
"@atlaskit/icon": "^36.0.0",
|
|
48
|
-
"@atlaskit/icon-lab": "^7.
|
|
48
|
+
"@atlaskit/icon-lab": "^7.1.0",
|
|
49
49
|
"@atlaskit/media-card": "^81.1.0",
|
|
50
|
-
"@atlaskit/media-client": "^37.
|
|
50
|
+
"@atlaskit/media-client": "^37.1.0",
|
|
51
51
|
"@atlaskit/media-client-react": "^6.0.0",
|
|
52
|
-
"@atlaskit/media-common": "^14.
|
|
52
|
+
"@atlaskit/media-common": "^14.1.0",
|
|
53
53
|
"@atlaskit/media-filmstrip": "^52.1.0",
|
|
54
54
|
"@atlaskit/media-picker": "^72.0.0",
|
|
55
|
-
"@atlaskit/media-ui": "^30.
|
|
56
|
-
"@atlaskit/media-viewer": "^54.
|
|
55
|
+
"@atlaskit/media-ui": "^30.3.0",
|
|
56
|
+
"@atlaskit/media-viewer": "^54.2.0",
|
|
57
57
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
58
58
|
"@atlaskit/primitives": "^20.0.0",
|
|
59
59
|
"@atlaskit/textfield": "^9.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
61
|
-
"@atlaskit/tokens": "^
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^110.0.0",
|
|
61
|
+
"@atlaskit/tokens": "^15.0.0",
|
|
62
62
|
"@atlaskit/tooltip": "^23.0.0",
|
|
63
63
|
"@babel/runtime": "^7.0.0",
|
|
64
64
|
"@emotion/react": "^11.7.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"uuid": "^3.1.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@atlaskit/editor-common": "^116.
|
|
72
|
+
"@atlaskit/editor-common": "^116.11.0",
|
|
73
73
|
"@atlaskit/media-core": "^38.0.0",
|
|
74
74
|
"react": "^18.2.0",
|
|
75
75
|
"react-dom": "^18.2.0",
|
|
@@ -157,6 +157,9 @@
|
|
|
157
157
|
"cc-maui-add-mark-for-remix-generated-images": {
|
|
158
158
|
"type": "boolean",
|
|
159
159
|
"referenceOnly": true
|
|
160
|
+
},
|
|
161
|
+
"cc-maui-toolbar-separators-update": {
|
|
162
|
+
"type": "boolean"
|
|
160
163
|
}
|
|
161
164
|
},
|
|
162
165
|
"stricter": {
|
|
@@ -167,6 +170,6 @@
|
|
|
167
170
|
"devDependencies": {
|
|
168
171
|
"react": "^18.2.0",
|
|
169
172
|
"react-dom": "^18.2.0",
|
|
170
|
-
"react-intl": "^
|
|
173
|
+
"react-intl": "^7.0.0"
|
|
171
174
|
}
|
|
172
175
|
}
|