@atlaskit/editor-plugin-media 2.6.6 → 2.7.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#143009](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/143009)
8
+ [`6711c20c022e4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6711c20c022e4) -
9
+ [UX-3339] Adds a configuration for media insert to only allow for external links.
10
+
11
+ ## 2.6.7
12
+
13
+ ### Patch Changes
14
+
15
+ - [#146103](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146103)
16
+ [`de3c759c70129`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de3c759c70129) -
17
+ [ux] ED-26971 Update media toolbar icons and show resize option in disabled state for inline media
18
+
3
19
  ## 2.6.6
4
20
 
5
21
  ### Patch Changes
@@ -254,41 +254,47 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
254
254
  })));
255
255
  (0, _defineProperty2.default)(this, "uploadExternalMedia", /*#__PURE__*/function () {
256
256
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(getPos) {
257
- var node, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos;
257
+ var _this$props, node, mediaOptions, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos;
258
258
  return _regenerator.default.wrap(function _callee7$(_context7) {
259
259
  while (1) switch (_context7.prev = _context7.next) {
260
260
  case 0:
261
- node = _this.props.node;
262
- _context7.next = 3;
263
- return _this.props.mediaProvider;
261
+ _this$props = _this.props, node = _this$props.node, mediaOptions = _this$props.mediaOptions;
262
+ if (!(mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.isExternalMediaUploadDisabled)) {
263
+ _context7.next = 3;
264
+ break;
265
+ }
266
+ return _context7.abrupt("return");
264
267
  case 3:
268
+ _context7.next = 5;
269
+ return _this.props.mediaProvider;
270
+ case 5:
265
271
  mediaProvider = _context7.sent;
266
272
  if (!(node && mediaProvider)) {
267
- _context7.next = 24;
273
+ _context7.next = 26;
268
274
  break;
269
275
  }
270
276
  uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
271
277
  if (!(!uploadMediaClientConfig || !node.attrs.url)) {
272
- _context7.next = 8;
278
+ _context7.next = 10;
273
279
  break;
274
280
  }
275
281
  return _context7.abrupt("return");
276
- case 8:
282
+ case 10:
277
283
  mediaClient = (0, _mediaClientReact.getMediaClient)(uploadMediaClientConfig);
278
284
  collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
279
- _context7.prev = 10;
280
- _context7.next = 13;
285
+ _context7.prev = 12;
286
+ _context7.next = 15;
281
287
  return mediaClient.file.uploadExternal(node.attrs.url, collection);
282
- case 13:
288
+ case 15:
283
289
  uploader = _context7.sent;
284
290
  uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
285
291
  pos = getPos();
286
292
  if (!(typeof pos !== 'number')) {
287
- _context7.next = 18;
293
+ _context7.next = 20;
288
294
  break;
289
295
  }
290
296
  return _context7.abrupt("return");
291
- case 18:
297
+ case 20:
292
298
  (0, _helpers.replaceExternalMedia)(pos + 1, {
293
299
  id: uploadableFileUpfrontIds.id,
294
300
  collection: collection,
@@ -296,11 +302,11 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
296
302
  width: dimensions.width,
297
303
  occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
298
304
  })(_this.props.view.state, _this.props.view.dispatch);
299
- _context7.next = 24;
305
+ _context7.next = 26;
300
306
  break;
301
- case 21:
302
- _context7.prev = 21;
303
- _context7.t0 = _context7["catch"](10);
307
+ case 23:
308
+ _context7.prev = 23;
309
+ _context7.t0 = _context7["catch"](12);
304
310
  //keep it as external media
305
311
  if (_this.props.dispatchAnalyticsEvent) {
306
312
  _this.props.dispatchAnalyticsEvent({
@@ -309,11 +315,11 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
309
315
  eventType: _analytics.EVENT_TYPE.OPERATIONAL
310
316
  });
311
317
  }
312
- case 24:
318
+ case 26:
313
319
  case "end":
314
320
  return _context7.stop();
315
321
  }
316
- }, _callee7, null, [[10, 21]]);
322
+ }, _callee7, null, [[12, 23]]);
317
323
  }));
318
324
  return function (_x3) {
319
325
  return _ref8.apply(this, arguments);
@@ -568,7 +568,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
568
568
  return mediaState !== null && mediaState !== void 0 && mediaState.mediaProvider ? Promise.resolve(mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider) : undefined;
569
569
  }, [mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider]);
570
570
  var isSelectedAndInteracted = (0, _react.useCallback)(function () {
571
- return Boolean(selected() && hasHadInteraction);
571
+ return Boolean(selected() && hasHadInteraction !== false);
572
572
  }, [hasHadInteraction, selected]);
573
573
  if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2__media_single') || (0, _platformFeatureFlags.fg)('platform_editor_react18_phase2__media_single_jira')) {
574
574
  return (0, _react2.jsx)(_mediaSingleNext.MediaSingleNodeNext, {
@@ -55,13 +55,13 @@ var MediaViewerContainer = exports.MediaViewerContainer = function MediaViewerCo
55
55
  var isVideoMedia = (0, _isType.isVideo)((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
56
56
  var shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia && (0, _experiments.editorExperiment)('platform_editor_controls', 'control');
57
57
  return (0, _react2.jsx)(_react.Fragment, null, isEditorViewMode ? (0, _react2.jsx)(_react.Fragment, null, isInline ?
58
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
58
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
59
59
  (0, _react2.jsx)("span", {
60
60
  onClick: showMediaViewer,
61
61
  css: interactiveStyles,
62
62
  "data-testid": mediaViewerContainerTestID
63
63
  }, children) :
64
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
64
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
65
65
  (0, _react2.jsx)("div", {
66
66
  onClick: showMediaViewer,
67
67
  css: interactiveStyles,
@@ -419,7 +419,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
419
419
  onClick: function onClick() {
420
420
  return true;
421
421
  },
422
- icon: /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
422
+ icon: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7') ? /*#__PURE__*/_react.default.createElement(_maximize.default, {
423
+ color: "currentColor",
424
+ spacing: "spacious",
425
+ label: ""
426
+ }) : /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
423
427
  color: "currentColor",
424
428
  spacing: "spacious",
425
429
  label: floatingSwitcherTitle,
@@ -434,7 +438,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
434
438
  options: _options2,
435
439
  title: intl.formatMessage(_mediaUi.messages.sizeOptions),
436
440
  icon: function icon() {
437
- return /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
441
+ return (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7') ? /*#__PURE__*/_react.default.createElement(_maximize.default, {
442
+ color: "currentColor",
443
+ spacing: "spacious",
444
+ label: intl.formatMessage(_mediaUi.messages.sizeOptions)
445
+ }) : /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
438
446
  color: "currentColor",
439
447
  spacing: "spacious",
440
448
  label: intl.formatMessage(_mediaUi.messages.sizeOptions),
@@ -341,7 +341,11 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
341
341
  id: 'editor.media.convert.mediasingle',
342
342
  title: mediaSingleTitle,
343
343
  onClick: (0, _commands.changeMediaInlineToMediaSingle)(editorAnalyticsAPI, widthPluginState),
344
- icon: /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
344
+ icon: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7') ? /*#__PURE__*/_react.default.createElement(_maximize.default, {
345
+ color: "currentColor",
346
+ spacing: "spacious",
347
+ label: ""
348
+ }) : /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
345
349
  color: "currentColor",
346
350
  spacing: "spacious",
347
351
  label: mediaSingleTitle,
@@ -10,6 +10,8 @@ var _react = _interopRequireDefault(require("react"));
10
10
  var _media = require("@atlaskit/editor-common/media");
11
11
  var _utils = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _growHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/grow-horizontal"));
13
+ var _imageFullscreen = _interopRequireDefault(require("@atlaskit/icon/core/image-fullscreen"));
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
15
  var _commands = require("../../pm-plugins/pixel-resizing/commands");
14
16
  var _ui = require("../../pm-plugins/pixel-resizing/ui");
15
17
  var _constants = require("../../pm-plugins/pixel-resizing/ui/constants");
@@ -62,7 +64,9 @@ var getResizeDropdownOption = exports.getResizeDropdownOption = function getResi
62
64
  return [{
63
65
  title: formatMessage(_media.pixelEntryMessages.resizeOption),
64
66
  onClick: (0, _commands.openPixelEditor)(),
65
- icon: /*#__PURE__*/_react.default.createElement(_growHorizontal.default, {
67
+ icon: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7') ? /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
68
+ label: ""
69
+ }) : /*#__PURE__*/_react.default.createElement(_growHorizontal.default, {
66
70
  label: ""
67
71
  }),
68
72
  testId: 'media-pixel-resizing-dropdown-option'
@@ -136,8 +136,12 @@ export class MediaNodeUpdater {
136
136
  });
137
137
  _defineProperty(this, "uploadExternalMedia", async getPos => {
138
138
  const {
139
- node
139
+ node,
140
+ mediaOptions
140
141
  } = this.props;
142
+ if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.isExternalMediaUploadDisabled) {
143
+ return;
144
+ }
141
145
  const mediaProvider = await this.props.mediaProvider;
142
146
  if (node && mediaProvider) {
143
147
  const uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
@@ -482,7 +482,7 @@ const MediaSingleNodeWrapper = ({
482
482
  } = useSharedPluginState(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode']);
483
483
  const hasHadInteraction = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.hasHadInteraction');
484
484
  const mediaProvider = useMemo(() => mediaState !== null && mediaState !== void 0 && mediaState.mediaProvider ? Promise.resolve(mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider) : undefined, [mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider]);
485
- const isSelectedAndInteracted = useCallback(() => Boolean(selected() && hasHadInteraction), [hasHadInteraction, selected]);
485
+ const isSelectedAndInteracted = useCallback(() => Boolean(selected() && hasHadInteraction !== false), [hasHadInteraction, selected]);
486
486
  if (fg('platform_editor_react18_phase2__media_single') || fg('platform_editor_react18_phase2__media_single_jira')) {
487
487
  return jsx(MediaSingleNodeNext, {
488
488
  width: (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0,
@@ -38,13 +38,13 @@ export const MediaViewerContainer = ({
38
38
  const isVideoMedia = isVideo((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
39
39
  const shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia && editorExperiment('platform_editor_controls', 'control');
40
40
  return jsx(Fragment, null, isEditorViewMode ? jsx(Fragment, null, isInline ?
41
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
41
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
42
42
  jsx("span", {
43
43
  onClick: showMediaViewer,
44
44
  css: interactiveStyles,
45
45
  "data-testid": mediaViewerContainerTestID
46
46
  }, children) :
47
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
47
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
48
48
  jsx("div", {
49
49
  onClick: showMediaViewer,
50
50
  css: interactiveStyles,
@@ -406,7 +406,11 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
406
406
  onClick: () => {
407
407
  return true;
408
408
  },
409
- icon: /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
409
+ icon: fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(MaximizeIcon, {
410
+ color: "currentColor",
411
+ spacing: "spacious",
412
+ label: ""
413
+ }) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
410
414
  color: "currentColor",
411
415
  spacing: "spacious",
412
416
  label: floatingSwitcherTitle,
@@ -420,7 +424,11 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
420
424
  type: 'dropdown',
421
425
  options: options,
422
426
  title: intl.formatMessage(messages.sizeOptions),
423
- icon: () => /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
427
+ icon: () => fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(MaximizeIcon, {
428
+ color: "currentColor",
429
+ spacing: "spacious",
430
+ label: intl.formatMessage(messages.sizeOptions)
431
+ }) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
424
432
  color: "currentColor",
425
433
  spacing: "spacious",
426
434
  label: intl.formatMessage(messages.sizeOptions),
@@ -332,7 +332,11 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
332
332
  id: 'editor.media.convert.mediasingle',
333
333
  title: mediaSingleTitle,
334
334
  onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState),
335
- icon: /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
335
+ icon: fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(MaximizeIcon, {
336
+ color: "currentColor",
337
+ spacing: "spacious",
338
+ label: ""
339
+ }) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
336
340
  color: "currentColor",
337
341
  spacing: "spacious",
338
342
  label: mediaSingleTitle,
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
3
3
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
4
4
  import GrowHorizontalIcon from '@atlaskit/icon/core/grow-horizontal';
5
+ import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
5
7
  import { openPixelEditor } from '../../pm-plugins/pixel-resizing/commands';
6
8
  import { PixelEntry } from '../../pm-plugins/pixel-resizing/ui';
7
9
  import { PIXEL_RESIZING_TOOLBAR_WIDTH } from '../../pm-plugins/pixel-resizing/ui/constants';
@@ -54,7 +56,9 @@ export const getResizeDropdownOption = (mediaOptions, state, formatMessage, sele
54
56
  return [{
55
57
  title: formatMessage(messages.resizeOption),
56
58
  onClick: openPixelEditor(),
57
- icon: /*#__PURE__*/React.createElement(GrowHorizontalIcon, {
59
+ icon: fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
60
+ label: ""
61
+ }) : /*#__PURE__*/React.createElement(GrowHorizontalIcon, {
58
62
  label: ""
59
63
  }),
60
64
  testId: 'media-pixel-resizing-dropdown-option'
@@ -247,41 +247,47 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
247
247
  })));
248
248
  _defineProperty(this, "uploadExternalMedia", /*#__PURE__*/function () {
249
249
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(getPos) {
250
- var node, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos;
250
+ var _this$props, node, mediaOptions, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos;
251
251
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
252
252
  while (1) switch (_context7.prev = _context7.next) {
253
253
  case 0:
254
- node = _this.props.node;
255
- _context7.next = 3;
256
- return _this.props.mediaProvider;
254
+ _this$props = _this.props, node = _this$props.node, mediaOptions = _this$props.mediaOptions;
255
+ if (!(mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.isExternalMediaUploadDisabled)) {
256
+ _context7.next = 3;
257
+ break;
258
+ }
259
+ return _context7.abrupt("return");
257
260
  case 3:
261
+ _context7.next = 5;
262
+ return _this.props.mediaProvider;
263
+ case 5:
258
264
  mediaProvider = _context7.sent;
259
265
  if (!(node && mediaProvider)) {
260
- _context7.next = 24;
266
+ _context7.next = 26;
261
267
  break;
262
268
  }
263
269
  uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
264
270
  if (!(!uploadMediaClientConfig || !node.attrs.url)) {
265
- _context7.next = 8;
271
+ _context7.next = 10;
266
272
  break;
267
273
  }
268
274
  return _context7.abrupt("return");
269
- case 8:
275
+ case 10:
270
276
  mediaClient = getMediaClient(uploadMediaClientConfig);
271
277
  collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
272
- _context7.prev = 10;
273
- _context7.next = 13;
278
+ _context7.prev = 12;
279
+ _context7.next = 15;
274
280
  return mediaClient.file.uploadExternal(node.attrs.url, collection);
275
- case 13:
281
+ case 15:
276
282
  uploader = _context7.sent;
277
283
  uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
278
284
  pos = getPos();
279
285
  if (!(typeof pos !== 'number')) {
280
- _context7.next = 18;
286
+ _context7.next = 20;
281
287
  break;
282
288
  }
283
289
  return _context7.abrupt("return");
284
- case 18:
290
+ case 20:
285
291
  replaceExternalMedia(pos + 1, {
286
292
  id: uploadableFileUpfrontIds.id,
287
293
  collection: collection,
@@ -289,11 +295,11 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
289
295
  width: dimensions.width,
290
296
  occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
291
297
  })(_this.props.view.state, _this.props.view.dispatch);
292
- _context7.next = 24;
298
+ _context7.next = 26;
293
299
  break;
294
- case 21:
295
- _context7.prev = 21;
296
- _context7.t0 = _context7["catch"](10);
300
+ case 23:
301
+ _context7.prev = 23;
302
+ _context7.t0 = _context7["catch"](12);
297
303
  //keep it as external media
298
304
  if (_this.props.dispatchAnalyticsEvent) {
299
305
  _this.props.dispatchAnalyticsEvent({
@@ -302,11 +308,11 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
302
308
  eventType: EVENT_TYPE.OPERATIONAL
303
309
  });
304
310
  }
305
- case 24:
311
+ case 26:
306
312
  case "end":
307
313
  return _context7.stop();
308
314
  }
309
- }, _callee7, null, [[10, 21]]);
315
+ }, _callee7, null, [[12, 23]]);
310
316
  }));
311
317
  return function (_x3) {
312
318
  return _ref8.apply(this, arguments);
@@ -563,7 +563,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
563
563
  return mediaState !== null && mediaState !== void 0 && mediaState.mediaProvider ? Promise.resolve(mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider) : undefined;
564
564
  }, [mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider]);
565
565
  var isSelectedAndInteracted = useCallback(function () {
566
- return Boolean(selected() && hasHadInteraction);
566
+ return Boolean(selected() && hasHadInteraction !== false);
567
567
  }, [hasHadInteraction, selected]);
568
568
  if (fg('platform_editor_react18_phase2__media_single') || fg('platform_editor_react18_phase2__media_single_jira')) {
569
569
  return jsx(MediaSingleNodeNext, {
@@ -44,13 +44,13 @@ export var MediaViewerContainer = function MediaViewerContainer(_ref) {
44
44
  var isVideoMedia = isVideo((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
45
45
  var shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia && editorExperiment('platform_editor_controls', 'control');
46
46
  return jsx(Fragment, null, isEditorViewMode ? jsx(Fragment, null, isInline ?
47
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
47
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
48
48
  jsx("span", {
49
49
  onClick: showMediaViewer,
50
50
  css: interactiveStyles,
51
51
  "data-testid": mediaViewerContainerTestID
52
52
  }, children) :
53
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
53
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
54
54
  jsx("div", {
55
55
  onClick: showMediaViewer,
56
56
  css: interactiveStyles,
@@ -409,7 +409,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
409
409
  onClick: function onClick() {
410
410
  return true;
411
411
  },
412
- icon: /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
412
+ icon: fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(MaximizeIcon, {
413
+ color: "currentColor",
414
+ spacing: "spacious",
415
+ label: ""
416
+ }) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
413
417
  color: "currentColor",
414
418
  spacing: "spacious",
415
419
  label: floatingSwitcherTitle,
@@ -424,7 +428,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
424
428
  options: _options2,
425
429
  title: intl.formatMessage(messages.sizeOptions),
426
430
  icon: function icon() {
427
- return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
431
+ return fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(MaximizeIcon, {
432
+ color: "currentColor",
433
+ spacing: "spacious",
434
+ label: intl.formatMessage(messages.sizeOptions)
435
+ }) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
428
436
  color: "currentColor",
429
437
  spacing: "spacious",
430
438
  label: intl.formatMessage(messages.sizeOptions),
@@ -331,7 +331,11 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
331
331
  id: 'editor.media.convert.mediasingle',
332
332
  title: mediaSingleTitle,
333
333
  onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState),
334
- icon: /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
334
+ icon: fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(MaximizeIcon, {
335
+ color: "currentColor",
336
+ spacing: "spacious",
337
+ label: ""
338
+ }) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
335
339
  color: "currentColor",
336
340
  spacing: "spacious",
337
341
  label: mediaSingleTitle,
@@ -5,6 +5,8 @@ import React from 'react';
5
5
  import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
6
6
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
7
  import GrowHorizontalIcon from '@atlaskit/icon/core/grow-horizontal';
8
+ import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
8
10
  import { openPixelEditor } from '../../pm-plugins/pixel-resizing/commands';
9
11
  import { PixelEntry } from '../../pm-plugins/pixel-resizing/ui';
10
12
  import { PIXEL_RESIZING_TOOLBAR_WIDTH } from '../../pm-plugins/pixel-resizing/ui/constants';
@@ -55,7 +57,9 @@ export var getResizeDropdownOption = function getResizeDropdownOption(mediaOptio
55
57
  return [{
56
58
  title: formatMessage(messages.resizeOption),
57
59
  onClick: openPixelEditor(),
58
- icon: /*#__PURE__*/React.createElement(GrowHorizontalIcon, {
60
+ icon: fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
61
+ label: ""
62
+ }) : /*#__PURE__*/React.createElement(GrowHorizontalIcon, {
59
63
  label: ""
60
64
  }),
61
65
  testId: 'media-pixel-resizing-dropdown-option'
@@ -57,6 +57,23 @@ export interface MediaPluginOptions {
57
57
  forceHandlePositioning?: HandlePositioning;
58
58
  mediaShallowCopyScope?: MediaCopyScope;
59
59
  allowPixelResizing?: boolean;
60
+ /**
61
+ * Enabling this will prevent this plugin from automatically trying to upload external images to the Media service.
62
+ * This can be used in conjunction with the `isOnlyExternalLinks` config for `media-insert-plugin` to limit images
63
+ * to external URLs in the UI as well.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * createDefaultPreset({ featureFlags: {}, paste: {} })
68
+ * .add(listPlugin)
69
+ * .add(gridPlugin)
70
+ * .add([mediaPlugin, { provider, allowMediaSingle: true, isExternalMediaUploadDisabled: true }])
71
+ * .add(insertBlockPlugin)
72
+ * .add(contentInsertionPlugin)
73
+ * .add([mediaInsertPlugin, { isOnlyExternalLinks: true }])
74
+ * ```
75
+ */
76
+ isExternalMediaUploadDisabled?: boolean;
60
77
  }
