@atlaskit/editor-plugin-media 1.43.12 → 1.43.14
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 +14 -0
- package/dist/cjs/nodeviews/mediaNodeUpdater.js +186 -147
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +4 -0
- package/dist/cjs/pm-plugins/utils/media-single.js +43 -25
- package/dist/cjs/ui/MediaLinkingToolbar.js +1 -0
- package/dist/cjs/ui/toolbar/mediaInline.js +3 -3
- package/dist/es2019/nodeviews/mediaNodeUpdater.js +60 -27
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +4 -0
- package/dist/es2019/pm-plugins/utils/media-single.js +40 -18
- package/dist/es2019/ui/MediaLinkingToolbar.js +1 -0
- package/dist/es2019/ui/toolbar/mediaInline.js +3 -3
- package/dist/esm/nodeviews/mediaNodeUpdater.js +186 -147
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +4 -0
- package/dist/esm/pm-plugins/utils/media-single.js +43 -25
- package/dist/esm/ui/MediaLinkingToolbar.js +1 -0
- package/dist/esm/ui/toolbar/mediaInline.js +3 -3
- package/dist/types/nodeviews/mediaNodeUpdater.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeUpdater.d.ts +1 -0
- package/package.json +14 -8
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
var _excluded = ["authProvider"],
|
|
7
|
+
_excluded2 = ["authProvider"];
|
|
5
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
@@ -401,76 +404,112 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
401
404
|
}
|
|
402
405
|
}, _callee9);
|
|
403
406
|
})));
|
|
404
|
-
_defineProperty(this, "
|
|
405
|
-
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(
|
|
406
|
-
var
|
|
407
|
+
_defineProperty(this, "handleCopyFileSwitcher", /*#__PURE__*/function () {
|
|
408
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(attrs) {
|
|
409
|
+
var mediaClient, source, destination, traceContext, _sourceAP, copyV2Source, _destAP, copyV2Destination, _yield$mediaClient$fi, id, _yield$mediaClient$fi2, _id;
|
|
407
410
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
408
411
|
while (1) switch (_context10.prev = _context10.next) {
|
|
412
|
+
case 0:
|
|
413
|
+
mediaClient = attrs.mediaClient, source = attrs.source, destination = attrs.destination, traceContext = attrs.traceContext;
|
|
414
|
+
if (!fg('platform_media_copy_and_paste_v2')) {
|
|
415
|
+
_context10.next = 11;
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
// don't need authProviders for v2 copy
|
|
419
|
+
_sourceAP = source.authProvider, copyV2Source = _objectWithoutProperties(source, _excluded);
|
|
420
|
+
_destAP = destination.authProvider, copyV2Destination = _objectWithoutProperties(destination, _excluded2);
|
|
421
|
+
_context10.next = 6;
|
|
422
|
+
return mediaClient.file.copyFile(copyV2Source, copyV2Destination, undefined, traceContext);
|
|
423
|
+
case 6:
|
|
424
|
+
_yield$mediaClient$fi = _context10.sent;
|
|
425
|
+
id = _yield$mediaClient$fi.id;
|
|
426
|
+
return _context10.abrupt("return", id);
|
|
427
|
+
case 11:
|
|
428
|
+
_context10.next = 13;
|
|
429
|
+
return mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
430
|
+
case 13:
|
|
431
|
+
_yield$mediaClient$fi2 = _context10.sent;
|
|
432
|
+
_id = _yield$mediaClient$fi2.id;
|
|
433
|
+
return _context10.abrupt("return", _id);
|
|
434
|
+
case 16:
|
|
435
|
+
case "end":
|
|
436
|
+
return _context10.stop();
|
|
437
|
+
}
|
|
438
|
+
}, _callee10);
|
|
439
|
+
}));
|
|
440
|
+
return function (_x4) {
|
|
441
|
+
return _ref11.apply(this, arguments);
|
|
442
|
+
};
|
|
443
|
+
}());
|
|
444
|
+
_defineProperty(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
|
|
445
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(getPos) {
|
|
446
|
+
var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
|
|
447
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
448
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
409
449
|
case 0:
|
|
410
450
|
attrs = _this.getAttrs();
|
|
411
451
|
if (!(!attrs || attrs.type !== 'external')) {
|
|
412
|
-
|
|
452
|
+
_context11.next = 3;
|
|
413
453
|
break;
|
|
414
454
|
}
|
|
415
|
-
return
|
|
455
|
+
return _context11.abrupt("return");
|
|
416
456
|
case 3:
|
|
417
457
|
url = attrs.url;
|
|
418
458
|
mediaAttrs = getAttrsFromUrl(url);
|
|
419
459
|
if (mediaAttrs) {
|
|
420
|
-
|
|
460
|
+
_context11.next = 7;
|
|
421
461
|
break;
|
|
422
462
|
}
|
|
423
|
-
return
|
|
463
|
+
return _context11.abrupt("return");
|
|
424
464
|
case 7:
|
|
425
|
-
|
|
465
|
+
_context11.next = 9;
|
|
426
466
|
return _this.props.mediaProvider;
|
|
427
467
|
case 9:
|
|
428
|
-
mediaProvider =
|
|
468
|
+
mediaProvider = _context11.sent;
|
|
429
469
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
430
|
-
|
|
470
|
+
_context11.next = 12;
|
|
431
471
|
break;
|
|
432
472
|
}
|
|
433
|
-
return
|
|
473
|
+
return _context11.abrupt("return");
|
|
434
474
|
case 12:
|
|
435
475
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
436
476
|
contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
|
|
437
477
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
438
478
|
if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
|
|
439
|
-
|
|
479
|
+
_context11.next = 17;
|
|
440
480
|
break;
|
|
441
481
|
}
|
|
442
|
-
return
|
|
482
|
+
return _context11.abrupt("return");
|
|
443
483
|
case 17:
|
|
444
484
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
485
|
+
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
486
|
+
_context11.next = 21;
|
|
487
|
+
return _this.handleCopyFileSwitcher({
|
|
488
|
+
mediaClient: mediaClient,
|
|
489
|
+
source: {
|
|
490
|
+
id: id,
|
|
491
|
+
collection: collection,
|
|
492
|
+
authProvider: function authProvider() {
|
|
493
|
+
return getAuthFromContext(contextId);
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
destination: {
|
|
497
|
+
collection: currentCollectionName,
|
|
498
|
+
authProvider: uploadMediaClientConfig.authProvider,
|
|
499
|
+
occurrenceKey: uuidV4()
|
|
454
500
|
}
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
authProvider: uploadMediaClientConfig.authProvider,
|
|
459
|
-
occurrenceKey: uuidV4()
|
|
460
|
-
};
|
|
461
|
-
_context10.next = 25;
|
|
462
|
-
return mediaClient.file.copyFile(source, destination);
|
|
463
|
-
case 25:
|
|
464
|
-
mediaFile = _context10.sent;
|
|
501
|
+
});
|
|
502
|
+
case 21:
|
|
503
|
+
mediaFileId = _context11.sent;
|
|
465
504
|
pos = getPos();
|
|
466
505
|
if (!(typeof pos !== 'number')) {
|
|
467
|
-
|
|
506
|
+
_context11.next = 25;
|
|
468
507
|
break;
|
|
469
508
|
}
|
|
470
|
-
return
|
|
471
|
-
case
|
|
509
|
+
return _context11.abrupt("return");
|
|
510
|
+
case 25:
|
|
472
511
|
replaceExternalMedia(pos + 1, {
|
|
473
|
-
id:
|
|
512
|
+
id: mediaFileId,
|
|
474
513
|
collection: currentCollectionName,
|
|
475
514
|
height: height,
|
|
476
515
|
width: width,
|
|
@@ -478,39 +517,39 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
478
517
|
__fileMimeType: mimeType,
|
|
479
518
|
__fileSize: size
|
|
480
519
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
481
|
-
case
|
|
520
|
+
case 26:
|
|
482
521
|
case "end":
|
|
483
|
-
return
|
|
522
|
+
return _context11.stop();
|
|
484
523
|
}
|
|
485
|
-
},
|
|
524
|
+
}, _callee11);
|
|
486
525
|
}));
|
|
487
|
-
return function (
|
|
488
|
-
return
|
|
526
|
+
return function (_x5) {
|
|
527
|
+
return _ref12.apply(this, arguments);
|
|
489
528
|
};
|
|
490
529
|
}());
|
|
491
530
|
// Copies the pasted node into the current collection using a getPos handler
|
|
492
531
|
_defineProperty(this, "copyNodeFromPos", /*#__PURE__*/function () {
|
|
493
|
-
var
|
|
532
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(getPos, traceContext) {
|
|
494
533
|
var attrs, copiedAttrs;
|
|
495
|
-
return _regeneratorRuntime.wrap(function
|
|
496
|
-
while (1) switch (
|
|
534
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
535
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
497
536
|
case 0:
|
|
498
537
|
attrs = _this.getAttrs();
|
|
499
538
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
500
|
-
|
|
539
|
+
_context12.next = 3;
|
|
501
540
|
break;
|
|
502
541
|
}
|
|
503
|
-
return
|
|
542
|
+
return _context12.abrupt("return");
|
|
504
543
|
case 3:
|
|
505
|
-
|
|
544
|
+
_context12.next = 5;
|
|
506
545
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
507
546
|
case 5:
|
|
508
|
-
copiedAttrs =
|
|
547
|
+
copiedAttrs = _context12.sent;
|
|
509
548
|
if (copiedAttrs) {
|
|
510
|
-
|
|
549
|
+
_context12.next = 8;
|
|
511
550
|
break;
|
|
512
551
|
}
|
|
513
|
-
return
|
|
552
|
+
return _context12.abrupt("return");
|
|
514
553
|
case 8:
|
|
515
554
|
updateCurrentMediaNodeAttrs(copiedAttrs, {
|
|
516
555
|
node: _this.props.node,
|
|
@@ -518,113 +557,113 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
518
557
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
519
558
|
case 9:
|
|
520
559
|
case "end":
|
|
521
|
-
return
|
|
560
|
+
return _context12.stop();
|
|
522
561
|
}
|
|
523
|
-
},
|
|
562
|
+
}, _callee12);
|
|
524
563
|
}));
|
|
525
|
-
return function (
|
|
526
|
-
return
|
|
564
|
+
return function (_x6, _x7) {
|
|
565
|
+
return _ref13.apply(this, arguments);
|
|
527
566
|
};
|
|
528
567
|
}());
|
|
529
568
|
// Copies the pasted node into the current collection
|
|
530
569
|
_defineProperty(this, "copyNode", /*#__PURE__*/function () {
|
|
531
|
-
var
|
|
570
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(traceContext) {
|
|
532
571
|
var attrs, view, copiedAttrs;
|
|
533
|
-
return _regeneratorRuntime.wrap(function
|
|
534
|
-
while (1) switch (
|
|
572
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
573
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
535
574
|
case 0:
|
|
536
575
|
attrs = _this.getAttrs();
|
|
537
576
|
view = _this.props.view;
|
|
538
577
|
if (!(!attrs || attrs && !isMediaTypeSupported(attrs.type))) {
|
|
539
|
-
|
|
578
|
+
_context13.next = 4;
|
|
540
579
|
break;
|
|
541
580
|
}
|
|
542
|
-
return
|
|
581
|
+
return _context13.abrupt("return");
|
|
543
582
|
case 4:
|
|
544
|
-
|
|
583
|
+
_context13.next = 6;
|
|
545
584
|
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
546
585
|
case 6:
|
|
547
|
-
copiedAttrs =
|
|
586
|
+
copiedAttrs = _context13.sent;
|
|
548
587
|
if (copiedAttrs) {
|
|
549
|
-
|
|
588
|
+
_context13.next = 9;
|
|
550
589
|
break;
|
|
551
590
|
}
|
|
552
|
-
return
|
|
591
|
+
return _context13.abrupt("return");
|
|
553
592
|
case 9:
|
|
554
593
|
updateMediaNodeAttrs(attrs.id, copiedAttrs)(view.state, view.dispatch);
|
|
555
594
|
case 10:
|
|
556
595
|
case "end":
|
|
557
|
-
return
|
|
596
|
+
return _context13.stop();
|
|
558
597
|
}
|
|
559
|
-
},
|
|
598
|
+
}, _callee13);
|
|
560
599
|
}));
|
|
561
|
-
return function (
|
|
562
|
-
return
|
|
600
|
+
return function (_x8) {
|
|
601
|
+
return _ref14.apply(this, arguments);
|
|
563
602
|
};
|
|
564
603
|
}());
|
|
565
604
|
_defineProperty(this, "copyFile", /*#__PURE__*/function () {
|
|
566
|
-
var
|
|
567
|
-
var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient,
|
|
568
|
-
return _regeneratorRuntime.wrap(function
|
|
569
|
-
while (1) switch (
|
|
605
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(id, collection, traceContext) {
|
|
606
|
+
var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
|
|
607
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
608
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
570
609
|
case 0:
|
|
571
|
-
|
|
610
|
+
_context14.next = 2;
|
|
572
611
|
return _this.props.mediaProvider;
|
|
573
612
|
case 2:
|
|
574
|
-
mediaProvider =
|
|
613
|
+
mediaProvider = _context14.sent;
|
|
575
614
|
if (mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams) {
|
|
576
|
-
|
|
615
|
+
_context14.next = 5;
|
|
577
616
|
break;
|
|
578
617
|
}
|
|
579
|
-
return
|
|
618
|
+
return _context14.abrupt("return");
|
|
580
619
|
case 5:
|
|
581
620
|
nodeContextId = _this.getNodeContextId();
|
|
582
621
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
583
622
|
if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
|
|
584
|
-
|
|
623
|
+
_context14.next = 9;
|
|
585
624
|
break;
|
|
586
625
|
}
|
|
587
|
-
return
|
|
626
|
+
return _context14.abrupt("return");
|
|
588
627
|
case 9:
|
|
589
628
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
590
|
-
_context13.next = 12;
|
|
591
|
-
return uploadMediaClientConfig.getAuthFromContext(nodeContextId);
|
|
592
|
-
case 12:
|
|
593
|
-
auth = _context13.sent;
|
|
594
|
-
_context13.next = 15;
|
|
595
|
-
return _this.getObjectId();
|
|
596
|
-
case 15:
|
|
597
|
-
objectId = _context13.sent;
|
|
598
|
-
source = {
|
|
599
|
-
id: id,
|
|
600
|
-
collection: collection,
|
|
601
|
-
authProvider: function authProvider() {
|
|
602
|
-
return Promise.resolve(auth);
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
629
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
return
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
630
|
+
_context14.next = 13;
|
|
631
|
+
return _this.getObjectId();
|
|
632
|
+
case 13:
|
|
633
|
+
objectId = _context14.sent;
|
|
634
|
+
getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
|
|
635
|
+
_context14.next = 17;
|
|
636
|
+
return _this.handleCopyFileSwitcher({
|
|
637
|
+
mediaClient: mediaClient,
|
|
638
|
+
source: {
|
|
639
|
+
id: id,
|
|
640
|
+
collection: collection,
|
|
641
|
+
authProvider: function authProvider() {
|
|
642
|
+
return getAuthFromContext(nodeContextId);
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
destination: {
|
|
646
|
+
collection: currentCollectionName,
|
|
647
|
+
authProvider: uploadMediaClientConfig.authProvider,
|
|
648
|
+
occurrenceKey: uuidV4()
|
|
649
|
+
},
|
|
650
|
+
traceContext: traceContext
|
|
651
|
+
});
|
|
652
|
+
case 17:
|
|
653
|
+
mediaFileId = _context14.sent;
|
|
654
|
+
return _context14.abrupt("return", {
|
|
655
|
+
id: mediaFileId,
|
|
617
656
|
collection: currentCollectionName,
|
|
618
657
|
__contextId: objectId
|
|
619
658
|
});
|
|
620
|
-
case
|
|
659
|
+
case 19:
|
|
621
660
|
case "end":
|
|
622
|
-
return
|
|
661
|
+
return _context14.stop();
|
|
623
662
|
}
|
|
624
|
-
},
|
|
663
|
+
}, _callee14);
|
|
625
664
|
}));
|
|
626
|
-
return function (
|
|
627
|
-
return
|
|
665
|
+
return function (_x9, _x10, _x11) {
|
|
666
|
+
return _ref15.apply(this, arguments);
|
|
628
667
|
};
|
|
629
668
|
}());
|
|
630
669
|
this.props = props;
|
|
@@ -643,42 +682,42 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
643
682
|
}, {
|
|
644
683
|
key: "getRemoteDimensions",
|
|
645
684
|
value: function () {
|
|
646
|
-
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
685
|
+
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
647
686
|
var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
|
|
648
|
-
return _regeneratorRuntime.wrap(function
|
|
649
|
-
while (1) switch (
|
|
687
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
688
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
650
689
|
case 0:
|
|
651
|
-
|
|
690
|
+
_context15.next = 2;
|
|
652
691
|
return this.props.mediaProvider;
|
|
653
692
|
case 2:
|
|
654
|
-
mediaProvider =
|
|
693
|
+
mediaProvider = _context15.sent;
|
|
655
694
|
mediaOptions = this.props.mediaOptions;
|
|
656
695
|
attrs = this.getAttrs();
|
|
657
696
|
if (!(!mediaProvider || !attrs)) {
|
|
658
|
-
|
|
697
|
+
_context15.next = 7;
|
|
659
698
|
break;
|
|
660
699
|
}
|
|
661
|
-
return
|
|
700
|
+
return _context15.abrupt("return", false);
|
|
662
701
|
case 7:
|
|
663
702
|
height = attrs.height, width = attrs.width;
|
|
664
703
|
if (!(attrs.type === 'external' || !attrs.id)) {
|
|
665
|
-
|
|
704
|
+
_context15.next = 10;
|
|
666
705
|
break;
|
|
667
706
|
}
|
|
668
|
-
return
|
|
707
|
+
return _context15.abrupt("return", false);
|
|
669
708
|
case 10:
|
|
670
709
|
id = attrs.id, collection = attrs.collection;
|
|
671
710
|
if (!(height && width)) {
|
|
672
|
-
|
|
711
|
+
_context15.next = 13;
|
|
673
712
|
break;
|
|
674
713
|
}
|
|
675
|
-
return
|
|
714
|
+
return _context15.abrupt("return", false);
|
|
676
715
|
case 13:
|
|
677
716
|
if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
|
|
678
|
-
|
|
717
|
+
_context15.next = 15;
|
|
679
718
|
break;
|
|
680
719
|
}
|
|
681
|
-
return
|
|
720
|
+
return _context15.abrupt("return", {
|
|
682
721
|
id: id,
|
|
683
722
|
height: DEFAULT_IMAGE_HEIGHT,
|
|
684
723
|
width: DEFAULT_IMAGE_WIDTH
|
|
@@ -686,40 +725,40 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
686
725
|
case 15:
|
|
687
726
|
viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
688
727
|
mediaClient = getMediaClient(viewMediaClientConfig);
|
|
689
|
-
|
|
728
|
+
_context15.next = 19;
|
|
690
729
|
return mediaClient.file.getCurrentState(id, {
|
|
691
730
|
collectionName: collection
|
|
692
731
|
});
|
|
693
732
|
case 19:
|
|
694
|
-
currentState =
|
|
733
|
+
currentState = _context15.sent;
|
|
695
734
|
if (isImageRepresentationReady(currentState)) {
|
|
696
|
-
|
|
735
|
+
_context15.next = 22;
|
|
697
736
|
break;
|
|
698
737
|
}
|
|
699
|
-
return
|
|
738
|
+
return _context15.abrupt("return", false);
|
|
700
739
|
case 22:
|
|
701
|
-
|
|
740
|
+
_context15.next = 24;
|
|
702
741
|
return mediaClient.getImageMetadata(id, {
|
|
703
742
|
collection: collection
|
|
704
743
|
});
|
|
705
744
|
case 24:
|
|
706
|
-
imageMetadata =
|
|
745
|
+
imageMetadata = _context15.sent;
|
|
707
746
|
if (!(!imageMetadata || !imageMetadata.original)) {
|
|
708
|
-
|
|
747
|
+
_context15.next = 27;
|
|
709
748
|
break;
|
|
710
749
|
}
|
|
711
|
-
return
|
|
750
|
+
return _context15.abrupt("return", false);
|
|
712
751
|
case 27:
|
|
713
|
-
return
|
|
752
|
+
return _context15.abrupt("return", {
|
|
714
753
|
id: id,
|
|
715
754
|
height: imageMetadata.original.height || DEFAULT_IMAGE_HEIGHT,
|
|
716
755
|
width: imageMetadata.original.width || DEFAULT_IMAGE_WIDTH
|
|
717
756
|
});
|
|
718
757
|
case 28:
|
|
719
758
|
case "end":
|
|
720
|
-
return
|
|
759
|
+
return _context15.stop();
|
|
721
760
|
}
|
|
722
|
-
},
|
|
761
|
+
}, _callee15, this);
|
|
723
762
|
}));
|
|
724
763
|
function getRemoteDimensions() {
|
|
725
764
|
return _getRemoteDimensions.apply(this, arguments);
|
|
@@ -729,38 +768,38 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
729
768
|
}, {
|
|
730
769
|
key: "handleExternalMedia",
|
|
731
770
|
value: function () {
|
|
732
|
-
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
733
|
-
return _regeneratorRuntime.wrap(function
|
|
734
|
-
while (1) switch (
|
|
771
|
+
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(getPos) {
|
|
772
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
773
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
735
774
|
case 0:
|
|
736
775
|
if (!this.isMediaBlobUrl()) {
|
|
737
|
-
|
|
776
|
+
_context16.next = 12;
|
|
738
777
|
break;
|
|
739
778
|
}
|
|
740
|
-
|
|
741
|
-
|
|
779
|
+
_context16.prev = 1;
|
|
780
|
+
_context16.next = 4;
|
|
742
781
|
return this.copyNodeFromBlobUrl(getPos);
|
|
743
782
|
case 4:
|
|
744
|
-
|
|
783
|
+
_context16.next = 10;
|
|
745
784
|
break;
|
|
746
785
|
case 6:
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
786
|
+
_context16.prev = 6;
|
|
787
|
+
_context16.t0 = _context16["catch"](1);
|
|
788
|
+
_context16.next = 10;
|
|
750
789
|
return this.uploadExternalMedia(getPos);
|
|
751
790
|
case 10:
|
|
752
|
-
|
|
791
|
+
_context16.next = 14;
|
|
753
792
|
break;
|
|
754
793
|
case 12:
|
|
755
|
-
|
|
794
|
+
_context16.next = 14;
|
|
756
795
|
return this.uploadExternalMedia(getPos);
|
|
757
796
|
case 14:
|
|
758
797
|
case "end":
|
|
759
|
-
return
|
|
798
|
+
return _context16.stop();
|
|
760
799
|
}
|
|
761
|
-
},
|
|
800
|
+
}, _callee16, this, [[1, 6]]);
|
|
762
801
|
}));
|
|
763
|
-
function handleExternalMedia(
|
|
802
|
+
function handleExternalMedia(_x12) {
|
|
764
803
|
return _handleExternalMedia.apply(this, arguments);
|
|
765
804
|
}
|
|
766
805
|
return handleExternalMedia;
|
|
@@ -33,6 +33,7 @@ var supportTextStyles = css({
|
|
|
33
33
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
34
34
|
fontSize: relativeFontSizeToBase16(12),
|
|
35
35
|
padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-500, 40px)"),
|
|
36
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
36
37
|
lineHeight: '20px',
|
|
37
38
|
borderTop: "1px solid ".concat("var(--ds-border, ".concat(N30, ")")),
|
|
38
39
|
margin: 0
|
|
@@ -43,16 +44,19 @@ var containerStyles = css({
|
|
|
43
44
|
display: 'flex',
|
|
44
45
|
flexDirection: 'column',
|
|
45
46
|
overflow: 'auto',
|
|
47
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
46
48
|
lineHeight: 2
|
|
47
49
|
});
|
|
48
50
|
var inputWrapperStyles = css({
|
|
49
51
|
display: 'flex',
|
|
52
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
50
53
|
lineHeight: 0,
|
|
51
54
|
padding: "var(--ds-space-075, 6px)".concat(" 0"),
|
|
52
55
|
alignItems: 'center'
|
|
53
56
|
});
|
|
54
57
|
var validationWrapperStyles = css({
|
|
55
58
|
display: 'flex',
|
|
59
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
56
60
|
lineHeight: 0,
|
|
57
61
|
padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-300, 24px)", " ", "var(--ds-space-150, 12px)", " 0"),
|
|
58
62
|
margin: "0 ".concat("var(--ds-space-150, 12px)", " 0 ", "var(--ds-space-500, 40px)"),
|