@atlaskit/editor-plugin-media 1.24.3 → 1.25.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 (95) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/hooks/useMediaProvider.js +16 -0
  3. package/dist/cjs/nodeviews/mediaGroup.js +32 -3
  4. package/dist/cjs/nodeviews/mediaInline.js +30 -4
  5. package/dist/cjs/nodeviews/mediaNodeView/index.js +13 -6
  6. package/dist/cjs/nodeviews/mediaSingle.js +12 -3
  7. package/dist/cjs/nodeviews/styles.js +4 -1
  8. package/dist/cjs/plugin.js +45 -36
  9. package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
  10. package/dist/cjs/pm-plugins/main.js +9 -2
  11. package/dist/cjs/toolbar/layout-group.js +4 -1
  12. package/dist/cjs/toolbar/linking-toolbar-appearance.js +4 -1
  13. package/dist/cjs/ui/CaptionPlaceholder/index.js +4 -1
  14. package/dist/cjs/ui/ImageBorder/index.js +4 -1
  15. package/dist/cjs/ui/Media/DropPlaceholder.js +4 -1
  16. package/dist/cjs/ui/MediaLinkingToolbar.js +4 -1
  17. package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +140 -34
  18. package/dist/cjs/ui/MediaViewer/MediaViewerContainer.js +4 -1
  19. package/dist/cjs/ui/PixelEntry/index.js +4 -1
  20. package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +4 -1
  21. package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -1
  22. package/dist/cjs/ui/ResizableMediaSingle/index.js +4 -1
  23. package/dist/es2019/hooks/useMediaProvider.js +11 -0
  24. package/dist/es2019/nodeviews/mediaGroup.js +32 -3
  25. package/dist/es2019/nodeviews/mediaInline.js +29 -5
  26. package/dist/es2019/nodeviews/mediaNodeView/index.js +13 -6
  27. package/dist/es2019/nodeviews/mediaSingle.js +11 -4
  28. package/dist/es2019/nodeviews/styles.js +4 -1
  29. package/dist/es2019/plugin.js +8 -0
  30. package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
  31. package/dist/es2019/pm-plugins/main.js +9 -2
  32. package/dist/es2019/toolbar/layout-group.js +4 -1
  33. package/dist/es2019/toolbar/linking-toolbar-appearance.js +4 -1
  34. package/dist/es2019/ui/CaptionPlaceholder/index.js +4 -1
  35. package/dist/es2019/ui/ImageBorder/index.js +4 -1
  36. package/dist/es2019/ui/Media/DropPlaceholder.js +4 -1
  37. package/dist/es2019/ui/MediaLinkingToolbar.js +4 -1
  38. package/dist/es2019/ui/MediaPicker/PickerFacadeProvider.js +64 -3
  39. package/dist/es2019/ui/MediaViewer/MediaViewerContainer.js +4 -1
  40. package/dist/es2019/ui/PixelEntry/index.js +4 -1
  41. package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +4 -1
  42. package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -1
  43. package/dist/es2019/ui/ResizableMediaSingle/index.js +4 -1
  44. package/dist/esm/hooks/useMediaProvider.js +10 -0
  45. package/dist/esm/nodeviews/mediaGroup.js +32 -3
  46. package/dist/esm/nodeviews/mediaInline.js +31 -5
  47. package/dist/esm/nodeviews/mediaNodeView/index.js +13 -6
  48. package/dist/esm/nodeviews/mediaSingle.js +13 -4
  49. package/dist/esm/nodeviews/styles.js +4 -1
  50. package/dist/esm/plugin.js +45 -36
  51. package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
  52. package/dist/esm/pm-plugins/main.js +9 -2
  53. package/dist/esm/toolbar/layout-group.js +4 -1
  54. package/dist/esm/toolbar/linking-toolbar-appearance.js +4 -1
  55. package/dist/esm/ui/CaptionPlaceholder/index.js +4 -1
  56. package/dist/esm/ui/ImageBorder/index.js +4 -1
  57. package/dist/esm/ui/Media/DropPlaceholder.js +4 -1
  58. package/dist/esm/ui/MediaLinkingToolbar.js +4 -1
  59. package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +136 -34
  60. package/dist/esm/ui/MediaViewer/MediaViewerContainer.js +4 -1
  61. package/dist/esm/ui/PixelEntry/index.js +4 -1
  62. package/dist/esm/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +4 -1
  63. package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -1
  64. package/dist/esm/ui/ResizableMediaSingle/index.js +4 -1
  65. package/dist/types/hooks/useMediaProvider.d.ts +3 -0
  66. package/dist/types/next-plugin-type.d.ts +8 -0
  67. package/dist/types/nodeviews/mediaNodeView/index.d.ts +5 -3
  68. package/dist/types/nodeviews/mediaSingle.d.ts +4 -1
  69. package/dist/types/nodeviews/styles.d.ts +4 -1
  70. package/dist/types/toolbar/layout-group.d.ts +4 -1
  71. package/dist/types/toolbar/linking-toolbar-appearance.d.ts +4 -1
  72. package/dist/types/ui/CaptionPlaceholder/index.d.ts +4 -1
  73. package/dist/types/ui/Media/DropPlaceholder.d.ts +4 -1
  74. package/dist/types/ui/MediaLinkingToolbar.d.ts +4 -1
  75. package/dist/types/ui/MediaPicker/PickerFacadeProvider.d.ts +1 -13
  76. package/dist/types/ui/MediaViewer/MediaViewerContainer.d.ts +4 -1
  77. package/dist/types/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.d.ts +4 -1
  78. package/dist/types/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +4 -1
  79. package/dist/types/ui/ResizableMediaSingle/index.d.ts +4 -1
  80. package/dist/types-ts4.5/hooks/useMediaProvider.d.ts +3 -0
  81. package/dist/types-ts4.5/next-plugin-type.d.ts +8 -0
  82. package/dist/types-ts4.5/nodeviews/mediaNodeView/index.d.ts +5 -3
  83. package/dist/types-ts4.5/nodeviews/mediaSingle.d.ts +4 -1
  84. package/dist/types-ts4.5/nodeviews/styles.d.ts +4 -1
  85. package/dist/types-ts4.5/toolbar/layout-group.d.ts +4 -1
  86. package/dist/types-ts4.5/toolbar/linking-toolbar-appearance.d.ts +4 -1
  87. package/dist/types-ts4.5/ui/CaptionPlaceholder/index.d.ts +4 -1
  88. package/dist/types-ts4.5/ui/Media/DropPlaceholder.d.ts +4 -1
  89. package/dist/types-ts4.5/ui/MediaLinkingToolbar.d.ts +4 -1
  90. package/dist/types-ts4.5/ui/MediaPicker/PickerFacadeProvider.d.ts +1 -13
  91. package/dist/types-ts4.5/ui/MediaViewer/MediaViewerContainer.d.ts +4 -1
  92. package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.d.ts +4 -1
  93. package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +4 -1
  94. package/dist/types-ts4.5/ui/ResizableMediaSingle/index.d.ts +4 -1
  95. package/package.json +5 -5
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { jsx } from '@emotion/react';
4
7
  import { ButtonGroup } from '@atlaskit/button';
