@atlaskit/editor-plugin-media 1.38.6 → 1.39.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
+ ## 1.39.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#158723](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/158723)
8
+ [`8ff5b01b0d37f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8ff5b01b0d37f) -
9
+ [ED-24682] Cleanup feature flag for commenting on media in the renderer
10
+
11
+ **@atlaskit/editor-plugin-media**: Add optional checks for the api in Comment Badges on media
12
+
13
+ ### Patch Changes
14
+
15
+ - [`ccf61c525278a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ccf61c525278a) -
16
+ fix floating toolbar spacing and legacy icon issues
17
+ - Updated dependencies
18
+
3
19
  ## 1.38.6
4
20
 
5
21
  ### Patch Changes
@@ -353,7 +353,7 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
353
353
  }, {
354
354
  key: "render",
355
355
  value: function render() {
356
- var _mediaOptions$getEdit, _pluginInjectionApi$m, _node$firstChild;
356
+ var _pluginInjectionApi$m, _node$firstChild;
357
357
  var _this$props2 = this.props,
358
358
  selected = _this$props2.selected,
359
359
  getPos = _this$props2.getPos,
@@ -370,13 +370,10 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
370
370
  editorDisabled = _this$props2.editorDisabled,
371
371
  annotationPluginState = _this$props2.annotationPluginState,
372
372
  editorAppearance = _this$props2.editorAppearance;
373
- var _ref4 = (mediaOptions === null || mediaOptions === void 0 || (_mediaOptions$getEdit = mediaOptions.getEditorFeatureFlags) === null || _mediaOptions$getEdit === void 0 ? void 0 : _mediaOptions$getEdit.call(mediaOptions)) || {},
374
- _ref4$commentsOnMedia = _ref4.commentsOnMedia,
375
- commentsOnMedia = _ref4$commentsOnMedia === void 0 ? false : _ref4$commentsOnMedia;
376
- var _ref5 = node.attrs,
377
- layout = _ref5.layout,
378
- widthType = _ref5.widthType,
379
- mediaSingleWidthAttribute = _ref5.width;
373
+ var _ref4 = node.attrs,
374
+ layout = _ref4.layout,
375
+ widthType = _ref4.widthType,
376
+ mediaSingleWidthAttribute = _ref4.width;
380
377
  var childNode = node.firstChild;
381
378
  var attrs = (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
382
379
 
@@ -490,11 +487,11 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
490
487
  mediaHeight: height,
491
488
  mediaWidth: width,
492
489
  extendedResizeOffset: (0, _platformFeatureFlags.fg)('platform.editor.media.extended-resize-experience') && !isInsideTable
493
- }, function (_ref6) {
494
- var badgeSize = _ref6.badgeSize;
490
+ }, function (_ref5) {
491
+ var badgeSize = _ref5.badgeSize;
495
492
  return (0, _react2.jsx)(_react.default.Fragment, null, shouldShowExternalMediaBadge && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
496
493
  badgeSize: badgeSize
497
- }), commentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeNextWrapper, {
494
+ }), mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeNextWrapper, {
498
495
  view: view,
499
496
  api: pluginInjectionApi,
500
497
  mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
@@ -502,7 +499,7 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
502
499
  isDrafting: isCurrentNodeDrafting,
503
500
  badgeSize: badgeSize
504
501
  }));
505
- }), !(0, _experiments.editorExperiment)('add-media-from-url', true) && commentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadge, {
502
+ }), !(0, _experiments.editorExperiment)('add-media-from-url', true) && mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadge, {
506
503
  view: view,
507
504
  api: pluginInjectionApi,
508
505
  mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
@@ -541,19 +538,19 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
541
538
  mediaOptions: {}
542
539
  });
543
540
  (0, _defineProperty2.default)(MediaSingleNode, "displayName", 'MediaSingleNode');
