@atlaskit/editor-plugin-media 8.2.1 → 8.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/mediaPlugin.js +28 -8
  3. package/dist/cjs/nodeviews/mediaNodeView/index.js +4 -1
  4. package/dist/cjs/nodeviews/mediaNodeView/media.js +10 -3
  5. package/dist/cjs/nodeviews/mediaSingleNext.js +7 -5
  6. package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
  7. package/dist/cjs/pm-plugins/pixel-resizing/ui/index.js +4 -1
  8. package/dist/cjs/pm-plugins/pixel-resizing/ui/pixel-entry.js +3 -3
  9. package/dist/cjs/ui/toolbar/alt-text.js +1 -2
  10. package/dist/cjs/ui/toolbar/index.js +2 -3
  11. package/dist/cjs/ui/toolbar/linking.js +2 -3
  12. package/dist/cjs/ui/toolbar/mediaInline.js +1 -2
  13. package/dist/es2019/mediaPlugin.js +28 -8
  14. package/dist/es2019/nodeviews/mediaNodeView/index.js +6 -1
  15. package/dist/es2019/nodeviews/mediaNodeView/media.js +8 -3
  16. package/dist/es2019/nodeviews/mediaSingleNext.js +3 -1
  17. package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
  18. package/dist/es2019/pm-plugins/pixel-resizing/ui/index.js +4 -1
  19. package/dist/es2019/pm-plugins/pixel-resizing/ui/pixel-entry.js +3 -3
  20. package/dist/es2019/ui/toolbar/alt-text.js +1 -2
  21. package/dist/es2019/ui/toolbar/index.js +2 -3
  22. package/dist/es2019/ui/toolbar/linking.js +2 -3
  23. package/dist/es2019/ui/toolbar/mediaInline.js +1 -2
  24. package/dist/esm/mediaPlugin.js +28 -8
  25. package/dist/esm/nodeviews/mediaNodeView/index.js +4 -1
  26. package/dist/esm/nodeviews/mediaNodeView/media.js +10 -3
  27. package/dist/esm/nodeviews/mediaSingleNext.js +3 -1
  28. package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
  29. package/dist/esm/pm-plugins/pixel-resizing/ui/index.js +4 -1
  30. package/dist/esm/pm-plugins/pixel-resizing/ui/pixel-entry.js +3 -3
  31. package/dist/esm/ui/toolbar/alt-text.js +1 -2
  32. package/dist/esm/ui/toolbar/index.js +2 -3
  33. package/dist/esm/ui/toolbar/linking.js +2 -3
  34. package/dist/esm/ui/toolbar/mediaInline.js +1 -2
  35. package/dist/types/mediaPluginType.d.ts +5 -0
  36. package/dist/types/nodeviews/mediaNodeView/media.d.ts +4 -0
  37. package/dist/types/pm-plugins/pixel-resizing/ui/pixel-entry.d.ts +1 -1
  38. package/dist/types/pm-plugins/pixel-resizing/ui/types.d.ts +4 -0
  39. package/dist/types-ts4.5/mediaPluginType.d.ts +5 -0
  40. package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +4 -0
  41. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/pixel-entry.d.ts +1 -1
  42. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/types.d.ts +4 -0
  43. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 8.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`507be0327d12c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/507be0327d12c) -
8
+ [ux] ED-29558 [Jira] Media element toolbar 'resize' doesn't work
9
+ - Updated dependencies
10
+
11
+ ## 8.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`e5f402044b1c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5f402044b1c6) -
16
+ Add media render error analytics
17
+
18
+ ### Patch Changes
19
+
20
+ - [`2352f7c910f27`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2352f7c910f27) -
21
+ upgrade use of browser util
22
+ - Updated dependencies
23
+
3
24
  ## 8.2.1
4
25
 
5
26
  ### Patch Changes
@@ -7,12 +7,13 @@ 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");
10
11
  var _hooks = require("@atlaskit/editor-common/hooks");
11
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
+ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
12
14
  var _state = require("@atlaskit/editor-prosemirror/state");
13
15
  var _mediaCommon = require("@atlaskit/media-common");
14
16
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
17
  var _lazyMedia = require("./nodeviews/lazy-media");