@@ -1,5 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import React, { Fragment, useEffect, useState } from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,6 +1,9 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject;
3
- /** @jsx jsx */
3
+ /**
4
+ * @jsxRuntime classic
5
+ * @jsx jsx
6
+ */
4
7
  import React from 'react';
5
8
 
6
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,5 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import { useCallback, useEffect, useRef, useState } from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { css, jsx } from '@emotion/react';
4
7
  import { injectIntl } from 'react-intl-next';
@@ -7,7 +7,10 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
- /** @jsx jsx */
10
+ /**
11
+ * @jsxRuntime classic
12
+ * @jsx jsx
13
+ */
11
14
  import React, { Fragment } from 'react';
12
15
 
13
16
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,4 +1,3 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/createClass";
4
3
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -6,10 +5,12 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
8
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
9
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
- import React from 'react';
12
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
13
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
13
14
  import { flushSync } from 'react-dom';
14
15
  import { ErrorReporter } from '@atlaskit/editor-common/utils';
15
16
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -21,55 +22,154 @@ var dummyMediaPickerObject = {
21
22
  destroy: function destroy() {},
22
23
  setUploadParams: function setUploadParams() {}
23
24
  };
25
+ function PickerFacadeProviderNew(_ref) {
26
+ var mediaState = _ref.mediaState,
27
+ analyticsName = _ref.analyticsName,
28
+ children = _ref.children;
29
+ var _useState = useState({
30
+ pickerFacadeInstance: undefined,
31
+ config: undefined,
32
+ mediaClientConfig: undefined
33
+ }),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ state = _useState2[0],
36
+ setState = _useState2[1];
37
+ var mediaProvider = useMemo(function () {
38
+ return mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider;
39
+ }, [mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider]);
40
+ var handleMediaProvider = useCallback( /*#__PURE__*/function () {
41
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, provider) {
42
+ var mediaProvider, resolvedMediaClientConfig, pickerFacadeConfig, pickerFacadeInstance, config;
43
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
44
+ while (1) switch (_context.prev = _context.next) {
45
+ case 0:
46
+ _context.next = 2;
47
+ return provider;
48
+ case 2:
49
+ mediaProvider = _context.sent;
50
+ if (!(!mediaProvider || !mediaProvider.uploadParams)) {
51
+ _context.next = 5;
52
+ break;
53
+ }
54
+ return _context.abrupt("return");
55
+ case 5:
56
+ _context.next = 7;
57
+ return mediaProvider.uploadMediaClientConfig;
58
+ case 7:
59
+ _context.t0 = _context.sent;
60
+ if (_context.t0) {
61
+ _context.next = 12;
62
+ break;
63
+ }
64
+ _context.next = 11;
65
+ return mediaProvider.viewMediaClientConfig;
66
+ case 11:
67
+ _context.t0 = _context.sent;
68
+ case 12:
69
+ resolvedMediaClientConfig = _context.t0;
70
+ if (resolvedMediaClientConfig) {
71
+ _context.next = 15;
72
+ break;
73
+ }
74
+ return _context.abrupt("return");
75
+ case 15:
76
+ pickerFacadeConfig = {
77
+ mediaClientConfig: resolvedMediaClientConfig,
78
+ errorReporter: mediaState.options.errorReporter || new ErrorReporter(),
79
+ featureFlags: mediaState.mediaOptions && mediaState.mediaOptions.featureFlags
80
+ };
81
+ _context.next = 18;
82
+ return new PickerFacade('customMediaPicker', pickerFacadeConfig, dummyMediaPickerObject, analyticsName).init();
83
+ case 18:
84
+ pickerFacadeInstance = _context.sent;
85
+ pickerFacadeInstance.onNewMedia(mediaState.insertFile);
86
+ pickerFacadeInstance.setUploadParams(mediaProvider.uploadParams);
87
+ config = {
88
+ uploadParams: mediaProvider.uploadParams
89
+ };
90
+ flushSync(function () {
91
+ setState({
92
+ pickerFacadeInstance: pickerFacadeInstance,
93
+ config: config,
94
+ mediaClientConfig: resolvedMediaClientConfig
95
+ });
96
+ });
97
+ case 23:
98
+ case "end":
99
+ return _context.stop();
100
+ }
101
+ }, _callee);
102
+ }));
103
+ return function (_x, _x2) {
104
+ return _ref2.apply(this, arguments);
105
+ };
106
+ }(), [analyticsName, mediaState.insertFile, mediaState.mediaOptions, mediaState.options.errorReporter]);
107
+ useEffect(function () {
108
+ if (mediaProvider) {
109
+ handleMediaProvider('mediaProvider', Promise.resolve(mediaProvider));
110
+ }
111
+ }, [mediaProvider, handleMediaProvider]);
112
+ var mediaClientConfig = state.mediaClientConfig,
113
+ config = state.config,
114
+ pickerFacadeInstance = state.pickerFacadeInstance;
115
+ if (!mediaClientConfig || !config || !pickerFacadeInstance) {
116
+ return null;
117
+ }
118
+ return children({
119
+ mediaClientConfig: mediaClientConfig,
120
+ config: config,
121
+ pickerFacadeInstance: pickerFacadeInstance
122
+ });
123
+ }
24
124
 