544
- var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref7) {
545
- var pluginInjectionApi = _ref7.pluginInjectionApi,
546
- contextIdentifierProvider = _ref7.contextIdentifierProvider,
547
- node = _ref7.node,
548
- getPos = _ref7.getPos,
549
- mediaOptions = _ref7.mediaOptions,
550
- view = _ref7.view,
551
- fullWidthMode = _ref7.fullWidthMode,
552
- selected = _ref7.selected,
553
- eventDispatcher = _ref7.eventDispatcher,
554
- dispatchAnalyticsEvent = _ref7.dispatchAnalyticsEvent,
555
- forwardRef = _ref7.forwardRef,
556
- editorAppearance = _ref7.editorAppearance;
541
+ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
542
+ var pluginInjectionApi = _ref6.pluginInjectionApi,
543
+ contextIdentifierProvider = _ref6.contextIdentifierProvider,
544
+ node = _ref6.node,
545
+ getPos = _ref6.getPos,
546
+ mediaOptions = _ref6.mediaOptions,
547
+ view = _ref6.view,
548
+ fullWidthMode = _ref6.fullWidthMode,
549
+ selected = _ref6.selected,
550
+ eventDispatcher = _ref6.eventDispatcher,
551
+ dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent,
552
+ forwardRef = _ref6.forwardRef,
553
+ editorAppearance = _ref6.editorAppearance;
557
554
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode']),
558
555
  widthState = _useSharedPluginState.widthState,
559
556
  mediaState = _useSharedPluginState.mediaState,
@@ -735,8 +732,8 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
735
732
  return (0, _react2.jsx)(_providerFactory.WithProviders, {
736
733
  providers: ['contextIdentifierProvider'],
737
734
  providerFactory: providerFactory,
738
- renderNode: function renderNode(_ref8) {
739
- var contextIdentifierProvider = _ref8.contextIdentifierProvider;
735
+ renderNode: function renderNode(_ref7) {
736
+ var contextIdentifierProvider = _ref7.contextIdentifierProvider;
740
737
  return (0, _react2.jsx)(MediaSingleNodeWrapper, {
741
738
  pluginInjectionApi: pluginInjectionApi,
742
739
  contextIdentifierProvider: contextIdentifierProvider,
@@ -287,7 +287,7 @@ var useUpdateSizeCallback = function useUpdateSizeCallback(_ref5) {
287
287
  */
288
288
  var FALLBACK_MOST_COMMON_WIDTH = 760;
289
289
  var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNextProps) {
290
- var _mediaOptions$getEdit, _pluginInjectionApi$m, _mediaNode$firstChild2;
290
+ var _pluginInjectionApi$m, _mediaNode$firstChild2;
291
291
  var selected = mediaSingleNodeNextProps.selected,
292
292
  getPos = mediaSingleNodeNextProps.getPos,
293
293
  nextMediaNode = mediaSingleNodeNextProps.node,
@@ -306,9 +306,6 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
306
306
  forwardRef = mediaSingleNodeNextProps.forwardRef,
307
307
  contextIdentifierProviderPromise = mediaSingleNodeNextProps.contextIdentifierProvider,
308
308
  mediaPluginState = mediaSingleNodeNextProps.mediaPluginState;
309
- var _ref6 = (mediaOptions === null || mediaOptions === void 0 || (_mediaOptions$getEdit = mediaOptions.getEditorFeatureFlags) === null || _mediaOptions$getEdit === void 0 ? void 0 : _mediaOptions$getEdit.call(mediaOptions)) || {},
310
- _ref6$commentsOnMedia = _ref6.commentsOnMedia,
311
- commentsOnMedia = _ref6$commentsOnMedia === void 0 ? false : _ref6$commentsOnMedia;
312
309
  var _React$useState3 = _react.default.useState(null),
313
310
  _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
314
311
  mediaProvider = _React$useState4[0],
@@ -382,10 +379,10 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
382
379
  }
383
380
  }
384
381
  }, [mediaNode]);
385
- var _ref7 = mediaNode.attrs,
386
- layout = _ref7.layout,
387
- widthType = _ref7.widthType,
388
- mediaSingleWidthAttribute = _ref7.width;
382
+ var _ref6 = mediaNode.attrs,
383
+ layout = _ref6.layout,
384
+ widthType = _ref6.widthType,
385
+ mediaSingleWidthAttribute = _ref6.width;
389
386
  var childNode = mediaNode.firstChild;
390
387
  var childMediaNodeAttrs = _react.default.useMemo(function () {
391
388
  return (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
@@ -497,11 +494,11 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
497
494
  mediaHeight: height,
498
495
  mediaWidth: width,
499
496
  extendedResizeOffset: (0, _platformFeatureFlags.fg)('platform.editor.media.extended-resize-experience') && !isInsideTable
500
- }, function (_ref8) {
501
- var badgeSize = _ref8.badgeSize;
497
+ }, function (_ref7) {
498
+ var badgeSize = _ref7.badgeSize;
502
499
  return (0, _react2.jsx)(_react.default.Fragment, null, shouldShowExternalMediaBadge && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
503
500
  badgeSize: badgeSize
504
- }), commentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeNextWrapper, {
501
+ }), mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeNextWrapper, {
505
502
  view: view,
506
503
  api: pluginInjectionApi,
507
504
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
@@ -509,7 +506,7 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
509
506
  isDrafting: isCurrentNodeDrafting,
510
507
  badgeSize: badgeSize
511
508
  }));
512
- }), !(0, _experiments.editorExperiment)('add-media-from-url', true) && commentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadge, {
509
+ }), !(0, _experiments.editorExperiment)('add-media-from-url', true) && mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadge, {
513
510
  view: view,
514
511
  api: pluginInjectionApi,
515
512
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
@@ -339,7 +339,6 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
339
339
  altTextValidator: options && options.altTextValidator,
340
340
  fullWidthEnabled: options && options.fullWidthEnabled,
341
341
  allowMediaInlineImages: options && options.allowMediaInlineImages,
342
- getEditorFeatureFlags: options && options.getEditorFeatureFlags,
343
342
  isViewOnly: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view'
344
343
  }, api);
