@atlaskit/editor-plugin-media 1.43.14 → 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/nodeviews/mediaGroup.js +4 -4
  3. package/dist/cjs/nodeviews/mediaGroupNext.js +4 -4
  4. package/dist/cjs/nodeviews/mediaInline.js +8 -8
  5. package/dist/cjs/nodeviews/mediaNodeUpdater.js +179 -141
  6. package/dist/cjs/nodeviews/mediaSingle.js +4 -4
  7. package/dist/cjs/nodeviews/mediaSingleNext.js +4 -4
  8. package/dist/cjs/pm-plugins/main.js +41 -13
  9. package/dist/es2019/nodeviews/mediaGroup.js +2 -2
  10. package/dist/es2019/nodeviews/mediaGroupNext.js +2 -2
  11. package/dist/es2019/nodeviews/mediaInline.js +5 -5
  12. package/dist/es2019/nodeviews/mediaNodeUpdater.js +18 -0
  13. package/dist/es2019/nodeviews/mediaSingle.js +2 -2
  14. package/dist/es2019/nodeviews/mediaSingleNext.js +2 -2
  15. package/dist/es2019/pm-plugins/main.js +42 -12
  16. package/dist/esm/nodeviews/mediaGroup.js +4 -4
  17. package/dist/esm/nodeviews/mediaGroupNext.js +4 -4
  18. package/dist/esm/nodeviews/mediaInline.js +8 -8
  19. package/dist/esm/nodeviews/mediaNodeUpdater.js +179 -141
  20. package/dist/esm/nodeviews/mediaSingle.js +4 -4
  21. package/dist/esm/nodeviews/mediaSingleNext.js +4 -4
  22. package/dist/esm/pm-plugins/main.js +42 -14
  23. package/dist/types/nodeviews/__mocks__/mediaNodeUpdater.d.ts +1 -0
  24. package/dist/types/nodeviews/mediaNodeUpdater.d.ts +3 -1
  25. package/dist/types/pm-plugins/main.d.ts +4 -1
  26. package/dist/types/pm-plugins/types.d.ts +2 -0
  27. package/dist/types/types/index.d.ts +2 -0
  28. package/dist/types-ts4.5/nodeviews/__mocks__/mediaNodeUpdater.d.ts +1 -0
  29. package/dist/types-ts4.5/nodeviews/mediaNodeUpdater.d.ts +3 -1
  30. package/dist/types-ts4.5/pm-plugins/main.d.ts +4 -1
  31. package/dist/types-ts4.5/pm-plugins/types.d.ts +2 -0
  32. package/dist/types-ts4.5/types/index.d.ts +2 -0
  33. package/package.json +1 -1
@@ -85,7 +85,7 @@ var useMediaNodeUpdater = function useMediaNodeUpdater(_ref) {
85
85
  };