61
78
  /**
62
79
  * @private
@@ -57,6 +57,23 @@ export interface MediaPluginOptions {
57
57
  forceHandlePositioning?: HandlePositioning;
58
58
  mediaShallowCopyScope?: MediaCopyScope;
59
59
  allowPixelResizing?: boolean;
60
+ /**
61
+ * Enabling this will prevent this plugin from automatically trying to upload external images to the Media service.
62
+ * This can be used in conjunction with the `isOnlyExternalLinks` config for `media-insert-plugin` to limit images
63
+ * to external URLs in the UI as well.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * createDefaultPreset({ featureFlags: {}, paste: {} })
68
+ * .add(listPlugin)
69
+ * .add(gridPlugin)
70
+ * .add([mediaPlugin, { provider, allowMediaSingle: true, isExternalMediaUploadDisabled: true }])
71
+ * .add(insertBlockPlugin)
72
+ * .add(contentInsertionPlugin)
73
+ * .add([mediaInsertPlugin, { isOnlyExternalLinks: true }])
74
+ * ```
75
+ */
76
+ isExternalMediaUploadDisabled?: boolean;
60
77
  }
61
78
  /**
62
79
  * @private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "2.6.6",
3
+ "version": "2.7.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
39
39
  "@atlaskit/analytics-next": "^11.0.0",
40
40
  "@atlaskit/button": "^23.0.0",
41
- "@atlaskit/editor-common": "^103.15.0",
41
+ "@atlaskit/editor-common": "^103.19.0",
42
42
  "@atlaskit/editor-palette": "^2.1.0",
43
43
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
44
44
  "@atlaskit/editor-plugin-annotation": "^2.7.0",
@@ -70,7 +70,7 @@
70
70
  "@atlaskit/primitives": "^14.4.0",
71
71
  "@atlaskit/textfield": "^8.0.0",
72
72
  "@atlaskit/theme": "^18.0.0",
73
- "@atlaskit/tmp-editor-statsig": "^4.13.0",
73
+ "@atlaskit/tmp-editor-statsig": "^4.15.0",
74
74
  "@atlaskit/tokens": "^4.8.0",
75
75
  "@atlaskit/tooltip": "^20.0.0",
76
76
  "@babel/runtime": "^7.0.0",
@@ -186,6 +186,9 @@
186
186
  },
187
187
  "platform_editor_no_selection_until_interaction": {
188
188
  "type": "boolean"
189
+ },
190
+ "platform_editor_controls_patch_7": {
191
+ "type": "boolean"
189
192
  }
190
193
  },
191
194
  "stricter": {