@atlaskit/editor-plugin-media 2.2.3 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,9 @@ import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atl
12
12
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
13
13
  import { contains, findParentNodeOfType, hasParentNode, hasParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
14
14
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
15
+ import CopyIcon from '@atlaskit/icon/core/copy';
15
16
  import DeleteIcon from '@atlaskit/icon/core/delete';
17
+ import GrowHorizontalIcon from '@atlaskit/icon/core/grow-horizontal';
16
18
  import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
17
19
  import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
18
20
  import MaximizeIcon from '@atlaskit/icon/core/maximize';
@@ -263,46 +265,96 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
263
265
  var _selectedNode$node$fi;
264
266
  // mediaInlne doesn't suppprt external images, so hiding buttons to prevent conversion from mediaSingle to mediaInline
265
267
  if (((_selectedNode$node$fi = selectedNode.node.firstChild) === null || _selectedNode$node$fi === void 0 ? void 0 : _selectedNode$node$fi.attrs.type) !== 'external') {
266
- var _pluginInjectionApi$a4;
267
268
  var hasCaption = contains(selectedNode.node, state.schema.nodes.caption);
268
269
  var inlineSwitcherTitle = intl.formatMessage(hasCaption ? mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
269
270
  var floatingSwitcherTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
270
- toolbarButtons.push({
271
- type: 'button',
272
- id: 'editor.media.image.view.switcher.inline',
273
- title: inlineSwitcherTitle,
274
- icon: function icon() {
275
- return /*#__PURE__*/React.createElement(ImageInlineIcon, {
271
+ if (editorExperiment('platform_editor_controls', 'control')) {
272
+ var _pluginInjectionApi$a4;
273
+ toolbarButtons.push({
274
+ type: 'button',
275
+ id: 'editor.media.image.view.switcher.inline',
276
+ title: inlineSwitcherTitle,
277
+ icon: function icon() {
278
+ return /*#__PURE__*/React.createElement(ImageInlineIcon, {
279
+ color: "currentColor",
280
+ spacing: "spacious",
281
+ label: inlineSwitcherTitle,
282
+ LEGACY_size: "medium",
283
+ LEGACY_fallbackIcon: IconInline
284
+ });
285
+ },
286
+ onClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions),
287
+ testId: 'image-inline-appearance'
288
+ }, {
289
+ type: 'button',
290
+ id: 'editor.media.image.view.switcher.floating',
291
+ title: floatingSwitcherTitle,
292
+ icon: function icon() {
293
+ return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
294
+ color: "currentColor",
295
+ spacing: "spacious",
296
+ label: floatingSwitcherTitle,
297
+ LEGACY_size: "medium",
298
+ LEGACY_fallbackIcon: IconEmbed
299
+ });
300
+ },
301
+ onClick: function onClick() {
302
+ return true;
303
+ },
304
+ testId: 'image-floating-appearance',
305
+ selected: true
306
+ }, {
307
+ type: 'separator'
308
+ });
309
+ } else {
310
+ var _pluginInjectionApi$a5;
311
+ var _options2 = [{
312
+ id: 'editor.media.convert.mediainline',
313
+ title: inlineSwitcherTitle,
314
+ onClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
315
+ icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
276
316
  color: "currentColor",
277
317
  spacing: "spacious",
278
318
  label: inlineSwitcherTitle,
279
319
  LEGACY_size: "medium",
280
320
  LEGACY_fallbackIcon: IconInline
281
- });
282
- },
283
- onClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions),
284
- testId: 'image-inline-appearance'
285
- }, {
286
- type: 'button',
287
- id: 'editor.media.image.view.switcher.floating',
288
- title: floatingSwitcherTitle,
289
- icon: function icon() {
290
- return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
321
+ })
322
+ }, {
323
+ id: 'editor.media.convert.mediasingle',
324
+ title: floatingSwitcherTitle,
325
+ selected: true,
326
+ onClick: function onClick() {
327
+ return true;
328
+ },
329
+ icon: /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
291
330
  color: "currentColor",
292
331
  spacing: "spacious",
293
332
  label: floatingSwitcherTitle,
294
333
  LEGACY_size: "medium",
295
334
  LEGACY_fallbackIcon: IconEmbed
296
- });
297
- },
298
- onClick: function onClick() {
299
- return true;
300
- },
301
- testId: 'image-floating-appearance',
302
- selected: true
303
- }, {
304
- type: 'separator'
305
- });
335
+ })
336
+ }];
337
+ var switchFromBlockToInline = {
338
+ id: 'media-block-to-inline-toolbar-item',
339
+ testId: 'media-inline-to-block-dropdown',
340
+ type: 'dropdown',
341
+ options: _options2,
342
+ title: intl.formatMessage(messages.sizeOptions),
343
+ icon: function icon() {
344
+ return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
345
+ color: "currentColor",
346
+ spacing: "spacious",
347
+ label: intl.formatMessage(messages.sizeOptions),
348
+ LEGACY_size: "medium",
349
+ LEGACY_fallbackIcon: IconEmbed
350
+ });
351
+ }
352
+ };
353
+ toolbarButtons.push(switchFromBlockToInline, {
354
+ type: 'separator',
355
+ fullHeight: true
356
+ });
357
+ }
306
358
  }
