@atlaskit/editor-plugin-media 9.4.17 → 9.5.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 9.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 9.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`c90ccf0c600ee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c90ccf0c600ee) -
14
+ Enable cross product/cross client copy and paste of Media files by including clientId during Copy
15
+ operations.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 9.4.17
4
22
 
5
23
  ### Patch Changes
@@ -16,11 +16,12 @@ var _analytics = require("@atlaskit/editor-common/analytics");
16
16
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
17
17
  var _mediaClient = require("@atlaskit/media-client");
18
18
  var _mediaClientReact = require("@atlaskit/media-client-react");
19
+ var _mediaCommon = require("@atlaskit/media-common");
19
20
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
21
  var _helpers = require("../pm-plugins/commands/helpers");
21
22
  var _pluginKey = require("../pm-plugins/plugin-key");
22
23
  var _batchMediaNodeAttrs = require("../pm-plugins/utils/batchMediaNodeAttrs");
23
- var _mediaCommon = require("../pm-plugins/utils/media-common");
24
+ var _mediaCommon2 = require("../pm-plugins/utils/media-common");
24
25
  var _excluded = ["authProvider"],
25
26
  _excluded2 = ["authProvider"]; // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
26
27
  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; }
@@ -354,7 +355,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
354
355
  }
355
356
  return _context8.abrupt("return", false);
356
357
  case 10:
357
- id = (0, _mediaCommon.getIdentifier)(attrs);
358
+ id = (0, _mediaCommon2.getIdentifier)(attrs);
358
359
  isIdentifierOutsideEditorScope = !_this.mediaPluginState.isIdentifierInEditorScope(id);
359
360
  return _context8.abrupt("return", isIdentifierOutsideEditorScope);
360
361
  case 13:
@@ -478,7 +479,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
478
479
  }());
479
480
  (0, _defineProperty2.default)(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
480
481
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(getPos) {
481
- var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
482
+ var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, clientId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
482
483
  return _regenerator.default.wrap(function _callee10$(_context10) {
483
484
  while (1) switch (_context10.prev = _context10.next) {
484
485
  case 0:
@@ -508,7 +509,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
508
509
  return _context10.abrupt("return");
509
510
  case 12:
510
511
  currentCollectionName = mediaProvider.uploadParams.collection;
511
- contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
512
+ 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;
512
513
  uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
513
514
  if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
514
515
  _context10.next = 17;
@@ -526,7 +527,8 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
526
527
  collection: collection,
527
528
  authProvider: function authProvider() {
528
529
  return getAuthFromContext(contextId);
529
- }
530
+ },
531
+ clientId: (0, _platformFeatureFlags.fg)('platform_media_cross_client_copy_with_auth') ? clientId : undefined
530
532
  },
531
533
  destination: {
532
534
  collection: currentCollectionName,
@@ -639,7 +641,7 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
639
641
  }());
640
642
  (0, _defineProperty2.default)(this, "copyFile", /*#__PURE__*/function () {
641
643
  var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, collection, traceContext) {
642
- var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
644
+ var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, clientId, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
643
645
  return _regenerator.default.wrap(function _callee13$(_context13) {
644
646
  while (1) switch (_context13.prev = _context13.next) {
645
647
  case 0:
@@ -662,13 +664,14 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
662
664
  return _context13.abrupt("return");
663
665
  case 9:
664
666
  mediaClient = (0, _mediaClientReact.getMediaClient)(uploadMediaClientConfig);
667
+ clientId = (0, _platformFeatureFlags.fg)('platform_media_cross_client_copy_with_auth') ? (0, _mediaCommon.getClientIdForFile)(id) : undefined;
665
668
  currentCollectionName = mediaProvider.uploadParams.collection;
666
- _context13.next = 13;
669
+ _context13.next = 14;
667
670
  return _this.getObjectId();
668
- case 13:
671
+ case 14:
669
672
  objectId = _context13.sent;
670
673
  getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
671
- _context13.next = 17;
674
+ _context13.next = 18;
672
675
  return _this.handleCopyFileSwitcher({
673
676
  mediaClient: mediaClient,
674
677
  source: {
@@ -676,7 +679,8 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
676
679
  collection: collection,
677
680
  authProvider: function authProvider() {
678
681
  return getAuthFromContext(nodeContextId);
679
- }
682
+ },
683
+ clientId: clientId
680
684
  },
681
685
  destination: {
682
686
  collection: currentCollectionName,
@@ -686,14 +690,14 @@ var MediaNodeUpdater = exports.MediaNodeUpdater = /*#__PURE__*/function () {
686
690
  },
687
691
  traceContext: traceContext
688
692
  });
689
- case 17:
693
+ case 18:
690
694
  mediaFileId = _context13.sent;
691
695
  return _context13.abrupt("return", {
692
696
  id: mediaFileId,
693
697
  collection: currentCollectionName,
694
698
  __contextId: objectId
695
699
  });
696
- case 19:
700
+ case 20:
697
701
  case "end":
698
702
  return _context13.stop();
699
703
  }
@@ -5,6 +5,7 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/anal
5
5
  import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
6
6
  import { getAttrsFromUrl, isImageRepresentationReady, isMediaBlobUrl } from '@atlaskit/media-client';
7
7
  import { getMediaClient } from '@atlaskit/media-client-react';
8
+ import { getClientIdForFile } from '@atlaskit/media-common';
8
9
  import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { replaceExternalMedia, updateCurrentMediaNodeAttrs, updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
10
11
  import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
@@ -71,7 +72,7 @@ export class MediaNodeUpdater {
71
72
  if (fileState.status === 'error') {
72
73
  return;
73
74
  }
74
- } catch (err) {
75
+ } catch {
75
76
  return;
76
77
  }
77
78
  const contextId = this.getNodeContextId() || (await this.getObjectId());
@@ -158,7 +159,7 @@ export class MediaNodeUpdater {
158
159
  width: dimensions.width,
159
160
  occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
160
161
  })(this.props.view.state, this.props.view.dispatch);
161
- } catch (e) {
162
+ } catch {
162
163
  //keep it as external media
163
164
  if (this.props.dispatchAnalyticsEvent) {
164
165
  this.props.dispatchAnalyticsEvent({
@@ -281,6 +282,7 @@ export class MediaNodeUpdater {
281
282
  const currentCollectionName = mediaProvider.uploadParams.collection;
282
283
  const {
283
284
  contextId,
285
+ clientId,
284
286
  id,
285
287
  collection,
286
288
  height,
@@ -300,7 +302,8 @@ export class MediaNodeUpdater {
300
302
  source: {
301
303
  id,
302
304
  collection,
303
- authProvider: () => getAuthFromContext(contextId)
305
+ authProvider: () => getAuthFromContext(contextId),
306
+ clientId: fg('platform_media_cross_client_copy_with_auth') ? clientId : undefined
304
307
  },
305
308
  destination: {
306
309
  collection: currentCollectionName,
@@ -364,6 +367,7 @@ export class MediaNodeUpdater {
364
367
  return;
365
368
  }
366
369
  const mediaClient = getMediaClient(uploadMediaClientConfig);
370
+ const clientId = fg('platform_media_cross_client_copy_with_auth') ? getClientIdForFile(id) : undefined;
367
371
  const currentCollectionName = mediaProvider.uploadParams.collection;
368
372
  const objectId = await this.getObjectId();
369
373
  const getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
@@ -372,7 +376,8 @@ export class MediaNodeUpdater {
372
376
  source: {
373
377
  id,
374
378
  collection,
375
- authProvider: () => getAuthFromContext(nodeContextId)
379
+ authProvider: () => getAuthFromContext(nodeContextId),
380
+ clientId
376
381
  },
377
382
  destination: {
378
383
  collection: currentCollectionName,
@@ -457,7 +462,7 @@ export class MediaNodeUpdater {
457
462
  if (this.isMediaBlobUrl()) {
458
463
  try {
459
464
  await this.copyNodeFromBlobUrl(getPos);
460
- } catch (e) {
465
+ } catch {
461
466
  await this.uploadExternalMedia(getPos);
462
467
  }
463
468
  } else {
@@ -14,6 +14,7 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/anal
14
14
  import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
15
15
  import { getAttrsFromUrl, isImageRepresentationReady, isMediaBlobUrl as _isMediaBlobUrl } from '@atlaskit/media-client';
16
16
  import { getMediaClient } from '@atlaskit/media-client-react';
17
+ import { getClientIdForFile } from '@atlaskit/media-common';
17
18
  import { fg } from '@atlaskit/platform-feature-flags';
18
19
  import { replaceExternalMedia, updateCurrentMediaNodeAttrs, updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
19
20
  import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
@@ -472,7 +473,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
472
473
  }());
473
474
  _defineProperty(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
474
475
  var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(getPos) {
475
- var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
476
+ var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, clientId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, getAuthFromContext, mediaFileId, pos;
476
477
  return _regeneratorRuntime.wrap(function _callee10$(_context10) {
477
478
  while (1) switch (_context10.prev = _context10.next) {
478
479
  case 0:
@@ -502,7 +503,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
502
503
  return _context10.abrupt("return");
503
504
  case 12:
504
505
  currentCollectionName = mediaProvider.uploadParams.collection;
505
- contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
506
+ 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;
506
507
  uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
507
508
  if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
508
509
  _context10.next = 17;
@@ -520,7 +521,8 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
520
521
  collection: collection,
521
522
  authProvider: function authProvider() {
522
523
  return getAuthFromContext(contextId);
523
- }
524
+ },
525
+ clientId: fg('platform_media_cross_client_copy_with_auth') ? clientId : undefined
524
526
  },
525
527
  destination: {
526
528
  collection: currentCollectionName,
@@ -633,7 +635,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
633
635
  }());
634
636
  _defineProperty(this, "copyFile", /*#__PURE__*/function () {
635
637
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, collection, traceContext) {
636
- var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
638
+ var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, clientId, currentCollectionName, objectId, getAuthFromContext, mediaFileId;
637
639
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
638
640
  while (1) switch (_context13.prev = _context13.next) {
639
641
  case 0:
@@ -656,13 +658,14 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
656
658
  return _context13.abrupt("return");
657
659
  case 9:
658
660
  mediaClient = getMediaClient(uploadMediaClientConfig);
661
+ clientId = fg('platform_media_cross_client_copy_with_auth') ? getClientIdForFile(id) : undefined;
659
662
  currentCollectionName = mediaProvider.uploadParams.collection;
660
- _context13.next = 13;
663
+ _context13.next = 14;
661
664
  return _this.getObjectId();
662
- case 13:
665
+ case 14:
663
666
  objectId = _context13.sent;
664
667
  getAuthFromContext = uploadMediaClientConfig.getAuthFromContext;
665
- _context13.next = 17;
668
+ _context13.next = 18;
666
669
  return _this.handleCopyFileSwitcher({
667
670
  mediaClient: mediaClient,
668
671
  source: {
@@ -670,7 +673,8 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
670
673
  collection: collection,
671
674
  authProvider: function authProvider() {
672
675
  return getAuthFromContext(nodeContextId);
673
- }
676
+ },
677
+ clientId: clientId
674
678
  },
675
679
  destination: {
676
680
  collection: currentCollectionName,
@@ -680,14 +684,14 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
680
684
  },
681
685
  traceContext: traceContext
682
686
  });
683
- case 17:
687
+ case 18:
684
688
  mediaFileId = _context13.sent;
685
689
  return _context13.abrupt("return", {
686
690
  id: mediaFileId,
687
691
  collection: currentCollectionName,
688
692
  __contextId: objectId
689
693
  });
690
- case 19:
694
+ case 20:
691
695
  case "end":
692
696
  return _context13.stop();
693
697
  }
@@ -2,7 +2,7 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { MediaTraceContext } from '@atlaskit/media-common';
5
+ import { type MediaTraceContext } from '@atlaskit/media-common';
6
6
  import type { MediaOptions, MediaPluginState, getPosHandler as ProsemirrorGetPosHandler, SupportedMediaAttributes } from '../types';
7
7
  type RemoteDimensions = {
8
8
  height: number;
@@ -2,7 +2,7 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { MediaTraceContext } from '@atlaskit/media-common';
5
+ import { type MediaTraceContext } from '@atlaskit/media-common';
6
6
  import type { MediaOptions, MediaPluginState, getPosHandler as ProsemirrorGetPosHandler, SupportedMediaAttributes } from '../types';
7
7
  type RemoteDimensions = {
8
8
  height: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "9.4.17",
3
+ "version": "9.5.1",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -55,18 +55,18 @@
55
55
  "@atlaskit/icon": "^31.0.0",
56
56
  "@atlaskit/icon-lab": "^5.16.0",
57
57
  "@atlaskit/media-card": "^79.15.0",
58
- "@atlaskit/media-client": "^35.7.0",
59
- "@atlaskit/media-client-react": "^4.1.0",
60
- "@atlaskit/media-common": "^12.3.0",
58
+ "@atlaskit/media-client": "^35.8.0",
59
+ "@atlaskit/media-client-react": "^4.2.0",
60
+ "@atlaskit/media-common": "^12.4.0",
61
61
  "@atlaskit/media-filmstrip": "^51.1.0",
62
62
  "@atlaskit/media-picker": "^70.1.0",
63
63
  "@atlaskit/media-ui": "^28.7.0",
64
- "@atlaskit/media-viewer": "^52.7.0",
64
+ "@atlaskit/media-viewer": "^52.8.0",
65
65
  "@atlaskit/platform-feature-flags": "^1.1.0",
66
66
  "@atlaskit/primitives": "^18.0.0",
67
67
  "@atlaskit/textfield": "^8.2.0",
68
68
  "@atlaskit/theme": "^21.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^25.0.0",
69
+ "@atlaskit/tmp-editor-statsig": "^26.0.0",
70
70
  "@atlaskit/tokens": "^11.0.0",
71
71
  "@atlaskit/tooltip": "^20.14.0",
72
72
  "@babel/runtime": "^7.0.0",
@@ -78,7 +78,7 @@
78
78
  "uuid": "^3.1.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^111.12.0",
81
+ "@atlaskit/editor-common": "^111.16.0",
82
82
  "@atlaskit/media-core": "^37.0.0",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",
@@ -124,6 +124,9 @@
124
124
  "platform_media_cross_client_copy": {
125
125
  "type": "boolean"
126
126
  },
127
+ "platform_media_cross_client_copy_with_auth": {
128
+ "type": "boolean"
129
+ },
127
130
  "platform_editor_typography_ugc": {
128
131
  "type": "boolean"
129
132
  },