@atlaskit/editor-plugin-block-controls 3.3.0 → 3.3.2

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,19 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 3.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#122490](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/122490)
14
+ [`6ec36bc622c47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6ec36bc622c47) -
15
+ Check for undefined on root pos before inserting
16
+
3
17
  ## 3.3.0
4
18
 
5
19
  ### Minor Changes
@@ -319,24 +319,23 @@ var newApply = exports.newApply = function newApply(api, formatMessage, tr, curr
319
319
  var oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
320
320
  decorations = decorations.remove(oldHandle);
321
321
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
322
- var _activeNode5, _activeNode6;
323
- var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.rootPos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.rootPos);
322
+ var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations);
324
323
  decorations = decorations.remove(oldQuickInsertButton);
325
324
  }
326
325
  } else if (api && shouldRecreateHandle) {
327
- var _activeNode7, _activeNode8;
328
- var _oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.pos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.pos);
326
+ var _activeNode5, _activeNode6;
327
+ var _oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
329
328
  decorations = decorations.remove(_oldHandle);
330
329
  var handleDec = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
331
330
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
332
- var _activeNode9, _activeNode10;
333
- var _oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos);
334
- decorations = decorations.remove(_oldQuickInsertButton);
335
- var quickInsertButton = (0, _decorationsQuickInsertButton.quickInsertButtonDecoration)(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
336
- decorations = decorations.add(newState.doc, [handleDec, quickInsertButton]);
337
- } else {
338
- decorations = decorations.add(newState.doc, [handleDec]);
331
+ if ((latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos) !== undefined) {
332
+ var _oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations);
333
+ decorations = decorations.remove(_oldQuickInsertButton);
334
+ var quickInsertButton = (0, _decorationsQuickInsertButton.quickInsertButtonDecoration)(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
335
+ decorations = decorations.add(newState.doc, [quickInsertButton]);
336
+ }
339
337
  }
338
+ decorations = decorations.add(newState.doc, [handleDec]);
340
339
  }
341
340
 
342
341
  // Drop targets may be missing when the node count is being changed during a drag
@@ -316,24 +316,23 @@ export const newApply = (api, formatMessage, tr, currentState, newState, flags,
316
316
  const oldHandle = findHandleDec(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
317
317
  decorations = decorations.remove(oldHandle);
318
318
  if (editorExperiment('platform_editor_controls', 'variant1')) {
319
- var _activeNode5, _activeNode6;
320
- const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.rootPos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.rootPos);
319
+ const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
321
320
  decorations = decorations.remove(oldQuickInsertButton);
322
321
  }
323
322
  } else if (api && shouldRecreateHandle) {
324
- var _activeNode7, _activeNode8;
325
- const oldHandle = findHandleDec(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.pos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.pos);
323
+ var _activeNode5, _activeNode6;
324
+ const oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
326
325
  decorations = decorations.remove(oldHandle);
327
326
  const handleDec = dragHandleDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
328
327
  if (editorExperiment('platform_editor_controls', 'variant1')) {
329
- var _activeNode9, _activeNode10;
330
- const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos);
331
- decorations = decorations.remove(oldQuickInsertButton);
332
- const quickInsertButton = quickInsertButtonDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
333
- decorations = decorations.add(newState.doc, [handleDec, quickInsertButton]);
334
- } else {
335
- decorations = decorations.add(newState.doc, [handleDec]);
328
+ if ((latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos) !== undefined) {
329
+ const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
330
+ decorations = decorations.remove(oldQuickInsertButton);
331
+ const quickInsertButton = quickInsertButtonDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
332
+ decorations = decorations.add(newState.doc, [quickInsertButton]);
333
+ }
336
334
  }
335
+ decorations = decorations.add(newState.doc, [handleDec]);
337
336
  }
338
337
 
339
338
  // Drop targets may be missing when the node count is being changed during a drag
@@ -312,24 +312,23 @@ export var newApply = function newApply(api, formatMessage, tr, currentState, ne
312
312
  var oldHandle = findHandleDec(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
313
313
  decorations = decorations.remove(oldHandle);
314
314
  if (editorExperiment('platform_editor_controls', 'variant1')) {
315
- var _activeNode5, _activeNode6;
316
- var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.rootPos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.rootPos);
315
+ var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
317
316
  decorations = decorations.remove(oldQuickInsertButton);
318
317
  }
319
318
  } else if (api && shouldRecreateHandle) {
320
- var _activeNode7, _activeNode8;
321
- var _oldHandle = findHandleDec(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.pos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.pos);
319
+ var _activeNode5, _activeNode6;
320
+ var _oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
322
321
  decorations = decorations.remove(_oldHandle);
323
322
  var handleDec = dragHandleDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
324
323
  if (editorExperiment('platform_editor_controls', 'variant1')) {
325
- var _activeNode9, _activeNode10;
326
- var _oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos);
327
- decorations = decorations.remove(_oldQuickInsertButton);
328
- var quickInsertButton = quickInsertButtonDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
329
- decorations = decorations.add(newState.doc, [handleDec, quickInsertButton]);
330
- } else {
331
- decorations = decorations.add(newState.doc, [handleDec]);
324
+ if ((latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos) !== undefined) {
325
+ var _oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
326
+ decorations = decorations.remove(_oldQuickInsertButton);
327
+ var quickInsertButton = quickInsertButtonDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
328
+ decorations = decorations.add(newState.doc, [quickInsertButton]);
329
+ }
332
330
  }
331
+ decorations = decorations.add(newState.doc, [handleDec]);
333
332
  }
334
333
 
335
334
  // Drop targets may be missing when the node count is being changed during a drag
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
52
52
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^2.1.0",
53
53
  "@atlaskit/primitives": "^14.1.0",
54
- "@atlaskit/theme": "^17.0.0",
54
+ "@atlaskit/theme": "^18.0.0",
55
55
  "@atlaskit/tmp-editor-statsig": "^3.4.0",
56
56
  "@atlaskit/tokens": "^4.3.0",
57
57
  "@atlaskit/tooltip": "^20.0.0",