307
359
  }
308
360
 
@@ -363,11 +415,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
363
415
  }
364
416
  },
365
417
  onSubmit: function onSubmit(_ref3) {
366
- var _pluginInjectionApi$a5;
418
+ var _pluginInjectionApi$a6;
367
419
  var width = _ref3.width,
368
420
  validation = _ref3.validation;
369
421
  var newLayout = calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled, isNested);
370
- updateMediaSingleWidth(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions)(width, validation, 'floatingToolBar', newLayout)(state, dispatch);
422
+ updateMediaSingleWidth(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a6 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a6 === void 0 ? void 0 : _pluginInjectionApi$a6.actions)(width, validation, 'floatingToolBar', newLayout)(state, dispatch);
371
423
  },
372
424
  onMigrate: function onMigrate() {
373
425
  var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
@@ -429,10 +481,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
429
481
  };
430
482
  var openLink = function openLink() {
431
483
  if (editorView) {
432
- var _pluginInjectionApi$a6;
484
+ var _pluginInjectionApi$a7;
433
485
  var tr = editorView.state.tr,
434
486
  dispatch = editorView.dispatch;
435
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a6 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a6 === void 0 || _pluginInjectionApi$a6.actions.attachAnalyticsEvent({
487
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 || _pluginInjectionApi$a7.actions.attachAnalyticsEvent({
436
488
  eventType: EVENT_TYPE.TRACK,
437
489
  action: ACTION.VISITED,
438
490
  actionSubject: ACTION_SUBJECT.MEDIA,
@@ -504,9 +556,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
504
556
  });
505
557
  }
506
558
  if (allowAltTextOnImages) {
507
- var _pluginInjectionApi$a7;
508
- toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions), {
509
- type: 'separator'
559
+ var _pluginInjectionApi$a8;
560
+ toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a8 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a8 === void 0 ? void 0 : _pluginInjectionApi$a8.actions), {
561
+ type: 'separator',
562
+ fullHeight: editorExperiment('platform_editor_controls', 'variant1')
510
563
  });
511
564
  }
512
565
  var removeButton = {
@@ -525,13 +578,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
525
578
  testId: 'media-toolbar-remove-button',
526
579
  supportsViewMode: false
527
580
  };
528
- if (!editorExperiment('platform_editor_controls', 'control')) {
529
- toolbarButtons.push(removeButton);
530
- toolbarButtons.push({
531
- type: 'separator',
532
- supportsViewMode: false
533
- });
534
-
581
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
535
582
  // Preview Support
536
583
  if (allowAdvancedToolBarOptions && allowImagePreview) {
537
584
  var _mediaNode$attrs2;
@@ -555,11 +602,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
555
602
  supportsViewMode: true
556
603
  }, {
557
604
  type: 'separator',
558
- supportsViewMode: true
605
+ supportsViewMode: true,
606
+ fullHeight: true
559
607
  });
560
608
  }
561
609
  }
562
- toolbarButtons.push({
610
+ isViewOnly && toolbarButtons.push({
563
611
  type: 'copy-button',
564
612
  items: [{
565
613
  state: state,
@@ -567,8 +615,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
567
615
  nodeType: mediaSingle
568
616
  }],
569
617
  supportsViewMode: true
570
- });
571
- toolbarButtons.push({
618
+ }, {
572
619
  type: 'separator',
573
620
  supportsViewMode: true
574
621
  });
@@ -654,7 +701,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
654
701
  selectedNodeType = state.selection.node.type;
655
702
  }
656
703
  if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
657
- var _pluginInjectionApi$a8, _pluginInjectionApi$f2;
704
+ var _pluginInjectionApi$a9, _pluginInjectionApi$f2;
658
705
  var mediaOffset = state.selection.$from.parentOffset + 1;
659
706
  baseToolbar.getDomRef = function () {
660
707
  var _mediaPluginState$ele;
@@ -663,7 +710,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
663
710
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
664
711
  return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
665
712
  };
666
- items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a8 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a8 === void 0 ? void 0 : _pluginInjectionApi$a8.actions, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector, isViewOnly);
713
+ items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a9 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a9 === void 0 ? void 0 : _pluginInjectionApi$a9.actions, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector, isViewOnly);
667
714
  } else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
