@atlaskit/editor-plugin-media 3.0.10 → 3.0.12
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 +15 -0
- package/dist/cjs/mediaPlugin.js +14 -15
- package/dist/cjs/nodeviews/lazy-media-group.js +4 -3
- package/dist/cjs/nodeviews/lazy-media-inline.js +4 -3
- package/dist/cjs/nodeviews/lazy-media-single.js +1 -2
- package/dist/cjs/nodeviews/lazy-media.js +1 -2
- package/dist/cjs/nodeviews/mediaGroupNext.js +1 -2
- package/dist/cjs/nodeviews/mediaNodeUpdater.js +140 -140
- package/dist/cjs/nodeviews/mediaNodeView/media.js +1 -2
- package/dist/cjs/nodeviews/mediaSingle.js +1 -2
- package/dist/cjs/nodeviews/mediaSingleNext.js +1 -2
- package/dist/cjs/pm-plugins/main.js +1 -2
- package/dist/cjs/pm-plugins/pixel-resizing/ui/pixel-entry.js +1 -2
- package/dist/cjs/ui/CaptionPlaceholder/index.js +1 -2
- package/dist/cjs/ui/CommentBadge/index.js +1 -2
- package/dist/cjs/ui/ImageBorder/styles.js +1 -2
- package/dist/cjs/ui/MediaLinkingToolbar.js +1 -2
- package/dist/cjs/ui/MediaViewer/MediaViewerContainer.js +1 -2
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +1 -2
- package/dist/cjs/ui/ResizableMediaSingle/styles.js +1 -2
- package/dist/cjs/ui/toolbar/index.js +6 -7
- package/dist/cjs/ui/toolbar/linking-toolbar-appearance.js +1 -2
- package/dist/cjs/ui/toolbar/mediaInline.js +1 -2
- package/dist/es2019/nodeviews/lazy-media-group.js +3 -1
- package/dist/es2019/nodeviews/lazy-media-inline.js +3 -1
- package/dist/es2019/ui/toolbar/index.js +7 -7
- package/dist/esm/mediaPlugin.js +13 -13
- package/dist/esm/nodeviews/lazy-media-group.js +3 -1
- package/dist/esm/nodeviews/lazy-media-inline.js +3 -1
- package/dist/esm/nodeviews/mediaNodeUpdater.js +140 -140
- package/dist/esm/ui/toolbar/index.js +5 -5
- package/package.json +6 -6
|
@@ -342,12 +342,12 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
342
342
|
}
|
|
343
343
|
});
|
|
344
344
|
_defineProperty(this, "shouldNodeBeDeepCopied", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
345
|
-
var
|
|
345
|
+
var _ref0, _this$props$mediaOpti, _this$props$mediaOpti2, _this$mediaPluginStat;
|
|
346
346
|
var scope, attrs, id, isIdentifierOutsideEditorScope;
|
|
347
347
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
348
348
|
while (1) switch (_context8.prev = _context8.next) {
|
|
349
349
|
case 0:
|
|
350
|
-
scope = (
|
|
350
|
+
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';
|
|
351
351
|
if (!(scope === 'context')) {
|
|
352
352
|
_context8.next = 7;
|
|
353
353
|
break;
|
|
@@ -396,139 +396,139 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
396
396
|
}
|
|
397
397
|
}, _callee9);
|
|
398
398
|
})));
|
|
399
|
-
_defineProperty(this, "isNodeFromDifferentCollection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
399
|
+
_defineProperty(this, "isNodeFromDifferentCollection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
|
|
400
400
|
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId;
|
|
401
|
-
return _regeneratorRuntime.wrap(function
|
|
402
|
-
while (1) switch (
|
|
401
|
+
return _regeneratorRuntime.wrap(function _callee0$(_context0) {
|
|
402
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
403
403
|
case 0:
|
|
404
|
-
|
|
404
|
+
_context0.next = 2;
|
|
405
405
|
return _this.props.mediaProvider;
|
|
406
406
|
case 2:
|
|
407
|
-
mediaProvider =
|
|
407
|
+
mediaProvider = _context0.sent;
|
|
408
408
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
409
|
-
|
|
409
|
+
_context0.next = 5;
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
|
-
return
|
|
412
|
+
return _context0.abrupt("return", false);
|
|
413
413
|
case 5:
|
|
414
414
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
415
415
|
attrs = _this.getAttrs();
|
|
416
416
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
417
|
-
|
|
417
|
+
_context0.next = 9;
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
|
-
return
|
|
420
|
+
return _context0.abrupt("return", false);
|
|
421
421
|
case 9:
|
|
422
422
|
nodeCollection = attrs.collection, __contextId = attrs.__contextId;
|
|
423
|
-
|
|
424
|
-
if (
|
|
425
|
-
|
|
423
|
+
_context0.t0 = __contextId;
|
|
424
|
+
if (_context0.t0) {
|
|
425
|
+
_context0.next = 15;
|
|
426
426
|
break;
|
|
427
427
|
}
|
|
428
|
-
|
|
428
|
+
_context0.next = 14;
|
|
429
429
|
return _this.getObjectId();
|
|
430
430
|
case 14:
|
|
431
|
-
|
|
431
|
+
_context0.t0 = _context0.sent;
|
|
432
432
|
case 15:
|
|
433
|
-
contextId =
|
|
433
|
+
contextId = _context0.t0;
|
|
434
434
|
if (!(contextId && currentCollectionName !== nodeCollection)) {
|
|
435
|
-
|
|
435
|
+
_context0.next = 18;
|
|
436
436
|
break;
|
|
437
437
|
}
|
|
438
|
-
return
|
|
438
|
+
return _context0.abrupt("return", true);
|
|
439
439
|
case 18:
|
|
440
|
-
return
|
|
440
|
+
return _context0.abrupt("return", false);
|
|
441
441
|
case 19:
|
|
442
442
|
case "end":
|
|
443
|
-
return
|
|
443
|
+
return _context0.stop();
|
|
444
444
|
}
|
|
445
|
-
},
|
|
445
|
+
}, _callee0);
|
|
446
446
|
})));
|
|
447
447
|
_defineProperty(this, "handleCopyFileSwitcher", /*#__PURE__*/function () {
|
|
448
|
-
var
|
|
448
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee1(attrs) {
|
|
449
449
|
var mediaClient, source, destination, traceContext, _yield$mediaClient$fi, id, _sourceAP, copyV2Source, _destAP, copyV2Destination, _yield$mediaClient$fi2, _id;
|
|
450
|
-
return _regeneratorRuntime.wrap(function
|
|
451
|
-
while (1) switch (
|
|
450
|
+
return _regeneratorRuntime.wrap(function _callee1$(_context1) {
|
|
451
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
452
452
|
case 0:
|
|
453
453
|
mediaClient = attrs.mediaClient, source = attrs.source, destination = attrs.destination, traceContext = attrs.traceContext;
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
_context1.prev = 1;
|
|
455
|
+
_context1.next = 4;
|
|
456
456
|
return mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
457
457
|
case 4:
|
|
458
|
-
_yield$mediaClient$fi =
|
|
458
|
+
_yield$mediaClient$fi = _context1.sent;
|
|
459
459
|
id = _yield$mediaClient$fi.id;
|
|
460
|
-
return
|
|
460
|
+
return _context1.abrupt("return", id);
|
|
461
461
|
case 9:
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
_context1.prev = 9;
|
|
463
|
+
_context1.t0 = _context1["catch"](1);
|
|
464
464
|
if (!fg('platform_media_cross_client_copy')) {
|
|
465
|
-
|
|
465
|
+
_context1.next = 21;
|
|
466
466
|
break;
|
|
467
467
|
}
|
|
468
468
|
// calling /v2/file/copy by removing the auth tokens to make cross product copy and pastes
|
|
469
469
|
_sourceAP = source.authProvider, copyV2Source = _objectWithoutProperties(source, _excluded);
|
|
470
470
|
_destAP = destination.authProvider, copyV2Destination = _objectWithoutProperties(destination, _excluded2);
|
|
471
|
-
|
|
471
|
+
_context1.next = 16;
|
|
472
472
|
return mediaClient.file.copyFile(copyV2Source, copyV2Destination, undefined, traceContext);
|
|
473
473
|
case 16:
|
|
474
|
-
_yield$mediaClient$fi2 =
|
|
474
|
+
_yield$mediaClient$fi2 = _context1.sent;
|
|
475
475
|
_id = _yield$mediaClient$fi2.id;
|
|
476
|
-
return
|
|
476
|
+
return _context1.abrupt("return", _id);
|
|
477
477
|
case 21:
|
|
478
|
-
throw
|
|
478
|
+
throw _context1.t0;
|
|
479
479
|
case 22:
|
|
480
480
|
case "end":
|
|
481
|
-
return
|
|
481
|
+
return _context1.stop();
|
|
482
482
|
}
|
|
483
|
-
},
|
|
483
|
+
}, _callee1, null, [[1, 9]]);
|
|
484
484
|
}));
|
|
485
485
|
return function (_x4) {
|
|
486
|
-
return
|
|
486
|
+
return _ref11.apply(this, arguments);
|
|
487
487
|
};
|
|
488
488
|
}());
|
|
489
489
|
_defineProperty(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
|
|
490
|
-
var
|
|
490
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(getPos) {
|
|
491
491
|
var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
|
|
492
|
-
return _regeneratorRuntime.wrap(function
|
|
493
|
-
while (1) switch (
|
|
492
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
493
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
494
494
|
case 0:
|
|
495
495
|
attrs = _this.getAttrs();
|
|
496
496
|
if (!(!attrs || attrs.type !== 'external')) {
|
|
497
|
-
|
|
497
|
+
_context10.next = 3;
|
|
498
498
|
break;
|
|
499
499
|
}
|
|
500
|
-
return
|
|
500
|
+
return _context10.abrupt("return");
|
|
501
501
|
case 3:
|
|
502
502
|
url = attrs.url;
|
|
503
503
|
mediaAttrs = getAttrsFromUrl(url);
|
|
504
504
|
if (mediaAttrs) {
|
|
505
|
-
|
|
505
|
+
_context10.next = 7;
|
|
506
506
|
break;
|
|
507
507
|
}
|
|
508
|
-
return
|
|
508
|
+
return _context10.abrupt("return");
|
|
509
509
|
case 7:
|
|
510
|
-
|
|
510
|
+
_context10.next = 9;
|
|
511
511
|
return _this.props.mediaProvider;
|
|
512
512
|
case 9:
|
|
513
|
-
mediaProvider =
|
|
513
|
+
mediaProvider = _context10.sent;
|
|
514
514
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
515
|
-
|
|
515
|
+
_context10.next = 12;
|
|
516
516
|
break;
|
|
517
517
|
}
|
|
518
|
-
return
|
|
518
|
+
return _context10.abrupt("return");
|
|
519
519
|
case 12:
|
|
520
520
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
521
521
|
contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
|
|
522
522
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
523
523
|
if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
|
|
524
|
-
|
|
524
|
+
_context10.next = 17;
|
|
525
525
|
break;
|
|
526
526
|
}
|
|
527
|
-
return
|
|
527
|
+
return _context10.abrupt("return");
|
|
528
528
|
case 17:
|
|
529
529
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
530
530
|
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
531
|
-
|
|
531
|
+
_context10.next = 21;
|
|
532
532
|
return _this.handleCopyFileSwitcher({
|
|
533
533
|
mediaClient: mediaClient,
|
|
534
534
|
source: {
|
|
@@ -545,13 +545,13 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
547
|
case 21:
|
|
548
|
-
mediaFileId =
|
|
548
|
+
mediaFileId = _context10.sent;
|
|
549
549
|
pos = getPos();
|
|
550
550
|
if (!(typeof pos !== 'number')) {
|
|
551
|
-
|
|
551
|
+
_context10.next = 25;
|
|
552
552
|
break;
|
|
553
553
|
}
|
|
554
|
-
return
|
|
554
|
+
return _context10.abrupt("return");
|
|
555
555
|
case 25:
|
|
556
556
|
replaceExternalMedia(pos + 1, {
|
|
557
557
|
id: mediaFileId,
|
|
@@ -564,37 +564,37 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
564
564
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
565
565
|
case 26:
|
|
566
566
|
case "end":
|
|
567
|
-
return
|
|
567
|
+
return _context10.stop();
|
|
568
568
|
}
|
|
569
|
-
},
|
|
569
|
+
}, _callee10);
|
|
570
570
|
}));
|
|
571
571
|
return function (_x5) {
|
|
572
|
-
return
|
|
572
|
+
return _ref12.apply(this, arguments);
|
|
573
573
|
};
|
|
574
574
|
}());
|
|
575
575
|
// Copies the pasted node into the current collection using a getPos handler
|
|
576
576
|
_defineProperty(this, "copyNodeFromPos", /*#__PURE__*/function () {
|
|
577
|
-
var
|
|
577
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(getPos, traceContext) {
|
|
578
578
|
var attrs, copiedAttrs;
|
|
579
|
-
return _regeneratorRuntime.wrap(function
|
|
580
|
-
while (1) switch (
|
|
579
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
580
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
581
581
|
case 0:
|
|
582
582
|
attrs = _this.getAttrs();
|
|
583
583
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
584
|
-
|
|
584
|
+
_context11.next = 3;
|
|
585
585
|
break;
|
|
586
586
|
}
|
|
587
|
-
return
|
|
587
|
+
return _context11.abrupt("return");
|
|
588
588
|
case 3:
|
|
589
|
-
|
|
589
|
+
_context11.next = 5;
|
|
590
590
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
591
591
|
case 5:
|
|
592
|
-
copiedAttrs =
|
|
592
|
+
copiedAttrs = _context11.sent;
|
|
593
593
|
if (copiedAttrs) {
|
|
594
|
-
|
|
594
|
+
_context11.next = 8;
|
|
595
595
|
break;
|
|
596
596
|
}
|
|
597
|
-
return
|
|
597
|
+
return _context11.abrupt("return");
|
|
598
598
|
case 8:
|
|
599
599
|
updateCurrentMediaNodeAttrs(copiedAttrs, {
|
|
600
600
|
node: _this.props.node,
|
|
@@ -602,82 +602,82 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
602
602
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
603
603
|
case 9:
|
|
604
604
|
case "end":
|
|
605
|
-
return
|
|
605
|
+
return _context11.stop();
|
|
606
606
|
}
|
|
607
|
-
},
|
|
607
|
+
}, _callee11);
|
|
608
608
|
}));
|
|
609
609
|
return function (_x6, _x7) {
|
|
610
|
-
return
|
|
610
|
+
return _ref13.apply(this, arguments);
|
|
611
611
|
};
|
|
612
612
|
}());
|
|
613
613
|
// Copies the pasted node into the current collection
|
|
614
614
|
_defineProperty(this, "copyNode", /*#__PURE__*/function () {
|
|
615
|
-
var
|
|
615
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(traceContext) {
|
|
616
616
|
var attrs, view, copiedAttrs;
|
|
617
|
-
return _regeneratorRuntime.wrap(function
|
|
618
|
-
while (1) switch (
|
|
617
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
618
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
619
619
|
case 0:
|
|
620
620
|
attrs = _this.getAttrs();
|
|
621
621
|
view = _this.props.view;
|
|
622
622
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
623
|
-
|
|
623
|
+
_context12.next = 4;
|
|
624
624
|
break;
|
|
625
625
|
}
|
|
626
|
-
return
|
|
626
|
+
return _context12.abrupt("return");
|
|
627
627
|
case 4:
|
|
628
|
-
|
|
628
|
+
_context12.next = 6;
|
|
629
629
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
630
630
|
case 6:
|
|
631
|
-
copiedAttrs =
|
|
631
|
+
copiedAttrs = _context12.sent;
|
|
632
632
|
if (copiedAttrs) {
|
|
633
|
-
|
|
633
|
+
_context12.next = 9;
|
|
634
634
|
break;
|
|
635
635
|
}
|
|
636
|
-
return
|
|
636
|
+
return _context12.abrupt("return");
|
|
637
637
|
case 9:
|
|
638
638
|
updateMediaNodeAttrs(attrs.id, copiedAttrs)(view.state, view.dispatch);
|
|
639
639
|
case 10:
|
|
640
640
|
case "end":
|
|
641
|
-
return
|
|
641
|
+
return _context12.stop();
|
|
642
642
|
}
|
|
643
|
-
},
|
|
643
|
+
}, _callee12);
|
|
644
644
|
}));
|
|
645
645
|
return function (_x8) {
|
|
646
|
-
return
|
|
646
|
+
return _ref14.apply(this, arguments);
|
|
647
647
|
};
|
|
648
648
|
}());
|
|
649
649
|
_defineProperty(this, "copyFile", /*#__PURE__*/function () {
|
|
650
|
-
var
|
|
650
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, collection, traceContext) {
|
|
651
651
|
var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
|
|
652
|
-
return _regeneratorRuntime.wrap(function
|
|
653
|
-
while (1) switch (
|
|
652
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
653
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
654
654
|
case 0:
|
|
655
|
-
|
|
655
|
+
_context13.next = 2;
|
|
656
656
|
return _this.props.mediaProvider;
|
|
657
657
|
case 2:
|
|
658
|
-
mediaProvider =
|
|
658
|
+
mediaProvider = _context13.sent;
|
|
659
659
|
if (mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams) {
|
|
660
|
-
|
|
660
|
+
_context13.next = 5;
|
|
661
661
|
break;
|
|
662
662
|
}
|
|
663
|
-
return
|
|
663
|
+
return _context13.abrupt("return");
|
|
664
664
|
case 5:
|
|
665
665
|
nodeContextId = _this.getNodeContextId();
|
|
666
666
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
667
667
|
if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
|
|
668
|
-
|
|
668
|
+
_context13.next = 9;
|
|
669
669
|
break;
|
|
670
670
|
}
|
|
671
|
-
return
|
|
671
|
+
return _context13.abrupt("return");
|
|
672
672
|
case 9:
|
|
673
673
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
674
674
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
675
|
-
|
|
675
|
+
_context13.next = 13;
|
|
676
676
|
return _this.getObjectId();
|
|
677
677
|
case 13:
|
|
678
|
-
objectId =
|
|
678
|
+
objectId = _context13.sent;
|
|
679
679
|
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
680
|
-
|
|
680
|
+
_context13.next = 17;
|
|
681
681
|
return _this.handleCopyFileSwitcher({
|
|
682
682
|
mediaClient: mediaClient,
|
|
683
683
|
source: {
|
|
@@ -695,20 +695,20 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
695
695
|
traceContext: traceContext
|
|
696
696
|
});
|
|
697
697
|
case 17:
|
|
698
|
-
mediaFileId =
|
|
699
|
-
return
|
|
698
|
+
mediaFileId = _context13.sent;
|
|
699
|
+
return _context13.abrupt("return", {
|
|
700
700
|
id: mediaFileId,
|
|
701
701
|
collection: currentCollectionName,
|
|
702
702
|
__contextId: objectId
|
|
703
703
|
});
|
|
704
704
|
case 19:
|
|
705
705
|
case "end":
|
|
706
|
-
return
|
|
706
|
+
return _context13.stop();
|
|
707
707
|
}
|
|
708
|
-
},
|
|
708
|
+
}, _callee13);
|
|
709
709
|
}));
|
|
710
|
-
return function (_x9,
|
|
711
|
-
return
|
|
710
|
+
return function (_x9, _x0, _x1) {
|
|
711
|
+
return _ref15.apply(this, arguments);
|
|
712
712
|
};
|
|
713
713
|
}());
|
|
714
714
|
this.props = props;
|
|
@@ -728,42 +728,42 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
728
728
|
}, {
|
|
729
729
|
key: "getRemoteDimensions",
|
|
730
730
|
value: function () {
|
|
731
|
-
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
731
|
+
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
732
732
|
var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
|
|
733
|
-
return _regeneratorRuntime.wrap(function
|
|
734
|
-
while (1) switch (
|
|
733
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
734
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
735
735
|
case 0:
|
|
736
|
-
|
|
736
|
+
_context14.next = 2;
|
|
737
737
|
return this.props.mediaProvider;
|
|
738
738
|
case 2:
|
|
739
|
-
mediaProvider =
|
|
739
|
+
mediaProvider = _context14.sent;
|
|
740
740
|
mediaOptions = this.props.mediaOptions;
|
|
741
741
|
attrs = this.getAttrs();
|
|
742
742
|
if (!(!mediaProvider || !attrs)) {
|
|
743
|
-
|
|
743
|
+
_context14.next = 7;
|
|
744
744
|
break;
|
|
745
745
|
}
|
|
746
|
-
return
|
|
746
|
+
return _context14.abrupt("return", false);
|
|
747
747
|
case 7:
|
|
748
748
|
height = attrs.height, width = attrs.width;
|
|
749
749
|
if (!(attrs.type === 'external' || !attrs.id)) {
|
|
750
|
-
|
|
750
|
+
_context14.next = 10;
|
|
751
751
|
break;
|
|
752
752
|
}
|
|
753
|
-
return
|
|
753
|
+
return _context14.abrupt("return", false);
|
|
754
754
|
case 10:
|
|
755
755
|
id = attrs.id, collection = attrs.collection;
|
|
756
756
|
if (!(height && width)) {
|
|
757
|
-
|
|
757
|
+
_context14.next = 13;
|
|
758
758
|
break;
|
|
759
759
|
}
|
|
760
|
-
return
|
|
760
|
+
return _context14.abrupt("return", false);
|
|
761
761
|
case 13:
|
|
762
762
|
if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
|
|
763
|
-
|
|
763
|
+
_context14.next = 15;
|
|
764
764
|
break;
|
|
765
765
|
}
|
|
766
|
-
return
|
|
766
|
+
return _context14.abrupt("return", {
|
|
767
767
|
id: id,
|
|
768
768
|
height: DEFAULT_IMAGE_HEIGHT,
|
|
769
769
|
width: DEFAULT_IMAGE_WIDTH
|
|
@@ -771,40 +771,40 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
771
771
|
case 15:
|
|
772
772
|
viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
773
773
|
mediaClient = getMediaClient(viewMediaClientConfig);
|
|
774
|
-
|
|
774
|
+
_context14.next = 19;
|
|
775
775
|
return mediaClient.file.getCurrentState(id, {
|
|
776
776
|
collectionName: collection
|
|
777
777
|
});
|
|
778
778
|
case 19:
|
|
779
|
-
currentState =
|
|
779
|
+
currentState = _context14.sent;
|
|
780
780
|
if (isImageRepresentationReady(currentState)) {
|
|
781
|
-
|
|
781
|
+
_context14.next = 22;
|
|
782
782
|
break;
|
|
783
783
|
}
|
|
784
|
-
return
|
|
784
|
+
return _context14.abrupt("return", false);
|
|
785
785
|
case 22:
|
|
786
|
-
|
|
786
|
+
_context14.next = 24;
|
|
787
787
|
return mediaClient.getImageMetadata(id, {
|
|
788
788
|
collection: collection
|
|
789
789
|
});
|
|
790
790
|
case 24:
|
|
791
|
-
imageMetadata =
|
|
791
|
+
imageMetadata = _context14.sent;
|
|
792
792
|
if (!(!imageMetadata || !imageMetadata.original)) {
|
|
793
|
-
|
|
793
|
+
_context14.next = 27;
|
|
794
794
|
break;
|
|
795
795
|
}
|
|
796
|
-
return
|
|
796
|
+
return _context14.abrupt("return", false);
|
|
797
797
|
case 27:
|
|
798
|
-
return
|
|
798
|
+
return _context14.abrupt("return", {
|
|
799
799
|
id: id,
|
|
800
800
|
height: imageMetadata.original.height || DEFAULT_IMAGE_HEIGHT,
|
|
801
801
|
width: imageMetadata.original.width || DEFAULT_IMAGE_WIDTH
|
|
802
802
|
});
|
|
803
803
|
case 28:
|
|
804
804
|
case "end":
|
|
805
|
-
return
|
|
805
|
+
return _context14.stop();
|
|
806
806
|
}
|
|
807
|
-
},
|
|
807
|
+
}, _callee14, this);
|
|
808
808
|
}));
|
|
809
809
|
function getRemoteDimensions() {
|
|
810
810
|
return _getRemoteDimensions.apply(this, arguments);
|
|
@@ -814,38 +814,38 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
814
814
|
}, {
|
|
815
815
|
key: "handleExternalMedia",
|
|
816
816
|
value: function () {
|
|
817
|
-
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
818
|
-
return _regeneratorRuntime.wrap(function
|
|
819
|
-
while (1) switch (
|
|
817
|
+
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(getPos) {
|
|
818
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
819
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
820
820
|
case 0:
|
|
821
821
|
if (!this.isMediaBlobUrl()) {
|
|
822
|
-
|
|
822
|
+
_context15.next = 12;
|
|
823
823
|
break;
|
|
824
824
|
}
|
|
825
|
-
|
|
826
|
-
|
|
825
|
+
_context15.prev = 1;
|
|
826
|
+
_context15.next = 4;
|
|
827
827
|
return this.copyNodeFromBlobUrl(getPos);
|
|
828
828
|
case 4:
|
|
829
|
-
|
|
829
|
+
_context15.next = 10;
|
|
830
830
|
break;
|
|
831
831
|
case 6:
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
832
|
+
_context15.prev = 6;
|
|
833
|
+
_context15.t0 = _context15["catch"](1);
|
|
834
|
+
_context15.next = 10;
|
|
835
835
|
return this.uploadExternalMedia(getPos);
|
|
836
836
|
case 10:
|
|
837
|
-
|
|
837
|
+
_context15.next = 14;
|
|
838
838
|
break;
|
|
839
839
|
case 12:
|
|
840
|
-
|
|
840
|
+
_context15.next = 14;
|
|
841
841
|
return this.uploadExternalMedia(getPos);
|
|
842
842
|
case 14:
|
|
843
843
|
case "end":
|
|
844
|
-
return
|
|
844
|
+
return _context15.stop();
|
|
845
845
|
}
|
|
846
|
-
},
|
|
846
|
+
}, _callee15, this, [[1, 6]]);
|
|
847
847
|
}));
|
|
848
|
-
function handleExternalMedia(
|
|
848
|
+
function handleExternalMedia(_x10) {
|
|
849
849
|
return _handleExternalMedia.apply(this, arguments);
|
|
850
850
|
}
|
|
851
851
|
return handleExternalMedia;
|
|
@@ -808,7 +808,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
808
808
|
selectedNodeType = state.selection.node.type;
|
|
809
809
|
}
|
|
810
810
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
811
|
-
var _pluginInjectionApi$
|
|
811
|
+
var _pluginInjectionApi$a0, _pluginInjectionApi$f2;
|
|
812
812
|
var mediaOffset = state.selection.$from.parentOffset + 1;
|
|
813
813
|
baseToolbar.getDomRef = function () {
|
|
814
814
|
var _mediaPluginState$ele2;
|
|
@@ -817,7 +817,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
817
817
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
818
818
|
return (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(selector);
|
|
819
819
|
};
|
|
820
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
820
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a0 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a0 === void 0 ? void 0 : _pluginInjectionApi$a0.actions, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector, isViewOnly);
|
|
821
821
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
822
822
|
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options);
|
|
823
823
|
} else {
|
|
@@ -831,9 +831,9 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
831
831
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi);
|
|
832
832
|
}
|
|
833
833
|
if (!mediaPluginState.isResizing && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
834
|
-
var _pluginInjectionApi$
|
|
834
|
+
var _pluginInjectionApi$a1, _pluginInjectionApi$a10;
|
|
835
835
|
updateToFullHeightSeparator(items);
|
|
836
|
-
var customOptions = [].concat(_toConsumableArray(getLinkingDropdownOptions(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly)), _toConsumableArray(getAltTextDropdownOption(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
836
|
+
var customOptions = [].concat(_toConsumableArray(getLinkingDropdownOptions(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly)), _toConsumableArray(getAltTextDropdownOption(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a1 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a1 === void 0 ? void 0 : _pluginInjectionApi$a1.actions)), _toConsumableArray(getResizeDropdownOption(options, state, intl.formatMessage, selectedNodeType)));
|
|
837
837
|
if (customOptions.length) {
|
|
838
838
|
customOptions.push({
|
|
839
839
|
type: 'separator'
|
|
@@ -864,7 +864,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
864
864
|
})
|
|
865
865
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)), _objectSpread({
|
|
866
866
|
title: intl === null || intl === void 0 ? void 0 : intl.formatMessage(commonMessages.delete),
|
|
867
|
-
onClick: fg('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
867
|
+
onClick: fg('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a10 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a10 === void 0 ? void 0 : _pluginInjectionApi$a10.actions, selectedNodeType) : remove,
|
|
868
868
|
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
869
869
|
label: ""
|
|
870
870
|
})
|