17
18
  var _lazyMediaGroup = require("./nodeviews/lazy-media-group");
18
19
  var _lazyMediaInline = require("./nodeviews/lazy-media-inline");
@@ -108,6 +109,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
108
109
  options = _ref3$config === void 0 ? {} : _ref3$config,
109
110
  api = _ref3.api;
110
111
  var previousMediaProvider;
112
+ var mediaErrorLocalIds = new Set();
111
113
  return {
112
114
  name: 'media',
113
115
  getSharedState: function getSharedState(editorState) {
@@ -117,9 +119,27 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
117
119
  return _pluginKey.stateKey.getState(editorState) || null;
118
120
  },
119
121
  actions: {
120
- insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod, insertMediaVia) {
122
+ handleMediaNodeRenderError: function handleMediaNodeRenderError(node, reason) {
121
123
  var _api$analytics;
122
- return (0, _mediaSingle2.insertMediaAsMediaSingle)(view, node, inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, insertMediaVia, options === null || options === void 0 ? void 0 : options.allowPixelResizing);
124
+ // Only fire the errored event once per media node
125
+ if (mediaErrorLocalIds.has(node.attrs.localId)) {
126
+ return;
127
+ }
128
+ mediaErrorLocalIds.add(node.attrs.localId);
129
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
130
+ action: _analytics.ACTION.ERRORED,
131
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
132
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
133
+ eventType: _analytics.EVENT_TYPE.UI,
134
+ attributes: {
135
+ reason: reason,
136
+ external: node.attrs.__external
137
+ }
138
+ });
139
+ },
140
+ insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod, insertMediaVia) {
141
+ var _api$analytics2;
142
+ return (0, _mediaSingle2.insertMediaAsMediaSingle)(view, node, inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, insertMediaVia, options === null || options === void 0 ? void 0 : options.allowPixelResizing);
123
143
  },
124
144
  setProvider: function setProvider(provider) {
125
145
  var _api$core$actions$exe;
@@ -214,9 +234,9 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
214
234
  }, {
215
235
  name: 'mediaKeymap',
216
236
  plugin: function plugin(_ref7) {
217
- var _api$analytics2, _api$selection;
237
+ var _api$analytics3, _api$selection;
218
238
  var getIntl = _ref7.getIntl;
219
- return (0, _keymap2.default)(options, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.actions, api === null || api === void 0 ? void 0 : api.width, getIntl);
239
+ return (0, _keymap2.default)(options, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.actions, api === null || api === void 0 ? void 0 : api.width, getIntl);
220
240
  }
221
241
  }];
222
242
  if (options && options.allowMediaSingle) {
@@ -236,9 +256,9 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
236
256
  pmPlugins.push({
237
257
  name: 'mediaAltTextKeymap',
238
258
  plugin: function plugin(_ref9) {
239
- var _api$analytics3;
259
+ var _api$analytics4;
240
260
  var schema = _ref9.schema;
241
- return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
261
+ return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
242
262
  }
243
263
  });
244
264
  }
@@ -258,7 +278,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
258
278
  }
259
279
  });
260
280
  }
261
- if (options && options.allowAdvancedToolBarOptions && options.allowResizing && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && options.allowPixelResizing) {
281
+ if (options && options.allowAdvancedToolBarOptions && options.allowResizing && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && options.allowPixelResizing) {
262
282
  pmPlugins.push({
263
283
  name: 'mediaPixelResizing',
264
284
  plugin: _pixelResizing.createPlugin
@@ -109,7 +109,9 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
109
109
  height: height
110
110
  };
111
111
  var isSelectedAndInteracted = _this.nodeInsideSelection() && interactionState !== 'hasNotHadInteraction';
112
+ var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
112
113
  return /*#__PURE__*/_react.default.createElement(_media.default, {
114
+ api: pluginInjectionApi,
113
115
  view: _this.view,
114
116
  node: _this.node,
115
117
  getPos: getPos,
@@ -121,7 +123,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
121
123
  contextIdentifierProvider: contextIdentifierProvider,
122
124
  mediaOptions: mediaOptions,
123
125
  onExternalImageLoaded: _this.onExternalImageLoaded,
124
- isViewOnly: ((_this$reactComponentP = _this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode) === 'view'
126
+ isViewOnly: ((_this$reactComponentP = _this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode) === 'view',
127
+ pluginInjectionApi: _this.reactComponentProps.pluginInjectionApi
125
128
  });
126
129
  };
127
130
  });
@@ -18,10 +18,12 @@ var _react = _interopRequireWildcard(require("react"));
18
18
  var _bindEventListener = require("bind-event-listener");
19
19
  var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
20
20
  var _analyticsNext = require("@atlaskit/analytics-next");
21
+ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
21
22
  var _utils = require("@atlaskit/editor-common/utils");
22
23
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
23
24
  var _mediaCard = require("@atlaskit/media-card");
24
25
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
25
27
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
26
28
  var _pluginKey = require("../../pm-plugins/plugin-key");
27
29
  var _styles = require("../styles");
@@ -64,13 +66,14 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
64
66
  }, _callee);