345
344
  }
@@ -33,7 +33,7 @@ var commentButton = exports.commentButton = function commentButton(intl, state,
33
33
  var _selectMediaNode$attr;
34
34
  setInlineCommentDraftState(true,
35
35
  // TODO: might need to update to reflect it's from media floating toolbar
36
- _analytics.INPUT_METHOD.FLOATING_TB, 'block', true, (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id)(state, dispatch);
36
+ _analytics.INPUT_METHOD.FLOATING_TB, 'block', (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id)(state, dispatch);
37
37
  }
38
38
  }
39
39
  return true;
@@ -23,6 +23,7 @@ var _imageFullscreen = _interopRequireDefault(require("@atlaskit/icon/core/image
23
23
  var _imageInline = _interopRequireDefault(require("@atlaskit/icon/core/image-inline"));
24
24
  var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
25
25
  var _download = _interopRequireDefault(require("@atlaskit/icon/core/migration/download"));
26
+ var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-card"));
26
27
  var _filePreview = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/file-preview"));
27
28
  var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
28
29
  var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
@@ -103,7 +104,8 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
103
104
  var items = [{
104
105
  id: 'editor.media.view.switcher.inline',
105
106
  type: 'button',
106
- icon: _card.IconInline,
107
+ icon: _imageInline.default,
108
+ iconFallback: _card.IconInline,
107
109
  selected: false,
108
110
  focusEditoronEnter: true,
109
111
  disabled: false,
@@ -114,7 +116,8 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
114
116
  }, {
115
117
  id: 'editor.media.view.switcher.thumbnail',
116
118
  type: 'button',
117
- icon: _card.IconCard,
119
+ icon: _smartLinkCard.default,
120
+ iconFallback: _card.IconCard,
118
121
  selected: true,
119
122
  disabled: false,
120
123
  focusEditoronEnter: true,
@@ -193,9 +196,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
193
196
  allowMediaInline = options.allowMediaInline,
194
197
  allowMediaInlineImages = options.allowMediaInlineImages,
195
198
  allowImagePreview = options.allowImagePreview,
196
- getEditorFeatureFlags = options.getEditorFeatureFlags,
197
199
  isViewOnly = options.isViewOnly;
198
- var editorFeatureFlags = getEditorFeatureFlags ? getEditorFeatureFlags() : undefined;
199
200
  var toolbarButtons = [];
200
201
  var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
201
202
  hoverDecoration = _ref2.hoverDecoration;
@@ -424,7 +425,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
424
425
  type: 'separator'
425
426
  });
426
427
  }
427
- if (editorFeatureFlags && editorFeatureFlags.commentsOnMedia && allowCommentsOnMedia) {
428
+ if (allowCommentsOnMedia) {
428
429
  toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi), {
429
430
  type: 'separator',
430
431
  supportsViewMode: true
@@ -529,7 +530,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
529
530
  type: 'button',
530
531
  appearance: 'danger',
531
532
  focusEditoronEnter: true,
532
- icon: _remove.default,
533
+ icon: _delete.default,
534
+ iconFallback: _remove.default,
533
535
  onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
534
536
  onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
535
537
  onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
@@ -106,7 +106,8 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = function LinkToolbar
106
106
  }),
107
107
  icon: (0, _react2.jsx)(_link.default, {
108
108
  color: "currentColor",
109
- label: _title
109
+ label: _title,
110
+ spacing: "spacious"
110
111
  })
111
112
  }), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null)) : null;