668
715
  items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options);
669
716
  } else {
@@ -676,6 +723,47 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
676
723
  };
677
724
  items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi);
678
725
  }
726
+ if (items.length > 0 && editorExperiment('platform_editor_controls', 'variant1')) {
727
+ if (items[items.length - 1].type === 'separator') {
728
+ var separatorItem = items[items.length - 1];
729
+ separatorItem.fullHeight = true;
730
+ } else {
731
+ items.push({
732
+ type: 'separator',
733
+ fullHeight: true
734
+ });
735
+ }
736
+ items.push({
737
+ type: 'overflow-dropdown',
738
+ options: [{
739
+ title: 'Resize',
740
+ onClick: function onClick() {
741
+ // TODO open resize dialog?
742
+ return true;
743
+ },
744
+ icon: /*#__PURE__*/React.createElement(GrowHorizontalIcon, {
745
+ label: "Resize"
746
+ })
747
+ }, {
748
+ type: 'separator'
749
+ }, {
750
+ title: 'Copy',
751
+ onClick: function onClick() {
752
+ // TODO replace with copy-button plugin
753
+ return true;
754
+ },
755
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
756
+ label: "Copy"
757
+ })
758
+ }, {
759
+ title: 'Delete',
760
+ onClick: remove,
761
+ icon: /*#__PURE__*/React.createElement(DeleteIcon, {
762
+ label: "Delete"
763
+ })
764
+ }]
765
+ });
766
+ }
679
767
 
680
768
  // Ignored via go/ees005
681
769
  // eslint-disable-next-line no-var
@@ -78,7 +78,8 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
78
78
  })) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
79
79
  }
80
80
  }, {
81
- type: 'separator'
81
+ type: 'separator',
82
+ fullHeight: editorExperiment('platform_editor_controls', 'variant1')
82
83
  }, {
83
84
  id: 'editor.media.card.download',
84
85
  type: 'button',
@@ -154,40 +155,92 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
154
155
  type: 'separator'
155
156
  });
156
157
  }
157
- inlineImageItems.push({
158
- id: 'editor.media.convert.mediainline',
159
- type: 'button',
160
- title: mediaInlineImageTitle,
161
- icon: function icon() {
162
- return /*#__PURE__*/React.createElement(ImageInlineIcon, {
158
+
159
+ // For Editor Controls: show options to convert from 'Inline' to 'Original size' via dropdown
160
+ if (editorExperiment('platform_editor_controls', 'control')) {
161
+ inlineImageItems.push({
162
+ id: 'editor.media.convert.mediainline',
163
+ type: 'button',
164
+ title: mediaInlineImageTitle,
165
+ icon: function icon() {
166
+ return /*#__PURE__*/React.createElement(ImageInlineIcon, {
167
+ color: "currentColor",
168
+ spacing: "spacious",
169
+ label: mediaInlineImageTitle,
170
+ LEGACY_size: "medium",
171
+ LEGACY_fallbackIcon: IconInline
172
+ });
173
+ },
174
+ onClick: function onClick() {
175
+ return true;
176
+ },
177
+ selected: true
178
+ }, {
179
+ id: 'editor.media.convert.mediasingle',
180
+ type: 'button',
181
+ title: mediaSingleTitle,
182
+ icon: function icon() {
183
+ return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
184
+ color: "currentColor",
185
+ spacing: "spacious",
186
+ label: mediaSingleTitle,
187
+ LEGACY_size: "medium",
188
+ LEGACY_fallbackIcon: IconEmbed
189
+ });
190
+ },
191
+ onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState)
192
+ }, {
193
+ type: 'separator'
194
+ });
195
+ } else {
196
+ var _options = [{
197
+ id: 'editor.media.convert.mediainline',
198
+ title: mediaInlineImageTitle,
199
+ onClick: function onClick() {
200
+ return true;
201
+ },
202
+ selected: true,
203
+ disabled: false,
204
+ icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
163
205
  color: "currentColor",
164
206
  spacing: "spacious",
165
207
  label: mediaInlineImageTitle,
166
208
  LEGACY_size: "medium",
167
209
  LEGACY_fallbackIcon: IconInline
168
- });
169
- },
170
- onClick: function onClick() {
171
- return true;
172
- },
173
- selected: true
174
- }, {
175
- id: 'editor.media.convert.mediasingle',
176
- type: 'button',
177
- title: mediaSingleTitle,
178
- icon: function icon() {
179
- return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
210
+ })
211
+ }, {
212
+ id: 'editor.media.convert.mediasingle',
213
+ title: mediaSingleTitle,
214
+ onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState),
215
+ icon: /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
180
216
  color: "currentColor",