65
67
  })));
66
68
  (0, _defineProperty2.default)(_this, "selectMediaSingleFromCard", function (_ref2) {
69
+ var _this$props$pluginInj;
67
70
  var event = _ref2.event;
68
71
  _this.selectMediaSingle(event);
69
72
 
70
73
  // In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
71
74
  // We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
72
75
  // another URL if the media node is wrapped in a link mark.
73
- if (_this.props.isViewOnly && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
76
+ if (_this.props.isViewOnly && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean((_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.toolbar))) {
74
77
  event.preventDefault();
75
78
  }
76
79
  });
@@ -243,7 +246,8 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
243
246
  originalDimensions = _this$props.originalDimensions,
244
247
  isLoading = _this$props.isLoading,
245
248
  maxDimensions = _this$props.maxDimensions,
246
- mediaOptions = _this$props.mediaOptions;
249
+ mediaOptions = _this$props.mediaOptions,
250
+ api = _this$props.api;
247
251
  var borderMark = node.marks.find(function (m) {
248
252
  return m.type.name === 'border';
249
253
  });
@@ -324,7 +328,10 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
324
328
  ssr: ssr,
325
329
  mediaSettings: {
326
330
  canUpdateVideoCaptions: (0, _platformFeatureFlags.fg)('platform_media_video_captions') ? !!viewAndUploadMediaClientConfig : false
327
- }
331
+ },
332
+ onError: (0, _expValEquals.expValEquals)('platform_editor_media_error_analytics', 'isEnabled', true) ? function (reason) {
333
+ return api === null || api === void 0 ? void 0 : api.media.actions.handleMediaNodeRenderError(node, reason);
334
+ } : undefined
328
335
  })));
329
336
  }
330
337
  }]);
@@ -12,15 +12,16 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _react2 = require("@emotion/react");
15
+ var _browser = require("@atlaskit/editor-common/browser");
15
16
  var _hooks = require("@atlaskit/editor-common/hooks");
16
17
  var _media = require("@atlaskit/editor-common/media");
17
18
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
18
19
  var _ui = require("@atlaskit/editor-common/ui");
19
- var _utils = require("@atlaskit/editor-common/utils");
20
20
  var _state = require("@atlaskit/editor-prosemirror/state");
21
- var _utils2 = require("@atlaskit/editor-prosemirror/utils");
21
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
22
22
  var _mediaClient = require("@atlaskit/media-client");
23
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
25
  var _captions = require("../pm-plugins/commands/captions");
25
26
  var _mediaCommon = require("../pm-plugins/utils/media-common");
26
27
  var _CaptionPlaceholder = require("../ui/CaptionPlaceholder");
@@ -393,7 +394,7 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
393
394
  // If resizing not allowed in tables, check parents for tables
394
395
  var $pos = view.state.doc.resolve(pos);
395
396
  var table = view.state.schema.nodes.table;
396
- var disabledNode = !!(0, _utils2.findParentNodeOfTypeClosestToPos)($pos, [table]);
397
+ var disabledNode = !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, [table]);
397
398
  return Boolean(result && !disabledNode);
398
399
  }, [mediaOptions, pos, view, editorDisabled, editorViewMode]);