112
113
  }
@@ -257,7 +257,7 @@ export default class MediaSingleNode extends Component {
257
257
  }
258
258
  }
259
259
  render() {
260
- var _mediaOptions$getEdit, _pluginInjectionApi$m, _pluginInjectionApi$m2, _node$firstChild;
260
+ var _pluginInjectionApi$m, _pluginInjectionApi$m2, _node$firstChild;
261
261
  const {
262
262
  selected,
263
263
  getPos,
@@ -277,9 +277,6 @@ export default class MediaSingleNode extends Component {
277
277
  annotationPluginState,
278
278
  editorAppearance
279
279
  } = this.props;
280
- const {
281
- commentsOnMedia = false
282
- } = (mediaOptions === null || mediaOptions === void 0 ? void 0 : (_mediaOptions$getEdit = mediaOptions.getEditorFeatureFlags) === null || _mediaOptions$getEdit === void 0 ? void 0 : _mediaOptions$getEdit.call(mediaOptions)) || {};
283
280
  const {
284
281
  layout,
285
282
  widthType,
@@ -412,14 +409,14 @@ export default class MediaSingleNode extends Component {
412
409
  badgeSize
413
410
  }) => jsx(React.Fragment, null, shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
414
411
  badgeSize: badgeSize
415
- }), commentsOnMedia && jsx(CommentBadgeNextWrapper, {
412
+ }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
416
413
  view: view,
417
414
  api: pluginInjectionApi,
418
415
  mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
419
416
  getPos: getPos,
420
417
  isDrafting: isCurrentNodeDrafting,
421
418
  badgeSize: badgeSize
422
- }))), !editorExperiment('add-media-from-url', true) && commentsOnMedia && jsx(CommentBadge, {
419
+ }))), !editorExperiment('add-media-from-url', true) && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
423
420
  view: view,
424
421
  api: pluginInjectionApi,
425
422
  mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
@@ -247,7 +247,7 @@ const useUpdateSizeCallback = ({
247
247
  */
248
248
  const FALLBACK_MOST_COMMON_WIDTH = 760;
249
249
  export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
250
- var _mediaOptions$getEdit, _pluginInjectionApi$m, _pluginInjectionApi$m2, _mediaNode$firstChild2;
250
+ var _pluginInjectionApi$m, _pluginInjectionApi$m2, _mediaNode$firstChild2;
251
251
  const {
252
252
  selected,
253
253
  getPos,
@@ -268,9 +268,6 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
268
268
  contextIdentifierProvider: contextIdentifierProviderPromise,
269
269
  mediaPluginState
270
270
  } = mediaSingleNodeNextProps;
271
- const {
272
- commentsOnMedia = false
273
- } = (mediaOptions === null || mediaOptions === void 0 ? void 0 : (_mediaOptions$getEdit = mediaOptions.getEditorFeatureFlags) === null || _mediaOptions$getEdit === void 0 ? void 0 : _mediaOptions$getEdit.call(mediaOptions)) || {};
274
271
  const [mediaProvider, setMediaProvider] = React.useState(null);
275
272
  const [_contextIdentifierProvider, setContextIdentifierProvider] = React.useState(null);
276
273
  const [viewMediaClientConfig, setViewMediaClientConfig] = React.useState();
@@ -462,14 +459,14 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
462
459
  badgeSize
463
460
  }) => jsx(React.Fragment, null, shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
464
461
  badgeSize: badgeSize
465
- }), commentsOnMedia && jsx(CommentBadgeNextWrapper, {
462
+ }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
466
463
  view: view,
467
464
  api: pluginInjectionApi,
468
465
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
469
466
  getPos: getPos,
470
467
  isDrafting: isCurrentNodeDrafting,
471
468
  badgeSize: badgeSize
472
- }))), !editorExperiment('add-media-from-url', true) && commentsOnMedia && jsx(CommentBadge, {
469
+ }))), !editorExperiment('add-media-from-url', true) && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
473
470
  view: view,
474
471
  api: pluginInjectionApi,
475
472
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
@@ -335,7 +335,6 @@ export const mediaPlugin = ({
335
335
  altTextValidator: options && options.altTextValidator,
336
336
  fullWidthEnabled: options && options.fullWidthEnabled,
337
337
  allowMediaInlineImages: options && options.allowMediaInlineImages,
338
- getEditorFeatureFlags: options && options.getEditorFeatureFlags,
339
338
  isViewOnly: (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view'
340
339
  }, api);
341
340
  }