25
- //eslint-disable-next-line @repo/internal/react/no-class-components
26
- var PickerFacadeProvider = /*#__PURE__*/function (_React$Component) {
27
- _inherits(PickerFacadeProvider, _React$Component);
28
- var _super = _createSuper(PickerFacadeProvider);
29
- function PickerFacadeProvider() {
125
+ // eslint-disable-next-line @repo/internal/react/no-class-components
126
+ var PickerFacadeProviderOld = /*#__PURE__*/function (_React$Component) {
127
+ _inherits(PickerFacadeProviderOld, _React$Component);
128
+ var _super = _createSuper(PickerFacadeProviderOld);
129
+ function PickerFacadeProviderOld() {
30
130
  var _this;
31
- _classCallCheck(this, PickerFacadeProvider);
131
+ _classCallCheck(this, PickerFacadeProviderOld);
32
132
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
133
  args[_key] = arguments[_key];
34
134
  }
35
135
  _this = _super.call.apply(_super, [this].concat(args));
36
136
  _defineProperty(_assertThisInitialized(_this), "state", {});
37
137
  _defineProperty(_assertThisInitialized(_this), "handleMediaProvider", /*#__PURE__*/function () {
38
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, provider) {
138
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_name, provider) {
39
139
  var _this$props, mediaState, analyticsName, mediaProvider, resolvedMediaClientConfig, pickerFacadeConfig, pickerFacadeInstance, config;
40
- return _regeneratorRuntime.wrap(function _callee$(_context) {
41
- while (1) switch (_context.prev = _context.next) {
140
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
141
+ while (1) switch (_context2.prev = _context2.next) {
42
142
  case 0:
43
143
  _this$props = _this.props, mediaState = _this$props.mediaState, analyticsName = _this$props.analyticsName;
44
- _context.next = 3;
144
+ _context2.next = 3;
45
145
  return provider;
46
146
  case 3:
47
- mediaProvider = _context.sent;
147
+ mediaProvider = _context2.sent;
48
148
  if (!(!mediaProvider || !mediaProvider.uploadParams)) {
49
- _context.next = 6;
149
+ _context2.next = 6;
50
150
  break;
51
151
  }
52
- return _context.abrupt("return");
152
+ return _context2.abrupt("return");
53
153
  case 6:
54
- _context.next = 8;
154
+ _context2.next = 8;
55
155
  return mediaProvider.uploadMediaClientConfig;
56
156
  case 8:
57
- _context.t0 = _context.sent;
58
- if (_context.t0) {
59
- _context.next = 13;
157
+ _context2.t0 = _context2.sent;
158
+ if (_context2.t0) {
159
+ _context2.next = 13;
60
160
  break;
61
161
  }
62
- _context.next = 12;
162
+ _context2.next = 12;
63
163
  return mediaProvider.viewMediaClientConfig;
64
164
  case 12:
65
- _context.t0 = _context.sent;
165
+ _context2.t0 = _context2.sent;
66
166
  case 13:
67
- resolvedMediaClientConfig = _context.t0;
167
+ resolvedMediaClientConfig = _context2.t0;
68
168
  if (resolvedMediaClientConfig) {
69
- _context.next = 16;
169
+ _context2.next = 16;
70
170
  break;
71
171
  }
72
- return _context.abrupt("return");
172
+ return _context2.abrupt("return");
73
173
  case 16:
74
174
  pickerFacadeConfig = {
75
175
  mediaClientConfig: resolvedMediaClientConfig,
@@ -84,10 +184,10 @@ var PickerFacadeProvider = /*#__PURE__*/function (_React$Component) {
84
184
  * But we don't want this to do anything since it's all part of the new React component (`Clipboard` component in this case).
85
185
  * Eventually PickerFacade will be removed and replaced with a new abstraction explained here https://product-fabric.atlassian.net/browse/MS-1937
86
186
  */
87
- _context.next = 19;
187
+ _context2.next = 19;
88
188
  return new PickerFacade('customMediaPicker', pickerFacadeConfig, dummyMediaPickerObject, analyticsName).init();
89
189
  case 19:
90
- pickerFacadeInstance = _context.sent;
190
+ pickerFacadeInstance = _context2.sent;
91
191
  /**
92
192
  * Based on the `initPickers` method in `MediaPluginState` we need these 2 `onNewMedia` subscriptions.
93
193
  * First one in order to trigger the entire process of uploading a file for when `onPreviewUpdate` is called
@@ -107,17 +207,17 @@ var PickerFacadeProvider = /*#__PURE__*/function (_React$Component) {
107
207
  });
108
208
  case 24:
109
209
  case "end":
110
- return _context.stop();
210
+ return _context2.stop();
111
211
  }
112
- }, _callee);
212
+ }, _callee2);
113
213
  }));
114
- return function (_x, _x2) {
115
- return _ref.apply(this, arguments);
214
+ return function (_x3, _x4) {
215
+ return _ref3.apply(this, arguments);
116
216
  };
117
217
  }());
118
218
  return _this;
119
219
  }
120
- _createClass(PickerFacadeProvider, [{
220
+ _createClass(PickerFacadeProviderOld, [{
121
221
  key: "componentDidMount",
122
222
  value: function componentDidMount() {
123
223
  var mediaProvider = this.props.mediaState.mediaProvider;
@@ -149,6 +249,8 @@ var PickerFacadeProvider = /*#__PURE__*/function (_React$Component) {
149
249
  });
150
250
  }
151
251
  }]);
152
- return PickerFacadeProvider;
252
+ return PickerFacadeProviderOld;
153
253
  }(React.Component);
154
- export { PickerFacadeProvider as default };
254
+ export default function PickerFacadeProvider(props) {
255
+ return fg('platform_editor_media_provider_from_plugin_config') ? /*#__PURE__*/React.createElement(PickerFacadeProviderNew, props) : /*#__PURE__*/React.createElement(PickerFacadeProviderOld, props);
256
+ }
@@ -1,5 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import React, { Fragment, useEffect, useState } from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,6 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- /** @jsx jsx */
3
+ /**
4
+ * @jsxRuntime classic
5
+ * @jsx jsx
6
+ */
4
7
  import { useCallback, useEffect, useMemo, useState } from 'react';
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
9
  import { jsx } from '@emotion/react';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { jsx } from '@emotion/react';
4
7
  import { resizableMediaMigrationNotificationStyle } from './styles';
@@ -10,7 +10,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
- /** @jsx jsx */
13
+ /**
14
+ * @jsxRuntime classic
15
+ * @jsx jsx
16
+ */
14
17
  import React from 'react';
15
18
 
16
19
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -10,7 +10,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
- /** @jsx jsx */
13
+ /**
14
+ * @jsxRuntime classic
15
+ * @jsx jsx
16
+ */
14
17
  import React from 'react';
15
18
 
16
19
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -0,0 +1,3 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { MediaNextEditorPluginType } from '../next-plugin-type';
3
+ export declare const useMediaProvider: (pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => import("@atlaskit/editor-common/provider-factory").MediaProvider | undefined;
@@ -1,3 +1,4 @@
1
+ import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
1
2
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
4
  import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
@@ -33,5 +34,12 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
33
34
  sharedState: MediaPluginState | null;
34
35
  actions: {
35
36
  insertMediaAsMediaSingle: InsertMediaAsMediaSingle;
37
+ /**
38
+ * Used to update the initial provider passed to the media plugin
39
+ *
40
+ * @param provider Promise<MediaProvider>
41
+ * @returns {boolean} if setting the provider was successful or not
42
+ */
43
+ setProvider: (provider: Promise<MediaProvider>) => boolean;
36
44
  };
37
45
  }>;
@@ -11,6 +11,10 @@ import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
11
11
  import type { MediaNextEditorPluginType } from '../../next-plugin-type';
12
12
  import type { getPosHandler, MediaOptions } from '../../types';
13
13
  import type { MediaNodeViewProps } from '../types';
14
+ interface MediaNodeWithPluginStateComponentProps {
15
+ width?: WidthPluginState;
16
+ newMediaProvider?: Promise<MediaProvider>;
17
+ }
14
18
  declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
15
19
  private isSelected;
16
20
  createDomRef(): HTMLElement;
@@ -22,9 +26,7 @@ declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
22
26
  width: number;
23
27
  height: number;
24
28
  }) => void;