399
400
  var shouldShowPlaceholder = _react.default.useMemo(function () {
@@ -404,7 +405,7 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
404
405
  if (typeof pos !== 'number') {
405
406
  return false;
406
407
  }
407
- return (0, _utils2.findParentNodeOfTypeClosestToPos)(view.state.doc.resolve(pos), [view.state.schema.nodes.table]);
408
+ return (0, _utils.findParentNodeOfTypeClosestToPos)(view.state.doc.resolve(pos), [view.state.schema.nodes.table]);
408
409
  }, [pos, view]);
409
410
  var currentMediaElement = _react.default.useCallback(function () {
410
411
  if (typeof pos !== 'number') {
@@ -433,9 +434,10 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
433
434
  var captionPlaceHolderRef = /*#__PURE__*/_react.default.createRef();
434
435
  var onMediaSingleClicked = _react.default.useCallback(function (event) {
435
436
  var _captionPlaceHolderRe;
437
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
436
438
  // Workaround for iOS 16 Caption selection issue
437
439
  // @see https://product-fabric.atlassian.net/browse/MEX-2012
438
- if (!_utils.browser.ios) {
440
+ if (!browser.ios) {
439
441
  return;
440
442
  }
441
443
  if (mediaSingleWrapperRef.current !== event.target) {
@@ -24,7 +24,6 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-left--chevron-left-large"));
25
25
  var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/core/migration/cross-circle"));
26
26
  var _colors = require("@atlaskit/theme/colors");
27
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
28
27
  var _commands = require("../commands");
29
28
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
30
29
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
@@ -134,9 +133,10 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
134
133
  });
135
134
  });
136
135
  (0, _defineProperty2.default)(_this, "handleOnBlur", function (e) {
136
+ var _this$props$areAnyNew;
137
137
  // prevent other selection transaction gets triggered
138
138
  e.stopPropagation();
139
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
139
+ if ((_this$props$areAnyNew = _this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew !== void 0 ? _this$props$areAnyNew : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
140
140
  _this.closeMediaAltTextMenuAndSetFocus();
141
141
  } else {
142
142
  _this.closeMediaAltTextMenu();
@@ -182,7 +182,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
182
182
  }, {
183
183
  key: "render",
184
184
  value: function render() {
185
- var _this$props$areAnyNew, _this$props$areAnyNew2;
185
+ var _this$props$areAnyNew2, _this$props$areAnyNew3, _this$props$areAnyNew4;
186
186
  var formatMessage = this.props.intl.formatMessage;
187
187
  var showClearTextButton = this.state.showClearTextButton;
188
188
  var backButtonMessage = formatMessage(_media.altTextMessages.back);
@@ -199,7 +199,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
199
199
  }, error);
200
200
  });
201
201
  var hasErrors = !!errorsList.length;
202
- var onSubmit = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? this.closeMediaAltTextMenuAndSetFocus : this.closeMediaAltTextMenu;
202
+ var onSubmit = ((_this$props$areAnyNew2 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew2 !== void 0 ? _this$props$areAnyNew2 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) ? this.closeMediaAltTextMenuAndSetFocus : this.closeMediaAltTextMenu;
203
203
  return (0, _react2.jsx)("div", {
204
204
  css: containerStyles
205
205
  }, (0, _react2.jsx)("section", {
@@ -214,7 +214,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
214
214
  }),
215
215
  tooltipContent: backButtonMessageComponent,
216
216
  onClick: this.closeMediaAltTextMenu,
217
- areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew !== void 0 ? _this$props$areAnyNew : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
217
+ areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew3 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew3 !== void 0 ? _this$props$areAnyNew3 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
218
218
  })), (0, _react2.jsx)(_ui.PanelTextInput, {
219
219
  testId: "alt-text-input",
220
220
  ariaLabel: formatMessage(_media.altTextMessages.placeholder),
@@ -241,7 +241,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
241
241
  })),
242
242
  tooltipContent: formatMessage(_media.altTextMessages.clear),
243
243
  onClick: this.handleClearText,
244
- areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew2 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew2 !== void 0 ? _this$props$areAnyNew2 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
244
+ areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew4 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew4 !== void 0 ? _this$props$areAnyNew4 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
245
245
  }))), hasErrors && (0, _react2.jsx)("section", {
246
246
  id: "errors-list",
247
247
  ref: this.errorsListRef,
@@ -10,6 +10,7 @@ var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
11
  var _media = require("@atlaskit/editor-common/media");
12
12
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
13
+ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
13
14
  var _state = require("@atlaskit/editor-prosemirror/state");
14
15
  var _utils = require("@atlaskit/editor-prosemirror/utils");
15
16
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -70,6 +71,7 @@ var PixelEntry = exports.PixelEntry = function PixelEntry(_ref) {
70
71
  mediaWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH);
71
72
  var pixelWidth = hasPixelType ? mediaSingleWidth : pixelWidthFromElement;
72
73
  var forceFocusSelector = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 || (_pluginInjectionApi$f = _pluginInjectionApi$f.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector;
74
+ var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
73
75
  return (0, _react2.jsx)(_pixelEntry.PixelEntryComponent, {
74
76
  intl: intl,
75
77
  width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
@@ -121,7 +123,8 @@ var PixelEntry = exports.PixelEntry = function PixelEntry(_ref) {
121
123
  }
122
124
  },
123
125
  isViewMode: pluginState.isResizing,
124
- triggerButtonSelector: triggerButtonSelector
126
+ triggerButtonSelector: triggerButtonSelector,
127
+ areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
125
128
  });
126
129
  };
127
130
  var FullWidthDisplay = exports.FullWidthDisplay = function FullWidthDisplay(_ref4) {
@@ -17,7 +17,6 @@ var _form = _interopRequireWildcard(require("@atlaskit/form"));
17
17
  var _cross = _interopRequireDefault(require("@atlaskit/icon/core/cross"));
18
18
  var _primitives = require("@atlaskit/primitives");
19
19
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
20
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
21
20
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
22
21
  var _constants = require("./constants");
23
22
  var _styles = require("./styles");
@@ -49,7 +48,8 @@ var PixelEntryComponent = exports.PixelEntryComponent = function PixelEntryCompo
49
48
  showMigration = _ref.showMigration,
50
49
  onMigrate = _ref.onMigrate,
51
50
  onCloseAndSave = _ref.onCloseAndSave,
52
- isViewMode = _ref.isViewMode;
51
+ isViewMode = _ref.isViewMode,
52
+ areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
53
53
  var ratioWidth = (0, _react.useMemo)(function () {
54
54
  return mediaHeight / mediaWidth;
55
55
  }, [mediaHeight, mediaWidth]);
@@ -170,7 +170,7 @@ var PixelEntryComponent = exports.PixelEntryComponent = function PixelEntryCompo
170
170
  testId: _constants.PIXELENTRY_MIGRATION_BUTTON_TESTID
171
171
  }, formatMessage(_media.pixelEntryMessages.migrationButtonText)));