@@ -25,7 +25,7 @@ export const commentButton = (intl, state, api) => {
25
25
  var _selectMediaNode$attr;
26
26
  setInlineCommentDraftState(true,
27
27
  // TODO: might need to update to reflect it's from media floating toolbar
28
- INPUT_METHOD.FLOATING_TB, 'block', true, (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id)(state, dispatch);
28
+ INPUT_METHOD.FLOATING_TB, 'block', (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id)(state, dispatch);
29
29
  }
30
30
  }
31
31
  return true;
@@ -13,6 +13,7 @@ import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
13
13
  import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
14
14
  import MaximizeIcon from '@atlaskit/icon/core/maximize';
15
15
  import DownloadIcon from '@atlaskit/icon/core/migration/download';
16
+ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
16
17
  import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
17
18
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
18
19
  import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
@@ -92,7 +93,8 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
92
93
  const items = [{
93
94
  id: 'editor.media.view.switcher.inline',
94
95
  type: 'button',
95
- icon: IconInline,
96
+ icon: ImageInlineIcon,
97
+ iconFallback: IconInline,
96
98
  selected: false,
97
99
  focusEditoronEnter: true,
98
100
  disabled: false,
@@ -103,7 +105,8 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
103
105
  }, {
104
106
  id: 'editor.media.view.switcher.thumbnail',
105
107
  type: 'button',
106
- icon: IconCard,
108
+ icon: SmartLinkCardIcon,
109
+ iconFallback: IconCard,
107
110
  selected: true,
108
111
  disabled: false,
109
112
  focusEditoronEnter: true,
@@ -183,10 +186,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
183
186
  allowMediaInline,
184
187
  allowMediaInlineImages,
185
188
  allowImagePreview,
186
- getEditorFeatureFlags,
187
189
  isViewOnly
188
190
  } = options;
189
- const editorFeatureFlags = getEditorFeatureFlags ? getEditorFeatureFlags() : undefined;
190
191
  let toolbarButtons = [];
191
192
  const {
192
193
  hoverDecoration
@@ -422,7 +423,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
422
423
  type: 'separator'
423
424
  });
424
425
  }
425
- if (editorFeatureFlags && editorFeatureFlags.commentsOnMedia && allowCommentsOnMedia) {
426
+ if (allowCommentsOnMedia) {
426
427
  toolbarButtons.push(commentButton(intl, state, pluginInjectionApi), {
427
428
  type: 'separator',
428
429
  supportsViewMode: true
@@ -533,7 +534,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
533
534
  type: 'button',
534
535
  appearance: 'danger',
535
536
  focusEditoronEnter: true,
536
- icon: RemoveIcon,
537
+ icon: DeleteIcon,
538
+ iconFallback: RemoveIcon,
537
539
  onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
538
540
  onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
539
541
  onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
@@ -92,7 +92,8 @@ export const LinkToolbarAppearance = ({
92
92
  }),
93
93
  icon: jsx(LinkIcon, {
94
94
  color: "currentColor",
95
- label: title
95
+ label: title,
96
+ spacing: "spacious"
96
97
  })
97
98
  }), jsx(Separator, null)) : null;
98
99
  }
@@ -347,7 +347,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
347
347
  }, {
348
348
  key: "render",
349
349
  value: function render() {
350
- var _mediaOptions$getEdit, _pluginInjectionApi$m, _node$firstChild;
350
+ var _pluginInjectionApi$m, _node$firstChild;
351
351
  var _this$props2 = this.props,
352
352
  selected = _this$props2.selected,
353
353
  getPos = _this$props2.getPos,
@@ -364,13 +364,10 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
364
364
  editorDisabled = _this$props2.editorDisabled,
365
365
  annotationPluginState = _this$props2.annotationPluginState,
366
366
  editorAppearance = _this$props2.editorAppearance;
367
- var _ref4 = (mediaOptions === null || mediaOptions === void 0 || (_mediaOptions$getEdit = mediaOptions.getEditorFeatureFlags) === null || _mediaOptions$getEdit === void 0 ? void 0 : _mediaOptions$getEdit.call(mediaOptions)) || {},
368
- _ref4$commentsOnMedia = _ref4.commentsOnMedia,
369
- commentsOnMedia = _ref4$commentsOnMedia === void 0 ? false : _ref4$commentsOnMedia;
370
- var _ref5 = node.attrs,
371
- layout = _ref5.layout,
372
- widthType = _ref5.widthType,
373
- mediaSingleWidthAttribute = _ref5.width;
367
+ var _ref4 = node.attrs,
368
+ layout = _ref4.layout,
369
+ widthType = _ref4.widthType,
370
+ mediaSingleWidthAttribute = _ref4.width;
374
371
  var childNode = node.firstChild;
375
372
  var attrs = (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
376
373
 
@@ -484,11 +481,11 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
484
481
  mediaHeight: height,
485
482
  mediaWidth: width,
486
483
  extendedResizeOffset: fg('platform.editor.media.extended-resize-experience') && !isInsideTable
487
- }, function (_ref6) {
488
- var badgeSize = _ref6.badgeSize;
484
+ }, function (_ref5) {
485
+ var badgeSize = _ref5.badgeSize;
489
486
  return jsx(React.Fragment, null, shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
490
487
  badgeSize: badgeSize
491
- }), commentsOnMedia && jsx(CommentBadgeNextWrapper, {
488
+ }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
492
489
  view: view,
493
490
  api: pluginInjectionApi,
494
491
  mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
@@ -496,7 +493,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
496
493
  isDrafting: isCurrentNodeDrafting,
497
494
  badgeSize: badgeSize
498
495
  }));
