@atlaskit/editor-plugin-media 8.1.4 → 8.2.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,24 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 8.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5167552fe1a93`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5167552fe1a93) -
8
+ [EDITOR-2339] Bump @atlaskit/adf-schema to 51.3.0
9
+
10
+ ### Patch Changes
11
+
12
+ - [`2bdec5e9ec1c9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2bdec5e9ec1c9) -
13
+ [EDITOR-442] Cleans up FG platform_editor_add_media_from_url_rollout
14
+ - Updated dependencies
15
+
16
+ ## 8.1.5
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 8.1.4
4
23
 
5
24
  ### Patch Changes
@@ -7,10 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.mediaPlugin = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
10
  var _hooks = require("@atlaskit/editor-common/hooks");
12
- var _messages = require("@atlaskit/editor-common/messages");
13
- var _quickInsert = require("@atlaskit/editor-common/quick-insert");
14
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
15
12
  var _state = require("@atlaskit/editor-prosemirror/state");
16
13
  var _mediaCommon = require("@atlaskit/media-common");
@@ -326,33 +323,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
326
323
  pluginsOptions: {
327
324
  quickInsert: function quickInsert(_ref12) {
328
325
  var formatMessage = _ref12.formatMessage;
329
- return (0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout') || options !== null && options !== void 0 && options.disableQuickInsert ? [] : [{
330
- id: 'media',
331
- title: formatMessage(_messages.toolbarInsertBlockMessages.mediaFiles),
332
- description: formatMessage(_messages.toolbarInsertBlockMessages.mediaFilesDescription),
333
- priority: 400,
334
- keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video', 'file'],
335
- icon: function icon() {
336
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconImages, null);
337
- },
338
- isDisabledOffline: true,
339
- action: function action(insert, state) {
340
- var _api$analytics4;
341
- var pluginState = _pluginKey.stateKey.getState(state);
342
- pluginState === null || pluginState === void 0 || pluginState.showMediaPicker();
343
- var tr = insert('');
344
- api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent({
345
- action: _analytics.ACTION.OPENED,
346
- actionSubject: _analytics.ACTION_SUBJECT.PICKER,
347
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
348
- attributes: {
349
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
350
- },
351
- eventType: _analytics.EVENT_TYPE.UI
352
- })(tr);
353
- return tr;
354
- }
355
- }];
326
+ return [];
356
327
  },
357
328
  floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
358
329
  var _api$editorViewMode;
@@ -396,15 +396,6 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
396
396
  var disabledNode = !!(0, _utils2.findParentNodeOfTypeClosestToPos)($pos, [table]);
397
397
  return Boolean(result && !disabledNode);
398
398
  }, [mediaOptions, pos, view, editorDisabled, editorViewMode]);
399
- var badgeOffsetRight = _react.default.useMemo(function () {
400
- if (typeof pos !== 'number') {
401
- return undefined;
402
- }
403
- var $pos = view.state.doc.resolve(pos);
404
- var table = view.state.schema.nodes.table;
405
- var foundTableNode = (0, _utils2.findParentNodeOfTypeClosestToPos)($pos, [table]);
406
- return foundTableNode ? '2px' : '14px';
407
- }, [pos, view]);
408
399
  var shouldShowPlaceholder = _react.default.useMemo(function () {
409
400
  var result = mediaOptions.allowCaptions && mediaNode.childCount !== 2 && isSelected && view.state.selection instanceof _state.NodeSelection;
410
401
  return !editorDisabled && result;
@@ -474,7 +465,7 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
474
465
  ,
475
466
  className: _styles.MediaSingleNodeSelector,
476
467
  onClick: onMediaSingleClicked
477
- }, (0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout') && (0, _react2.jsx)(_mediaSingle.MediaBadges, {
468
+ }, (0, _react2.jsx)(_mediaSingle.MediaBadges, {
478
469
  mediaElement: currentMediaElement(),
479
470
  mediaHeight: height,
480
471
  mediaWidth: width,
@@ -484,20 +475,13 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
484
475
  return (0, _react2.jsx)(_react.default.Fragment, null, visible && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
485
476
  type: childMediaNodeAttrs.type,
486
477
  url: childMediaNodeAttrs.type === 'external' ? childMediaNodeAttrs.url : undefined
487
- }), mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeNextWrapper, {
478
+ }), mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeWrapper, {
488
479
  view: view,
489
480
  api: pluginInjectionApi,
490
481
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
491
482
  getPos: getPos,
492
483
  isDrafting: isCurrentNodeDrafting
493
484
  }));
