@atlaskit/editor-plugin-media 12.8.2 → 12.9.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 +19 -0
- package/dist/cjs/nodeviews/mediaGroupNext.js +12 -12
- package/dist/cjs/nodeviews/mediaInline.js +25 -25
- package/dist/cjs/nodeviews/mediaNodeUpdater.js +199 -198
- package/dist/cjs/nodeviews/mediaNodeView/media.js +29 -17
- package/dist/cjs/nodeviews/mediaSingleNext.js +24 -24
- package/dist/cjs/pm-plugins/ai-generating-decoration.js +59 -12
- package/dist/cjs/pm-plugins/commands.js +2 -2
- package/dist/cjs/pm-plugins/main.js +55 -46
- package/dist/cjs/pm-plugins/mediaTaskManager.js +6 -6
- package/dist/cjs/pm-plugins/picker-facade.js +4 -4
- package/dist/cjs/pm-plugins/utils/check-media-type.js +17 -17
- package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +21 -21
- package/dist/cjs/ui/ResizableMediaSingle/index.js +18 -18
- package/dist/cjs/ui/toolbar/utils.js +11 -11
- package/dist/es2019/nodeviews/mediaNodeView/media.js +12 -0
- package/dist/es2019/pm-plugins/ai-generating-decoration.js +53 -12
- package/dist/es2019/pm-plugins/commands.js +2 -2
- package/dist/es2019/pm-plugins/main.js +11 -1
- package/dist/esm/nodeviews/mediaGroupNext.js +12 -12
- package/dist/esm/nodeviews/mediaInline.js +25 -25
- package/dist/esm/nodeviews/mediaNodeUpdater.js +199 -198
- package/dist/esm/nodeviews/mediaNodeView/media.js +28 -16
- package/dist/esm/nodeviews/mediaSingleNext.js +23 -23
- package/dist/esm/pm-plugins/ai-generating-decoration.js +59 -12
- package/dist/esm/pm-plugins/commands.js +2 -2
- package/dist/esm/pm-plugins/main.js +54 -45
- package/dist/esm/pm-plugins/mediaTaskManager.js +6 -6
- package/dist/esm/pm-plugins/picker-facade.js +4 -4
- package/dist/esm/pm-plugins/utils/check-media-type.js +17 -17
- package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +21 -21
- package/dist/esm/ui/ResizableMediaSingle/index.js +18 -18
- package/dist/esm/ui/toolbar/utils.js +11 -11
- package/dist/types/mediaPluginType.d.ts +2 -1
- package/dist/types/nodeviews/mediaNodeView/media.d.ts +1 -0
- package/dist/types/pm-plugins/ai-generating-decoration.d.ts +3 -1
- package/dist/types/pm-plugins/commands.d.ts +2 -1
- package/dist/types/pm-plugins/main.d.ts +1 -0
- package/dist/types/pm-plugins/types.d.ts +1 -0
- package/dist/types-ts4.5/mediaPluginType.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/ai-generating-decoration.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/types.d.ts +1 -0
- package/package.json +10 -7
|
@@ -42,20 +42,20 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
42
42
|
// Updates the node with contextId if it doesn't have one already
|
|
43
43
|
(0, _defineProperty2.default)(this, "updateContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
44
44
|
var attrs, id, objectId;
|
|
45
|
-
return _regenerator.default.wrap(function
|
|
45
|
+
return _regenerator.default.wrap(function (_context) {
|
|
46
46
|
while (1) switch (_context.prev = _context.next) {
|
|
47
47
|
case 0:
|
|
48
48
|
attrs = _this.getAttrs();
|
|
49
49
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
50
|
-
_context.next =
|
|
50
|
+
_context.next = 1;
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
53
|
return _context.abrupt("return");
|
|
54
|
-
case
|
|
54
|
+
case 1:
|
|
55
55
|
id = attrs.id;
|
|
56
|
-
_context.next =
|
|
56
|
+
_context.next = 2;
|
|
57
57
|
return _this.getObjectId();
|
|
58
|
-
case
|
|
58
|
+
case 2:
|
|
59
59
|
objectId = _context.sent;
|
|
60
60
|
(0, _batchMediaNodeAttrs.batchMediaNodeAttrsUpdate)(_this.props.view, {
|
|
61
61
|
id: id,
|
|
@@ -63,7 +63,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
63
63
|
__contextId: objectId
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
case
|
|
66
|
+
case 3:
|
|
67
67
|
case "end":
|
|
68
68
|
return _context.stop();
|
|
69
69
|
}
|
|
@@ -72,19 +72,19 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
72
72
|
(0, _defineProperty2.default)(this, "updateNodeContextId", /*#__PURE__*/function () {
|
|
73
73
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(getPos) {
|
|
74
74
|
var attrs, objectId;
|
|
75
|
-
return _regenerator.default.wrap(function
|
|
75
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
76
76
|
while (1) switch (_context2.prev = _context2.next) {
|
|
77
77
|
case 0:
|
|
78
78
|
attrs = _this.getAttrs();
|
|
79
79
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
80
|
-
_context2.next =
|
|
80
|
+
_context2.next = 1;
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
return _context2.abrupt("return");
|
|
84
|
-
case
|
|
85
|
-
_context2.next =
|
|
84
|
+
case 1:
|
|
85
|
+
_context2.next = 2;
|
|
86
86
|
return _this.getObjectId();
|
|
87
|
-
case
|
|
87
|
+
case 2:
|
|
88
88
|
objectId = _context2.sent;
|
|
89
89
|
(0, _helpers.updateCurrentMediaNodeAttrs)({
|
|
90
90
|
__contextId: objectId
|
|
@@ -92,7 +92,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
92
92
|
node: _this.props.node,
|
|
93
93
|
getPos: getPos
|
|
94
94
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
95
|
-
case
|
|
95
|
+
case 3:
|
|
96
96
|
case "end":
|
|
97
97
|
return _context2.stop();
|
|
98
98
|
}
|
|
@@ -106,55 +106,55 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
106
106
|
return attrs && attrs.type === 'file' && attrs.__fileName && attrs.__fileMimeType && attrs.__fileSize && attrs.__contextId;
|
|
107
107
|
});
|
|
108
108
|
(0, _defineProperty2.default)(this, "getNewFileAttrsForNode", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
109
|
-
var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs;
|
|
110
|
-
return _regenerator.default.wrap(function
|
|
109
|
+
var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs, _t, _t2;
|
|
110
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
111
111
|
while (1) switch (_context3.prev = _context3.next) {
|
|
112
112
|
case 0:
|
|
113
113
|
attrs = _this.getAttrs();
|
|
114
|
-
_context3.next =
|
|
114
|
+
_context3.next = 1;
|
|
115
115
|
return _this.props.mediaProvider;
|
|
116
|
-
case
|
|
116
|
+
case 1:
|
|
117
117
|
mediaProvider = _context3.sent;
|
|
118
118
|
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || !isMediaTypeSupported(attrs.type) || _this.hasFileAttributesDefined(attrs))) {
|
|
119
|
-
_context3.next =
|
|
119
|
+
_context3.next = 2;
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
122
|
return _context3.abrupt("return");
|
|
123
|
-
case
|
|
123
|
+
case 2:
|
|
124
124
|
mediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
125
125
|
mediaClient = (0, _mediaClientReact.getMediaClient)(mediaClientConfig);
|
|
126
126
|
id = attrs.id, collectionName = attrs.collection;
|
|
127
|
-
_context3.prev =
|
|
128
|
-
_context3.next =
|
|
127
|
+
_context3.prev = 3;
|
|
128
|
+
_context3.next = 4;
|
|
129
129
|
return mediaClient.file.getCurrentState(id, {
|
|
130
130
|
collectionName: collectionName
|
|
131
131
|
});
|
|
132
|
-
case
|
|
132
|
+
case 4:
|
|
133
133
|
fileState = _context3.sent;
|
|
134
134
|
if (!(fileState.status === 'error')) {
|
|
135
|
-
_context3.next =
|
|
135
|
+
_context3.next = 5;
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
138
|
return _context3.abrupt("return");
|
|
139
|
-
case
|
|
140
|
-
_context3.next =
|
|
139
|
+
case 5:
|
|
140
|
+
_context3.next = 7;
|
|
141
141
|
break;
|
|
142
|
-
case
|
|
143
|
-
_context3.prev =
|
|
144
|
-
|
|
142
|
+
case 6:
|
|
143
|
+
_context3.prev = 6;
|
|
144
|
+
_t = _context3["catch"](3);
|
|
145
145
|
return _context3.abrupt("return");
|
|
146
|
-
case
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
_context3.next =
|
|
146
|
+
case 7:
|
|
147
|
+
_t2 = _this.getNodeContextId();
|
|
148
|
+
if (_t2) {
|
|
149
|
+
_context3.next = 9;
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
|
-
_context3.next =
|
|
152
|
+
_context3.next = 8;
|
|
153
153
|
return _this.getObjectId();
|
|
154
|
-
case
|
|
155
|
-
|
|
156
|
-
case
|
|
157
|
-
contextId =
|
|
154
|
+
case 8:
|
|
155
|
+
_t2 = _context3.sent;
|
|
156
|
+
case 9:
|
|
157
|
+
contextId = _t2;
|
|
158
158
|
_fileState = fileState, name = _fileState.name, mimeType = _fileState.mimeType, size = _fileState.size;
|
|
159
159
|
newAttrs = {
|
|
160
160
|
__fileName: name,
|
|
@@ -163,26 +163,26 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
163
163
|
__contextId: contextId
|
|
164
164
|
};
|
|
165
165
|
if (hasPrivateAttrsChanged(attrs, newAttrs)) {
|
|
166
|
-
_context3.next =
|
|
166
|
+
_context3.next = 10;
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
return _context3.abrupt("return");
|
|
170
|
-
case
|
|
170
|
+
case 10:
|
|
171
171
|
return _context3.abrupt("return", newAttrs);
|
|
172
|
-
case
|
|
172
|
+
case 11:
|
|
173
173
|
case "end":
|
|
174
174
|
return _context3.stop();
|
|
175
175
|
}
|
|
176
|
-
}, _callee3, null, [[
|
|
176
|
+
}, _callee3, null, [[3, 6]]);
|
|
177
177
|
})));
|
|
178
178
|
(0, _defineProperty2.default)(this, "updateMediaSingleFileAttrs", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
179
179
|
var newAttrs, _ref5, id;
|
|
180
|
-
return _regenerator.default.wrap(function
|
|
180
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
181
181
|
while (1) switch (_context4.prev = _context4.next) {
|
|
182
182
|
case 0:
|
|
183
|
-
_context4.next =
|
|
183
|
+
_context4.next = 1;
|
|
184
184
|
return _this.getNewFileAttrsForNode();
|
|
185
|
-
case
|
|
185
|
+
case 1:
|
|
186
186
|
newAttrs = _context4.sent;
|
|
187
187
|
_ref5 = _this.getAttrs(), id = _ref5.id;
|
|
188
188
|
if (id && newAttrs) {
|
|
@@ -191,7 +191,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
191
191
|
nextAttributes: newAttrs
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
case
|
|
194
|
+
case 2:
|
|
195
195
|
case "end":
|
|
196
196
|
return _context4.stop();
|
|
197
197
|
}
|
|
@@ -200,12 +200,12 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
200
200
|
(0, _defineProperty2.default)(this, "updateNodeAttrs", /*#__PURE__*/function () {
|
|
201
201
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(getPos) {
|
|
202
202
|
var newAttrs;
|
|
203
|
-
return _regenerator.default.wrap(function
|
|
203
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
204
204
|
while (1) switch (_context5.prev = _context5.next) {
|
|
205
205
|
case 0:
|
|
206
|
-
_context5.next =
|
|
206
|
+
_context5.next = 1;
|
|
207
207
|
return _this.getNewFileAttrsForNode();
|
|
208
|
-
case
|
|
208
|
+
case 1:
|
|
209
209
|
newAttrs = _context5.sent;
|
|
210
210
|
if (newAttrs) {
|
|
211
211
|
(0, _helpers.updateCurrentMediaNodeAttrs)(newAttrs, {
|
|
@@ -213,7 +213,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
213
213
|
getPos: getPos
|
|
214
214
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
215
215
|
}
|
|
216
|
-
case
|
|
216
|
+
case 2:
|
|
217
217
|
case "end":
|
|
218
218
|
return _context5.stop();
|
|
219
219
|
}
|
|
@@ -232,15 +232,15 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
232
232
|
});
|
|
233
233
|
(0, _defineProperty2.default)(this, "getObjectId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
234
234
|
var contextIdentifierProvider;
|
|
235
|
-
return _regenerator.default.wrap(function
|
|
235
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
236
236
|
while (1) switch (_context6.prev = _context6.next) {
|
|
237
237
|
case 0:
|
|
238
|
-
_context6.next =
|
|
238
|
+
_context6.next = 1;
|
|
239
239
|
return _this.props.contextIdentifierProvider;
|
|
240
|
-
case
|
|
240
|
+
case 1:
|
|
241
241
|
contextIdentifierProvider = _context6.sent;
|
|
242
242
|
return _context6.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
|
|
243
|
-
case
|
|
243
|
+
case 2:
|
|
244
244
|
case "end":
|
|
245
245
|
return _context6.stop();
|
|
246
246
|
}
|
|
@@ -248,47 +248,47 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
248
248
|
})));
|
|
249
249
|
(0, _defineProperty2.default)(this, "uploadExternalMedia", /*#__PURE__*/function () {
|
|
250
250
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(getPos) {
|
|
251
|
-
var _this$props, node, mediaOptions, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos;
|
|
252
|
-
return _regenerator.default.wrap(function
|
|
251
|
+
var _this$props, node, mediaOptions, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos, _t3;
|
|
252
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
253
253
|
while (1) switch (_context7.prev = _context7.next) {
|
|
254
254
|
case 0:
|
|
255
255
|
_this$props = _this.props, node = _this$props.node, mediaOptions = _this$props.mediaOptions;
|
|
256
256
|
if (!(mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.isExternalMediaUploadDisabled)) {
|
|
257
|
-
_context7.next =
|
|
257
|
+
_context7.next = 1;
|
|
258
258
|
break;
|
|
259
259
|
}
|
|
260
260
|
return _context7.abrupt("return");
|
|
261
|
-
case
|
|
262
|
-
_context7.next =
|
|
261
|
+
case 1:
|
|
262
|
+
_context7.next = 2;
|
|
263
263
|
return _this.props.mediaProvider;
|
|
264
|
-
case
|
|
264
|
+
case 2:
|
|
265
265
|
mediaProvider = _context7.sent;
|
|
266
266
|
if (!(node && mediaProvider)) {
|
|
267
|
-
_context7.next =
|
|
267
|
+
_context7.next = 8;
|
|
268
268
|
break;
|
|
269
269
|
}
|
|
270
270
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
271
271
|
if (!(!uploadMediaClientConfig || !node.attrs.url)) {
|
|
272
|
-
_context7.next =
|
|
272
|
+
_context7.next = 3;
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
return _context7.abrupt("return");
|
|
276
|
-
case
|
|
276
|
+
case 3:
|
|
277
277
|
mediaClient = (0, _mediaClientReact.getMediaClient)(uploadMediaClientConfig);
|
|
278
278
|
collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
|
|
279
|
-
_context7.prev =
|
|
280
|
-
_context7.next =
|
|
279
|
+
_context7.prev = 4;
|
|
280
|
+
_context7.next = 5;
|
|
281
281
|
return mediaClient.file.uploadExternal(node.attrs.url, collection);
|
|
282
|
-
case
|
|
282
|
+
case 5:
|
|
283
283
|
uploader = _context7.sent;
|
|
284
284
|
uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
|
|
285
285
|
pos = getPos();
|
|
286
286
|
if (!(typeof pos !== 'number')) {
|
|
287
|
-
_context7.next =
|
|
287
|
+
_context7.next = 6;
|
|
288
288
|
break;
|
|
289
289
|
}
|
|
290
290
|
return _context7.abrupt("return");
|
|
291
|
-
case
|
|
291
|
+
case 6:
|
|
292
292
|
(0, _helpers.replaceExternalMedia)(pos + 1, {
|
|
293
293
|
id: uploadableFileUpfrontIds.id,
|
|
294
294
|
collection: collection,
|
|
@@ -296,11 +296,11 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
296
296
|
width: dimensions.width,
|
|
297
297
|
occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
|
|
298
298
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
299
|
-
_context7.next =
|
|
299
|
+
_context7.next = 8;
|
|
300
300
|
break;
|
|
301
|
-
case
|
|
302
|
-
_context7.prev =
|
|
303
|
-
|
|
301
|
+
case 7:
|
|
302
|
+
_context7.prev = 7;
|
|
303
|
+
_t3 = _context7["catch"](4);
|
|
304
304
|
//keep it as external media
|
|
305
305
|
if (_this.props.dispatchAnalyticsEvent) {
|
|
306
306
|
_this.props.dispatchAnalyticsEvent({
|
|
@@ -309,11 +309,11 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
309
309
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
|
-
case
|
|
312
|
+
case 8:
|
|
313
313
|
case "end":
|
|
314
314
|
return _context7.stop();
|
|
315
315
|
}
|
|
316
|
-
}, _callee7, null, [[
|
|
316
|
+
}, _callee7, null, [[4, 7]]);
|
|
317
317
|
}));
|
|
318
318
|
return function (_x3) {
|
|
319
319
|
return _ref8.apply(this, arguments);
|
|
@@ -404,30 +404,30 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
404
404
|
(0, _defineProperty2.default)(this, "shouldNodeBeDeepCopied", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
405
405
|
var _ref0, _this$props$mediaOpti, _this$props$mediaOpti2, _this$mediaPluginStat;
|
|
406
406
|
var scope, attrs, id, isIdentifierOutsideEditorScope;
|
|
407
|
-
return _regenerator.default.wrap(function
|
|
407
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
408
408
|
while (1) switch (_context8.prev = _context8.next) {
|
|
409
409
|
case 0:
|
|
410
410
|
scope = (_ref0 = (_this$props$mediaOpti = (_this$props$mediaOpti2 = _this.props.mediaOptions) === null || _this$props$mediaOpti2 === void 0 ? void 0 : _this$props$mediaOpti2.mediaShallowCopyScope) !== null && _this$props$mediaOpti !== void 0 ? _this$props$mediaOpti : (_this$mediaPluginStat = _this.mediaPluginState) === null || _this$mediaPluginStat === void 0 || (_this$mediaPluginStat = _this$mediaPluginStat.mediaOptions) === null || _this$mediaPluginStat === void 0 ? void 0 : _this$mediaPluginStat.mediaShallowCopyScope) !== null && _ref0 !== void 0 ? _ref0 : 'context';
|
|
411
411
|
if (!(scope === 'context')) {
|
|
412
|
-
_context8.next =
|
|
412
|
+
_context8.next = 2;
|
|
413
413
|
break;
|
|
414
414
|
}
|
|
415
|
-
_context8.next =
|
|
415
|
+
_context8.next = 1;
|
|
416
416
|
return _this.hasDifferentContextId();
|
|
417
|
-
case
|
|
417
|
+
case 1:
|
|
418
418
|
return _context8.abrupt("return", _context8.sent);
|
|
419
|
-
case
|
|
419
|
+
case 2:
|
|
420
420
|
attrs = _this.getAttrs();
|
|
421
421
|
if (!(!attrs || !_this.mediaPluginState)) {
|
|
422
|
-
_context8.next =
|
|
422
|
+
_context8.next = 3;
|
|
423
423
|
break;
|
|
424
424
|
}
|
|
425
425
|
return _context8.abrupt("return", false);
|
|
426
|
-
case
|
|
426
|
+
case 3:
|
|
427
427
|
id = (0, _mediaCommon2.getIdentifier)(attrs);
|
|
428
428
|
isIdentifierOutsideEditorScope = !_this.mediaPluginState.isIdentifierInEditorScope(id);
|
|
429
429
|
return _context8.abrupt("return", isIdentifierOutsideEditorScope);
|
|
430
|
-
case
|
|
430
|
+
case 4:
|
|
431
431
|
case "end":
|
|
432
432
|
return _context8.stop();
|
|
433
433
|
}
|
|
@@ -435,70 +435,70 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
435
435
|
})));
|
|
436
436
|
(0, _defineProperty2.default)(this, "hasDifferentContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
437
437
|
var nodeContextId, currentContextId;
|
|
438
|
-
return _regenerator.default.wrap(function
|
|
438
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
439
439
|
while (1) switch (_context9.prev = _context9.next) {
|
|
440
440
|
case 0:
|
|
441
441
|
nodeContextId = _this.getNodeContextId();
|
|
442
|
-
_context9.next =
|
|
442
|
+
_context9.next = 1;
|
|
443
443
|
return _this.getObjectId();
|
|
444
|
-
case
|
|
444
|
+
case 1:
|
|
445
445
|
currentContextId = _context9.sent;
|
|
446
446
|
if (!(nodeContextId && currentContextId && nodeContextId !== currentContextId)) {
|
|
447
|
-
_context9.next =
|
|
447
|
+
_context9.next = 2;
|
|
448
448
|
break;
|
|
449
449
|
}
|
|
450
450
|
return _context9.abrupt("return", true);
|
|
451
|
-
case
|
|
451
|
+
case 2:
|
|
452
452
|
return _context9.abrupt("return", false);
|
|
453
|
-
case
|
|
453
|
+
case 3:
|
|
454
454
|
case "end":
|
|
455
455
|
return _context9.stop();
|
|
456
456
|
}
|
|
457
457
|
}, _callee9);
|
|
458
458
|
})));
|
|
459
459
|
(0, _defineProperty2.default)(this, "isNodeFromDifferentCollection", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
460
|
-
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId;
|
|
461
|
-
return _regenerator.default.wrap(function
|
|
460
|
+
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId, _t4;
|
|
461
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
462
462
|
while (1) switch (_context0.prev = _context0.next) {
|
|
463
463
|
case 0:
|
|
464
|
-
_context0.next =
|
|
464
|
+
_context0.next = 1;
|
|
465
465
|
return _this.props.mediaProvider;
|
|
466
|
-
case
|
|
466
|
+
case 1:
|
|
467
467
|
mediaProvider = _context0.sent;
|
|
468
468
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
469
|
-
_context0.next =
|
|
469
|
+
_context0.next = 2;
|
|
470
470
|
break;
|
|
471
471
|
}
|
|
472
472
|
return _context0.abrupt("return", false);
|
|
473
|
-
case
|
|
473
|
+
case 2:
|
|
474
474
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
475
475
|
attrs = _this.getAttrs();
|
|
476
476
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
477
|
-
_context0.next =
|
|
477
|
+
_context0.next = 3;
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
480
|
return _context0.abrupt("return", false);
|
|
481
|
-
case
|
|
481
|
+
case 3:
|
|
482
482
|
nodeCollection = attrs.collection, __contextId = attrs.__contextId;
|
|
483
|
-
|
|
484
|
-
if (
|
|
485
|
-
_context0.next =
|
|
483
|
+
_t4 = __contextId;
|
|
484
|
+
if (_t4) {
|
|
485
|
+
_context0.next = 5;
|
|
486
486
|
break;
|
|
487
487
|
}
|
|
488
|
-
_context0.next =
|
|
488
|
+
_context0.next = 4;
|
|
489
489
|
return _this.getObjectId();
|
|
490
|
-
case
|
|
491
|
-
|
|
492
|
-
case
|
|
493
|
-
contextId =
|
|
490
|
+
case 4:
|
|
491
|
+
_t4 = _context0.sent;
|
|
492
|
+
case 5:
|
|
493
|
+
contextId = _t4;
|
|
494
494
|
if (!(contextId && currentCollectionName !== nodeCollection)) {
|
|
495
|
-
_context0.next =
|
|
495
|
+
_context0.next = 6;
|
|
496
496
|
break;
|
|
497
497
|
}
|
|
498
498
|
return _context0.abrupt("return", true);
|
|
499
|
-
case
|
|
499
|
+
case 6:
|
|
500
500
|
return _context0.abrupt("return", false);
|
|
501
|
-
case
|
|
501
|
+
case 7:
|
|
502
502
|
case "end":
|
|
503
503
|
return _context0.stop();
|
|
504
504
|
}
|
|
@@ -506,41 +506,41 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
506
506
|
})));
|
|
507
507
|
(0, _defineProperty2.default)(this, "handleCopyFileSwitcher", /*#__PURE__*/function () {
|
|
508
508
|
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee1(attrs) {
|
|
509
|
-
var mediaClient, source, destination, traceContext, _yield$mediaClient$fi, id, _sourceAP, copyV2Source, _destAP, copyV2Destination, _yield$mediaClient$fi2, _id;
|
|
510
|
-
return _regenerator.default.wrap(function
|
|
509
|
+
var mediaClient, source, destination, traceContext, _yield$mediaClient$fi, id, _sourceAP, copyV2Source, _destAP, copyV2Destination, _yield$mediaClient$fi2, _id, _t5;
|
|
510
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
511
511
|
while (1) switch (_context1.prev = _context1.next) {
|
|
512
512
|
case 0:
|
|
513
513
|
mediaClient = attrs.mediaClient, source = attrs.source, destination = attrs.destination, traceContext = attrs.traceContext;
|
|
514
514
|
_context1.prev = 1;
|
|
515
|
-
_context1.next =
|
|
515
|
+
_context1.next = 2;
|
|
516
516
|
return mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
517
|
-
case
|
|
517
|
+
case 2:
|
|
518
518
|
_yield$mediaClient$fi = _context1.sent;
|
|
519
519
|
id = _yield$mediaClient$fi.id;
|
|
520
520
|
return _context1.abrupt("return", id);
|
|
521
|
-
case
|
|
522
|
-
_context1.prev =
|
|
523
|
-
|
|
521
|
+
case 3:
|
|
522
|
+
_context1.prev = 3;
|
|
523
|
+
_t5 = _context1["catch"](1);
|
|
524
524
|
if (!(0, _platformFeatureFlags.fg)('platform_media_cross_client_copy')) {
|
|
525
|
-
_context1.next =
|
|
525
|
+
_context1.next = 5;
|
|
526
526
|
break;
|
|
527
527
|
}
|
|
528
528
|
// calling /v2/file/copy by removing the auth tokens to make cross product copy and pastes
|
|
529
529
|
_sourceAP = source.authProvider, copyV2Source = (0, _objectWithoutProperties2.default)(source, _excluded);
|
|
530
530
|
_destAP = destination.authProvider, copyV2Destination = (0, _objectWithoutProperties2.default)(destination, _excluded2);
|
|
531
|
-
_context1.next =
|
|
531
|
+
_context1.next = 4;
|
|
532
532
|
return mediaClient.file.copyFile(copyV2Source, copyV2Destination, undefined, traceContext);
|
|
533
|
-
case
|
|
533
|
+
case 4:
|
|
534
534
|
_yield$mediaClient$fi2 = _context1.sent;
|
|
535
535
|
_id = _yield$mediaClient$fi2.id;
|
|
536
536
|
return _context1.abrupt("return", _id);
|
|
537
|
-
case
|
|
538
|
-
throw
|
|
539
|
-
case
|
|
537
|
+
case 5:
|
|
538
|
+
throw _t5;
|
|
539
|
+
case 6:
|
|
540
540
|
case "end":
|
|
541
541
|
return _context1.stop();
|
|
542
542
|
}
|
|
543
|
-
}, _callee1, null, [[1,
|
|
543
|
+
}, _callee1, null, [[1, 3]]);
|
|
544
544
|
}));
|
|
545
545
|
return function (_x4) {
|
|
546
546
|
return _ref11.apply(this, arguments);
|
|
@@ -549,46 +549,46 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
549
549
|
(0, _defineProperty2.default)(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
|
|
550
550
|
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(getPos) {
|
|
551
551
|
var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, clientId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
|
|
552
|
-
return _regenerator.default.wrap(function
|
|
552
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
553
553
|
while (1) switch (_context10.prev = _context10.next) {
|
|
554
554
|
case 0:
|
|
555
555
|
attrs = _this.getAttrs();
|
|
556
556
|
if (!(!attrs || attrs.type !== 'external')) {
|
|
557
|
-
_context10.next =
|
|
557
|
+
_context10.next = 1;
|
|
558
558
|
break;
|
|
559
559
|
}
|
|
560
560
|
return _context10.abrupt("return");
|
|
561
|
-
case
|
|
561
|
+
case 1:
|
|
562
562
|
url = attrs.url;
|
|
563
563
|
mediaAttrs = (0, _mediaClient.getAttrsFromUrl)(url);
|
|
564
564
|
if (mediaAttrs) {
|
|
565
|
-
_context10.next =
|
|
565
|
+
_context10.next = 2;
|
|
566
566
|
break;
|
|
567
567
|
}
|
|
568
568
|
return _context10.abrupt("return");
|
|
569
|
-
case
|
|
570
|
-
_context10.next =
|
|
569
|
+
case 2:
|
|
570
|
+
_context10.next = 3;
|
|
571
571
|
return _this.props.mediaProvider;
|
|
572
|
-
case
|
|
572
|
+
case 3:
|
|
573
573
|
mediaProvider = _context10.sent;
|
|
574
574
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
575
|
-
_context10.next =
|
|
575
|
+
_context10.next = 4;
|
|
576
576
|
break;
|
|
577
577
|
}
|
|
578
578
|
return _context10.abrupt("return");
|
|
579
|
-
case
|
|
579
|
+
case 4:
|
|
580
580
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
581
581
|
contextId = mediaAttrs.contextId, clientId = mediaAttrs.clientId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
|
|
582
582
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
583
583
|
if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
|
|
584
|
-
_context10.next =
|
|
584
|
+
_context10.next = 5;
|
|
585
585
|
break;
|
|
586
586
|
}
|
|
587
587
|
return _context10.abrupt("return");
|
|
588
|
-
case
|
|
588
|
+
case 5:
|
|
589
589
|
mediaClient = (0, _mediaClientReact.getMediaClient)(uploadMediaClientConfig);
|
|
590
590
|
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
591
|
-
_context10.next =
|
|
591
|
+
_context10.next = 6;
|
|
592
592
|
return _this.handleCopyFileSwitcher({
|
|
593
593
|
mediaClient: mediaClient,
|
|
594
594
|
source: {
|
|
@@ -606,15 +606,15 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
606
606
|
occurrenceKey: (0, _v.default)()
|
|
607
607
|
}
|
|
608
608
|
});
|
|
609
|
-
case
|
|
609
|
+
case 6:
|
|
610
610
|
mediaFileId = _context10.sent;
|
|
611
611
|
pos = getPos();
|
|
612
612
|
if (!(typeof pos !== 'number')) {
|
|
613
|
-
_context10.next =
|
|
613
|
+
_context10.next = 7;
|
|
614
614
|
break;
|
|
615
615
|
}
|
|
616
616
|
return _context10.abrupt("return");
|
|
617
|
-
case
|
|
617
|
+
case 7:
|
|
618
618
|
(0, _helpers.replaceExternalMedia)(pos + 1, {
|
|
619
619
|
id: mediaFileId,
|
|
620
620
|
collection: currentCollectionName,
|
|
@@ -624,7 +624,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
624
624
|
__fileMimeType: mimeType,
|
|
625
625
|
__fileSize: size
|
|
626
626
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
627
|
-
case
|
|
627
|
+
case 8:
|
|
628
628
|
case "end":
|
|
629
629
|
return _context10.stop();
|
|
630
630
|
}
|
|
@@ -638,31 +638,31 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
638
638
|
(0, _defineProperty2.default)(this, "copyNodeFromPos", /*#__PURE__*/function () {
|
|
639
639
|
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(getPos, traceContext) {
|
|
640
640
|
var attrs, copiedAttrs;
|
|
641
|
-
return _regenerator.default.wrap(function
|
|
641
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
642
642
|
while (1) switch (_context11.prev = _context11.next) {
|
|
643
643
|
case 0:
|
|
644
644
|
attrs = _this.getAttrs();
|
|
645
645
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
646
|
-
_context11.next =
|
|
646
|
+
_context11.next = 1;
|
|
647
647
|
break;
|
|
648
648
|
}
|
|
649
649
|
return _context11.abrupt("return");
|
|
650
|
-
case
|
|
651
|
-
_context11.next =
|
|
650
|
+
case 1:
|
|
651
|
+
_context11.next = 2;
|
|
652
652
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
653
|
-
case
|
|
653
|
+
case 2:
|
|
654
654
|
copiedAttrs = _context11.sent;
|
|
655
655
|
if (copiedAttrs) {
|
|
656
|
-
_context11.next =
|
|
656
|
+
_context11.next = 3;
|
|
657
657
|
break;
|
|
658
658
|
}
|
|
659
659
|
return _context11.abrupt("return");
|
|
660
|
-
case
|
|
660
|
+
case 3:
|
|
661
661
|
(0, _helpers.updateCurrentMediaNodeAttrs)(copiedAttrs, {
|
|
662
662
|
node: _this.props.node,
|
|
663
663
|
getPos: getPos
|
|
664
664
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
665
|
-
case
|
|
665
|
+
case 4:
|
|
666
666
|
case "end":
|
|
667
667
|
return _context11.stop();
|
|
668
668
|
}
|
|
@@ -676,29 +676,29 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
676
676
|
(0, _defineProperty2.default)(this, "copyNode", /*#__PURE__*/function () {
|
|
677
677
|
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(traceContext) {
|
|
678
678
|
var attrs, view, copiedAttrs;
|
|
679
|
-
return _regenerator.default.wrap(function
|
|
679
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
680
680
|
while (1) switch (_context12.prev = _context12.next) {
|
|
681
681
|
case 0:
|
|
682
682
|
attrs = _this.getAttrs();
|
|
683
683
|
view = _this.props.view;
|
|
684
684
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
685
|
-
_context12.next =
|
|
685
|
+
_context12.next = 1;
|
|
686
686
|
break;
|
|
687
687
|
}
|
|
688
688
|
return _context12.abrupt("return");
|
|
689
|
-
case
|
|
690
|
-
_context12.next =
|
|
689
|
+
case 1:
|
|
690
|
+
_context12.next = 2;
|
|
691
691
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
692
|
-
case
|
|
692
|
+
case 2:
|
|
693
693
|
copiedAttrs = _context12.sent;
|
|
694
694
|
if (copiedAttrs) {
|
|
695
|
-
_context12.next =
|
|
695
|
+
_context12.next = 3;
|
|
696
696
|
break;
|
|
697
697
|
}
|
|
698
698
|
return _context12.abrupt("return");
|
|
699
|
-
case
|
|
699
|
+
case 3:
|
|
700
700
|
(0, _helpers.updateMediaNodeAttrs)(attrs.id, copiedAttrs)(view.state, view.dispatch);
|
|
701
|
-
case
|
|
701
|
+
case 4:
|
|
702
702
|
case "end":
|
|
703
703
|
return _context12.stop();
|
|
704
704
|
}
|
|
@@ -711,36 +711,36 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
711
711
|
(0, _defineProperty2.default)(this, "copyFile", /*#__PURE__*/function () {
|
|
712
712
|
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, collection, traceContext) {
|
|
713
713
|
var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, clientId, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
|
|
714
|
-
return _regenerator.default.wrap(function
|
|
714
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
715
715
|
while (1) switch (_context13.prev = _context13.next) {
|
|
716
716
|
case 0:
|
|
717
|
-
_context13.next =
|
|
717
|
+
_context13.next = 1;
|
|
718
718
|
return _this.props.mediaProvider;
|
|
719
|
-
case
|
|
719
|
+
case 1:
|
|
720
720
|
mediaProvider = _context13.sent;
|
|
721
721
|
if (mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams) {
|
|
722
|
-
_context13.next =
|
|
722
|
+
_context13.next = 2;
|
|
723
723
|
break;
|
|
724
724
|
}
|
|
725
725
|
return _context13.abrupt("return");
|
|
726
|
-
case
|
|
726
|
+
case 2:
|
|
727
727
|
nodeContextId = _this.getNodeContextId();
|
|
728
728
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
729
729
|
if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
|
|
730
|
-
_context13.next =
|
|
730
|
+
_context13.next = 3;
|
|
731
731
|
break;
|
|
732
732
|
}
|
|
733
733
|
return _context13.abrupt("return");
|
|
734
|
-
case
|
|
734
|
+
case 3:
|
|
735
735
|
mediaClient = (0, _mediaClientReact.getMediaClient)(uploadMediaClientConfig);
|
|
736
736
|
clientId = (0, _platformFeatureFlags.fg)('platform_media_cross_client_copy_with_auth') ? (0, _mediaCommon.getClientIdForFile)(id) : undefined;
|
|
737
737
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
738
|
-
_context13.next =
|
|
738
|
+
_context13.next = 4;
|
|
739
739
|
return _this.getObjectId();
|
|
740
|
-
case
|
|
740
|
+
case 4:
|
|
741
741
|
objectId = _context13.sent;
|
|
742
742
|
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
743
|
-
_context13.next =
|
|
743
|
+
_context13.next = 5;
|
|
744
744
|
return _this.handleCopyFileSwitcher({
|
|
745
745
|
mediaClient: mediaClient,
|
|
746
746
|
source: {
|
|
@@ -759,14 +759,14 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
759
759
|
},
|
|
760
760
|
traceContext: traceContext
|
|
761
761
|
});
|
|
762
|
-
case
|
|
762
|
+
case 5:
|
|
763
763
|
mediaFileId = _context13.sent;
|
|
764
764
|
return _context13.abrupt("return", {
|
|
765
765
|
id: mediaFileId,
|
|
766
766
|
collection: currentCollectionName,
|
|
767
767
|
__contextId: objectId
|
|
768
768
|
});
|
|
769
|
-
case
|
|
769
|
+
case 6:
|
|
770
770
|
case "end":
|
|
771
771
|
return _context13.stop();
|
|
772
772
|
}
|
|
@@ -795,37 +795,37 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
795
795
|
value: function () {
|
|
796
796
|
var _getRemoteDimensions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
797
797
|
var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
|
|
798
|
-
return _regenerator.default.wrap(function
|
|
798
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
799
799
|
while (1) switch (_context14.prev = _context14.next) {
|
|
800
800
|
case 0:
|
|
801
|
-
_context14.next =
|
|
801
|
+
_context14.next = 1;
|
|
802
802
|
return this.props.mediaProvider;
|
|
803
|
-
case
|
|
803
|
+
case 1:
|
|
804
804
|
mediaProvider = _context14.sent;
|
|
805
805
|
mediaOptions = this.props.mediaOptions;
|
|
806
806
|
attrs = this.getAttrs();
|
|
807
807
|
if (!(!mediaProvider || !attrs)) {
|
|
808
|
-
_context14.next =
|
|
808
|
+
_context14.next = 2;
|
|
809
809
|
break;
|
|
810
810
|
}
|
|
811
811
|
return _context14.abrupt("return", false);
|
|
812
|
-
case
|
|
812
|
+
case 2:
|
|
813
813
|
height = attrs.height, width = attrs.width;
|
|
814
814
|
if (!(attrs.type === 'external' || !attrs.id)) {
|
|
815
|
-
_context14.next =
|
|
815
|
+
_context14.next = 3;
|
|
816
816
|
break;
|
|
817
817
|
}
|
|
818
818
|
return _context14.abrupt("return", false);
|
|
819
|
-
case
|
|
819
|
+
case 3:
|
|
820
820
|
id = attrs.id, collection = attrs.collection;
|
|
821
821
|
if (!(height && width)) {
|
|
822
|
-
_context14.next =
|
|
822
|
+
_context14.next = 4;
|
|
823
823
|
break;
|
|
824
824
|
}
|
|
825
825
|
return _context14.abrupt("return", false);
|
|
826
|
-
case
|
|
826
|
+
case 4:
|
|
827
827
|
if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
|
|
828
|
-
_context14.next =
|
|
828
|
+
_context14.next = 5;
|
|
829
829
|
break;
|
|
830
830
|
}
|
|
831
831
|
return _context14.abrupt("return", {
|
|
@@ -833,39 +833,39 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
833
833
|
height: _mediaSingle.DEFAULT_IMAGE_HEIGHT,
|
|
834
834
|
width: _mediaSingle.DEFAULT_IMAGE_WIDTH
|
|
835
835
|
});
|
|
836
|
-
case
|
|
836
|
+
case 5:
|
|
837
837
|
viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
838
838
|
mediaClient = (0, _mediaClientReact.getMediaClient)(viewMediaClientConfig);
|
|
839
|
-
_context14.next =
|
|
839
|
+
_context14.next = 6;
|
|
840
840
|
return mediaClient.file.getCurrentState(id, {
|
|
841
841
|
collectionName: collection
|
|
842
842
|
});
|
|
843
|
-
case
|
|
843
|
+
case 6:
|
|
844
844
|
currentState = _context14.sent;
|
|
845
845
|
if ((0, _mediaClient.isImageRepresentationReady)(currentState)) {
|
|
846
|
-
_context14.next =
|
|
846
|
+
_context14.next = 7;
|
|
847
847
|
break;
|
|
848
848
|
}
|
|
849
849
|
return _context14.abrupt("return", false);
|
|
850
|
-
case
|
|
851
|
-
_context14.next =
|
|
850
|
+
case 7:
|
|
851
|
+
_context14.next = 8;
|
|
852
852
|
return mediaClient.getImageMetadata(id, {
|
|
853
853
|
collection: collection
|
|
854
854
|
});
|
|
855
|
-
case
|
|
855
|
+
case 8:
|
|
856
856
|
imageMetadata = _context14.sent;
|
|
857
857
|
if (!(!imageMetadata || !imageMetadata.original)) {
|
|
858
|
-
_context14.next =
|
|
858
|
+
_context14.next = 9;
|
|
859
859
|
break;
|
|
860
860
|
}
|
|
861
861
|
return _context14.abrupt("return", false);
|
|
862
|
-
case
|
|
862
|
+
case 9:
|
|
863
863
|
return _context14.abrupt("return", {
|
|
864
864
|
id: id,
|
|
865
865
|
height: imageMetadata.original.height || _mediaSingle.DEFAULT_IMAGE_HEIGHT,
|
|
866
866
|
width: imageMetadata.original.width || _mediaSingle.DEFAULT_IMAGE_WIDTH
|
|
867
867
|
});
|
|
868
|
-
case
|
|
868
|
+
case 10:
|
|
869
869
|
case "end":
|
|
870
870
|
return _context14.stop();
|
|
871
871
|
}
|
|
@@ -880,35 +880,36 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
880
880
|
key: "handleExternalMedia",
|
|
881
881
|
value: function () {
|
|
882
882
|
var _handleExternalMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(getPos) {
|
|
883
|
-
|
|
883
|
+
var _t6;
|
|
884
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
884
885
|
while (1) switch (_context15.prev = _context15.next) {
|
|
885
886
|
case 0:
|
|
886
887
|
if (!this.isMediaBlobUrl()) {
|
|
887
|
-
_context15.next =
|
|
888
|
+
_context15.next = 5;
|
|
888
889
|
break;
|
|
889
890
|
}
|
|
890
891
|
_context15.prev = 1;
|
|
891
|
-
_context15.next =
|
|
892
|
+
_context15.next = 2;
|
|
892
893
|
return this.copyNodeFromBlobUrl(getPos);
|
|
893
|
-
case
|
|
894
|
-
_context15.next =
|
|
894
|
+
case 2:
|
|
895
|
+
_context15.next = 4;
|
|
895
896
|
break;
|
|
896
|
-
case
|
|
897
|
-
_context15.prev =
|
|
898
|
-
|
|
899
|
-
_context15.next =
|
|
897
|
+
case 3:
|
|
898
|
+
_context15.prev = 3;
|
|
899
|
+
_t6 = _context15["catch"](1);
|
|
900
|
+
_context15.next = 4;
|
|
900
901
|
return this.uploadExternalMedia(getPos);
|
|
901
|
-
case
|
|
902
|
-
_context15.next =
|
|
902
|
+
case 4:
|
|
903
|
+
_context15.next = 6;
|
|
903
904
|
break;
|
|
904
|
-
case
|
|
905
|
-
_context15.next =
|
|
905
|
+
case 5:
|
|
906
|
+
_context15.next = 6;
|
|
906
907
|
return this.uploadExternalMedia(getPos);
|
|
907
|
-
case
|
|
908
|
+
case 6:
|
|
908
909
|
case "end":
|
|
909
910
|
return _context15.stop();
|
|
910
911
|
}
|
|
911
|
-
}, _callee15, this, [[1,
|
|
912
|
+
}, _callee15, this, [[1, 3]]);
|
|
912
913
|
}));
|
|
913
914
|
function handleExternalMedia(_x10) {
|
|
914
915
|
return _handleExternalMedia.apply(this, arguments);
|