499
- }), !editorExperiment('add-media-from-url', true) && commentsOnMedia && jsx(CommentBadge, {
496
+ }), !editorExperiment('add-media-from-url', true) && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
500
497
  view: view,
501
498
  api: pluginInjectionApi,
502
499
  mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
@@ -536,19 +533,19 @@ _defineProperty(MediaSingleNode, "defaultProps", {
536
533
  });
537
534
  _defineProperty(MediaSingleNode, "displayName", 'MediaSingleNode');
538
535
  export { MediaSingleNode as default };
539
- var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref7) {
540
- var pluginInjectionApi = _ref7.pluginInjectionApi,
541
- contextIdentifierProvider = _ref7.contextIdentifierProvider,
542
- node = _ref7.node,
543
- getPos = _ref7.getPos,
544
- mediaOptions = _ref7.mediaOptions,
545
- view = _ref7.view,
546
- fullWidthMode = _ref7.fullWidthMode,
547
- selected = _ref7.selected,
548
- eventDispatcher = _ref7.eventDispatcher,
549
- dispatchAnalyticsEvent = _ref7.dispatchAnalyticsEvent,
550
- forwardRef = _ref7.forwardRef,
551
- editorAppearance = _ref7.editorAppearance;
536
+ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
537
+ var pluginInjectionApi = _ref6.pluginInjectionApi,
538
+ contextIdentifierProvider = _ref6.contextIdentifierProvider,
539
+ node = _ref6.node,
540
+ getPos = _ref6.getPos,
541
+ mediaOptions = _ref6.mediaOptions,
542
+ view = _ref6.view,
543
+ fullWidthMode = _ref6.fullWidthMode,
544
+ selected = _ref6.selected,
545
+ eventDispatcher = _ref6.eventDispatcher,
546
+ dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent,
547
+ forwardRef = _ref6.forwardRef,
548
+ editorAppearance = _ref6.editorAppearance;
552
549
  var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode']),
553
550
  widthState = _useSharedPluginState.widthState,
554
551
  mediaState = _useSharedPluginState.mediaState,
@@ -730,8 +727,8 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
730
727
  return jsx(WithProviders, {
731
728
  providers: ['contextIdentifierProvider'],
732
729
  providerFactory: providerFactory,
733
- renderNode: function renderNode(_ref8) {
734
- var contextIdentifierProvider = _ref8.contextIdentifierProvider;
730
+ renderNode: function renderNode(_ref7) {
731
+ var contextIdentifierProvider = _ref7.contextIdentifierProvider;
735
732
  return jsx(MediaSingleNodeWrapper, {
736
733
  pluginInjectionApi: pluginInjectionApi,
737
734
  contextIdentifierProvider: contextIdentifierProvider,
@@ -280,7 +280,7 @@ var useUpdateSizeCallback = function useUpdateSizeCallback(_ref5) {
280
280
  */
281
281
  var FALLBACK_MOST_COMMON_WIDTH = 760;
282
282
  export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNextProps) {
283
- var _mediaOptions$getEdit, _pluginInjectionApi$m, _mediaNode$firstChild2;
283
+ var _pluginInjectionApi$m, _mediaNode$firstChild2;
284
284
  var selected = mediaSingleNodeNextProps.selected,
285
285
  getPos = mediaSingleNodeNextProps.getPos,
286
286
  nextMediaNode = mediaSingleNodeNextProps.node,
@@ -299,9 +299,6 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
299
299
  forwardRef = mediaSingleNodeNextProps.forwardRef,
300
300
  contextIdentifierProviderPromise = mediaSingleNodeNextProps.contextIdentifierProvider,
301
301
  mediaPluginState = mediaSingleNodeNextProps.mediaPluginState;
302
- var _ref6 = (mediaOptions === null || mediaOptions === void 0 || (_mediaOptions$getEdit = mediaOptions.getEditorFeatureFlags) === null || _mediaOptions$getEdit === void 0 ? void 0 : _mediaOptions$getEdit.call(mediaOptions)) || {},
303
- _ref6$commentsOnMedia = _ref6.commentsOnMedia,
304
- commentsOnMedia = _ref6$commentsOnMedia === void 0 ? false : _ref6$commentsOnMedia;
305
302
  var _React$useState3 = React.useState(null),
306
303
  _React$useState4 = _slicedToArray(_React$useState3, 2),
307
304
  mediaProvider = _React$useState4[0],
@@ -375,10 +372,10 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
375
372
  }
376
373
  }
377
374
  }, [mediaNode]);
378
- var _ref7 = mediaNode.attrs,
379
- layout = _ref7.layout,
380
- widthType = _ref7.widthType,
381
- mediaSingleWidthAttribute = _ref7.width;
375
+ var _ref6 = mediaNode.attrs,
376
+ layout = _ref6.layout,
377
+ widthType = _ref6.widthType,
378
+ mediaSingleWidthAttribute = _ref6.width;
382
379
  var childNode = mediaNode.firstChild;
383
380
  var childMediaNodeAttrs = React.useMemo(function () {
384
381
  return (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
@@ -490,11 +487,11 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
490
487
  mediaHeight: height,
491
488
  mediaWidth: width,
492
489
  extendedResizeOffset: fg('platform.editor.media.extended-resize-experience') && !isInsideTable
493
- }, function (_ref8) {
494
- var badgeSize = _ref8.badgeSize;
490
+ }, function (_ref7) {
491
+ var badgeSize = _ref7.badgeSize;
495
492
  return jsx(React.Fragment, null, shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
496
493
  badgeSize: badgeSize
497
- }), commentsOnMedia && jsx(CommentBadgeNextWrapper, {
494
+ }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
498
495
  view: view,
499
496
  api: pluginInjectionApi,
500
497
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
@@ -502,7 +499,7 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
502
499
  isDrafting: isCurrentNodeDrafting,
503
500
  badgeSize: badgeSize
504
501
  }));
505
- }), !editorExperiment('add-media-from-url', true) && commentsOnMedia && jsx(CommentBadge, {
502
+ }), !editorExperiment('add-media-from-url', true) && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
506
503
  view: view,
507
504
  api: pluginInjectionApi,
508
505
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
@@ -329,7 +329,6 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
329
329
  altTextValidator: options && options.altTextValidator,
330
330
  fullWidthEnabled: options && options.fullWidthEnabled,
331
331
  allowMediaInlineImages: options && options.allowMediaInlineImages,
332
- getEditorFeatureFlags: options && options.getEditorFeatureFlags,
333
332
  isViewOnly: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view'
334
333
  }, api);
