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