494
- }), !(0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout') && mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadge, {
495
- view: view,
496
- api: pluginInjectionApi,
497
- mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
498
- badgeOffsetRight: badgeOffsetRight,
499
- getPos: getPos,
500
- isDrafting: isCurrentNodeDrafting
501
485
  }), (0, _react2.jsx)("div", {
502
486
  ref: forwardRef
503
487
  }), shouldShowPlaceholder && ((0, _platformFeatureFlags.fg)('platform_editor_typography_ugc') ? (0, _react2.jsx)(_CaptionPlaceholder.CaptionPlaceholderButton
@@ -14,7 +14,6 @@ var _selection = require("@atlaskit/editor-common/selection");
14
14
  var _utils = require("@atlaskit/editor-common/utils");
15
15
  var _model = require("@atlaskit/editor-prosemirror/model");
16
16
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _mediaCommon = require("../utils/media-common");
19
18
  var _analytics2 = require("./analytics");
20
19
  var _isType = require("./is-type");
@@ -95,8 +94,7 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
95
94
  if (node.type !== media || !(0, _isType.isImage)(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
96
95
  return false;
97
96
  }
98
- var insertMediaPopup = (0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout');
99
- var mediaSingleAttrs = allowPixelResizing && insertMediaPopup ? {
97
+ var mediaSingleAttrs = allowPixelResizing ? {
100
98
  widthType: 'pixel',
101
99
  width: (0, _mediaSingle.getMediaSingleInitialWidth)((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : _mediaSingle.DEFAULT_IMAGE_WIDTH),
102
100
  layout: 'center'
@@ -5,10 +5,9 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.CommentBadgeNextWrapper = exports.CommentBadge = void 0;
8
+ exports.CommentBadgeWrapper = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
- var _reactIntlNext = require("react-intl-next");
12
11
  var _analytics = require("@atlaskit/editor-common/analytics");
13
12
  var _hooks = require("@atlaskit/editor-common/hooks");
14
13
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
@@ -21,22 +20,20 @@ var selector = function selector(states) {
21
20
  annotations: (_states$annotationSta3 = states.annotationState) === null || _states$annotationSta3 === void 0 ? void 0 : _states$annotationSta3.annotations
22
21
  };
23
22
  };
24
- var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
23
+ var CommentBadgeWrapper = exports.CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
25
24
  var api = _ref.api,
26
25
  mediaNode = _ref.mediaNode,
27
26
  view = _ref.view,
28
27
  getPos = _ref.getPos,
29
- intl = _ref.intl,
30
- isDrafting = _ref.isDrafting,
31
- badgeOffsetRight = _ref.badgeOffsetRight;
32
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['annotation'], selector),
33
- selectedAnnotations = _useSharedPluginState.selectedAnnotations,
34
- isInlineCommentViewClosed = _useSharedPluginState.isInlineCommentViewClosed,
35
- annotations = _useSharedPluginState.annotations;
28
+ isDrafting = _ref.isDrafting;
36
29
  var _useState = (0, _react.useState)(false),
37
30
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
38
31
  entered = _useState2[0],
39
32
  setEntered = _useState2[1];
33
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['annotation'], selector),
34
+ selectedAnnotations = _useSharedPluginState.selectedAnnotations,
35
+ isInlineCommentViewClosed = _useSharedPluginState.isInlineCommentViewClosed,
36
+ annotations = _useSharedPluginState.annotations;
40
37
  var _view$state$schema = view.state.schema,
41
38
  media = _view$state$schema.nodes.media,
42
39
  annotation = _view$state$schema.marks.annotation,
@@ -65,80 +62,6 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
65
62
  if (!isDrafting && hasNoComments || !mediaNode) {
66
63
  return null;
67
64
  }
68
-
69
- /**
70
- * After performing certain operations like drag and drop,
71
- * the position may momentarily shift. It will NOT always be an HTML element;
72
- * it could also be plain text.
73
- */
74
- var maybeMediaSingleElement = view.domAtPos(pos + 1).node;
75
- var mediaSingleElement = maybeMediaSingleElement instanceof HTMLElement ? maybeMediaSingleElement : null;
76
- return /*#__PURE__*/_react.default.createElement(_mediaSingle.CommentBadge, {
77
- badgeOffsetRight: badgeOffsetRight,
78
- width: mediaNode.attrs.width,
79
- height: mediaNode.attrs.height,
80
- onClick: onClick,
81
- mediaSingleElement: mediaSingleElement,
82
- intl: intl,
83
- status: entered ? 'entered' : status,
84
- onMouseEnter: function onMouseEnter() {
85
- return setEntered(true);
86
- },
87
- onMouseLeave: function onMouseLeave() {
88
- return setEntered(false);
89
- }
90
- });
91
- };
92
- var CommentBadge = exports.CommentBadge = (0, _reactIntlNext.injectIntl)(CommentBadgeWrapper);
93
-
94
- /**
95
- * Remove CommentBadgeWrapper component above
96
- * and rename CommentBadgeNextWrapper to CommentBadgeWrapper
97
- * when clean up platform_editor_add_media_from_url_rollout feature flag
98
- */
99
-
100
- var CommentBadgeNextWrapper = exports.CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
101
- var api = _ref2.api,
102
- mediaNode = _ref2.mediaNode,
103
- view = _ref2.view,
104
- getPos = _ref2.getPos,
105
- isDrafting = _ref2.isDrafting;
106
- var _useState3 = (0, _react.useState)(false),
107
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
108
- entered = _useState4[0],
109
- setEntered = _useState4[1];
110
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginStateWithSelector)(api, ['annotation'], selector),
111
- selectedAnnotations = _useSharedPluginState2.selectedAnnotations,
112
- isInlineCommentViewClosed = _useSharedPluginState2.isInlineCommentViewClosed,
113
- annotations = _useSharedPluginState2.annotations;
114
- var _view$state$schema2 = view.state.schema,
115
- media = _view$state$schema2.nodes.media,
116
- annotation = _view$state$schema2.marks.annotation,
117
- state = view.state,
118
- dispatch = view.dispatch;
119
- var status = (0, _react.useMemo)(function () {
120
- if (!selectedAnnotations || !mediaNode) {
121
- return 'default';
122
- }
123
- return selectedAnnotations.some(function (annotation) {
124
- return !!mediaNode.marks.find(function (mark) {
125
- return mark.attrs.id === annotation.id;
126
- });
127
- }) && !isInlineCommentViewClosed ? 'active' : 'default';
128
- }, [selectedAnnotations, isInlineCommentViewClosed, mediaNode]);
129
- var onClick = (0, _react.useCallback)(function () {
130
- if (api.annotation && mediaNode) {
131
- var showCommentForBlockNode = api.annotation.actions.showCommentForBlockNode;
132
- showCommentForBlockNode(mediaNode, _analytics.VIEW_METHOD.BADGE)(state, dispatch);
133
- }
134
- }, [api.annotation, dispatch, mediaNode, state]);
135
- var pos = getPos();
136
- var hasNoComments = !Number.isFinite(pos) || !annotations || !mediaNode || mediaNode.type !== media || mediaNode.marks.every(function (maybeAnnotation) {
137
- return maybeAnnotation.type !== annotation || !(maybeAnnotation.attrs.id in annotations) || annotations[maybeAnnotation.attrs.id];
138
- });
139
- if (!isDrafting && hasNoComments || !mediaNode) {
140
- return null;
141
- }
142
65
  var maybeMediaSingleElement = view.domAtPos(pos + 1).node;
143
66
  var mediaSingleElement = maybeMediaSingleElement instanceof HTMLElement ? maybeMediaSingleElement : null;
144
67
  return /*#__PURE__*/_react.default.createElement(_mediaSingle.CommentBadgeNext, {
@@ -8,7 +8,6 @@ exports.RenderMediaViewer = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactDom = _interopRequireDefault(require("react-dom"));
10
10
  var _mediaViewer = require("@atlaskit/media-viewer");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var _utils = require("../../ui/toolbar/utils");
13
12
  var getIdentifier = function getIdentifier(attrs) {
14
13
  if ((0, _utils.isExternalMedia)(attrs)) {
@@ -33,32 +32,11 @@ var RenderMediaViewer = exports.RenderMediaViewer = function RenderMediaViewer(_
33
32
  selectedNodeAttrs = _ref.selectedNodeAttrs,
34
33
  _ref$items = _ref.items,
35
34
  items = _ref$items === void 0 ? [] : _ref$items;
36
- if ((0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout')) {
37
- var _identifier = getIdentifier(selectedNodeAttrs);
38
- var collectionName = (0, _utils.isExternalMedia)(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
39
- return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_mediaViewer.MediaViewer, {
40
- collectionName: collectionName,
41
- items: items
42
- // Ignored via go/ees005
43
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
44
- ,
45
- mediaClientConfig: mediaClientConfig,
46
- selectedItem: _identifier,
47
- onClose: onClose
48
- }), document.body);
49
- }
50
- var _ref2 = selectedNodeAttrs,
51
- id = _ref2.id,
52
- _ref2$collection = _ref2.collection,
53
- collection = _ref2$collection === void 0 ? '' : _ref2$collection;
54
- var identifier = {
55
- id: id,
56
- mediaItemType: 'file',
57
- collectionName: collection
58
- };
35
+ var identifier = getIdentifier(selectedNodeAttrs);
36
+ var collectionName = (0, _utils.isExternalMedia)(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
59
37
  return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_mediaViewer.MediaViewer, {
60
- collectionName: collection,
61
- items: []
38
+ collectionName: collectionName,
39
+ items: items
62
40
  // Ignored via go/ees005
63
41
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
64
42
  ,
@@ -1,8 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconImages } from '@atlaskit/editor-common/quick-insert';
6
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
4
  import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
8
5
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
@@ -325,31 +322,7 @@ export const mediaPlugin = ({
325
322
  pluginsOptions: {
326
323
  quickInsert: ({
327
324
  formatMessage
328
- }) => fg('platform_editor_add_media_from_url_rollout') || options !== null && options !== void 0 && options.disableQuickInsert ? [] : [{
329
- id: 'media',
330
- title: formatMessage(messages.mediaFiles),
331
- description: formatMessage(messages.mediaFilesDescription),
332
- priority: 400,
333
- keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video', 'file'],
334
- icon: () => /*#__PURE__*/React.createElement(IconImages, null),
335
- isDisabledOffline: true,
336
- action(insert, state) {
337
- var _api$analytics4;
338
- const pluginState = stateKey.getState(state);
339
- pluginState === null || pluginState === void 0 ? void 0 : pluginState.showMediaPicker();
340
- const tr = insert('');
341
- api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
342
- action: ACTION.OPENED,
343
- actionSubject: ACTION_SUBJECT.PICKER,
344
- actionSubjectId: ACTION_SUBJECT_ID.PICKER_CLOUD,
345
- attributes: {
346
- inputMethod: INPUT_METHOD.QUICK_INSERT
347
- },
348
- eventType: EVENT_TYPE.UI
349
- })(tr);
350
- return tr;
351
- }
352
- }],
325
+ }) => [],
353
326
  floatingToolbar: (state, intl, providerFactory) => {
354
327
  var _api$editorViewMode, _api$editorViewMode$s;
355
328
  return floatingToolbar(state, intl, {
@@ -19,7 +19,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
19
19
  import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
20
20
  import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
21
21
  import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
22
- import { CommentBadge, CommentBadgeNextWrapper } from '../ui/CommentBadge';
22
+ import { CommentBadgeWrapper } from '../ui/CommentBadge';
23
23
  import ResizableMediaSingle from '../ui/ResizableMediaSingle';
24
24
  import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
25
25
  import { hasPrivateAttrsChanged } from './helpers';
@@ -356,17 +356,6 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
356
356
  const disabledNode = !!findParentNodeOfTypeClosestToPos($pos, [table]);
357
357
  return Boolean(result && !disabledNode);
358
358
  }, [mediaOptions, pos, view, editorDisabled, editorViewMode]);
359
- const badgeOffsetRight = React.useMemo(() => {
360
- if (typeof pos !== 'number') {
361
- return undefined;
362
- }
363
- const $pos = view.state.doc.resolve(pos);
364
- const {
365
- table
366
- } = view.state.schema.nodes;
367
- const foundTableNode = findParentNodeOfTypeClosestToPos($pos, [table]);
368
- return foundTableNode ? '2px' : '14px';
369
- }, [pos, view]);
370
359
  const shouldShowPlaceholder = React.useMemo(() => {
371
360
  const result = mediaOptions.allowCaptions && mediaNode.childCount !== 2 && isSelected && view.state.selection instanceof NodeSelection;
372
361
  return !editorDisabled && result;
@@ -436,7 +425,7 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
436
425
  ,
437
426
  className: MediaSingleNodeSelector,
438
427
  onClick: onMediaSingleClicked
439
- }, fg('platform_editor_add_media_from_url_rollout') && jsx(MediaBadges, {
428
+ }, jsx(MediaBadges, {
440
429
  mediaElement: currentMediaElement(),
441
430
  mediaHeight: height,
442
431
  mediaWidth: width,
@@ -446,20 +435,13 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
446
435
  }) => jsx(React.Fragment, null, visible && jsx(ExternalImageBadge, {
447
436
  type: childMediaNodeAttrs.type,
448
437
  url: childMediaNodeAttrs.type === 'external' ? childMediaNodeAttrs.url : undefined
449
- }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
450
- view: view,
451
- api: pluginInjectionApi,
452
- mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
453
- getPos: getPos,
454
- isDrafting: isCurrentNodeDrafting
455
- }))), !fg('platform_editor_add_media_from_url_rollout') && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
438
+ }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeWrapper, {
456
439
  view: view,
457
440
  api: pluginInjectionApi,
458
441
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
459
- badgeOffsetRight: badgeOffsetRight,
460
442
  getPos: getPos,
461
443
  isDrafting: isCurrentNodeDrafting
462
- }), jsx("div", {
444
+ }))), jsx("div", {
463
445
  ref: forwardRef
464
446
  }), shouldShowPlaceholder && (fg('platform_editor_typography_ugc') ? jsx(CaptionPlaceholderButton
465
447
  // platform_editor_typography_ugc clean up
@@ -6,7 +6,6 @@ import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
6
6
  import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
7
7
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
8
8
  import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
11
10
  import { findChangeFromLocation, getChangeMediaAnalytics } from './analytics';
12
11
  import { isImage } from './is-type';
@@ -88,8 +87,7 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
88
87
  if (node.type !== media || !isImage(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
89
88
  return false;
90
89
  }
91
- const insertMediaPopup = fg('platform_editor_add_media_from_url_rollout');
92
- const mediaSingleAttrs = allowPixelResizing && insertMediaPopup ? {
90
+ const mediaSingleAttrs = allowPixelResizing ? {
93
91
  widthType: 'pixel',
94
92
  width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH),
95
93
  layout: 'center'
@@ -1,8 +1,7 @@
1
1
  import React, { useCallback, useMemo, useState } from 'react';
2
- import { injectIntl } from 'react-intl-next';
3
2
  import { VIEW_METHOD } from '@atlaskit/editor-common/analytics';
4
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
- import { CommentBadge as CommentBadgeComponent, CommentBadgeNext } from '@atlaskit/editor-common/media-single';
4
+ import { CommentBadgeNext } from '@atlaskit/editor-common/media-single';
6
5
  const selector = states => {
7
6
  var _states$annotationSta, _states$annotationSta2, _states$annotationSta3;
8
7
  return {
@@ -11,83 +10,7 @@ const selector = states => {
11
10
  annotations: (_states$annotationSta3 = states.annotationState) === null || _states$annotationSta3 === void 0 ? void 0 : _states$annotationSta3.annotations
12
11
  };
13
12
  };
14
- const CommentBadgeWrapper = ({
15
- api,
16
- mediaNode,
17
- view,
18
- getPos,
19
- intl,
20
- isDrafting,
21
- badgeOffsetRight
22
- }) => {
23
- const {
24
- selectedAnnotations,
25
- isInlineCommentViewClosed,
26
- annotations
27
- } = useSharedPluginStateWithSelector(api, ['annotation'], selector);
28
- const [entered, setEntered] = useState(false);
29
- const {
30
- state: {
31
- schema: {
32
- nodes: {
33
- media
34
- },
35
- marks: {
36
- annotation
37
- }
38
- }
39
- },
40
- state,
41
- dispatch
42
- } = view;
43
- const status = useMemo(() => {
44
- if (!selectedAnnotations || !mediaNode) {
45
- return 'default';
46
- }
47
- return selectedAnnotations.some(annotation => !!mediaNode.marks.find(mark => mark.attrs.id === annotation.id)) && !isInlineCommentViewClosed ? 'active' : 'default';
48
- }, [selectedAnnotations, isInlineCommentViewClosed, mediaNode]);
49
- const onClick = useCallback(() => {
50
- if (api.annotation && mediaNode) {
51
- const {
52
- showCommentForBlockNode
53
- } = api.annotation.actions;
54
- showCommentForBlockNode(mediaNode, VIEW_METHOD.BADGE)(state, dispatch);
55
- }
56
- }, [api.annotation, dispatch, mediaNode, state]);
57
- const pos = getPos();
58
- const hasNoComments = !Number.isFinite(pos) || !annotations || !mediaNode || mediaNode.type !== media || mediaNode.marks.every(maybeAnnotation => maybeAnnotation.type !== annotation || !(maybeAnnotation.attrs.id in annotations) || annotations[maybeAnnotation.attrs.id]);
59
- if (!isDrafting && hasNoComments || !mediaNode) {
60
- return null;
61
- }
62
-
63
- /**
64
- * After performing certain operations like drag and drop,
65
- * the position may momentarily shift. It will NOT always be an HTML element;
66
- * it could also be plain text.
67
- */
68
- const maybeMediaSingleElement = view.domAtPos(pos + 1).node;
69
- const mediaSingleElement = maybeMediaSingleElement instanceof HTMLElement ? maybeMediaSingleElement : null;
70
- return /*#__PURE__*/React.createElement(CommentBadgeComponent, {
71
- badgeOffsetRight: badgeOffsetRight,
72
- width: mediaNode.attrs.width,
73
- height: mediaNode.attrs.height,
74
- onClick: onClick,
75
- mediaSingleElement: mediaSingleElement,
76
- intl: intl,
77
- status: entered ? 'entered' : status,
78
- onMouseEnter: () => setEntered(true),
79
- onMouseLeave: () => setEntered(false)
80
- });
81
- };
82
- export const CommentBadge = injectIntl(CommentBadgeWrapper);
83
-
84
- /**
85
- * Remove CommentBadgeWrapper component above
86
- * and rename CommentBadgeNextWrapper to CommentBadgeWrapper
87
- * when clean up platform_editor_add_media_from_url_rollout feature flag
88
- */
89
-
90
- export const CommentBadgeNextWrapper = ({
13
+ export const CommentBadgeWrapper = ({
91
14
  api,
92
15
  mediaNode,
93
16
  view,
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import { MediaViewer } from '@atlaskit/media-viewer';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { isExternalMedia } from '../../ui/toolbar/utils';
6
5
  const getIdentifier = attrs => {
7
6
  if (isExternalMedia(attrs)) {
@@ -27,32 +26,11 @@ export const RenderMediaViewer = ({
27
26
  selectedNodeAttrs,
28
27
  items = []
29
28
  }) => {
30
- if (fg('platform_editor_add_media_from_url_rollout')) {
31
- const identifier = getIdentifier(selectedNodeAttrs);
32
- const collectionName = isExternalMedia(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
33
- return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
34
- collectionName: collectionName,
35
- items: items
36
- // Ignored via go/ees005
37
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
38
- ,
39
- mediaClientConfig: mediaClientConfig,
40
- selectedItem: identifier,
41
- onClose: onClose
42
- }), document.body);
43
- }
44
- const {
45
- id,
46
- collection = ''
47
- } = selectedNodeAttrs;
48
- const identifier = {
49
- id,
50
- mediaItemType: 'file',
51
- collectionName: collection
52
- };
29
+ const identifier = getIdentifier(selectedNodeAttrs);
30
+ const collectionName = isExternalMedia(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
53
31
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
54
- collectionName: collection,
55
- items: []
32
+ collectionName: collectionName,
33
+ items: items
56
34
  // Ignored via go/ees005
57
35
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
58
36
  ,
@@ -1,8 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconImages } from '@atlaskit/editor-common/quick-insert';
6
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
4
  import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
8
5
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
@@ -317,33 +314,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
317
314
  pluginsOptions: {
318
315
  quickInsert: function quickInsert(_ref12) {
319
316
  var formatMessage = _ref12.formatMessage;
320
- return fg('platform_editor_add_media_from_url_rollout') || options !== null && options !== void 0 && options.disableQuickInsert ? [] : [{
321
- id: 'media',
322
- title: formatMessage(messages.mediaFiles),
323
- description: formatMessage(messages.mediaFilesDescription),
324
- priority: 400,
325
- keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video', 'file'],
326
- icon: function icon() {
327
- return /*#__PURE__*/React.createElement(IconImages, null);
328
- },
329
- isDisabledOffline: true,
330
- action: function action(insert, state) {
331
- var _api$analytics4;
332
- var pluginState = stateKey.getState(state);
333
- pluginState === null || pluginState === void 0 || pluginState.showMediaPicker();
334
- var tr = insert('');
335
- api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent({
336
- action: ACTION.OPENED,
337
- actionSubject: ACTION_SUBJECT.PICKER,
338
- actionSubjectId: ACTION_SUBJECT_ID.PICKER_CLOUD,
339
- attributes: {
340
- inputMethod: INPUT_METHOD.QUICK_INSERT
341
- },
342
- eventType: EVENT_TYPE.UI
343
- })(tr);
344
- return tr;
345
- }
346
- }];
317
+ return [];
347
318
  },
348
319
  floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
349
320
  var _api$editorViewMode;
@@ -25,7 +25,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
25
25
  import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
26
26
  import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
27
27
  import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
28
- import { CommentBadge, CommentBadgeNextWrapper } from '../ui/CommentBadge';
28
+ import { CommentBadgeWrapper } from '../ui/CommentBadge';
29
29
  import ResizableMediaSingle from '../ui/ResizableMediaSingle';
30
30
  import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
31
31
  import { hasPrivateAttrsChanged } from './helpers';
@@ -390,15 +390,6 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
390
390
  var disabledNode = !!findParentNodeOfTypeClosestToPos($pos, [table]);
391
391
  return Boolean(result && !disabledNode);
392
392
  }, [mediaOptions, pos, view, editorDisabled, editorViewMode]);
393
- var badgeOffsetRight = React.useMemo(function () {
394
- if (typeof pos !== 'number') {
395
- return undefined;
396
- }
397
- var $pos = view.state.doc.resolve(pos);
398
- var table = view.state.schema.nodes.table;
399
- var foundTableNode = findParentNodeOfTypeClosestToPos($pos, [table]);
400
- return foundTableNode ? '2px' : '14px';
401
- }, [pos, view]);
402
393
  var shouldShowPlaceholder = React.useMemo(function () {
403
394
  var result = mediaOptions.allowCaptions && mediaNode.childCount !== 2 && isSelected && view.state.selection instanceof NodeSelection;
404
395
  return !editorDisabled && result;
@@ -468,7 +459,7 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
468
459
  ,
469
460
  className: MediaSingleNodeSelector,
470
461
  onClick: onMediaSingleClicked
471
- }, fg('platform_editor_add_media_from_url_rollout') && jsx(MediaBadges, {
462
+ }, jsx(MediaBadges, {
472
463
  mediaElement: currentMediaElement(),
473
464
  mediaHeight: height,
474
465
  mediaWidth: width,
@@ -478,20 +469,13 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
478
469
  return jsx(React.Fragment, null, visible && jsx(ExternalImageBadge, {
479
470
  type: childMediaNodeAttrs.type,
480
471
  url: childMediaNodeAttrs.type === 'external' ? childMediaNodeAttrs.url : undefined
481
- }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
472
+ }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeWrapper, {
482
473
  view: view,
483
474
  api: pluginInjectionApi,
484
475
  mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
485
476
  getPos: getPos,
486
477
  isDrafting: isCurrentNodeDrafting
487
478
  }));
488
- }), !fg('platform_editor_add_media_from_url_rollout') && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
489
- view: view,
490
- api: pluginInjectionApi,
491
- mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
492
- badgeOffsetRight: badgeOffsetRight,
493
- getPos: getPos,
494
- isDrafting: isCurrentNodeDrafting
495
479
  }), jsx("div", {
496
480
  ref: forwardRef
497
481
  }), shouldShowPlaceholder && (fg('platform_editor_typography_ugc') ? jsx(CaptionPlaceholderButton
@@ -9,7 +9,6 @@ import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
9
9
  import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
10
10
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
11
11
  import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
14
13
  import { findChangeFromLocation, getChangeMediaAnalytics } from './analytics';
15
14
  import { isImage } from './is-type';
@@ -88,8 +87,7 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
88
87
  if (node.type !== media || !isImage(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
89
88
  return false;
90
89
  }
91
- var insertMediaPopup = fg('platform_editor_add_media_from_url_rollout');
92
- var mediaSingleAttrs = allowPixelResizing && insertMediaPopup ? {
90
+ var mediaSingleAttrs = allowPixelResizing ? {
93
91
  widthType: 'pixel',
94
92
  width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH),
95
93
  layout: 'center'
@@ -1,9 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useMemo, useState } from 'react';
3
- import { injectIntl } from 'react-intl-next';
4
3
  import { VIEW_METHOD } from '@atlaskit/editor-common/analytics';
5
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
- import { CommentBadge as CommentBadgeComponent, CommentBadgeNext } from '@atlaskit/editor-common/media-single';
5
+ import { CommentBadgeNext } from '@atlaskit/editor-common/media-single';
7
6
  var selector = function selector(states) {
8
7
  var _states$annotationSta, _states$annotationSta2, _states$annotationSta3;
9
8
  return {
@@ -12,22 +11,20 @@ var selector = function selector(states) {
12
11
  annotations: (_states$annotationSta3 = states.annotationState) === null || _states$annotationSta3 === void 0 ? void 0 : _states$annotationSta3.annotations
13
12
  };
14
13
  };
15
- var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
14
+ export var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
16
15
  var api = _ref.api,
17
16
  mediaNode = _ref.mediaNode,
18
17
  view = _ref.view,
19
18
  getPos = _ref.getPos,
20
- intl = _ref.intl,
21
- isDrafting = _ref.isDrafting,
22
- badgeOffsetRight = _ref.badgeOffsetRight;
23
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['annotation'], selector),
24
- selectedAnnotations = _useSharedPluginState.selectedAnnotations,
25
- isInlineCommentViewClosed = _useSharedPluginState.isInlineCommentViewClosed,
26
- annotations = _useSharedPluginState.annotations;
19
+ isDrafting = _ref.isDrafting;
27
20
  var _useState = useState(false),
28
21
  _useState2 = _slicedToArray(_useState, 2),
29
22
  entered = _useState2[0],
30
23
  setEntered = _useState2[1];
24
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['annotation'], selector),
25
+ selectedAnnotations = _useSharedPluginState.selectedAnnotations,
26
+ isInlineCommentViewClosed = _useSharedPluginState.isInlineCommentViewClosed,
27
+ annotations = _useSharedPluginState.annotations;
31
28
  var _view$state$schema = view.state.schema,
32
29
  media = _view$state$schema.nodes.media,
33
30
  annotation = _view$state$schema.marks.annotation,
@@ -56,80 +53,6 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
56
53
  if (!isDrafting && hasNoComments || !mediaNode) {
57
54
  return null;
58
55
  }
59
-
60
- /**
61
- * After performing certain operations like drag and drop,
62
- * the position may momentarily shift. It will NOT always be an HTML element;
63
- * it could also be plain text.
64
- */
65
- var maybeMediaSingleElement = view.domAtPos(pos + 1).node;
66
- var mediaSingleElement = maybeMediaSingleElement instanceof HTMLElement ? maybeMediaSingleElement : null;
67
- return /*#__PURE__*/React.createElement(CommentBadgeComponent, {
68
- badgeOffsetRight: badgeOffsetRight,
69
- width: mediaNode.attrs.width,
70
- height: mediaNode.attrs.height,
71
- onClick: onClick,
72
- mediaSingleElement: mediaSingleElement,
73
- intl: intl,
74
- status: entered ? 'entered' : status,
75
- onMouseEnter: function onMouseEnter() {
76
- return setEntered(true);
77
- },
78
- onMouseLeave: function onMouseLeave() {
79
- return setEntered(false);
80
- }
81
- });
82
- };
83
- export var CommentBadge = injectIntl(CommentBadgeWrapper);
84
-
85
- /**
86
- * Remove CommentBadgeWrapper component above
87
- * and rename CommentBadgeNextWrapper to CommentBadgeWrapper
88
- * when clean up platform_editor_add_media_from_url_rollout feature flag
89
- */
90
-
91
- export var CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
92
- var api = _ref2.api,
93
- mediaNode = _ref2.mediaNode,
94
- view = _ref2.view,
95
- getPos = _ref2.getPos,
96
- isDrafting = _ref2.isDrafting;
97
- var _useState3 = useState(false),
98
- _useState4 = _slicedToArray(_useState3, 2),
99
- entered = _useState4[0],
100
- setEntered = _useState4[1];
101
- var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['annotation'], selector),
102
- selectedAnnotations = _useSharedPluginState2.selectedAnnotations,
103
- isInlineCommentViewClosed = _useSharedPluginState2.isInlineCommentViewClosed,
104
- annotations = _useSharedPluginState2.annotations;
105
- var _view$state$schema2 = view.state.schema,
106
- media = _view$state$schema2.nodes.media,
107
- annotation = _view$state$schema2.marks.annotation,
108
- state = view.state,
109
- dispatch = view.dispatch;
110
- var status = useMemo(function () {
111
- if (!selectedAnnotations || !mediaNode) {
112
- return 'default';
113
- }
114
- return selectedAnnotations.some(function (annotation) {
115
- return !!mediaNode.marks.find(function (mark) {
116
- return mark.attrs.id === annotation.id;
117
- });
118
- }) && !isInlineCommentViewClosed ? 'active' : 'default';
119
- }, [selectedAnnotations, isInlineCommentViewClosed, mediaNode]);
120
- var onClick = useCallback(function () {
121
- if (api.annotation && mediaNode) {
122
- var showCommentForBlockNode = api.annotation.actions.showCommentForBlockNode;
123
- showCommentForBlockNode(mediaNode, VIEW_METHOD.BADGE)(state, dispatch);
124
- }
125
- }, [api.annotation, dispatch, mediaNode, state]);
126
- var pos = getPos();
127
- var hasNoComments = !Number.isFinite(pos) || !annotations || !mediaNode || mediaNode.type !== media || mediaNode.marks.every(function (maybeAnnotation) {
128
- return maybeAnnotation.type !== annotation || !(maybeAnnotation.attrs.id in annotations) || annotations[maybeAnnotation.attrs.id];
129
- });
130
- if (!isDrafting && hasNoComments || !mediaNode) {
131
- return null;
132
- }
133
56
  var maybeMediaSingleElement = view.domAtPos(pos + 1).node;
134
57
  var mediaSingleElement = maybeMediaSingleElement instanceof HTMLElement ? maybeMediaSingleElement : null;
135
58
  return /*#__PURE__*/React.createElement(CommentBadgeNext, {
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import { MediaViewer } from '@atlaskit/media-viewer';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { isExternalMedia } from '../../ui/toolbar/utils';
6
5
  var getIdentifier = function getIdentifier(attrs) {
7
6
  if (isExternalMedia(attrs)) {
@@ -26,32 +25,11 @@ export var RenderMediaViewer = function RenderMediaViewer(_ref) {
26
25
  selectedNodeAttrs = _ref.selectedNodeAttrs,
27
26
  _ref$items = _ref.items,
28
27
  items = _ref$items === void 0 ? [] : _ref$items;
29
- if (fg('platform_editor_add_media_from_url_rollout')) {
30
- var _identifier = getIdentifier(selectedNodeAttrs);
31
- var collectionName = isExternalMedia(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
32
- return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
33
- collectionName: collectionName,
34
- items: items
35
- // Ignored via go/ees005
36
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
- ,
38
- mediaClientConfig: mediaClientConfig,
39
- selectedItem: _identifier,
40
- onClose: onClose
41
- }), document.body);
42
- }
43
- var _ref2 = selectedNodeAttrs,
44
- id = _ref2.id,
45
- _ref2$collection = _ref2.collection,
46
- collection = _ref2$collection === void 0 ? '' : _ref2$collection;
47
- var identifier = {
48
- id: id,
49
- mediaItemType: 'file',
50
- collectionName: collection
51
- };
28
+ var identifier = getIdentifier(selectedNodeAttrs);
29
+ var collectionName = isExternalMedia(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
52
30
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
53
- collectionName: collection,
54
- items: []
31
+ collectionName: collectionName,
32
+ items: items
55
33
  // Ignored via go/ees005
56
34
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
57
35
  ,
@@ -1,29 +1,11 @@
1
1
  import React from 'react';
2
- import type { IntlShape } from 'react-intl-next';
3
2
  import type { AnnotationMarkDefinition } from '@atlaskit/adf-schema';
4
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
4
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
6
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
8
7
  import type { getPosHandler } from '../../types';
9
- type CommentBadgeProps = {
10
- api: ExtractInjectionAPI<MediaNextEditorPluginType>;
11
- badgeOffsetRight?: string;
12
- getPos: getPosHandler;
13
- intl: IntlShape;
14
- isDrafting: boolean;
15
- mediaNode: PMNode | null;
16
- view: EditorView;
17
- };
18
- export declare const CommentBadge: React.FC<import("react-intl-next").WithIntlProps<CommentBadgeProps>> & {
19
- WrappedComponent: React.ComponentType<CommentBadgeProps>;
20
- };
21
- /**
22
- * Remove CommentBadgeWrapper component above
23
- * and rename CommentBadgeNextWrapper to CommentBadgeWrapper
24
- * when clean up platform_editor_add_media_from_url_rollout feature flag
25
- */
26
- type CommentBadgeNextWrapperProps = {
8
+ type CommentBadgeWrapperProps = {
27
9
  api: ExtractInjectionAPI<MediaNextEditorPluginType>;
28
10
  getPos: getPosHandler;
29
11
  isDrafting?: boolean;
@@ -32,5 +14,5 @@ type CommentBadgeNextWrapperProps = {
32
14
  mediaSingleElement?: HTMLElement | null;
33
15
  view: EditorView;
34
16
  };
35
- export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, }: CommentBadgeNextWrapperProps) => React.JSX.Element | null;
17
+ export declare const CommentBadgeWrapper: ({ api, mediaNode, view, getPos, isDrafting, }: CommentBadgeWrapperProps) => React.JSX.Element | null;
36
18
  export {};
@@ -1,29 +1,11 @@
1
1
  import React from 'react';
2
- import type { IntlShape } from 'react-intl-next';
3
2
  import type { AnnotationMarkDefinition } from '@atlaskit/adf-schema';
4
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
4
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
6
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
8
7
  import type { getPosHandler } from '../../types';
9
- type CommentBadgeProps = {
10
- api: ExtractInjectionAPI<MediaNextEditorPluginType>;
11
- badgeOffsetRight?: string;
12
- getPos: getPosHandler;
13
- intl: IntlShape;
14
- isDrafting: boolean;
15
- mediaNode: PMNode | null;
16
- view: EditorView;
17
- };
18
- export declare const CommentBadge: React.FC<import("react-intl-next").WithIntlProps<CommentBadgeProps>> & {
19
- WrappedComponent: React.ComponentType<CommentBadgeProps>;
20
- };
21
- /**
22
- * Remove CommentBadgeWrapper component above
23
- * and rename CommentBadgeNextWrapper to CommentBadgeWrapper
24
- * when clean up platform_editor_add_media_from_url_rollout feature flag
25
- */
26
- type CommentBadgeNextWrapperProps = {
8
+ type CommentBadgeWrapperProps = {
27
9
  api: ExtractInjectionAPI<MediaNextEditorPluginType>;
28
10
  getPos: getPosHandler;
29
11
  isDrafting?: boolean;
@@ -32,5 +14,5 @@ type CommentBadgeNextWrapperProps = {
32
14
  mediaSingleElement?: HTMLElement | null;
33
15
  view: EditorView;
34
16
  };
35
- export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, }: CommentBadgeNextWrapperProps) => React.JSX.Element | null;
17
+ export declare const CommentBadgeWrapper: ({ api, mediaNode, view, getPos, isDrafting, }: CommentBadgeWrapperProps) => React.JSX.Element | null;
36
18
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "8.1.4",
3
+ "version": "8.2.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,13 +29,13 @@
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
- "@atlaskit/adf-schema": "^51.2.0",
32
+ "@atlaskit/adf-schema": "^51.3.0",
33
33
  "@atlaskit/analytics-namespaced-context": "^7.1.0",
34
34
  "@atlaskit/analytics-next": "^11.1.0",
35
35
  "@atlaskit/button": "^23.5.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
- "@atlaskit/editor-plugin-analytics": "^6.1.0",
38
- "@atlaskit/editor-plugin-annotation": "^6.1.0",
37
+ "@atlaskit/editor-plugin-analytics": "^6.2.0",
38
+ "@atlaskit/editor-plugin-annotation": "^6.2.0",
39
39
  "@atlaskit/editor-plugin-connectivity": "^6.0.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
41
41
  "@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/editor-plugin-focus": "^5.0.0",
45
45
  "@atlaskit/editor-plugin-grid": "^6.0.0",
46
46
  "@atlaskit/editor-plugin-guideline": "^6.0.0",
47
- "@atlaskit/editor-plugin-interaction": "^8.0.0",
47
+ "@atlaskit/editor-plugin-interaction": "^9.0.0",
48
48
  "@atlaskit/editor-plugin-selection": "^6.1.0",
49
49
  "@atlaskit/editor-plugin-toolbar": "^3.3.0",
50
50
  "@atlaskit/editor-plugin-width": "^7.0.0",
@@ -63,11 +63,11 @@
63
63
  "@atlaskit/media-ui": "^28.7.0",
64
64
  "@atlaskit/media-viewer": "^52.4.0",
65
65
  "@atlaskit/platform-feature-flags": "^1.1.0",
66
- "@atlaskit/primitives": "^15.0.0",
66
+ "@atlaskit/primitives": "^16.0.0",
67
67
  "@atlaskit/textfield": "^8.0.0",
68
68
  "@atlaskit/theme": "^21.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^13.12.0",
70
- "@atlaskit/tokens": "^6.5.0",
69
+ "@atlaskit/tmp-editor-statsig": "^13.13.0",
70
+ "@atlaskit/tokens": "^7.0.0",
71
71
  "@atlaskit/tooltip": "^20.5.0",
72
72
  "@babel/runtime": "^7.0.0",
73
73
  "@emotion/react": "^11.7.1",
@@ -78,7 +78,7 @@
78
78
  "uuid": "^3.1.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^110.13.0",
81
+ "@atlaskit/editor-common": "^110.14.0",
82
82
  "@atlaskit/media-core": "^37.0.0",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",
@@ -142,9 +142,6 @@
142
142
  "platform_editor_safari_media_clipboard_fix": {
143
143
  "type": "boolean"
144
144
  },
145
- "platform_editor_add_media_from_url_rollout": {
146
- "type": "boolean"
147
- },
148
145
  "platform_editor_remove_media_inline_feature_flag": {
149
146
  "type": "boolean"
150
147
  },