335
334
  }
@@ -26,7 +26,7 @@ export var commentButton = function commentButton(intl, state, api) {
26
26
  var _selectMediaNode$attr;
27
27
  setInlineCommentDraftState(true,
28
28
  // TODO: might need to update to reflect it's from media floating toolbar
29
- INPUT_METHOD.FLOATING_TB, 'block', true, (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id)(state, dispatch);
29
+ INPUT_METHOD.FLOATING_TB, 'block', (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id)(state, dispatch);
30
30
  }
31
31
  }
32
32
  return true;
@@ -17,6 +17,7 @@ import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
17
17
  import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
18
18
  import MaximizeIcon from '@atlaskit/icon/core/maximize';
19
19
  import DownloadIcon from '@atlaskit/icon/core/migration/download';
20
+ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
20
21
  import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
21
22
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
22
23
  import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
@@ -93,7 +94,8 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
93
94
  var items = [{
94
95
  id: 'editor.media.view.switcher.inline',
95
96
  type: 'button',
96
- icon: IconInline,
97
+ icon: ImageInlineIcon,
98
+ iconFallback: IconInline,
97
99
  selected: false,
98
100
  focusEditoronEnter: true,
99
101
  disabled: false,
@@ -104,7 +106,8 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
104
106
  }, {
105
107
  id: 'editor.media.view.switcher.thumbnail',
106
108
  type: 'button',
107
- icon: IconCard,
109
+ icon: SmartLinkCardIcon,
110
+ iconFallback: IconCard,
108
111
  selected: true,
109
112
  disabled: false,
110
113
  focusEditoronEnter: true,
@@ -183,9 +186,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
183
186
  allowMediaInline = options.allowMediaInline,
184
187
  allowMediaInlineImages = options.allowMediaInlineImages,
185
188
  allowImagePreview = options.allowImagePreview,
186
- getEditorFeatureFlags = options.getEditorFeatureFlags,
187
189
  isViewOnly = options.isViewOnly;
188
- var editorFeatureFlags = getEditorFeatureFlags ? getEditorFeatureFlags() : undefined;
189
190
  var toolbarButtons = [];
190
191
  var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
191
192
  hoverDecoration = _ref2.hoverDecoration;
@@ -414,7 +415,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
414
415
  type: 'separator'
415
416
  });