181
217
  spacing: "spacious",
182
218
  label: mediaSingleTitle,
183
219
  LEGACY_size: "medium",
184
220
  LEGACY_fallbackIcon: IconEmbed
185
- });
186
- },
187
- onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState)
188
- }, {
189
- type: 'separator'
190
- });
221
+ })
222
+ }];
223
+ var switchFromInlineToBlock = {
224
+ id: 'media-inline-to-block-toolbar-item',
225
+ testId: 'media-inline-to-block-dropdown',
226
+ type: 'dropdown',
227
+ options: _options,
228
+ title: intl.formatMessage(messages.sizeOptions),
229
+ icon: function icon() {
230
+ return /*#__PURE__*/React.createElement(ImageInlineIcon, {
231
+ color: "currentColor",
232
+ spacing: "spacious",
233
+ label: mediaInlineImageTitle,
234
+ LEGACY_size: "medium",
235
+ LEGACY_fallbackIcon: IconInline
236
+ });
237
+ }
238
+ };
239
+ inlineImageItems.push(switchFromInlineToBlock, {
240
+ type: 'separator',
241
+ fullHeight: true
242
+ });
243
+ }
191
244
 
192
245
  // TODO: editor controls move to overflow menu
193
246
  if (editorExperiment('platform_editor_controls', 'control')) {
@@ -235,30 +288,11 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
235
288
  supportsViewMode: true
236
289
  });
237
290
  }
238
- if (options.allowAltTextOnImages && !editorExperiment('platform_editor_controls', 'control')) {
291
+ if (options.allowAltTextOnImages && editorExperiment('platform_editor_controls', 'variant1')) {
239
292
  var _pluginInjectionApi$a5;
240
293
  inlineImageItems.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
241
- type: 'separator'
242
- });
243
- }
244
- if (!editorExperiment('platform_editor_controls', 'control')) {
245
- inlineImageItems.push({
246
- id: 'editor.media.delete',
247
- type: 'button',
248
- appearance: 'danger',
249
- focusEditoronEnter: true,
250
- icon: DeleteIcon,
251
- iconFallback: RemoveIcon,
252
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
253
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
254
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
255
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
256
- title: intl.formatMessage(commonMessages.remove),
257
- onClick: removeInlineCard,
258
- testId: 'media-toolbar-remove-button'
259
- });
260
- inlineImageItems.push({
261
- type: 'separator'
294
+ type: 'separator',
295
+ fullHeight: true
262
296
  });
263
297
  }
264
298
 
@@ -281,7 +315,8 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
281
315
  supportsViewMode: true
282
316
  }, {
283
317
  type: 'separator',
284
- supportsViewMode: true
318
+ supportsViewMode: true,
319
+ fullHeight: editorExperiment('platform_editor_controls', 'variant1')
285
320
  });
286
321
  }
287
322
  if (options.isViewOnly) {
@@ -306,15 +341,17 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
306
341
  type: 'separator'
307
342
  });
308
343
  }
309
- inlineImageItems.push({
310
- type: 'copy-button',
311
- supportsViewMode: true,
312
- items: [{
313
- state: state,
314
- formatMessage: intl.formatMessage,
315
- nodeType: mediaInline
316
- }]
317
- });
344
+ if (options.isViewOnly || editorExperiment('platform_editor_controls', 'control')) {
345
+ inlineImageItems.push({
346
+ type: 'copy-button',
347
+ supportsViewMode: true,
348
+ items: [{
349
+ state: state,
350
+ formatMessage: intl.formatMessage,
351
+ nodeType: mediaInline
352
+ }]
353
+ });
354
+ }
318
355
  if (editorExperiment('platform_editor_controls', 'control')) {
319
356
  inlineImageItems.push({
320
357
  type: 'separator'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -70,7 +70,7 @@
70
70
  "@atlaskit/textfield": "^8.0.0",
71
71
  "@atlaskit/theme": "^17.0.0",
72
72
  "@atlaskit/tmp-editor-statsig": "^3.3.0",
73
- "@atlaskit/tokens": "^4.2.0",
73
+ "@atlaskit/tokens": "^4.3.0",
74
74
  "@atlaskit/tooltip": "^20.0.0",
75
75
  "@babel/runtime": "^7.0.0",
76
76
  "@emotion/react": "^11.7.1",