86
86
  var mediaAsyncOperations = /*#__PURE__*/function () {
87
87
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(props) {
88
- var updatedDimensions, currentAttrs, updatingNode, contextId, hasDifferentContextId, copyNode;
88
+ var updatedDimensions, currentAttrs, updatingNode, contextId, shouldNodeBeDeepCopied, copyNode;
89
89
  return _regenerator.default.wrap(function _callee$(_context) {
90
90
  while (1) switch (_context.prev = _context.next) {
91
91
  case 0:
@@ -117,10 +117,10 @@ var mediaAsyncOperations = /*#__PURE__*/function () {
117
117
  return props.updater.updateContextId();
118
118
  case 15:
119
119
  _context.next = 17;
120
- return props.updater.hasDifferentContextId();
120
+ return props.updater.shouldNodeBeDeepCopied();
121
121
  case 17:
122
- hasDifferentContextId = _context.sent;
123
- if (!hasDifferentContextId) {
122
+ shouldNodeBeDeepCopied = _context.sent;
123
+ if (!shouldNodeBeDeepCopied) {
124
124
  _context.next = 28;
125
125
  break;
126
126
  }
@@ -117,7 +117,7 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
117
117
  (0, _defineProperty2.default)(this, "destroyed", false);
118
118
  (0, _defineProperty2.default)(this, "removeOnCloseListener", function () {});
119
119
  (0, _defineProperty2.default)(this, "onPopupToggleCallback", function () {});
120
- (0, _defineProperty2.default)(this, "nodeCount", new Map());
120
+ (0, _defineProperty2.default)(this, "identifierCount", new Map());
121
121
  (0, _defineProperty2.default)(this, "taskManager", new _mediaTaskManager.MediaTaskManager());
122
122
  (0, _defineProperty2.default)(this, "pickers", []);
123
123
  (0, _defineProperty2.default)(this, "pickerPromises", []);
@@ -275,23 +275,51 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
275
275
  }
276
276
  (0, _mediaCommon2.removeMediaNode)(_this.view, getNode, getPos);
277
277
  });
278
+ (0, _defineProperty2.default)(this, "getIdentifierKey", function (identifier) {
279
+ if (identifier.mediaItemType === "file") {
280
+ return identifier.id;
281
+ } else {
282
+ return identifier.dataURI;
283
+ }
284
+ });
278
285
  (0, _defineProperty2.default)(this, "trackMediaNodeAddition", function (node) {
279
- var _this$nodeCount$get;
280
- var id = node.attrs.id;
281
- var count = (_this$nodeCount$get = _this.nodeCount.get(id)) !== null && _this$nodeCount$get !== void 0 ? _this$nodeCount$get : 0;
286
+ var _this$identifierCount;
287
+ var identifier = (0, _mediaCommon2.getIdentifier)(node.attrs);
288
+ var key = _this.getIdentifierKey(identifier);
289
+ var _ref2 = (_this$identifierCount = _this.identifierCount.get(key)) !== null && _this$identifierCount !== void 0 ? _this$identifierCount : {
290
+ count: 0
291
+ },
292
+ count = _ref2.count;
282
293
  if (count === 0) {
283
- _this.taskManager.resumePendingTask(id);
294
+ _this.taskManager.resumePendingTask(key);
284
295
  }
285
- _this.nodeCount.set(id, count + 1);
296
+ _this.identifierCount.set(key, {
297
+ identifier: identifier,
298
+ count: count + 1
299
+ });
286
300
  });
287
301
  (0, _defineProperty2.default)(this, "trackMediaNodeRemoval", function (node) {
288
- var _this$nodeCount$get2;
289
- var id = node.attrs.id;
290
- var count = (_this$nodeCount$get2 = _this.nodeCount.get(id)) !== null && _this$nodeCount$get2 !== void 0 ? _this$nodeCount$get2 : 0;
302
+ var _this$identifierCount2;
303
+ var identifier = (0, _mediaCommon2.getIdentifier)(node.attrs);
304
+ var key = _this.getIdentifierKey(identifier);
305
+ var _ref3 = (_this$identifierCount2 = _this.identifierCount.get(key)) !== null && _this$identifierCount2 !== void 0 ? _this$identifierCount2 : {
306
+ count: 0
307
+ },
308
+ count = _ref3.count;
291
309
  if (count === 1) {
292
- _this.taskManager.cancelPendingTask(id);
310
+ _this.taskManager.cancelPendingTask(key);
293
311
  }
294
- _this.nodeCount.set(id, count - 1);
312
+ _this.identifierCount.set(key, {
313
+ identifier: identifier,
314
+ count: count - 1
315
+ });
316
+ });
317
+ (0, _defineProperty2.default)(this, "isIdentifierInEditorScope", function (identifier) {
318
+ var key = _this.getIdentifierKey(identifier);
319
+
320
+ // rely on has instead of count > 0 because if the user cuts and pastes the same media
321
+ // the count will temporarily be 0 but the media is still in the scope of editor.
322
+ return _this.identifierCount.has(key);
295
323
  });
296
324
  /**
297
325
  * Called from React UI Component on componentDidMount
@@ -309,8 +337,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
309
337
  */
310
338
  (0, _defineProperty2.default)(this, "handleMediaNodeUnmount", function (oldNode) {
311
339
  _this.trackMediaNodeRemoval(oldNode);
312
- _this.mediaNodes = _this.mediaNodes.filter(function (_ref2) {
313
- var node = _ref2.node;
340
+ _this.mediaNodes = _this.mediaNodes.filter(function (_ref4) {
341
+ var node = _ref4.node;
314
342
  return oldNode !== node;
315
343
  });
316
344
  });
@@ -211,8 +211,8 @@ class MediaGroup extends React.Component {
211
211
  if (!contextId) {
212
212
  await mediaNodeUpdater.updateNodeContextId(getPos);
213
213
  }
214
- const hasDifferentContextId = await mediaNodeUpdater.hasDifferentContextId();
215
- if (hasDifferentContextId) {
214
+ const shouldNodeBeDeepCopied = await mediaNodeUpdater.shouldNodeBeDeepCopied();
215
+ if (shouldNodeBeDeepCopied) {
216
216
  await mediaNodeUpdater.copyNodeFromPos(getPos, {
217
217
  traceId: node.attrs.__mediaTraceId
218
218
  });
@@ -116,8 +116,8 @@ const runMediaNodeUpdate = async ({
116
116
  if (!contextId) {
117
117
  await mediaNodeUpdater.updateNodeContextId(getPos);
118
118
  }
119
- const hasDifferentContextId = await mediaNodeUpdater.hasDifferentContextId();
120
- if (hasDifferentContextId) {
119
+ const shouldNodeBeDeepCopied = await mediaNodeUpdater.shouldNodeBeDeepCopied();
120
+ if (shouldNodeBeDeepCopied) {
121
121
  await mediaNodeUpdater.copyNodeFromPos(getPos, {
122
122
  traceId: node.attrs.__mediaTraceId
123
123
  });
@@ -45,8 +45,8 @@ const updateMediaNodeAttributes = async (props, mediaNodeUpdater) => {
45
45
  if (!contextId) {
46
46
  await mediaNodeUpdater.updateContextId();
47
47
  }
48
- const hasDifferentContextId = await mediaNodeUpdater.hasDifferentContextId();
49
- if (hasDifferentContextId) {
48
+ const shouldNodeBeDeepCopied = await mediaNodeUpdater.shouldNodeBeDeepCopied();
49
+ if (shouldNodeBeDeepCopied) {
50
50
  // Copy paste flow (different pages)
51
51
  try {
52
52
  const copyNode = mediaNodeUpdater.copyNode({
@@ -71,10 +71,10 @@ export const handleNewNode = props => {
71
71
  export const MediaInline = props => {
72
72
  var _props$node, _props$node$marks;
73
73
  const [viewMediaClientConfig, setViewMediaClientConfig] = useState();
74
- const [isContextIdUnsync, setIsContextIdUnsync] = useState(true);
74
+ const [isNodeScopeUnsync, setIsNodeScopeUnsync] = useState(true);
75
75
  useEffect(() => {
76
76
  const mediaNodeUpdater = createMediaNodeUpdater(props);
77
- mediaNodeUpdater.hasDifferentContextId().then(setIsContextIdUnsync);
77
+ mediaNodeUpdater.shouldNodeBeDeepCopied().then(setIsNodeScopeUnsync);
78
78
  handleNewNode(props);
79
79
  updateMediaNodeAttributes(props, mediaNodeUpdater);
80
80
  updateViewMediaClientConfig(props);
@@ -115,7 +115,7 @@ export const MediaInline = props => {
115
115
  * to prevent calling the media API (in mounting of `MediaInlineCard`)
116
116
  * before the prerequisites meet
117
117
  */
118
- if (!viewMediaClientConfig || isContextIdUnsync) {
118
+ if (!viewMediaClientConfig || isNodeScopeUnsync) {
119
119
  return jsx(MediaInlineCardLoadingView, {
120
120
  message: "",
121
121
  isSelected: false
@@ -6,7 +6,9 @@ import { getAttrsFromUrl, isImageRepresentationReady, isMediaBlobUrl } from '@at
6
6
  import { getMediaClient } from '@atlaskit/media-client-react';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { replaceExternalMedia, updateAllMediaNodesAttrs, updateCurrentMediaNodeAttrs, updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
9
+ import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
9
10
  import { batchMediaNodeAttrsUpdate } from '../pm-plugins/utils/batchMediaNodeAttrs';
11
+ import { getIdentifier } from '../pm-plugins/utils/media-common';
10
12
  const isMediaTypeSupported = type => {
11
13
  if (type) {
12
14
  return ['image', 'file'].includes(type);
@@ -196,6 +198,21 @@ export class MediaNodeUpdater {
196
198
  })(this.props.view.state, this.props.view.dispatch);
197
199
  }
198
200
  });
201
+ _defineProperty(this, "shouldNodeBeDeepCopied", async () => {
202
+ var _ref, _this$props$mediaOpti, _this$props$mediaOpti2, _this$mediaPluginStat, _this$mediaPluginStat2;
203
+ const scope = (_ref = (_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 ? void 0 : (_this$mediaPluginStat2 = _this$mediaPluginStat.mediaOptions) === null || _this$mediaPluginStat2 === void 0 ? void 0 : _this$mediaPluginStat2.mediaShallowCopyScope) !== null && _ref !== void 0 ? _ref : 'context';
204
+ if (scope === 'context') {
205
+ return await this.hasDifferentContextId();
206
+ } else {
207
+ const attrs = this.getAttrs();
208
+ if (!attrs || !this.mediaPluginState) {
209
+ return false;
210
+ }
211
+ const id = getIdentifier(attrs);
212
+ const isIdentifierOutsideEditorScope = !(await this.mediaPluginState.isIdentifierInEditorScope(id));
213
+ return isIdentifierOutsideEditorScope;
214
+ }
215
+ });
199
216
  _defineProperty(this, "hasDifferentContextId", async () => {
200
217
  const nodeContextId = this.getNodeContextId();
201
218
  const currentContextId = await this.getObjectId();
@@ -377,6 +394,7 @@ export class MediaNodeUpdater {
377
394
  };
378
395
  });
379
396
  this.props = props;
397
+ this.mediaPluginState = mediaStateKey.getState(props.view.state);
380
398
  }
381
399
  setProps(newComponentProps) {
382
400
  this.props = {
@@ -110,8 +110,8 @@ export default class MediaSingleNode extends Component {
110
110
  var _this$mediaNodeUpdate5;
111
111
  await ((_this$mediaNodeUpdate5 = this.mediaNodeUpdater) === null || _this$mediaNodeUpdate5 === void 0 ? void 0 : _this$mediaNodeUpdate5.updateContextId());
112
112
  }
113
- const hasDifferentContextId = await ((_this$mediaNodeUpdate6 = this.mediaNodeUpdater) === null || _this$mediaNodeUpdate6 === void 0 ? void 0 : _this$mediaNodeUpdate6.hasDifferentContextId());
114
- if (hasDifferentContextId) {
113
+ const shouldNodeBeDeepCopied = await ((_this$mediaNodeUpdate6 = this.mediaNodeUpdater) === null || _this$mediaNodeUpdate6 === void 0 ? void 0 : _this$mediaNodeUpdate6.shouldNodeBeDeepCopied());
114
+ if (shouldNodeBeDeepCopied) {
115
115
  this.setState({
116
116
  isCopying: true
117
117
  });
@@ -88,8 +88,8 @@ const mediaAsyncOperations = async props => {
88
88
  if (!contextId) {
89
89
  await props.updater.updateContextId();
90
90
  }
91
- const hasDifferentContextId = await props.updater.hasDifferentContextId();
92
- if (hasDifferentContextId) {
91
+ const shouldNodeBeDeepCopied = await props.updater.shouldNodeBeDeepCopied();
92
+ if (shouldNodeBeDeepCopied) {
93
93
  try {
94
94
  const copyNode = props.updater.copyNode({
95
95
  traceId: props.mediaNode.attrs.__mediaTraceId
@@ -21,7 +21,7 @@ import { updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
21
21
  // Ignored via go/ees005
22
22
  // eslint-disable-next-line import/no-namespace
23
23
  import * as helpers from '../pm-plugins/commands/helpers';
24
- import { getMediaFromSupportedMediaNodesFromSelection, isNodeDoubleClickSupportedInLivePagesViewMode, removeMediaNode, splitMediaGroup } from '../pm-plugins/utils/media-common';
24
+ import { getIdentifier, getMediaFromSupportedMediaNodesFromSelection, isNodeDoubleClickSupportedInLivePagesViewMode, removeMediaNode, splitMediaGroup } from '../pm-plugins/utils/media-common';
25
25
  import { insertMediaGroupNode, insertMediaInlineNode } from '../pm-plugins/utils/media-files';
26
26
  import { getMediaNodeInsertionType } from '../pm-plugins/utils/media-inline';
27
27
  import { insertMediaSingleNode } from '../pm-plugins/utils/media-single';
@@ -92,7 +92,7 @@ export class MediaPluginStateImplementation {
92
92
  _defineProperty(this, "destroyed", false);
93
93
  _defineProperty(this, "removeOnCloseListener", () => {});
94
94
  _defineProperty(this, "onPopupToggleCallback", () => {});
95
- _defineProperty(this, "nodeCount", new Map());
95
+ _defineProperty(this, "identifierCount", new Map());
96
96
  _defineProperty(this, "taskManager", new MediaTaskManager());
97
97
  _defineProperty(this, "pickers", []);
98
98
  _defineProperty(this, "pickerPromises", []);
@@ -247,23 +247,53 @@ export class MediaPluginStateImplementation {
247
247
  }
248
248
  removeMediaNode(this.view, getNode, getPos);
249
249
  });
250
+ _defineProperty(this, "getIdentifierKey", identifier => {
251
+ if (identifier.mediaItemType === "file") {
252
+ return identifier.id;
253
+ } else {
254
+ return identifier.dataURI;
255
+ }
256
+ });
250
257
  _defineProperty(this, "trackMediaNodeAddition", node => {
251
- var _this$nodeCount$get;
252
- const id = node.attrs.id;
253
- const count = (_this$nodeCount$get = this.nodeCount.get(id)) !== null && _this$nodeCount$get !== void 0 ? _this$nodeCount$get : 0;
258
+ var _this$identifierCount;
259
+ const identifier = getIdentifier(node.attrs);
260
+ const key = this.getIdentifierKey(identifier);
261
+ const {
262
+ count
263
+ } = (_this$identifierCount = this.identifierCount.get(key)) !== null && _this$identifierCount !== void 0 ? _this$identifierCount : {
264
+ count: 0
265
+ };
254
266
  if (count === 0) {
255
- this.taskManager.resumePendingTask(id);
267
+ this.taskManager.resumePendingTask(key);
256
268
  }
257
- this.nodeCount.set(id, count + 1);
269
+ this.identifierCount.set(key, {
270
+ identifier,
271
+ count: count + 1
272
+ });
258
273
  });
259
274
  _defineProperty(this, "trackMediaNodeRemoval", node => {
260
- var _this$nodeCount$get2;
261
- const id = node.attrs.id;
262
- const count = (_this$nodeCount$get2 = this.nodeCount.get(id)) !== null && _this$nodeCount$get2 !== void 0 ? _this$nodeCount$get2 : 0;
275
+ var _this$identifierCount2;
276
+ const identifier = getIdentifier(node.attrs);
277
+ const key = this.getIdentifierKey(identifier);
278
+ const {
279
+ count
280
+ } = (_this$identifierCount2 = this.identifierCount.get(key)) !== null && _this$identifierCount2 !== void 0 ? _this$identifierCount2 : {
281
+ count: 0
282
+ };
263
283
  if (count === 1) {
264
- this.taskManager.cancelPendingTask(id);
284
+ this.taskManager.cancelPendingTask(key);
265
285
  }
266
- this.nodeCount.set(id, count - 1);
286
+ this.identifierCount.set(key, {
287
+ identifier,
288
+ count: count - 1
289
+ });
290
+ });
291
+ _defineProperty(this, "isIdentifierInEditorScope", identifier => {
292
+ const key = this.getIdentifierKey(identifier);
293
+
294
+ // rely on has instead of count > 0 because if the user cuts and pastes the same media
295
+ // the count will temporarily be 0 but the media is still in the scope of editor.
296
+ return this.identifierCount.has(key);
267
297
  });
268
298
  /**
269
299
  * Called from React UI Component on componentDidMount
@@ -193,7 +193,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
193
193
  this.updateMediaClientConfig();
194
194
  this.mediaNodes.forEach( /*#__PURE__*/function () {
195
195
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(node) {
196
- var _this2$props, view, mediaProvider, contextIdentifierProvider, mediaNodeUpdater, getPos, contextId, hasDifferentContextId;
196
+ var _this2$props, view, mediaProvider, contextIdentifierProvider, mediaNodeUpdater, getPos, contextId, shouldNodeBeDeepCopied;
197
197
  return _regeneratorRuntime.wrap(function _callee$(_context) {
198
198
  while (1) switch (_context.prev = _context.next) {
199
199
  case 0:
@@ -232,10 +232,10 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
232
232
  return mediaNodeUpdater.updateNodeContextId(getPos);
233
233
  case 9:
234
234
  _context.next = 11;
235
- return mediaNodeUpdater.hasDifferentContextId();
235
+ return mediaNodeUpdater.shouldNodeBeDeepCopied();
236
236
  case 11:
237
- hasDifferentContextId = _context.sent;
238
- if (!hasDifferentContextId) {
237
+ shouldNodeBeDeepCopied = _context.sent;
238
+ if (!shouldNodeBeDeepCopied) {
239
239
  _context.next = 15;
240
240
  break;
241
241
  }
@@ -117,7 +117,7 @@ var useLatestMediaGroupNode = function useLatestMediaGroupNode(nextMediaNode) {
117
117
  };
118
118
  var runMediaNodeUpdate = /*#__PURE__*/function () {
119
119
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
120
- var mediaNodeUpdater, getPos, node, updateAttrs, contextId, hasDifferentContextId;
120
+ var mediaNodeUpdater, getPos, node, updateAttrs, contextId, shouldNodeBeDeepCopied;
121
121
  return _regeneratorRuntime.wrap(function _callee$(_context) {
122
122
  while (1) switch (_context.prev = _context.next) {
123
123
  case 0:
@@ -138,10 +138,10 @@ var runMediaNodeUpdate = /*#__PURE__*/function () {
138
138
  return mediaNodeUpdater.updateNodeContextId(getPos);
139
139
  case 8:
140
140
  _context.next = 10;
141
- return mediaNodeUpdater.hasDifferentContextId();
141
+ return mediaNodeUpdater.shouldNodeBeDeepCopied();
142
142
  case 10:
143
- hasDifferentContextId = _context.sent;
144
- if (!hasDifferentContextId) {
143
+ shouldNodeBeDeepCopied = _context.sent;
144
+ if (!shouldNodeBeDeepCopied) {
145
145
  _context.next = 14;
146
146
  break;
147
147
  }
@@ -49,7 +49,7 @@ var createMediaNodeUpdater = function createMediaNodeUpdater(props) {
49
49
  */
50
50
  var updateMediaNodeAttributes = /*#__PURE__*/function () {
51
51
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(props, mediaNodeUpdater) {
52
- var addPendingTask, node, contextId, hasDifferentContextId, copyNode;
52
+ var addPendingTask, node, contextId, shouldNodeBeDeepCopied, copyNode;
53
53
  return _regeneratorRuntime.wrap(function _callee$(_context) {
54
54
  while (1) switch (_context.prev = _context.next) {
55
55
  case 0:
@@ -70,10 +70,10 @@ var updateMediaNodeAttributes = /*#__PURE__*/function () {
70
70
  return mediaNodeUpdater.updateContextId();
71
71
  case 8:
72
72
  _context.next = 10;
73
- return mediaNodeUpdater.hasDifferentContextId();
73
+ return mediaNodeUpdater.shouldNodeBeDeepCopied();
74
74
  case 10:
75
- hasDifferentContextId = _context.sent;
76
- if (!hasDifferentContextId) {
75
+ shouldNodeBeDeepCopied = _context.sent;
76
+ if (!shouldNodeBeDeepCopied) {
77
77
  _context.next = 22;
78
78
  break;
79
79
  }
@@ -120,11 +120,11 @@ export var MediaInline = function MediaInline(props) {
120
120
  setViewMediaClientConfig = _useState2[1];
121
121
  var _useState3 = useState(true),
122
122
  _useState4 = _slicedToArray(_useState3, 2),
123
- isContextIdUnsync = _useState4[0],
124
- setIsContextIdUnsync = _useState4[1];
123
+ isNodeScopeUnsync = _useState4[0],
124
+ setIsNodeScopeUnsync = _useState4[1];
125
125
  useEffect(function () {
126
126
  var mediaNodeUpdater = createMediaNodeUpdater(props);
127
- mediaNodeUpdater.hasDifferentContextId().then(setIsContextIdUnsync);
127
+ mediaNodeUpdater.shouldNodeBeDeepCopied().then(setIsNodeScopeUnsync);
128
128
  handleNewNode(props);
129
129
  updateMediaNodeAttributes(props, mediaNodeUpdater);
130
130
  updateViewMediaClientConfig(props);
@@ -179,7 +179,7 @@ export var MediaInline = function MediaInline(props) {
179
179
  * to prevent calling the media API (in mounting of `MediaInlineCard`)
180
180
  * before the prerequisites meet
181
181
  */
182
- if (!viewMediaClientConfig || isContextIdUnsync) {
182
+ if (!viewMediaClientConfig || isNodeScopeUnsync) {
183
183
  return jsx(MediaInlineCardLoadingView, {
184
184
  message: "",
185
185
  isSelected: false