172
172
  }
173
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
173
+ if (areAnyNewToolbarFlagsEnabled) {
174
174
  return (0, _react2.jsx)(PixelEntryComponentNext, {
175
175
  maxWidth: maxWidth,
176
176
  formatMessage: formatMessage,
@@ -13,7 +13,6 @@ var _styles = require("@atlaskit/editor-common/styles");
13
13
  var _ui = require("@atlaskit/editor-common/ui");
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _imageAltText = _interopRequireDefault(require("@atlaskit/icon-lab/core/image-alt-text"));
16
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
16
  var _commands = require("../../pm-plugins/alt-text/commands");
18
17
  var _AltTextEdit = _interopRequireDefault(require("../../pm-plugins/alt-text/ui/AltTextEdit"));
19
18
  var _isType = require("../../pm-plugins/utils/is-type");
@@ -60,7 +59,7 @@ var altTextEditComponent = function altTextEditComponent(options) {
60
59
  var _options$forceFocusSe;
61
60
  var tr = view.state.tr,
62
61
  dispatch = view.dispatch;
63
- var elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? options.triggerButtonSelector : "[data-testid=\"".concat(testId, "\"]");
62
+ var elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector && options !== null && options !== void 0 && options.areAnyNewToolbarFlagsEnabled ? options.triggerButtonSelector : "[data-testid=\"".concat(testId, "\"]");
64
63
  var newTr = options === null || options === void 0 || (_options$forceFocusSe = options.forceFocusSelector) === null || _options$forceFocusSe === void 0 ? void 0 : _options$forceFocusSe.call(options, elementSelector)(tr);
65
64
  if (newTr) {
66
65
  dispatch(newTr);
@@ -31,7 +31,6 @@ var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
31
31
  var _mediaUi = require("@atlaskit/media-ui");
32
32
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
33
33
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
34
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
35
34
  var _styles = require("../../nodeviews/styles");
36
35
  var _altText = require("../../pm-plugins/alt-text");
37
36
  var _linking = require("../../pm-plugins/commands/linking");
@@ -756,7 +755,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
756
755
 
757
756
  // testId is required to show focus on trigger button on ESC key press
758
757
  // see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
759
- var overflowButtonSelector = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? "[data-testid=\"".concat(overflowDropdwonBtnTriggerTestId, "\"]") : undefined;
758
+ var overflowButtonSelector = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? "[data-testid=\"".concat(overflowDropdwonBtnTriggerTestId, "\"]") : undefined;
760
759
  if (allowAltTextOnImages) {
761
760
  var mediaAltTextPluginState = (0, _altText.getPluginState)(state);
762
761
  if (mediaAltTextPluginState.isAltTextEditorOpen) {
@@ -771,7 +770,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
771
770
  }
772
771
  var selection = state.selection;
773
772
  var isWithinTable = (0, _utils.hasParentNodeOfType)([state.schema.nodes.table])(selection);
774
- if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
773
+ if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
775
774
  var mediaPixelResizingPluginState = (0, _pixelResizing.getPluginState)(state);
776
775
  if (mediaPixelResizingPluginState !== null && mediaPixelResizingPluginState !== void 0 && mediaPixelResizingPluginState.isPixelEditorOpen) {
777
776
  return (0, _pixelResizing2.getPixelResizingToolbar)(baseToolbar, {
@@ -15,7 +15,6 @@ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
15
15
  var _ui = require("@atlaskit/editor-common/ui");
16
16
  var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
17
17
  var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
18
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
19
18
  var _linking = require("../../pm-plugins/commands/linking");
20
19
  var _linking2 = require("../../pm-plugins/linking");
21
20
  var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
@@ -63,7 +62,7 @@ var getLinkingToolbar = exports.getLinkingToolbar = function getLinkingToolbar(t
63
62
  return null;
64
63
  }
65
64
  var setFocusOnFloatingToolbar = function setFocusOnFloatingToolbar(setFocus) {
66
- if (setFocus && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
65
+ if (setFocus && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
67
66
  var _pluginInjectionApi$f;
68
67
  var tr = view.state.tr,
69
68
  dispatch = view.dispatch;
@@ -98,7 +97,7 @@ var getLinkingToolbar = exports.getLinkingToolbar = function getLinkingToolbar(t
98
97
  */
99
98
  var tr = view.state.tr,
100
99
  dispatch = view.dispatch;
101
- var selector = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS : FORCE_FOCUS_SELECTOR;
100
+ var selector = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS : FORCE_FOCUS_SELECTOR;
102
101
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 || _pluginInjectionApi$f2.forceFocusSelector(selector)(tr);
103
102
  dispatch(tr);
104
103
  },
@@ -20,7 +20,6 @@ var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
20
20
  var _download = _interopRequireDefault(require("@atlaskit/icon/core/migration/download"));
21
21
  var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-card"));
22
22
  var _mediaUi = require("@atlaskit/media-ui");
23
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
24
23
  var _linking = require("../../pm-plugins/commands/linking");
25
24
  var _linking2 = require("../../pm-plugins/linking");
26
25
  var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
@@ -189,7 +188,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
189
188
  var mediaSingleTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaSingle);
190
189
  var widthPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
191
190
  var inlineImageItems = [];
192
- var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
191
+ var isEditorControlsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
193
192
  var isViewOnly = options.isViewOnly,
194
193
  allowAltTextOnImages = options.allowAltTextOnImages,
195
194
  allowLinking = options.allowLinking,
@@ -1,10 +1,11 @@
1
1
  import React, { useMemo } from 'react';
2
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
+ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
4
6
  import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
5
7
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
6
8
  import { fg } from '@atlaskit/platform-feature-flags';
7
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
9
  import { lazyMediaView } from './nodeviews/lazy-media';
9
10
  import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
10
11
  import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
@@ -103,6 +104,7 @@ export const mediaPlugin = ({
103
104
  api
104
105
  }) => {
105
106
  let previousMediaProvider;
107
+ const mediaErrorLocalIds = new Set();
106
108
  return {
107
109
  name: 'media',
108
110
  getSharedState(editorState) {
@@ -112,9 +114,27 @@ export const mediaPlugin = ({
112
114
  return stateKey.getState(editorState) || null;
113
115
  },
114
116
  actions: {
115
- insertMediaAsMediaSingle: (view, node, inputMethod, insertMediaVia) => {
117
+ handleMediaNodeRenderError: (node, reason) => {
116
118
  var _api$analytics;
117
- return insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, insertMediaVia, options === null || options === void 0 ? void 0 : options.allowPixelResizing);
119
+ // Only fire the errored event once per media node
120
+ if (mediaErrorLocalIds.has(node.attrs.localId)) {
121
+ return;
122
+ }
123
+ mediaErrorLocalIds.add(node.attrs.localId);
124
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
125
+ action: ACTION.ERRORED,
126
+ actionSubject: ACTION_SUBJECT.EDITOR,
127
+ actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
128
+ eventType: EVENT_TYPE.UI,
129
+ attributes: {
130
+ reason,
131
+ external: node.attrs.__external
132
+ }
133
+ });
134
+ },
135
+ insertMediaAsMediaSingle: (view, node, inputMethod, insertMediaVia) => {
136
+ var _api$analytics2;
137
+ return insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, insertMediaVia, options === null || options === void 0 ? void 0 : options.allowPixelResizing);
118
138
  },
119
139
  setProvider: provider => {
120
140
  var _api$core$actions$exe;
@@ -209,8 +229,8 @@ export const mediaPlugin = ({
209
229
  plugin: ({
210
230
  getIntl
211
231
  }) => {
212
- var _api$analytics2, _api$selection;
213
- return keymapPlugin(options, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, api === null || api === void 0 ? void 0 : (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.actions, api === null || api === void 0 ? void 0 : api.width, getIntl);
232
+ var _api$analytics3, _api$selection;
233
+ return keymapPlugin(options, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, api === null || api === void 0 ? void 0 : (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.actions, api === null || api === void 0 ? void 0 : api.width, getIntl);
214
234
  }
215
235
  }];
216
236
  if (options && options.allowMediaSingle) {
@@ -231,8 +251,8 @@ export const mediaPlugin = ({
231
251
  plugin: ({
232
252
  schema
233
253
  }) => {
234
- var _api$analytics3;
235
- return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
254
+ var _api$analytics4;
255
+ return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
236
256
  }
237
257
  });
238
258
  }
@@ -250,7 +270,7 @@ export const mediaPlugin = ({
250
270
  }) => keymapLinkingPlugin(schema)
251
271
  });
252
272
  }
253
- if (options && options.allowAdvancedToolBarOptions && options.allowResizing && editorExperiment('platform_editor_controls', 'variant1') && options.allowPixelResizing) {
273
+ if (options && options.allowAdvancedToolBarOptions && options.allowResizing && areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && options.allowPixelResizing) {
254
274
  pmPlugins.push({
255
275
  name: 'mediaPixelResizing',
256
276
  plugin: createMediaPixelResizingPlugin
@@ -96,7 +96,11 @@ class MediaNodeView extends SelectionBasedNodeView {
96
96
  height
97
97
  };
98
98
  const isSelectedAndInteracted = this.nodeInsideSelection() && interactionState !== 'hasNotHadInteraction';
99
+ const {
100
+ pluginInjectionApi
101
+ } = this.reactComponentProps;
99
102
  return /*#__PURE__*/React.createElement(MediaNode, {
103
+ api: pluginInjectionApi,
100
104
  view: this.view,
101
105
  node: this.node,
102
106
  getPos: getPos,
@@ -108,7 +112,8 @@ class MediaNodeView extends SelectionBasedNodeView {
108
112
  contextIdentifierProvider: contextIdentifierProvider,
109
113
  mediaOptions: mediaOptions,
110
114
  onExternalImageLoaded: this.onExternalImageLoaded,
111
- isViewOnly: ((_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : (_this$reactComponentP3 = _this$reactComponentP2.sharedState.currentState()) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.mode) === 'view'
115
+ isViewOnly: ((_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : (_this$reactComponentP3 = _this$reactComponentP2.sharedState.currentState()) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.mode) === 'view',
116
+ pluginInjectionApi: this.reactComponentProps.pluginInjectionApi
112
117
  });
113
118
  };
114
119
  });
@@ -3,10 +3,12 @@ import React, { Component } from 'react';
3
3
  import { bind } from 'bind-event-listener';
4
4
  import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
5
5
  import { AnalyticsContext } from '@atlaskit/analytics-next';
6
+ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
6
7
  import { setNodeSelection, setTextSelection, withImageLoader } from '@atlaskit/editor-common/utils';
7
8
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
8
9
  import { Card, CardLoading } from '@atlaskit/media-card';
9
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
13
  import { stateKey as mediaStateKey } from '../../pm-plugins/plugin-key';
12
14
  import { MediaCardWrapper } from '../styles';
@@ -35,12 +37,13 @@ export class MediaNode extends Component {
35
37
  _defineProperty(this, "selectMediaSingleFromCard", ({
36
38
  event
37
39
  }) => {
40
+ var _this$props$pluginInj;
38
41
  this.selectMediaSingle(event);
39
42
 
40
43
  // In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
41
44
  // We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
42
45
  // another URL if the media node is wrapped in a link mark.
43
- if (this.props.isViewOnly && editorExperiment('platform_editor_controls', 'variant1')) {
46
+ if (this.props.isViewOnly && areToolbarFlagsEnabled(Boolean((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.toolbar))) {
44
47
  event.preventDefault();
45
48
  }
46
49
  });
@@ -184,7 +187,8 @@ export class MediaNode extends Component {
184
187
  originalDimensions,
185
188
  isLoading,
186
189
  maxDimensions,
187
- mediaOptions
190
+ mediaOptions,
191
+ api
188
192
  } = this.props;
189
193
  const borderMark = node.marks.find(m => m.type.name === 'border');
190
194
  const {
@@ -266,7 +270,8 @@ export class MediaNode extends Component {
266
270
  ssr: ssr,
267
271
  mediaSettings: {
268
272
  canUpdateVideoCaptions: fg('platform_media_video_captions') ? !!viewAndUploadMediaClientConfig : false
269
- }
273
+ },
274
+ onError: expValEquals('platform_editor_media_error_analytics', 'isEnabled', true) ? reason => api === null || api === void 0 ? void 0 : api.media.actions.handleMediaNodeRenderError(node, reason) : undefined
270
275
  })));
271
276
  }
272
277
  }
@@ -7,15 +7,16 @@ import React, { Fragment } from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
10
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
10
11
  import { usePreviousState } from '@atlaskit/editor-common/hooks';
11
12
  import { captionMessages } from '@atlaskit/editor-common/media';
12
13
  import { calcMediaSinglePixelWidth, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, ExternalImageBadge, getMaxWidthForNestedNode, MEDIA_SINGLE_GUTTER_SIZE, MediaBadges } from '@atlaskit/editor-common/media-single';
13
14
  import { MediaSingle } from '@atlaskit/editor-common/ui';
14
- import { browser } from '@atlaskit/editor-common/utils';
15
15
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
16
16
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
17
17
  import { getAttrsFromUrl } from '@atlaskit/media-client';
18
18
  import { fg } from '@atlaskit/platform-feature-flags';
19
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
20
  import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
20
21
  import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
21
22
  import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
@@ -393,6 +394,7 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
393
394
  const captionPlaceHolderRef = /*#__PURE__*/React.createRef();
394
395
  const onMediaSingleClicked = React.useCallback(event => {
395
396
  var _captionPlaceHolderRe;
397
+ const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
396
398
  // Workaround for iOS 16 Caption selection issue
397
399
  // @see https://product-fabric.atlassian.net/browse/MEX-2012
398
400
  if (!browser.ios) {