25
- renderMediaNodeWithState: (mediaProvider?: Promise<MediaProvider>, contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth }: {
26
- width?: WidthPluginState | undefined;
27
- }) => JSX.Element;
29
+ renderMediaNodeWithState: (mediaProvider?: Promise<MediaProvider>, contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, newMediaProvider }: MediaNodeWithPluginStateComponentProps) => JSX.Element;
28
30
  renderMediaNodeWithProviders: ({ mediaProvider, contextIdentifierProvider }: Providers) => JSX.Element;
29
31
  render(): JSX.Element;
30
32
  }
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import type { MouseEvent } from 'react';
3
6
  import React, { Component } from 'react';
4
7
  import { jsx } from '@emotion/react';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { NumericalCardDimensions } from '@atlaskit/media-card';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { jsx } from '@emotion/react';
3
6
  import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
4
7
  type Props = {
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { IntlShape } from 'react-intl-next';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  declare const _default: React.ForwardRefExoticComponent<{
4
7
  onClick: () => void;
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { jsx } from '@emotion/react';
3
6
  export type PlaceholderType = 'single' | 'group';
4
7
  export interface Props {
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { IntlShape, WrappedComponentProps } from 'react-intl-next';
@@ -13,16 +13,4 @@ export type Props = {
13
13
  analyticsName: string;
14
14
  children: (props: ChildrenProps) => React.ReactElement | null;
15
15
  };
16
- type State = {
17
- config?: ClipboardConfig | BrowserConfig | DropzoneConfig;
18
- mediaClientConfig?: MediaClientConfig;
19
- pickerFacadeInstance?: PickerFacade;
20
- };
21
- export default class PickerFacadeProvider extends React.Component<Props, State> {
22
- state: State;
23
- private handleMediaProvider;
24
- componentDidMount(): void;
25
- componentWillUnmount(): void;
26
- render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
27
- }
28
- export {};
16
+ export default function PickerFacadeProvider(props: Props): JSX.Element;
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
@@ -1,3 +1,6 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { jsx } from '@emotion/react';
3
6
  export declare const ResizableMediaMigrationNotification: () => jsx.JSX.Element;
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
@@ -0,0 +1,3 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { MediaNextEditorPluginType } from '../next-plugin-type';
3
+ export declare const useMediaProvider: (pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => import("@atlaskit/editor-common/provider-factory").MediaProvider | undefined;
@@ -1,3 +1,4 @@
1
+ import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
1
2
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
4
  import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
@@ -33,5 +34,12 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
33
34
  sharedState: MediaPluginState | null;
34
35
  actions: {
35
36
  insertMediaAsMediaSingle: InsertMediaAsMediaSingle;
37
+ /**
38
+ * Used to update the initial provider passed to the media plugin
39
+ *
40
+ * @param provider Promise<MediaProvider>
41
+ * @returns {boolean} if setting the provider was successful or not
42
+ */
43
+ setProvider: (provider: Promise<MediaProvider>) => boolean;
36
44
  };
37
45
  }>;
@@ -11,6 +11,10 @@ import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
11
11
  import type { MediaNextEditorPluginType } from '../../next-plugin-type';
12
12
  import type { getPosHandler, MediaOptions } from '../../types';
13
13
  import type { MediaNodeViewProps } from '../types';
14
+ interface MediaNodeWithPluginStateComponentProps {
15
+ width?: WidthPluginState;
16
+ newMediaProvider?: Promise<MediaProvider>;
17
+ }
14
18
  declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
15
19
  private isSelected;
16
20
  createDomRef(): HTMLElement;
@@ -22,9 +26,7 @@ declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
22
26
  width: number;
23
27
  height: number;
24
28
  }) => void;
25
- renderMediaNodeWithState: (mediaProvider?: Promise<MediaProvider>, contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth }: {
26
- width?: WidthPluginState | undefined;
27
- }) => JSX.Element;
29
+ renderMediaNodeWithState: (mediaProvider?: Promise<MediaProvider>, contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, newMediaProvider }: MediaNodeWithPluginStateComponentProps) => JSX.Element;
28
30
  renderMediaNodeWithProviders: ({ mediaProvider, contextIdentifierProvider }: Providers) => JSX.Element;
29
31
  render(): JSX.Element;
30
32
  }
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import type { MouseEvent } from 'react';
3
6
  import React, { Component } from 'react';
4
7
  import { jsx } from '@emotion/react';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { NumericalCardDimensions } from '@atlaskit/media-card';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { jsx } from '@emotion/react';
3
6
  import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
4
7
  type Props = {
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  import { jsx } from '@emotion/react';
4
7
  import type { IntlShape } from 'react-intl-next';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React from 'react';
3
6
  declare const _default: React.ForwardRefExoticComponent<{
4
7
  onClick: () => void;