@atlaskit/editor-plugin-media 1.42.17 → 1.43.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/nodeviews/mediaGroup.js +14 -19
  3. package/dist/cjs/nodeviews/mediaInline.js +8 -9
  4. package/dist/cjs/nodeviews/mediaNodeUpdater.js +1 -2
  5. package/dist/cjs/nodeviews/mediaNodeView/index.js +12 -14
  6. package/dist/cjs/nodeviews/mediaNodeView/media.js +13 -16
  7. package/dist/cjs/nodeviews/mediaSingle.js +27 -31
  8. package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +11 -14
  9. package/dist/cjs/pm-plugins/main.js +1 -2
  10. package/dist/cjs/pm-plugins/picker-facade.js +1 -2
  11. package/dist/cjs/ui/MediaLinkingToolbar.js +12 -15
  12. package/dist/cjs/ui/MediaPicker/index.js +13 -13
  13. package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +29 -28
  14. package/dist/cjs/ui/ResizableMediaSingle/index.js +13 -16
  15. package/dist/es2019/index.js +3 -0
  16. package/dist/es2019/ui/MediaPicker/index.js +6 -3
  17. package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -2
  18. package/dist/esm/index.js +3 -0
  19. package/dist/esm/nodeviews/mediaGroup.js +14 -19
  20. package/dist/esm/nodeviews/mediaInline.js +8 -9
  21. package/dist/esm/nodeviews/mediaNodeUpdater.js +1 -2
  22. package/dist/esm/nodeviews/mediaNodeView/index.js +12 -14
  23. package/dist/esm/nodeviews/mediaNodeView/media.js +13 -16
  24. package/dist/esm/nodeviews/mediaSingle.js +27 -31
  25. package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +11 -14
  26. package/dist/esm/pm-plugins/main.js +1 -2
  27. package/dist/esm/pm-plugins/picker-facade.js +1 -2
  28. package/dist/esm/ui/MediaLinkingToolbar.js +12 -15
  29. package/dist/esm/ui/MediaPicker/index.js +13 -13
  30. package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +29 -28
  31. package/dist/esm/ui/ResizableMediaSingle/index.js +13 -16
  32. package/dist/types/mediaPluginType.d.ts +3 -1
  33. package/dist/types/pm-plugins/main.d.ts +1 -1
  34. package/dist/types-ts4.5/mediaPluginType.d.ts +3 -1
  35. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  36. package/package.json +5 -4
@@ -14,8 +14,9 @@ const MediaPicker = ({
14
14
  }) => {
15
15
  var _editorDom$parentElem;
16
16
  const {
17
- focusState
18
- } = useSharedPluginState(api, ['focus']);
17
+ focusState,
18
+ connectivityState
19
+ } = useSharedPluginState(api, ['focus', 'connectivity']);
19
20
  const featureFlags = mediaState.mediaOptions && mediaState.mediaOptions.featureFlags;
20
21
  const editorDom = editorDomElement;
21
22
  const editorParent = (_editorDom$parentElem = editorDom.parentElement) !== null && _editorDom$parentElem !== void 0 ? _editorDom$parentElem : undefined;
@@ -34,7 +35,9 @@ const MediaPicker = ({
34
35
  }) : null;