416
417
  }
417
- if (editorFeatureFlags && editorFeatureFlags.commentsOnMedia && allowCommentsOnMedia) {
418
+ if (allowCommentsOnMedia) {
418
419
  toolbarButtons.push(commentButton(intl, state, pluginInjectionApi), {
419
420
  type: 'separator',
420
421
  supportsViewMode: true
@@ -519,7 +520,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
519
520
  type: 'button',
520
521
  appearance: 'danger',
521
522
  focusEditoronEnter: true,
522
- icon: RemoveIcon,
523
+ icon: DeleteIcon,
524
+ iconFallback: RemoveIcon,
523
525
  onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
524
526
  onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
525
527
  onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
@@ -95,7 +95,8 @@ export var LinkToolbarAppearance = function LinkToolbarAppearance(_ref) {
95
95
  }),
96
96
  icon: jsx(LinkIcon, {
97
97
  color: "currentColor",
98
- label: _title
98
+ label: _title,
99
+ spacing: "spacious"
99
100
  })
100
101
  }), jsx(Separator, null)) : null;
101
102
  }
@@ -112,7 +112,6 @@ export type MediaFloatingToolbarOptions = {
112
112
  allowAltTextOnImages?: boolean;
113
113
  allowImagePreview?: boolean;
114
114
  altTextValidator?: (value: string) => string[];
115
- getEditorFeatureFlags?: GetEditorFeatureFlags;
116
115
  fullWidthEnabled?: boolean;
117
116
  allowCommentsOnMedia?: boolean;
118
117
  isViewOnly?: boolean;
@@ -112,7 +112,6 @@ export type MediaFloatingToolbarOptions = {
112
112
  allowAltTextOnImages?: boolean;
113
113
  allowImagePreview?: boolean;
114
114
  altTextValidator?: (value: string) => string[];
115
- getEditorFeatureFlags?: GetEditorFeatureFlags;
116
115
  fullWidthEnabled?: boolean;
117
116
  allowCommentsOnMedia?: boolean;
118
117
  isViewOnly?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.38.6",
3
+ "version": "1.39.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-common": "^94.9.0",
40
40
  "@atlaskit/editor-palette": "1.6.3",
41
41
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
42
- "@atlaskit/editor-plugin-annotation": "1.23.2",
42
+ "@atlaskit/editor-plugin-annotation": "1.23.3",
43
43
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
44
44
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
45
45
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/icon": "^22.24.0",
57
57
  "@atlaskit/media-card": "^78.10.0",
58
58
  "@atlaskit/media-client": "^28.0.0",
59
- "@atlaskit/media-client-react": "^2.2.0",
59
+ "@atlaskit/media-client-react": "^2.3.0",
60
60
  "@atlaskit/media-common": "^11.7.0",
61
61
  "@atlaskit/media-filmstrip": "^47.4.0",
62
62
  "@atlaskit/media-picker": "^67.0.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/primitives": "^13.0.0",
67
67
  "@atlaskit/textfield": "^6.5.0",
68
68
  "@atlaskit/theme": "^14.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^2.10.0",
69
+ "@atlaskit/tmp-editor-statsig": "^2.11.0",
70
70
  "@atlaskit/tokens": "^2.0.0",
71
71
  "@atlaskit/tooltip": "^18.8.0",
72
72
  "@babel/runtime": "^7.0.0",