@atlaskit/editor-plugin-media-insert 23.3.2 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/ui/MediaFromURL.js +18 -18
- package/dist/esm/ui/MediaFromURL.js +17 -17
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -30,7 +30,7 @@ var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
|
30
30
|
var _MediaCard = require("./MediaCard");
|
|
31
31
|
var _useAnalyticsEvents2 = require("./useAnalyticsEvents");
|
|
32
32
|
var _excluded = ["value", "onChange"];
|
|
33
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
33
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
34
34
|
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; }
|
|
35
35
|
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) { (0, _defineProperty2.default)(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; } // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
36
36
|
var PreviewBoxStyles = (0, _primitives.xcss)({
|
|
@@ -132,8 +132,8 @@ function MediaFromURL(_ref) {
|
|
|
132
132
|
onUploadFailureAnalytics = _useAnalyticsEvents.onUploadFailureAnalytics;
|
|
133
133
|
var uploadExternalMedia = _react.default.useCallback( /*#__PURE__*/function () {
|
|
134
134
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url) {
|
|
135
|
-
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message;
|
|
136
|
-
return _regenerator.default.wrap(function
|
|
135
|
+
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message, _t;
|
|
136
|
+
return _regenerator.default.wrap(function (_context) {
|
|
137
137
|
while (1) switch (_context.prev = _context.next) {
|
|
138
138
|
case 0:
|
|
139
139
|
onUploadButtonClickedAnalytics();
|
|
@@ -142,18 +142,18 @@ function MediaFromURL(_ref) {
|
|
|
142
142
|
});
|
|
143
143
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig, uploadParams = mediaProvider.uploadParams;
|
|
144
144
|
if (uploadMediaClientConfig) {
|
|
145
|
-
_context.next =
|
|
145
|
+
_context.next = 1;
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
148
|
return _context.abrupt("return");
|
|
149
|
-
case
|
|
149
|
+
case 1:
|
|
150
150
|
mediaClient = (0, _mediaClientReact.getMediaClient)(uploadMediaClientConfig);
|
|
151
151
|
collection = uploadParams === null || uploadParams === void 0 ? void 0 : uploadParams.collection;
|
|
152
152
|
onUploadCommencedAnalytics('url');
|
|
153
|
-
_context.prev =
|
|
154
|
-
_context.next =
|
|
153
|
+
_context.prev = 2;
|
|
154
|
+
_context.next = 3;
|
|
155
155
|
return mediaClient.file.uploadExternal(url, collection);
|
|
156
|
-
case
|
|
156
|
+
case 3:
|
|
157
157
|
_yield$mediaClient$fi = _context.sent;
|
|
158
158
|
uploadableFileUpfrontIds = _yield$mediaClient$fi.uploadableFileUpfrontIds;
|
|
159
159
|
dimensions = _yield$mediaClient$fi.dimensions;
|
|
@@ -170,23 +170,23 @@ function MediaFromURL(_ref) {
|
|
|
170
170
|
}
|
|
171
171
|
// eslint-disable-next-line no-unused-vars
|
|
172
172
|
});
|
|
173
|
-
_context.next =
|
|
173
|
+
_context.next = 5;
|
|
174
174
|
break;
|
|
175
|
-
case
|
|
176
|
-
_context.prev =
|
|
177
|
-
|
|
175
|
+
case 4:
|
|
176
|
+
_context.prev = 4;
|
|
177
|
+
_t = _context["catch"](2);
|
|
178
178
|
// eslint-disable-line no-unused-vars
|
|
179
|
-
if (typeof
|
|
179
|
+
if (typeof _t === 'string' && _t === 'Could not download remote file') {
|
|
180
180
|
// TODO: ED-26962 - Make sure this gets good unit test coverage with the actual media plugin.
|
|
181
181
|
// This hard coded error message could be changed at any
|
|
182
182
|
// point and we need a unit test to break to stop people changing it.
|
|
183
|
-
onUploadFailureAnalytics(
|
|
183
|
+
onUploadFailureAnalytics(_t, 'url');
|
|
184
184
|
dispatch({
|
|
185
185
|
type: 'warning',
|
|
186
|
-
warning:
|
|
186
|
+
warning: _t,
|
|
187
187
|
url: url
|
|
188
188
|
});
|
|
189
|
-
} else if (
|
|
189
|
+
} else if (_t instanceof Error) {
|
|
190
190
|
message = 'Image preview fetch failed';
|
|
191
191
|
onUploadFailureAnalytics(message, 'url');
|
|
192
192
|
dispatch({
|
|
@@ -200,11 +200,11 @@ function MediaFromURL(_ref) {
|
|
|
200
200
|
error: 'Unknown error'
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
-
case
|
|
203
|
+
case 5:
|
|
204
204
|
case "end":
|
|
205
205
|
return _context.stop();
|
|
206
206
|
}
|
|
207
|
-
}, _callee, null, [[
|
|
207
|
+
}, _callee, null, [[2, 4]]);
|
|
208
208
|
}));
|
|
209
209
|
return function (_x) {
|
|
210
210
|
return _ref2.apply(this, arguments);
|
|
@@ -123,8 +123,8 @@ export function MediaFromURL(_ref) {
|
|
|
123
123
|
onUploadFailureAnalytics = _useAnalyticsEvents.onUploadFailureAnalytics;
|
|
124
124
|
var uploadExternalMedia = React.useCallback( /*#__PURE__*/function () {
|
|
125
125
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
|
|
126
|
-
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message;
|
|
127
|
-
return _regeneratorRuntime.wrap(function
|
|
126
|
+
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message, _t;
|
|
127
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
128
128
|
while (1) switch (_context.prev = _context.next) {
|
|
129
129
|
case 0:
|
|
130
130
|
onUploadButtonClickedAnalytics();
|
|
@@ -133,18 +133,18 @@ export function MediaFromURL(_ref) {
|
|
|
133
133
|
});
|
|
134
134
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig, uploadParams = mediaProvider.uploadParams;
|
|
135
135
|
if (uploadMediaClientConfig) {
|
|
136
|
-
_context.next =
|
|
136
|
+
_context.next = 1;
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
139
|
return _context.abrupt("return");
|
|
140
|
-
case
|
|
140
|
+
case 1:
|
|
141
141
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
142
142
|
collection = uploadParams === null || uploadParams === void 0 ? void 0 : uploadParams.collection;
|
|
143
143
|
onUploadCommencedAnalytics('url');
|
|
144
|
-
_context.prev =
|
|
145
|
-
_context.next =
|
|
144
|
+
_context.prev = 2;
|
|
145
|
+
_context.next = 3;
|
|
146
146
|
return mediaClient.file.uploadExternal(url, collection);
|
|
147
|
-
case
|
|
147
|
+
case 3:
|
|
148
148
|
_yield$mediaClient$fi = _context.sent;
|
|
149
149
|
uploadableFileUpfrontIds = _yield$mediaClient$fi.uploadableFileUpfrontIds;
|
|
150
150
|
dimensions = _yield$mediaClient$fi.dimensions;
|
|
@@ -161,23 +161,23 @@ export function MediaFromURL(_ref) {
|
|
|
161
161
|
}
|
|
162
162
|
// eslint-disable-next-line no-unused-vars
|
|
163
163
|
});
|
|
164
|
-
_context.next =
|
|
164
|
+
_context.next = 5;
|
|
165
165
|
break;
|
|
166
|
-
case
|
|
167
|
-
_context.prev =
|
|
168
|
-
|
|
166
|
+
case 4:
|
|
167
|
+
_context.prev = 4;
|
|
168
|
+
_t = _context["catch"](2);
|
|
169
169
|
// eslint-disable-line no-unused-vars
|
|
170
|
-
if (typeof
|
|
170
|
+
if (typeof _t === 'string' && _t === 'Could not download remote file') {
|
|
171
171
|
// TODO: ED-26962 - Make sure this gets good unit test coverage with the actual media plugin.
|
|
172
172
|
// This hard coded error message could be changed at any
|
|
173
173
|
// point and we need a unit test to break to stop people changing it.
|
|
174
|
-
onUploadFailureAnalytics(
|
|
174
|
+
onUploadFailureAnalytics(_t, 'url');
|
|
175
175
|
dispatch({
|
|
176
176
|
type: 'warning',
|
|
177
|
-
warning:
|
|
177
|
+
warning: _t,
|
|
178
178
|
url: url
|
|
179
179
|
});
|
|
180
|
-
} else if (
|
|
180
|
+
} else if (_t instanceof Error) {
|
|
181
181
|
message = 'Image preview fetch failed';
|
|
182
182
|
onUploadFailureAnalytics(message, 'url');
|
|
183
183
|
dispatch({
|
|
@@ -191,11 +191,11 @@ export function MediaFromURL(_ref) {
|
|
|
191
191
|
error: 'Unknown error'
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
case
|
|
194
|
+
case 5:
|
|
195
195
|
case "end":
|
|
196
196
|
return _context.stop();
|
|
197
197
|
}
|
|
198
|
-
}, _callee, null, [[
|
|
198
|
+
}, _callee, null, [[2, 4]]);
|
|
199
199
|
}));
|
|
200
200
|
return function (_x) {
|
|
201
201
|
return _ref2.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media-insert",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0",
|
|
4
4
|
"description": "Media Insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,28 +21,28 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^52.
|
|
24
|
+
"@atlaskit/adf-schema": "^52.15.0",
|
|
25
25
|
"@atlaskit/button": "^23.11.0",
|
|
26
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
27
|
-
"@atlaskit/editor-plugin-media": "^
|
|
26
|
+
"@atlaskit/editor-plugin-analytics": "^11.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-media": "^13.0.0",
|
|
28
28
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
29
29
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
30
30
|
"@atlaskit/form": "^15.5.0",
|
|
31
|
-
"@atlaskit/icon": "^35.
|
|
32
|
-
"@atlaskit/media-card": "^80.
|
|
31
|
+
"@atlaskit/icon": "^35.3.0",
|
|
32
|
+
"@atlaskit/media-card": "^80.7.0",
|
|
33
33
|
"@atlaskit/media-client": "^36.3.0",
|
|
34
|
-
"@atlaskit/media-client-react": "^5.
|
|
35
|
-
"@atlaskit/media-picker": "^71.
|
|
34
|
+
"@atlaskit/media-client-react": "^5.2.0",
|
|
35
|
+
"@atlaskit/media-picker": "^71.4.0",
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
37
37
|
"@atlaskit/primitives": "^19.0.0",
|
|
38
|
-
"@atlaskit/section-message": "^8.
|
|
38
|
+
"@atlaskit/section-message": "^8.13.0",
|
|
39
39
|
"@atlaskit/tabs": "^19.1.0",
|
|
40
40
|
"@atlaskit/textfield": "^8.3.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@atlaskit/editor-common": "^
|
|
45
|
-
"@atlaskit/tokens": "^13.
|
|
44
|
+
"@atlaskit/editor-common": "^115.0.0",
|
|
45
|
+
"@atlaskit/tokens": "^13.1.0",
|
|
46
46
|
"react": "^18.2.0",
|
|
47
47
|
"react-dom": "^18.2.0",
|
|
48
48
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -94,6 +94,8 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
+
"react": "^18.2.0",
|
|
98
|
+
"react-dom": "^18.2.0",
|
|
97
99
|
"react-intl": "^6.6.2"
|
|
98
100
|
}
|
|
99
101
|
}
|