@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
|
@@ -36,20 +36,20 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
36
36
|
// Updates the node with contextId if it doesn't have one already
|
|
37
37
|
_defineProperty(this, "updateContextId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
38
|
var attrs, id, objectId;
|
|
39
|
-
return _regeneratorRuntime.wrap(function
|
|
39
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
40
40
|
while (1) switch (_context.prev = _context.next) {
|
|
41
41
|
case 0:
|
|
42
42
|
attrs = _this.getAttrs();
|
|
43
43
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
44
|
-
_context.next =
|
|
44
|
+
_context.next = 1;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
return _context.abrupt("return");
|
|
48
|
-
case
|
|
48
|
+
case 1:
|
|
49
49
|
id = attrs.id;
|
|
50
|
-
_context.next =
|
|
50
|
+
_context.next = 2;
|
|
51
51
|
return _this.getObjectId();
|
|
52
|
-
case
|
|
52
|
+
case 2:
|
|
53
53
|
objectId = _context.sent;
|
|
54
54
|
batchMediaNodeAttrsUpdate(_this.props.view, {
|
|
55
55
|
id: id,
|
|
@@ -57,7 +57,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
57
57
|
__contextId: objectId
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
case
|
|
60
|
+
case 3:
|
|
61
61
|
case "end":
|
|
62
62
|
return _context.stop();
|
|
63
63
|
}
|
|
@@ -66,19 +66,19 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
66
66
|
_defineProperty(this, "updateNodeContextId", /*#__PURE__*/function () {
|
|
67
67
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(getPos) {
|
|
68
68
|
var attrs, objectId;
|
|
69
|
-
return _regeneratorRuntime.wrap(function
|
|
69
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
70
70
|
while (1) switch (_context2.prev = _context2.next) {
|
|
71
71
|
case 0:
|
|
72
72
|
attrs = _this.getAttrs();
|
|
73
73
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
74
|
-
_context2.next =
|
|
74
|
+
_context2.next = 1;
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
77
|
return _context2.abrupt("return");
|
|
78
|
-
case
|
|
79
|
-
_context2.next =
|
|
78
|
+
case 1:
|
|
79
|
+
_context2.next = 2;
|
|
80
80
|
return _this.getObjectId();
|
|
81
|
-
case
|
|
81
|
+
case 2:
|
|
82
82
|
objectId = _context2.sent;
|
|
83
83
|
updateCurrentMediaNodeAttrs({
|
|
84
84
|
__contextId: objectId
|
|
@@ -86,7 +86,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
86
86
|
node: _this.props.node,
|
|
87
87
|
getPos: getPos
|
|
88
88
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
89
|
-
case
|
|
89
|
+
case 3:
|
|
90
90
|
case "end":
|
|
91
91
|
return _context2.stop();
|
|
92
92
|
}
|
|
@@ -100,55 +100,55 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
100
100
|
return attrs && attrs.type === 'file' && attrs.__fileName && attrs.__fileMimeType && attrs.__fileSize && attrs.__contextId;
|
|
101
101
|
});
|
|
102
102
|
_defineProperty(this, "getNewFileAttrsForNode", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
103
|
-
var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs;
|
|
104
|
-
return _regeneratorRuntime.wrap(function
|
|
103
|
+
var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs, _t, _t2;
|
|
104
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
105
105
|
while (1) switch (_context3.prev = _context3.next) {
|
|
106
106
|
case 0:
|
|
107
107
|
attrs = _this.getAttrs();
|
|
108
|
-
_context3.next =
|
|
108
|
+
_context3.next = 1;
|
|
109
109
|
return _this.props.mediaProvider;
|
|
110
|
-
case
|
|
110
|
+
case 1:
|
|
111
111
|
mediaProvider = _context3.sent;
|
|
112
112
|
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || !isMediaTypeSupported(attrs.type) || _this.hasFileAttributesDefined(attrs))) {
|
|
113
|
-
_context3.next =
|
|
113
|
+
_context3.next = 2;
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
116
|
return _context3.abrupt("return");
|
|
117
|
-
case
|
|
117
|
+
case 2:
|
|
118
118
|
mediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
119
119
|
mediaClient = getMediaClient(mediaClientConfig);
|
|
120
120
|
id = attrs.id, collectionName = attrs.collection;
|
|
121
|
-
_context3.prev =
|
|
122
|
-
_context3.next =
|
|
121
|
+
_context3.prev = 3;
|
|
122
|
+
_context3.next = 4;
|
|
123
123
|
return mediaClient.file.getCurrentState(id, {
|
|
124
124
|
collectionName: collectionName
|
|
125
125
|
});
|
|
126
|
-
case
|
|
126
|
+
case 4:
|
|
127
127
|
fileState = _context3.sent;
|
|
128
128
|
if (!(fileState.status === 'error')) {
|
|
129
|
-
_context3.next =
|
|
129
|
+
_context3.next = 5;
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
return _context3.abrupt("return");
|
|
133
|
-
case
|
|
134
|
-
_context3.next =
|
|
133
|
+
case 5:
|
|
134
|
+
_context3.next = 7;
|
|
135
135
|
break;
|
|
136
|
-
case
|
|
137
|
-
_context3.prev =
|
|
138
|
-
|
|
136
|
+
case 6:
|
|
137
|
+
_context3.prev = 6;
|
|
138
|
+
_t = _context3["catch"](3);
|
|
139
139
|
return _context3.abrupt("return");
|
|
140
|
-
case
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
_context3.next =
|
|
140
|
+
case 7:
|
|
141
|
+
_t2 = _this.getNodeContextId();
|
|
142
|
+
if (_t2) {
|
|
143
|
+
_context3.next = 9;
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
|
-
_context3.next =
|
|
146
|
+
_context3.next = 8;
|
|
147
147
|
return _this.getObjectId();
|
|
148
|
-
case
|
|
149
|
-
|
|
150
|
-
case
|
|
151
|
-
contextId =
|
|
148
|
+
case 8:
|
|
149
|
+
_t2 = _context3.sent;
|
|
150
|
+
case 9:
|
|
151
|
+
contextId = _t2;
|
|
152
152
|
_fileState = fileState, name = _fileState.name, mimeType = _fileState.mimeType, size = _fileState.size;
|
|
153
153
|
newAttrs = {
|
|
154
154
|
__fileName: name,
|
|
@@ -157,26 +157,26 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
157
157
|
__contextId: contextId
|
|
158
158
|
};
|
|
159
159
|
if (hasPrivateAttrsChanged(attrs, newAttrs)) {
|
|
160
|
-
_context3.next =
|
|
160
|
+
_context3.next = 10;
|
|
161
161
|
break;
|
|
162
162
|
}
|
|
163
163
|
return _context3.abrupt("return");
|
|
164
|
-
case
|
|
164
|
+
case 10:
|
|
165
165
|
return _context3.abrupt("return", newAttrs);
|
|
166
|
-
case
|
|
166
|
+
case 11:
|
|
167
167
|
case "end":
|
|
168
168
|
return _context3.stop();
|
|
169
169
|
}
|
|
170
|
-
}, _callee3, null, [[
|
|
170
|
+
}, _callee3, null, [[3, 6]]);
|
|
171
171
|
})));
|
|
172
172
|
_defineProperty(this, "updateMediaSingleFileAttrs", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
173
173
|
var newAttrs, _ref5, id;
|
|
174
|
-
return _regeneratorRuntime.wrap(function
|
|
174
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
175
175
|
while (1) switch (_context4.prev = _context4.next) {
|
|
176
176
|
case 0:
|
|
177
|
-
_context4.next =
|
|
177
|
+
_context4.next = 1;
|
|
178
178
|
return _this.getNewFileAttrsForNode();
|
|
179
|
-
case
|
|
179
|
+
case 1:
|
|
180
180
|
newAttrs = _context4.sent;
|
|
181
181
|
_ref5 = _this.getAttrs(), id = _ref5.id;
|
|
182
182
|
if (id && newAttrs) {
|
|
@@ -185,7 +185,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
185
185
|
nextAttributes: newAttrs
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
case
|
|
188
|
+
case 2:
|
|
189
189
|
case "end":
|
|
190
190
|
return _context4.stop();
|
|
191
191
|
}
|
|
@@ -194,12 +194,12 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
194
194
|
_defineProperty(this, "updateNodeAttrs", /*#__PURE__*/function () {
|
|
195
195
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(getPos) {
|
|
196
196
|
var newAttrs;
|
|
197
|
-
return _regeneratorRuntime.wrap(function
|
|
197
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
198
198
|
while (1) switch (_context5.prev = _context5.next) {
|
|
199
199
|
case 0:
|
|
200
|
-
_context5.next =
|
|
200
|
+
_context5.next = 1;
|
|
201
201
|
return _this.getNewFileAttrsForNode();
|
|
202
|
-
case
|
|
202
|
+
case 1:
|
|
203
203
|
newAttrs = _context5.sent;
|
|
204
204
|
if (newAttrs) {
|
|
205
205
|
updateCurrentMediaNodeAttrs(newAttrs, {
|
|
@@ -207,7 +207,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
207
207
|
getPos: getPos
|
|
208
208
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
209
209
|
}
|
|
210
|
-
case
|
|
210
|
+
case 2:
|
|
211
211
|
case "end":
|
|
212
212
|
return _context5.stop();
|
|
213
213
|
}
|
|
@@ -226,15 +226,15 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
226
226
|
});
|
|
227
227
|
_defineProperty(this, "getObjectId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
228
228
|
var contextIdentifierProvider;
|
|
229
|
-
return _regeneratorRuntime.wrap(function
|
|
229
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
230
230
|
while (1) switch (_context6.prev = _context6.next) {
|
|
231
231
|
case 0:
|
|
232
|
-
_context6.next =
|
|
232
|
+
_context6.next = 1;
|
|
233
233
|
return _this.props.contextIdentifierProvider;
|
|
234
|
-
case
|
|
234
|
+
case 1:
|
|
235
235
|
contextIdentifierProvider = _context6.sent;
|
|
236
236
|
return _context6.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
|
|
237
|
-
case
|
|
237
|
+
case 2:
|
|
238
238
|
case "end":
|
|
239
239
|
return _context6.stop();
|
|
240
240
|
}
|
|
@@ -242,47 +242,47 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
242
242
|
})));
|
|
243
243
|
_defineProperty(this, "uploadExternalMedia", /*#__PURE__*/function () {
|
|
244
244
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(getPos) {
|
|
245
|
-
var _this$props, node, mediaOptions, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos;
|
|
246
|
-
return _regeneratorRuntime.wrap(function
|
|
245
|
+
var _this$props, node, mediaOptions, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions, pos, _t3;
|
|
246
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
247
247
|
while (1) switch (_context7.prev = _context7.next) {
|
|
248
248
|
case 0:
|
|
249
249
|
_this$props = _this.props, node = _this$props.node, mediaOptions = _this$props.mediaOptions;
|
|
250
250
|
if (!(mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.isExternalMediaUploadDisabled)) {
|
|
251
|
-
_context7.next =
|
|
251
|
+
_context7.next = 1;
|
|
252
252
|
break;
|
|
253
253
|
}
|
|
254
254
|
return _context7.abrupt("return");
|
|
255
|
-
case
|
|
256
|
-
_context7.next =
|
|
255
|
+
case 1:
|
|
256
|
+
_context7.next = 2;
|
|
257
257
|
return _this.props.mediaProvider;
|
|
258
|
-
case
|
|
258
|
+
case 2:
|
|
259
259
|
mediaProvider = _context7.sent;
|
|
260
260
|
if (!(node && mediaProvider)) {
|
|
261
|
-
_context7.next =
|
|
261
|
+
_context7.next = 8;
|
|
262
262
|
break;
|
|
263
263
|
}
|
|
264
264
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
265
265
|
if (!(!uploadMediaClientConfig || !node.attrs.url)) {
|
|
266
|
-
_context7.next =
|
|
266
|
+
_context7.next = 3;
|
|
267
267
|
break;
|
|
268
268
|
}
|
|
269
269
|
return _context7.abrupt("return");
|
|
270
|
-
case
|
|
270
|
+
case 3:
|
|
271
271
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
272
272
|
collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
|
|
273
|
-
_context7.prev =
|
|
274
|
-
_context7.next =
|
|
273
|
+
_context7.prev = 4;
|
|
274
|
+
_context7.next = 5;
|
|
275
275
|
return mediaClient.file.uploadExternal(node.attrs.url, collection);
|
|
276
|
-
case
|
|
276
|
+
case 5:
|
|
277
277
|
uploader = _context7.sent;
|
|
278
278
|
uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
|
|
279
279
|
pos = getPos();
|
|
280
280
|
if (!(typeof pos !== 'number')) {
|
|
281
|
-
_context7.next =
|
|
281
|
+
_context7.next = 6;
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
284
|
return _context7.abrupt("return");
|
|
285
|
-
case
|
|
285
|
+
case 6:
|
|
286
286
|
replaceExternalMedia(pos + 1, {
|
|
287
287
|
id: uploadableFileUpfrontIds.id,
|
|
288
288
|
collection: collection,
|
|
@@ -290,11 +290,11 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
290
290
|
width: dimensions.width,
|
|
291
291
|
occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
|
|
292
292
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
293
|
-
_context7.next =
|
|
293
|
+
_context7.next = 8;
|
|
294
294
|
break;
|
|
295
|
-
case
|
|
296
|
-
_context7.prev =
|
|
297
|
-
|
|
295
|
+
case 7:
|
|
296
|
+
_context7.prev = 7;
|
|
297
|
+
_t3 = _context7["catch"](4);
|
|
298
298
|
//keep it as external media
|
|
299
299
|
if (_this.props.dispatchAnalyticsEvent) {
|
|
300
300
|
_this.props.dispatchAnalyticsEvent({
|
|
@@ -303,11 +303,11 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
303
303
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
|
-
case
|
|
306
|
+
case 8:
|
|
307
307
|
case "end":
|
|
308
308
|
return _context7.stop();
|
|
309
309
|
}
|
|
310
|
-
}, _callee7, null, [[
|
|
310
|
+
}, _callee7, null, [[4, 7]]);
|
|
311
311
|
}));
|
|
312
312
|
return function (_x3) {
|
|
313
313
|
return _ref8.apply(this, arguments);
|
|
@@ -398,30 +398,30 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
398
398
|
_defineProperty(this, "shouldNodeBeDeepCopied", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
399
399
|
var _ref0, _this$props$mediaOpti, _this$props$mediaOpti2, _this$mediaPluginStat;
|
|
400
400
|
var scope, attrs, id, isIdentifierOutsideEditorScope;
|
|
401
|
-
return _regeneratorRuntime.wrap(function
|
|
401
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
402
402
|
while (1) switch (_context8.prev = _context8.next) {
|
|
403
403
|
case 0:
|
|
404
404
|
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';
|
|
405
405
|
if (!(scope === 'context')) {
|
|
406
|
-
_context8.next =
|
|
406
|
+
_context8.next = 2;
|
|
407
407
|
break;
|
|
408
408
|
}
|
|
409
|
-
_context8.next =
|
|
409
|
+
_context8.next = 1;
|
|
410
410
|
return _this.hasDifferentContextId();
|
|
411
|
-
case
|
|
411
|
+
case 1:
|
|
412
412
|
return _context8.abrupt("return", _context8.sent);
|
|
413
|
-
case
|
|
413
|
+
case 2:
|
|
414
414
|
attrs = _this.getAttrs();
|
|
415
415
|
if (!(!attrs || !_this.mediaPluginState)) {
|
|
416
|
-
_context8.next =
|
|
416
|
+
_context8.next = 3;
|
|
417
417
|
break;
|
|
418
418
|
}
|
|
419
419
|
return _context8.abrupt("return", false);
|
|
420
|
-
case
|
|
420
|
+
case 3:
|
|
421
421
|
id = getIdentifier(attrs);
|
|
422
422
|
isIdentifierOutsideEditorScope = !_this.mediaPluginState.isIdentifierInEditorScope(id);
|
|
423
423
|
return _context8.abrupt("return", isIdentifierOutsideEditorScope);
|
|
424
|
-
case
|
|
424
|
+
case 4:
|
|
425
425
|
case "end":
|
|
426
426
|
return _context8.stop();
|
|
427
427
|
}
|
|
@@ -429,70 +429,70 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
429
429
|
})));
|
|
430
430
|
_defineProperty(this, "hasDifferentContextId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
431
431
|
var nodeContextId, currentContextId;
|
|
432
|
-
return _regeneratorRuntime.wrap(function
|
|
432
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
433
433
|
while (1) switch (_context9.prev = _context9.next) {
|
|
434
434
|
case 0:
|
|
435
435
|
nodeContextId = _this.getNodeContextId();
|
|
436
|
-
_context9.next =
|
|
436
|
+
_context9.next = 1;
|
|
437
437
|
return _this.getObjectId();
|
|
438
|
-
case
|
|
438
|
+
case 1:
|
|
439
439
|
currentContextId = _context9.sent;
|
|
440
440
|
if (!(nodeContextId && currentContextId && nodeContextId !== currentContextId)) {
|
|
441
|
-
_context9.next =
|
|
441
|
+
_context9.next = 2;
|
|
442
442
|
break;
|
|
443
443
|
}
|
|
444
444
|
return _context9.abrupt("return", true);
|
|
445
|
-
case
|
|
445
|
+
case 2:
|
|
446
446
|
return _context9.abrupt("return", false);
|
|
447
|
-
case
|
|
447
|
+
case 3:
|
|
448
448
|
case "end":
|
|
449
449
|
return _context9.stop();
|
|
450
450
|
}
|
|
451
451
|
}, _callee9);
|
|
452
452
|
})));
|
|
453
453
|
_defineProperty(this, "isNodeFromDifferentCollection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
|
|
454
|
-
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId;
|
|
455
|
-
return _regeneratorRuntime.wrap(function
|
|
454
|
+
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId, _t4;
|
|
455
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
456
456
|
while (1) switch (_context0.prev = _context0.next) {
|
|
457
457
|
case 0:
|
|
458
|
-
_context0.next =
|
|
458
|
+
_context0.next = 1;
|
|
459
459
|
return _this.props.mediaProvider;
|
|
460
|
-
case
|
|
460
|
+
case 1:
|
|
461
461
|
mediaProvider = _context0.sent;
|
|
462
462
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
463
|
-
_context0.next =
|
|
463
|
+
_context0.next = 2;
|
|
464
464
|
break;
|
|
465
465
|
}
|
|
466
466
|
return _context0.abrupt("return", false);
|
|
467
|
-
case
|
|
467
|
+
case 2:
|
|
468
468
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
469
469
|
attrs = _this.getAttrs();
|
|
470
470
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
471
|
-
_context0.next =
|
|
471
|
+
_context0.next = 3;
|
|
472
472
|
break;
|
|
473
473
|
}
|
|
474
474
|
return _context0.abrupt("return", false);
|
|
475
|
-
case
|
|
475
|
+
case 3:
|
|
476
476
|
nodeCollection = attrs.collection, __contextId = attrs.__contextId;
|
|
477
|
-
|
|
478
|
-
if (
|
|
479
|
-
_context0.next =
|
|
477
|
+
_t4 = __contextId;
|
|
478
|
+
if (_t4) {
|
|
479
|
+
_context0.next = 5;
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
|
-
_context0.next =
|
|
482
|
+
_context0.next = 4;
|
|
483
483
|
return _this.getObjectId();
|
|
484
|
-
case
|
|
485
|
-
|
|
486
|
-
case
|
|
487
|
-
contextId =
|
|
484
|
+
case 4:
|
|
485
|
+
_t4 = _context0.sent;
|
|
486
|
+
case 5:
|
|
487
|
+
contextId = _t4;
|
|
488
488
|
if (!(contextId && currentCollectionName !== nodeCollection)) {
|
|
489
|
-
_context0.next =
|
|
489
|
+
_context0.next = 6;
|
|
490
490
|
break;
|
|
491
491
|
}
|
|
492
492
|
return _context0.abrupt("return", true);
|
|
493
|
-
case
|
|
493
|
+
case 6:
|
|
494
494
|
return _context0.abrupt("return", false);
|
|
495
|
-
case
|
|
495
|
+
case 7:
|
|
496
496
|
case "end":
|
|
497
497
|
return _context0.stop();
|
|
498
498
|
}
|
|
@@ -500,41 +500,41 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
500
500
|
})));
|
|
501
501
|
_defineProperty(this, "handleCopyFileSwitcher", /*#__PURE__*/function () {
|
|
502
502
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee1(attrs) {
|
|
503
|
-
var mediaClient, source, destination, traceContext, _yield$mediaClient$fi, id, _sourceAP, copyV2Source, _destAP, copyV2Destination, _yield$mediaClient$fi2, _id;
|
|
504
|
-
return _regeneratorRuntime.wrap(function
|
|
503
|
+
var mediaClient, source, destination, traceContext, _yield$mediaClient$fi, id, _sourceAP, copyV2Source, _destAP, copyV2Destination, _yield$mediaClient$fi2, _id, _t5;
|
|
504
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
505
505
|
while (1) switch (_context1.prev = _context1.next) {
|
|
506
506
|
case 0:
|
|
507
507
|
mediaClient = attrs.mediaClient, source = attrs.source, destination = attrs.destination, traceContext = attrs.traceContext;
|
|
508
508
|
_context1.prev = 1;
|
|
509
|
-
_context1.next =
|
|
509
|
+
_context1.next = 2;
|
|
510
510
|
return mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
511
|
-
case
|
|
511
|
+
case 2:
|
|
512
512
|
_yield$mediaClient$fi = _context1.sent;
|
|
513
513
|
id = _yield$mediaClient$fi.id;
|
|
514
514
|
return _context1.abrupt("return", id);
|
|
515
|
-
case
|
|
516
|
-
_context1.prev =
|
|
517
|
-
|
|
515
|
+
case 3:
|
|
516
|
+
_context1.prev = 3;
|
|
517
|
+
_t5 = _context1["catch"](1);
|
|
518
518
|
if (!fg('platform_media_cross_client_copy')) {
|
|
519
|
-
_context1.next =
|
|
519
|
+
_context1.next = 5;
|
|
520
520
|
break;
|
|
521
521
|
}
|
|
522
522
|
// calling /v2/file/copy by removing the auth tokens to make cross product copy and pastes
|
|
523
523
|
_sourceAP = source.authProvider, copyV2Source = _objectWithoutProperties(source, _excluded);
|
|
524
524
|
_destAP = destination.authProvider, copyV2Destination = _objectWithoutProperties(destination, _excluded2);
|
|
525
|
-
_context1.next =
|
|
525
|
+
_context1.next = 4;
|
|
526
526
|
return mediaClient.file.copyFile(copyV2Source, copyV2Destination, undefined, traceContext);
|
|
527
|
-
case
|
|
527
|
+
case 4:
|
|
528
528
|
_yield$mediaClient$fi2 = _context1.sent;
|
|
529
529
|
_id = _yield$mediaClient$fi2.id;
|
|
530
530
|
return _context1.abrupt("return", _id);
|
|
531
|
-
case
|
|
532
|
-
throw
|
|
533
|
-
case
|
|
531
|
+
case 5:
|
|
532
|
+
throw _t5;
|
|
533
|
+
case 6:
|
|
534
534
|
case "end":
|
|
535
535
|
return _context1.stop();
|
|
536
536
|
}
|
|
537
|
-
}, _callee1, null, [[1,
|
|
537
|
+
}, _callee1, null, [[1, 3]]);
|
|
538
538
|
}));
|
|
539
539
|
return function (_x4) {
|
|
540
540
|
return _ref11.apply(this, arguments);
|
|
@@ -543,46 +543,46 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
543
543
|
_defineProperty(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
|
|
544
544
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(getPos) {
|
|
545
545
|
var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, clientId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
|
|
546
|
-
return _regeneratorRuntime.wrap(function
|
|
546
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
547
547
|
while (1) switch (_context10.prev = _context10.next) {
|
|
548
548
|
case 0:
|
|
549
549
|
attrs = _this.getAttrs();
|
|
550
550
|
if (!(!attrs || attrs.type !== 'external')) {
|
|
551
|
-
_context10.next =
|
|
551
|
+
_context10.next = 1;
|
|
552
552
|
break;
|
|
553
553
|
}
|
|
554
554
|
return _context10.abrupt("return");
|
|
555
|
-
case
|
|
555
|
+
case 1:
|
|
556
556
|
url = attrs.url;
|
|
557
557
|
mediaAttrs = getAttrsFromUrl(url);
|
|
558
558
|
if (mediaAttrs) {
|
|
559
|
-
_context10.next =
|
|
559
|
+
_context10.next = 2;
|
|
560
560
|
break;
|
|
561
561
|
}
|
|
562
562
|
return _context10.abrupt("return");
|
|
563
|
-
case
|
|
564
|
-
_context10.next =
|
|
563
|
+
case 2:
|
|
564
|
+
_context10.next = 3;
|
|
565
565
|
return _this.props.mediaProvider;
|
|
566
|
-
case
|
|
566
|
+
case 3:
|
|
567
567
|
mediaProvider = _context10.sent;
|
|
568
568
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
569
|
-
_context10.next =
|
|
569
|
+
_context10.next = 4;
|
|
570
570
|
break;
|
|
571
571
|
}
|
|
572
572
|
return _context10.abrupt("return");
|
|
573
|
-
case
|
|
573
|
+
case 4:
|
|
574
574
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
575
575
|
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;
|
|
576
576
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
577
577
|
if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
|
|
578
|
-
_context10.next =
|
|
578
|
+
_context10.next = 5;
|
|
579
579
|
break;
|
|
580
580
|
}
|
|
581
581
|
return _context10.abrupt("return");
|
|
582
|
-
case
|
|
582
|
+
case 5:
|
|
583
583
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
584
584
|
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
585
|
-
_context10.next =
|
|
585
|
+
_context10.next = 6;
|
|
586
586
|
return _this.handleCopyFileSwitcher({
|
|
587
587
|
mediaClient: mediaClient,
|
|
588
588
|
source: {
|
|
@@ -600,15 +600,15 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
600
600
|
occurrenceKey: uuidV4()
|
|
601
601
|
}
|
|
602
602
|
});
|
|
603
|
-
case
|
|
603
|
+
case 6:
|
|
604
604
|
mediaFileId = _context10.sent;
|
|
605
605
|
pos = getPos();
|
|
606
606
|
if (!(typeof pos !== 'number')) {
|
|
607
|
-
_context10.next =
|
|
607
|
+
_context10.next = 7;
|
|
608
608
|
break;
|
|
609
609
|
}
|
|
610
610
|
return _context10.abrupt("return");
|
|
611
|
-
case
|
|
611
|
+
case 7:
|
|
612
612
|
replaceExternalMedia(pos + 1, {
|
|
613
613
|
id: mediaFileId,
|
|
614
614
|
collection: currentCollectionName,
|
|
@@ -618,7 +618,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
618
618
|
__fileMimeType: mimeType,
|
|
619
619
|
__fileSize: size
|
|
620
620
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
621
|
-
case
|
|
621
|
+
case 8:
|
|
622
622
|
case "end":
|
|
623
623
|
return _context10.stop();
|
|
624
624
|
}
|
|
@@ -632,31 +632,31 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
632
632
|
_defineProperty(this, "copyNodeFromPos", /*#__PURE__*/function () {
|
|
633
633
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(getPos, traceContext) {
|
|
634
634
|
var attrs, copiedAttrs;
|
|
635
|
-
return _regeneratorRuntime.wrap(function
|
|
635
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
636
636
|
while (1) switch (_context11.prev = _context11.next) {
|
|
637
637
|
case 0:
|
|
638
638
|
attrs = _this.getAttrs();
|
|
639
639
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
640
|
-
_context11.next =
|
|
640
|
+
_context11.next = 1;
|
|
641
641
|
break;
|
|
642
642
|
}
|
|
643
643
|
return _context11.abrupt("return");
|
|
644
|
-
case
|
|
645
|
-
_context11.next =
|
|
644
|
+
case 1:
|
|
645
|
+
_context11.next = 2;
|
|
646
646
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
647
|
-
case
|
|
647
|
+
case 2:
|
|
648
648
|
copiedAttrs = _context11.sent;
|
|
649
649
|
if (copiedAttrs) {
|
|
650
|
-
_context11.next =
|
|
650
|
+
_context11.next = 3;
|
|
651
651
|
break;
|
|
652
652
|
}
|
|
653
653
|
return _context11.abrupt("return");
|
|
654
|
-
case
|
|
654
|
+
case 3:
|
|
655
655
|
updateCurrentMediaNodeAttrs(copiedAttrs, {
|
|
656
656
|
node: _this.props.node,
|
|
657
657
|
getPos: getPos
|
|
658
658
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
659
|
-
case
|
|
659
|
+
case 4:
|
|
660
660
|
case "end":
|
|
661
661
|
return _context11.stop();
|
|
662
662
|
}
|
|
@@ -670,29 +670,29 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
670
670
|
_defineProperty(this, "copyNode", /*#__PURE__*/function () {
|
|
671
671
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(traceContext) {
|
|
672
672
|
var attrs, view, copiedAttrs;
|
|
673
|
-
return _regeneratorRuntime.wrap(function
|
|
673
|
+
return _regeneratorRuntime.wrap(function (_context12) {
|
|
674
674
|
while (1) switch (_context12.prev = _context12.next) {
|
|
675
675
|
case 0:
|
|
676
676
|
attrs = _this.getAttrs();
|
|
677
677
|
view = _this.props.view;
|
|
678
678
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
679
|
-
_context12.next =
|
|
679
|
+
_context12.next = 1;
|
|
680
680
|
break;
|
|
681
681
|
}
|
|
682
682
|
return _context12.abrupt("return");
|
|
683
|
-
case
|
|
684
|
-
_context12.next =
|
|
683
|
+
case 1:
|
|
684
|
+
_context12.next = 2;
|
|
685
685
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
686
|
-
case
|
|
686
|
+
case 2:
|
|
687
687
|
copiedAttrs = _context12.sent;
|
|
688
688
|
if (copiedAttrs) {
|
|
689
|
-
_context12.next =
|
|
689
|
+
_context12.next = 3;
|
|
690
690
|
break;
|
|
691
691
|
}
|
|
692
692
|
return _context12.abrupt("return");
|
|
693
|
-
case
|
|
693
|
+
case 3:
|
|
694
694
|
updateMediaNodeAttrs(attrs.id, copiedAttrs)(view.state, view.dispatch);
|
|
695
|
-
case
|
|
695
|
+
case 4:
|
|
696
696
|
case "end":
|
|
697
697
|
return _context12.stop();
|
|
698
698
|
}
|
|
@@ -705,36 +705,36 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
705
705
|
_defineProperty(this, "copyFile", /*#__PURE__*/function () {
|
|
706
706
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, collection, traceContext) {
|
|
707
707
|
var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, clientId, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
|
|
708
|
-
return _regeneratorRuntime.wrap(function
|
|
708
|
+
return _regeneratorRuntime.wrap(function (_context13) {
|
|
709
709
|
while (1) switch (_context13.prev = _context13.next) {
|
|
710
710
|
case 0:
|
|
711
|
-
_context13.next =
|
|
711
|
+
_context13.next = 1;
|
|
712
712
|
return _this.props.mediaProvider;
|
|
713
|
-
case
|
|
713
|
+
case 1:
|
|
714
714
|
mediaProvider = _context13.sent;
|
|
715
715
|
if (mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams) {
|
|
716
|
-
_context13.next =
|
|
716
|
+
_context13.next = 2;
|
|
717
717
|
break;
|
|
718
718
|
}
|
|
719
719
|
return _context13.abrupt("return");
|
|
720
|
-
case
|
|
720
|
+
case 2:
|
|
721
721
|
nodeContextId = _this.getNodeContextId();
|
|
722
722
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
723
723
|
if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
|
|
724
|
-
_context13.next =
|
|
724
|
+
_context13.next = 3;
|
|
725
725
|
break;
|
|
726
726
|
}
|
|
727
727
|
return _context13.abrupt("return");
|
|
728
|
-
case
|
|
728
|
+
case 3:
|
|
729
729
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
730
730
|
clientId = fg('platform_media_cross_client_copy_with_auth') ? getClientIdForFile(id) : undefined;
|
|
731
731
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
732
|
-
_context13.next =
|
|
732
|
+
_context13.next = 4;
|
|
733
733
|
return _this.getObjectId();
|
|
734
|
-
case
|
|
734
|
+
case 4:
|
|
735
735
|
objectId = _context13.sent;
|
|
736
736
|
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
737
|
-
_context13.next =
|
|
737
|
+
_context13.next = 5;
|
|
738
738
|
return _this.handleCopyFileSwitcher({
|
|
739
739
|
mediaClient: mediaClient,
|
|
740
740
|
source: {
|
|
@@ -753,14 +753,14 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
753
753
|
},
|
|
754
754
|
traceContext: traceContext
|
|
755
755
|
});
|
|
756
|
-
case
|
|
756
|
+
case 5:
|
|
757
757
|
mediaFileId = _context13.sent;
|
|
758
758
|
return _context13.abrupt("return", {
|
|
759
759
|
id: mediaFileId,
|
|
760
760
|
collection: currentCollectionName,
|
|
761
761
|
__contextId: objectId
|
|
762
762
|
});
|
|
763
|
-
case
|
|
763
|
+
case 6:
|
|
764
764
|
case "end":
|
|
765
765
|
return _context13.stop();
|
|
766
766
|
}
|
|
@@ -789,37 +789,37 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
789
789
|
value: function () {
|
|
790
790
|
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
791
791
|
var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
|
|
792
|
-
return _regeneratorRuntime.wrap(function
|
|
792
|
+
return _regeneratorRuntime.wrap(function (_context14) {
|
|
793
793
|
while (1) switch (_context14.prev = _context14.next) {
|
|
794
794
|
case 0:
|
|
795
|
-
_context14.next =
|
|
795
|
+
_context14.next = 1;
|
|
796
796
|
return this.props.mediaProvider;
|
|
797
|
-
case
|
|
797
|
+
case 1:
|
|
798
798
|
mediaProvider = _context14.sent;
|
|
799
799
|
mediaOptions = this.props.mediaOptions;
|
|
800
800
|
attrs = this.getAttrs();
|
|
801
801
|
if (!(!mediaProvider || !attrs)) {
|
|
802
|
-
_context14.next =
|
|
802
|
+
_context14.next = 2;
|
|
803
803
|
break;
|
|
804
804
|
}
|
|
805
805
|
return _context14.abrupt("return", false);
|
|
806
|
-
case
|
|
806
|
+
case 2:
|
|
807
807
|
height = attrs.height, width = attrs.width;
|
|
808
808
|
if (!(attrs.type === 'external' || !attrs.id)) {
|
|
809
|
-
_context14.next =
|
|
809
|
+
_context14.next = 3;
|
|
810
810
|
break;
|
|
811
811
|
}
|
|
812
812
|
return _context14.abrupt("return", false);
|
|
813
|
-
case
|
|
813
|
+
case 3:
|
|
814
814
|
id = attrs.id, collection = attrs.collection;
|
|
815
815
|
if (!(height && width)) {
|
|
816
|
-
_context14.next =
|
|
816
|
+
_context14.next = 4;
|
|
817
817
|
break;
|
|
818
818
|
}
|
|
819
819
|
return _context14.abrupt("return", false);
|
|
820
|
-
case
|
|
820
|
+
case 4:
|
|
821
821
|
if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
|
|
822
|
-
_context14.next =
|
|
822
|
+
_context14.next = 5;
|
|
823
823
|
break;
|
|
824
824
|
}
|
|
825
825
|
return _context14.abrupt("return", {
|
|
@@ -827,39 +827,39 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
827
827
|
height: DEFAULT_IMAGE_HEIGHT,
|
|
828
828
|
width: DEFAULT_IMAGE_WIDTH
|
|
829
829
|
});
|
|
830
|
-
case
|
|
830
|
+
case 5:
|
|
831
831
|
viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
832
832
|
mediaClient = getMediaClient(viewMediaClientConfig);
|
|
833
|
-
_context14.next =
|
|
833
|
+
_context14.next = 6;
|
|
834
834
|
return mediaClient.file.getCurrentState(id, {
|
|
835
835
|
collectionName: collection
|
|
836
836
|
});
|
|
837
|
-
case
|
|
837
|
+
case 6:
|
|
838
838
|
currentState = _context14.sent;
|
|
839
839
|
if (isImageRepresentationReady(currentState)) {
|
|
840
|
-
_context14.next =
|
|
840
|
+
_context14.next = 7;
|
|
841
841
|
break;
|
|
842
842
|
}
|
|
843
843
|
return _context14.abrupt("return", false);
|
|
844
|
-
case
|
|
845
|
-
_context14.next =
|
|
844
|
+
case 7:
|
|
845
|
+
_context14.next = 8;
|
|
846
846
|
return mediaClient.getImageMetadata(id, {
|
|
847
847
|
collection: collection
|
|
848
848
|
});
|
|
849
|
-
case
|
|
849
|
+
case 8:
|
|
850
850
|
imageMetadata = _context14.sent;
|
|
851
851
|
if (!(!imageMetadata || !imageMetadata.original)) {
|
|
852
|
-
_context14.next =
|
|
852
|
+
_context14.next = 9;
|
|
853
853
|
break;
|
|
854
854
|
}
|
|
855
855
|
return _context14.abrupt("return", false);
|
|
856
|
-
case
|
|
856
|
+
case 9:
|
|
857
857
|
return _context14.abrupt("return", {
|
|
858
858
|
id: id,
|
|
859
859
|
height: imageMetadata.original.height || DEFAULT_IMAGE_HEIGHT,
|
|
860
860
|
width: imageMetadata.original.width || DEFAULT_IMAGE_WIDTH
|
|
861
861
|
});
|
|
862
|
-
case
|
|
862
|
+
case 10:
|
|
863
863
|
case "end":
|
|
864
864
|
return _context14.stop();
|
|
865
865
|
}
|
|
@@ -874,35 +874,36 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
874
874
|
key: "handleExternalMedia",
|
|
875
875
|
value: function () {
|
|
876
876
|
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(getPos) {
|
|
877
|
-
|
|
877
|
+
var _t6;
|
|
878
|
+
return _regeneratorRuntime.wrap(function (_context15) {
|
|
878
879
|
while (1) switch (_context15.prev = _context15.next) {
|
|
879
880
|
case 0:
|
|
880
881
|
if (!this.isMediaBlobUrl()) {
|
|
881
|
-
_context15.next =
|
|
882
|
+
_context15.next = 5;
|
|
882
883
|
break;
|
|
883
884
|
}
|
|
884
885
|
_context15.prev = 1;
|
|
885
|
-
_context15.next =
|
|
886
|
+
_context15.next = 2;
|
|
886
887
|
return this.copyNodeFromBlobUrl(getPos);
|
|
887
|
-
case
|
|
888
|
-
_context15.next =
|
|
888
|
+
case 2:
|
|
889
|
+
_context15.next = 4;
|
|
889
890
|
break;
|
|
890
|
-
case
|
|
891
|
-
_context15.prev =
|
|
892
|
-
|
|
893
|
-
_context15.next =
|
|
891
|
+
case 3:
|
|
892
|
+
_context15.prev = 3;
|
|
893
|
+
_t6 = _context15["catch"](1);
|
|
894
|
+
_context15.next = 4;
|
|
894
895
|
return this.uploadExternalMedia(getPos);
|
|
895
|
-
case
|
|
896
|
-
_context15.next =
|
|
896
|
+
case 4:
|
|
897
|
+
_context15.next = 6;
|
|
897
898
|
break;
|
|
898
|
-
case
|
|
899
|
-
_context15.next =
|
|
899
|
+
case 5:
|
|
900
|
+
_context15.next = 6;
|
|
900
901
|
return this.uploadExternalMedia(getPos);
|
|
901
|
-
case
|
|
902
|
+
case 6:
|
|
902
903
|
case "end":
|
|
903
904
|
return _context15.stop();
|
|
904
905
|
}
|
|
905
|
-
}, _callee15, this, [[1,
|
|
906
|
+
}, _callee15, this, [[1, 3]]);
|
|
906
907
|
}));
|
|
907
908
|
function handleExternalMedia(_x10) {
|
|
908
909
|
return _handleExternalMedia.apply(this, arguments);
|