35
36
  return /*#__PURE__*/React.createElement(React.Fragment, null, clipboard, /*#__PURE__*/React.createElement(DropzoneWrapper, {
36
37
  mediaState: mediaState,
37
- isActive: !isPopupOpened,
38
+ isActive: !isPopupOpened &&
39
+ // If we're offline don't show the dropzone
40
+ (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) !== 'offline',
38
41
  featureFlags: featureFlags,
39
42
  editorDomElement: editorDomElement,
40
43
  appearance: appearance
@@ -985,7 +985,9 @@ const ResizableMediaSingleToggle = ({
985
985
  }) => {
986
986
  if (fg('platform_editor_react18_phase2__media_single')) {
987
987
  return jsx(ResizableMediaSingleNextFunctional, {
988
- allowBreakoutSnapPoints: allowBreakoutSnapPoints,
988
+ allowBreakoutSnapPoints: allowBreakoutSnapPoints
989
+ // eslint-disable-next-line react/no-children-prop
990
+ ,
989
991
  children: children
990
992
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
991
993
  ,
@@ -1020,7 +1022,9 @@ const ResizableMediaSingleToggle = ({
1020
1022
  });
1021
1023
  }
1022
1024
  return jsx(ResizableMediaSingleNext, {
1023
- allowBreakoutSnapPoints: allowBreakoutSnapPoints,
1025
+ allowBreakoutSnapPoints: allowBreakoutSnapPoints
1026
+ // eslint-disable-next-line react/no-children-prop
1027
+ ,
1024
1028
  children: children
1025
1029
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
1026
1030
  ,
package/dist/esm/index.js CHANGED
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { mediaPlugin } from './mediaPlugin';
@@ -1,15 +1,14 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
8
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
11
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
13
12
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
13
  import React from 'react';
15
14
  import { injectIntl } from 'react-intl-next';
@@ -55,16 +54,14 @@ var hasSelectionChanged = function hasSelectionChanged(oldProps, newProps) {
55
54
 
56
55
  // eslint-disable-next-line @repo/internal/react/no-class-components
57
56
  var MediaGroup = /*#__PURE__*/function (_React$Component) {
58
- _inherits(MediaGroup, _React$Component);
59
- var _super = _createSuper(MediaGroup);
60
57
  function MediaGroup(_props) {
61
58
  var _this;
62
59
  _classCallCheck(this, MediaGroup);
63
- _this = _super.call(this, _props);
64
- _defineProperty(_assertThisInitialized(_this), "state", {
60
+ _this = _callSuper(this, MediaGroup, [_props]);
61
+ _defineProperty(_this, "state", {
65
62
  viewMediaClientConfig: undefined
66
63
  });
67
- _defineProperty(_assertThisInitialized(_this), "updateNodeAttrs", function (props, node, getPos) {
64
+ _defineProperty(_this, "updateNodeAttrs", function (props, node, getPos) {
68
65
  var view = props.view,
69
66
  mediaProvider = props.mediaProvider,
70
67
  contextIdentifierProvider = props.contextIdentifierProvider;
@@ -77,7 +74,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
77
74
  });
78
75
  mediaNodeUpdater.updateNodeAttrs(getPos);
79
76
  });
80
- _defineProperty(_assertThisInitialized(_this), "setMediaItems", function (props) {
77
+ _defineProperty(_this, "setMediaItems", function (props) {
81
78
  var _this$mediaPluginStat;
82
79
  var updatedAttrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
83
80
  var node = props.node;
@@ -103,7 +100,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
103
100
  });
104
101
  (_this$mediaPluginStat = _this.mediaPluginState) === null || _this$mediaPluginStat === void 0 || _this$mediaPluginStat.handleMediaGroupUpdate(oldMediaNodes, _this.mediaNodes);
105
102
  });
106
- _defineProperty(_assertThisInitialized(_this), "getIdentifier", function (item) {
103
+ _defineProperty(_this, "getIdentifier", function (item) {
107
104
  if (item.attrs.type === 'external') {
108
105
  return {
109
106
  mediaItemType: 'external-image',
@@ -116,7 +113,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
116
113
  collectionName: item.attrs.collection
117
114
  };
118
115
  });
119
- _defineProperty(_assertThisInitialized(_this), "isNodeSelected", function (nodePos) {
116
+ _defineProperty(_this, "isNodeSelected", function (nodePos) {
120
117
  var selected = isMediaGroupSelectedFromProps(_this.props);
121
118
  if (selected === SelectedState.selectedInRange) {
122
119
  return true;
@@ -126,7 +123,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
126
123
  }
127
124
  return false;
128
125
  });
129
- _defineProperty(_assertThisInitialized(_this), "renderChildNodes", function () {
126
+ _defineProperty(_this, "renderChildNodes", function () {
130
127
  var viewMediaClientConfig = _this.state.viewMediaClientConfig;
131
128
  var _this$props = _this.props,
132
129
  getPos = _this$props.getPos,
@@ -188,7 +185,8 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
188
185
  };
189
186
  return _this;
190
187
  }
191
- _createClass(MediaGroup, [{
188
+ _inherits(MediaGroup, _React$Component);
189
+ return _createClass(MediaGroup, [{
192
190
  key: "componentDidMount",
193
191
  value: function componentDidMount() {
194
192
  var _this2 = this;
@@ -295,7 +293,6 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
295
293
  return this.renderChildNodes();
296
294
  }
297
295
  }]);
298
- return MediaGroup;
299
296
  }(React.Component);
300
297
  _defineProperty(MediaGroup, "displayName", 'MediaGroup');
301
298
  var IntlMediaGroup = injectIntl(MediaGroup);
@@ -314,13 +311,12 @@ function MediaGroupNodeViewInternal(_ref3) {
314
311
  });
315
312
  }
316
313
  var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
317
- _inherits(MediaGroupNodeView, _ReactNodeView);
318
- var _super2 = _createSuper(MediaGroupNodeView);
319
314
  function MediaGroupNodeView() {
320
315
  _classCallCheck(this, MediaGroupNodeView);
321
- return _super2.apply(this, arguments);
316
+ return _callSuper(this, MediaGroupNodeView, arguments);
322
317
  }
323
- _createClass(MediaGroupNodeView, [{
318
+ _inherits(MediaGroupNodeView, _ReactNodeView);
319
+ return _createClass(MediaGroupNodeView, [{
324
320
  key: "render",
325
321
  value: function render(props, forwardRef) {
326
322
  var _this3 = this;
@@ -382,7 +378,6 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
382
378
  });
383
379
  }
384
380
  }]);
385
- return MediaGroupNodeView;
386
381
  }(ReactNodeView);
387
382
  export var ReactMediaGroupNode = function ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory) {
388
383
  var mediaOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
@@ -1,14 +1,15 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _get from "@babel/runtime/helpers/get";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
+ import _get from "@babel/runtime/helpers/get";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
8
8
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
10
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
12
13
  import _regeneratorRuntime from "@babel/runtime/regenerator";
13
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
15
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -241,13 +242,12 @@ var MediaInlineSharedState = function MediaInlineSharedState(_ref3) {
241
242
  });
242
243
  };
243
244
  export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
244
- _inherits(MediaInlineNodeView, _SelectionBasedNodeVi);
245
- var _super = _createSuper(MediaInlineNodeView);
246
245
  function MediaInlineNodeView() {
247
246
  _classCallCheck(this, MediaInlineNodeView);
248
- return _super.apply(this, arguments);
247
+ return _callSuper(this, MediaInlineNodeView, arguments);
249
248
  }
250
- _createClass(MediaInlineNodeView, [{
249
+ _inherits(MediaInlineNodeView, _SelectionBasedNodeVi);
250
+ return _createClass(MediaInlineNodeView, [{
251
251
  key: "createDomRef",
252
252
  value: function createDomRef() {
253
253
  var domRef = document.createElement('span');
@@ -265,7 +265,7 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
265
265
  if (this.node.attrs !== nextNode.attrs) {
266
266
  return true;
267
267
  }
268
- return _get(_getPrototypeOf(MediaInlineNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode);
268
+ return _superPropGet(MediaInlineNodeView, "viewShouldUpdate", this, 3)([nextNode]);
269
269
  }
270
270
  }, {
271
271
  key: "render",
@@ -294,7 +294,6 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
294
294
  });
295
295
  }
296
296
  }]);
297
- return MediaInlineNodeView;
298
297
  }(SelectionBasedNodeView);
299
298
  export var ReactMediaInlineNode = function ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api, dispatchAnalyticsEvent) {
300
299
  return function (node, view, getPos) {
@@ -629,7 +629,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
629
629
  }());
630
630
  this.props = props;
631
631
  }
632
- _createClass(MediaNodeUpdater, [{
632
+ return _createClass(MediaNodeUpdater, [{
633
633
  key: "setProps",
634
634
  value: function setProps(newComponentProps) {
635
635
  this.props = _objectSpread(_objectSpread({}, this.props), newComponentProps);
@@ -766,7 +766,6 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
766
766
  return handleExternalMedia;
767
767
  }()
768
768
  }]);
769
- return MediaNodeUpdater;
770
769
  }();
771
770
  var hasPrivateAttrsChanged = function hasPrivateAttrsChanged(currentAttrs, newAttrs) {
772
771
  return currentAttrs.__fileName !== newAttrs.__fileName || currentAttrs.__fileMimeType !== newAttrs.__fileMimeType || currentAttrs.__fileSize !== newAttrs.__fileSize || currentAttrs.__contextId !== newAttrs.__contextId;
@@ -1,17 +1,17 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _get from "@babel/runtime/helpers/get";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _get from "@babel/runtime/helpers/get";
7
+ import _inherits from "@babel/runtime/helpers/inherits";
9
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
9
  var _excluded = ["width", "height"];
11
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
12
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
14
13
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
15
15
  import React from 'react';
16
16
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
17
17
  import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
@@ -36,17 +36,15 @@ function isMediaDecorationSpec(decoration) {
36
36
  return decoration.spec.type !== undefined && decoration.spec.selected !== undefined;
37
37
  }
38
38
  var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
39
- _inherits(MediaNodeView, _SelectionBasedNodeVi);
40
- var _super = _createSuper(MediaNodeView);
41
39
  function MediaNodeView() {
42
40
  var _this;
43
41
  _classCallCheck(this, MediaNodeView);
44
42
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45
43
  args[_key] = arguments[_key];
46
44
  }
47
- _this = _super.call.apply(_super, [this].concat(args));
48
- _defineProperty(_assertThisInitialized(_this), "isSelected", false);
49
- _defineProperty(_assertThisInitialized(_this), "onExternalImageLoaded", function (dimensions) {
45
+ _this = _callSuper(this, MediaNodeView, [].concat(args));
46
+ _defineProperty(_this, "isSelected", false);
47
+ _defineProperty(_this, "onExternalImageLoaded", function (dimensions) {
50
48
  var getPos = _this.getPos;
51
49
  var _this$getAttrs = _this.getAttrs(),
52
50
  width = _this$getAttrs.width,
@@ -62,7 +60,7 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
62
60
  })(_this.view.state, _this.view.dispatch);
63
61
  }
64
62
  });
65
- _defineProperty(_assertThisInitialized(_this), "renderMediaNodeWithState", function (contextIdentifierProvider) {
63
+ _defineProperty(_this, "renderMediaNodeWithState", function (contextIdentifierProvider) {
66
64
  return function (_ref2) {
67
65
  var editorWidth = _ref2.width,
68
66
  mediaProvider = _ref2.mediaProvider;
@@ -108,7 +106,7 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
108
106
  });
109
107
  };
110
108
  });
111
- _defineProperty(_assertThisInitialized(_this), "renderMediaNodeWithProviders", function (_ref3) {
109
+ _defineProperty(_this, "renderMediaNodeWithProviders", function (_ref3) {
112
110
  var contextIdentifierProvider = _ref3.contextIdentifierProvider;
113
111
  var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
114
112
  return /*#__PURE__*/React.createElement(MediaNodeWithProviders, {
@@ -118,7 +116,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
118
116
  });
119
117
  return _this;
120
118
  }
121
- _createClass(MediaNodeView, [{
119
+ _inherits(MediaNodeView, _SelectionBasedNodeVi);
120
+ return _createClass(MediaNodeView, [{
122
121
  key: "createDomRef",
123
122
  value: function createDomRef() {
124
123
  var domRef = document.createElement('div');
@@ -142,7 +141,7 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
142
141
  if (this.node.attrs !== nextNode.attrs) {
143
142
  return true;
144
143
  }
145
- return _get(_getPrototypeOf(MediaNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode, decorations);
144
+ return _superPropGet(MediaNodeView, "viewShouldUpdate", this, 3)([nextNode, decorations]);
146
145
  }
147
146
  }, {
148
147
  key: "stopEvent",
@@ -179,7 +178,6 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
179
178
  });
180
179
  }
181
180
  }]);
182
- return MediaNodeView;
183
181
  }(SelectionBasedNodeView);
184
182
  export var ReactMediaNode = function ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory) {
185
183
  var mediaOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
@@ -1,13 +1,12 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
8
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
9
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
11
  import React, { Component } from 'react';
13
12
  import { bind } from 'bind-event-listener';
@@ -24,16 +23,14 @@ export var MEDIA_HEIGHT = 125;
24
23
  export var FILE_WIDTH = 156;
25
24
  // eslint-disable-next-line @repo/internal/react/no-class-components
26
25
  export var MediaNode = /*#__PURE__*/function (_Component) {
27
- _inherits(MediaNode, _Component);
28
- var _super = _createSuper(MediaNode);
29
26
  function MediaNode(_props) {
30
27
  var _this;
31
28
  _classCallCheck(this, MediaNode);
32
- _this = _super.call(this, _props);
33
- _defineProperty(_assertThisInitialized(_this), "state", {});
34
- _defineProperty(_assertThisInitialized(_this), "videoControlsWrapperRef", /*#__PURE__*/React.createRef());
35
- _defineProperty(_assertThisInitialized(_this), "unbindKeyDown", null);
36
- _defineProperty(_assertThisInitialized(_this), "setViewMediaClientConfig", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
29
+ _this = _callSuper(this, MediaNode, [_props]);
30
+ _defineProperty(_this, "state", {});
31
+ _defineProperty(_this, "videoControlsWrapperRef", /*#__PURE__*/React.createRef());
32
+ _defineProperty(_this, "unbindKeyDown", null);
33
+ _defineProperty(_this, "setViewMediaClientConfig", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
37
34
  var mediaProvider, viewMediaClientConfig;
38
35
  return _regeneratorRuntime.wrap(function _callee$(_context) {
39
36
  while (1) switch (_context.prev = _context.next) {
@@ -54,11 +51,11 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
54
51
  }
55
52
  }, _callee);
56
53
  })));
57
- _defineProperty(_assertThisInitialized(_this), "selectMediaSingleFromCard", function (_ref2) {
54
+ _defineProperty(_this, "selectMediaSingleFromCard", function (_ref2) {
58
55
  var event = _ref2.event;
59
56
  _this.selectMediaSingle(event);
60
57
  });
61
- _defineProperty(_assertThisInitialized(_this), "selectMediaSingle", function (event) {
58
+ _defineProperty(_this, "selectMediaSingle", function (event) {
62
59
  var propPos = _this.props.getPos();
63
60
  if (typeof propPos !== 'number') {
64
61
  return;
@@ -80,13 +77,13 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
80
77
  setNodeSelection(_this.props.view, propPos - 1);
81
78
  }
82
79
  });
83
- _defineProperty(_assertThisInitialized(_this), "onFullscreenChange", function (fullscreen) {
80
+ _defineProperty(_this, "onFullscreenChange", function (fullscreen) {
84
81
  var _this$mediaPluginStat;
85
82
  (_this$mediaPluginStat = _this.mediaPluginState) === null || _this$mediaPluginStat === void 0 || _this$mediaPluginStat.updateAndDispatch({
86
83
  isFullscreen: fullscreen
87
84
  });
88
85
  });
89
- _defineProperty(_assertThisInitialized(_this), "handleNewNode", function (props) {
86
+ _defineProperty(_this, "handleNewNode", function (props) {
90
87
  var _this$mediaPluginStat2;
91
88
  var node = props.node;
92
89
  (_this$mediaPluginStat2 = _this.mediaPluginState) === null || _this$mediaPluginStat2 === void 0 || _this$mediaPluginStat2.handleMediaNodeMount(node, function () {
@@ -97,7 +94,8 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
97
94
  _this.mediaPluginState = mediaStateKey.getState(view.state);
98
95
  return _this;
99
96
  }
100
- _createClass(MediaNode, [{
97
+ _inherits(MediaNode, _Component);
98
+ return _createClass(MediaNode, [{
101
99
  key: "shouldComponentUpdate",
102
100
  value: function shouldComponentUpdate(nextProps, nextState) {
103
101
  var hasNewViewMediaClientConfig = !this.state.viewMediaClientConfig && nextState.viewMediaClientConfig;
@@ -285,6 +283,5 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
285
283
  })));
286
284
  }
287
285
  }]);
288
- return MediaNode;
289
286
  }(Component);
290
287
  export default withImageLoader(MediaNode);
@@ -3,15 +3,15 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
5
  import _createClass from "@babel/runtime/helpers/createClass";
6
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
7
- import _inherits from "@babel/runtime/helpers/inherits";
8
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
+ import _inherits from "@babel/runtime/helpers/inherits";
10
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
11
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
14
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
15
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
16
16
  /**
17
17
  * @jsxRuntime classic
@@ -55,27 +55,25 @@ var figureWrapperStyles = css({
55
55
  */
56
56
  // eslint-disable-next-line @repo/internal/react/no-class-components
57
57
  var MediaSingleNode = /*#__PURE__*/function (_Component) {
58
- _inherits(MediaSingleNode, _Component);
59
- var _super = _createSuper(MediaSingleNode);
60
58
  function MediaSingleNode() {
61
59
  var _this;
62
60
  _classCallCheck(this, MediaSingleNode);
63
61
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
64
62
  args[_key] = arguments[_key];
65
63
  }
66
- _this = _super.call.apply(_super, [this].concat(args));
67
- _defineProperty(_assertThisInitialized(_this), "mediaNodeUpdater", null);
68
- _defineProperty(_assertThisInitialized(_this), "state", {
64
+ _this = _callSuper(this, MediaSingleNode, [].concat(args));
65
+ _defineProperty(_this, "mediaNodeUpdater", null);
66
+ _defineProperty(_this, "state", {
69
67
  width: undefined,
70
68
  height: undefined,
71
69
  viewMediaClientConfig: undefined,
72
70
  isCopying: false
73
71
  });
74
- _defineProperty(_assertThisInitialized(_this), "mediaSingleWrapperRef", /*#__PURE__*/React.createRef());
72
+ _defineProperty(_this, "mediaSingleWrapperRef", /*#__PURE__*/React.createRef());
75
73
  // platform_editor_typography_ugc clean up
76
74
  // remove HTMLSpanElement type
77
- _defineProperty(_assertThisInitialized(_this), "captionPlaceHolderRef", /*#__PURE__*/React.createRef());
78
- _defineProperty(_assertThisInitialized(_this), "createOrUpdateMediaNodeUpdater", function (props) {
75
+ _defineProperty(_this, "captionPlaceHolderRef", /*#__PURE__*/React.createRef());
76
+ _defineProperty(_this, "createOrUpdateMediaNodeUpdater", function (props) {
79
77
  var node = _this.props.node.firstChild;
80
78
  var updaterProps = _objectSpread(_objectSpread({}, props), {}, {
81
79
  isMediaSingle: true,
@@ -89,7 +87,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
89
87
  (_this$mediaNodeUpdate = _this.mediaNodeUpdater) === null || _this$mediaNodeUpdate === void 0 || _this$mediaNodeUpdate.setProps(updaterProps);
90
88
  }
91
89
  });
92
- _defineProperty(_assertThisInitialized(_this), "setViewMediaClientConfig", /*#__PURE__*/function () {
90
+ _defineProperty(_this, "setViewMediaClientConfig", /*#__PURE__*/function () {
93
91
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(props) {
94
92
  var mediaProvider, viewMediaClientConfig;
95
93
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -115,7 +113,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
115
113
  return _ref.apply(this, arguments);
116
114
  };
117
115
  }());
118
- _defineProperty(_assertThisInitialized(_this), "updateMediaNodeAttributes", /*#__PURE__*/function () {
116
+ _defineProperty(_this, "updateMediaNodeAttributes", /*#__PURE__*/function () {
119
117
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props) {
120
118
  var _this$mediaNodeUpdate2, _this$props$node$firs, _this$mediaNodeUpdate4, _this$mediaNodeUpdate6;
121
119
  var addPendingTask, node, updatedDimensions, currentAttrs, _this$mediaNodeUpdate3, updatingNode, contextId, _this$mediaNodeUpdate5, hasDifferentContextId, copyNode;
@@ -196,7 +194,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
196
194
  return _ref2.apply(this, arguments);
197
195
  };
198
196
  }());
199
- _defineProperty(_assertThisInitialized(_this), "selectMediaSingle", function (_ref3) {
197
+ _defineProperty(_this, "selectMediaSingle", function (_ref3) {
200
198
  var event = _ref3.event;
201
199
  var propPos = _this.props.getPos();
202
200
  if (typeof propPos !== 'number') {
@@ -219,7 +217,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
219
217
  setNodeSelection(_this.props.view, propPos);
220
218
  }
221
219
  });
222
- _defineProperty(_assertThisInitialized(_this), "updateSize", function (width, layout) {
220
+ _defineProperty(_this, "updateSize", function (width, layout) {
223
221
  var _this$props$view = _this.props.view,
224
222
  state = _this$props$view.state,
225
223
  dispatch = _this$props$view.dispatch;
@@ -244,7 +242,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
244
242
  tr.setSelection(NodeSelection.create(tr.doc, pos));
245
243
  return dispatch(tr);
246
244
  });
247
- _defineProperty(_assertThisInitialized(_this), "onMediaSingleClicked", function (event) {
245
+ _defineProperty(_this, "onMediaSingleClicked", function (event) {
248
246
  var _this$captionPlaceHol;
249
247
  // Workaround for iOS 16 Caption selection issue
250
248
  // @see https://product-fabric.atlassian.net/browse/MEX-2012
@@ -256,7 +254,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
256
254
  }
257
255
  (_this$captionPlaceHol = _this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 || _this$captionPlaceHol.click();
258
256
  });
259
- _defineProperty(_assertThisInitialized(_this), "clickPlaceholder", function () {
257
+ _defineProperty(_this, "clickPlaceholder", function () {
260
258
  var _pluginInjectionApi$a;
261
259
  var _this$props = _this.props,
262
260
  view = _this$props.view,
@@ -270,7 +268,8 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
270
268
  });
271
269
  return _this;
272
270
  }
273
- _createClass(MediaSingleNode, [{
271
+ _inherits(MediaSingleNode, _Component);
272
+ return _createClass(MediaSingleNode, [{
274
273
  key: "UNSAFE_componentWillReceiveProps",
275
274
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
276
275
  if (!this.mediaNodeUpdater) {
@@ -534,7 +533,6 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
534
533
  }), MediaChildren));
535
534
  }
536
535
  }]);
537
- return MediaSingleNode;
538
536
  }(Component);
539
537
  _defineProperty(MediaSingleNode, "defaultProps", {
540
538
  mediaOptions: {}
@@ -609,19 +607,17 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
609
607
  });
610
608
  };
611
609
  var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
612
- _inherits(MediaSingleNodeView, _ReactNodeView);
613
- var _super2 = _createSuper(MediaSingleNodeView);
614
610
  function MediaSingleNodeView() {
615
611
  var _this2;
616
612
  _classCallCheck(this, MediaSingleNodeView);
617
613
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
618
614
  args[_key2] = arguments[_key2];
619
615
  }
620
- _this2 = _super2.call.apply(_super2, [this].concat(args));
621
- _defineProperty(_assertThisInitialized(_this2), "lastOffsetLeft", 0);
622
- _defineProperty(_assertThisInitialized(_this2), "forceViewUpdate", false);
623
- _defineProperty(_assertThisInitialized(_this2), "selectionType", null);
624
- _defineProperty(_assertThisInitialized(_this2), "checkAndUpdateSelectionType", function () {
616
+ _this2 = _callSuper(this, MediaSingleNodeView, [].concat(args));
617
+ _defineProperty(_this2, "lastOffsetLeft", 0);
618
+ _defineProperty(_this2, "forceViewUpdate", false);
619
+ _defineProperty(_this2, "selectionType", null);
620
+ _defineProperty(_this2, "checkAndUpdateSelectionType", function () {
625
621
  var getPos = _this2.getPos;
626
622
  var selection = _this2.view.state.selection;
627
623
 
@@ -640,13 +636,14 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
640
636
  _this2.selectionType = isNodeSelected;
641
637
  return isNodeSelected;
642
638
  });
643
- _defineProperty(_assertThisInitialized(_this2), "isNodeSelected", function () {
639
+ _defineProperty(_this2, "isNodeSelected", function () {
644
640
  _this2.checkAndUpdateSelectionType();
645
641
  return _this2.selectionType !== null;
646
642
  });
647
643
  return _this2;
648
644
  }
649
- _createClass(MediaSingleNodeView, [{
645
+ _inherits(MediaSingleNodeView, _ReactNodeView);
646
+ return _createClass(MediaSingleNodeView, [{
650
647
  key: "createDomRef",
651
648
  value: function createDomRef() {
652
649
  var domRef = document.createElement('div');
@@ -693,7 +690,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
693
690
  if (this.node.childCount !== nextNode.childCount) {
694
691
  return true;
695
692
  }
696
- return _get(_getPrototypeOf(MediaSingleNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode);
693
+ return _superPropGet(MediaSingleNodeView, "viewShouldUpdate", this, 3)([nextNode]);
697
694
  }
698
695
  }, {
699
696
  key: "subscribeToViewModeChange",
@@ -750,7 +747,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
750
747
  return _this4.getNodeMediaId(currentNode) === _this4.getNodeMediaId(newNode);
751
748
  };
752
749
  }
753
- return _get(_getPrototypeOf(MediaSingleNodeView.prototype), "update", this).call(this, node, decorations, _innerDecorations, isValidUpdate);
750
+ return _superPropGet(MediaSingleNodeView, "update", this, 3)([node, decorations, _innerDecorations, isValidUpdate]);
754
751
  }
755
752
  }, {
756
753
  key: "render",
@@ -812,7 +809,6 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
812
809
  (_this$unsubscribeToVi = this.unsubscribeToViewModeChange) === null || _this$unsubscribeToVi === void 0 || _this$unsubscribeToVi.call(this);
813
810
  }
814
811
  }]);
815
- return MediaSingleNodeView;
816
812
  }(ReactNodeView);
817
813
  export var ReactMediaSingleNode = function ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent) {
818
814
  var mediaOptions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};