@atlaskit/editor-plugin-block-controls 11.2.20 → 11.3.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,21 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 11.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4c22fe79f104e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4c22fe79f104e) -
8
+ Guard against undefined plugin state when reading shared state in floating-toolbar handler
9
+ (layout) and useEffect deps array (block-controls drag handle); fixes intermittent crash during
10
+ editor reconfigure / partial-preset transitions.
11
+
12
+ ## 11.3.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`89a8af72aa2c9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/89a8af72aa2c9) -
17
+ Add reusable toolbar menu container and render the layout column menu in a popup
18
+
3
19
  ## 11.2.20
4
20
 
5
21
  ### Patch Changes
@@ -340,7 +340,7 @@ var getNodeMargins = function getNodeMargins(node) {
340
340
  return _consts2.nodeMargins[nodeTypeName] || _consts2.nodeMargins['default'];
341
341
  };
342
342
  var DragHandle = exports.DragHandle = function DragHandle(_ref) {
343
- var _api$core4;
343
+ var _api$core4, _api$blockControls8;
344
344
  var view = _ref.view,
345
345
  api = _ref.api,
346
346
  formatMessage = _ref.formatMessage,
@@ -464,8 +464,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
464
464
  if (startPos === undefined) {
465
465
  return tr;
466
466
  }
467
- if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
468
- tr.setMeta('toggleLayoutColumnMenu', {});
467
+ if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
468
+ tr.setMeta('toggleLayoutColumnMenu', {
469
+ isOpen: true
470
+ });
469
471
  }
470
472
  var resolvedStartPos = tr.doc.resolve(startPos);
471
473
  var selection = ((_selectionPreservatio = _pluginKey.selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
@@ -515,8 +517,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
515
517
  if (startPos === undefined) {
516
518
  return tr;
517
519
  }
518
- if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
519
- tr.setMeta('toggleLayoutColumnMenu', {});
520
+ if (nodeType === 'layoutColumn' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true)) {
521
+ tr.setMeta('toggleLayoutColumnMenu', {
522
+ isOpen: true
523
+ });
520
524
  }
521
525
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
522
526
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
@@ -896,7 +900,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
896
900
  } else {
897
901
  setDragHandleDisabled(false);
898
902
  }
899
- }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isShiftDown, isTopLevelNodeValue, view]);
903
+ }, [api === null || api === void 0 || (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isShiftDown, isTopLevelNodeValue, view]);
900
904
  var dragHandleMessage = (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
901
905
  br: (0, _react2.jsx)("br", null)
902
906
  }) : formatMessage(_messages.blockControlsMessages.dragToMove);
@@ -344,7 +344,7 @@ export const DragHandle = ({
344
344
  isTopLevelNode = true,
345
345
  anchorRectCache
346
346
  }) => {
347
- var _api$core4;
347
+ var _api$core4, _api$blockControls8;
348
348
  const buttonRef = useRef(null);
349
349
  const mouseDownRef = useRef(false);
350
350
  const [dragHandleSelected, setDragHandleSelected] = useState(false);
@@ -439,8 +439,10 @@ export const DragHandle = ({
439
439
  if (startPos === undefined) {
440
440
  return tr;
441
441
  }
442
- if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
443
- tr.setMeta('toggleLayoutColumnMenu', {});
442
+ if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
443
+ tr.setMeta('toggleLayoutColumnMenu', {
444
+ isOpen: true
445
+ });
444
446
  }
445
447
  const resolvedStartPos = tr.doc.resolve(startPos);
446
448
  const selection = ((_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
@@ -491,8 +493,10 @@ export const DragHandle = ({
491
493
  if (startPos === undefined) {
492
494
  return tr;
493
495
  }
494
- if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
495
- tr.setMeta('toggleLayoutColumnMenu', {});
496
+ if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
497
+ tr.setMeta('toggleLayoutColumnMenu', {
498
+ isOpen: true
499
+ });
496
500
  }
497
501
  const mSelect = api === null || api === void 0 ? void 0 : (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
498
502
  const $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
@@ -878,7 +882,7 @@ export const DragHandle = ({
878
882
  } else {
879
883
  setDragHandleDisabled(false);
880
884
  }
881
- }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isShiftDown, isTopLevelNodeValue, view]);
885
+ }, [api === null || api === void 0 ? void 0 : (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isShiftDown, isTopLevelNodeValue, view]);
882
886
  const dragHandleMessage = editorExperiment('platform_editor_block_menu', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
883
887
  br: jsx("br", null)
884
888
  }) : formatMessage(blockControlsMessages.dragToMove);
@@ -336,7 +336,7 @@ var getNodeMargins = function getNodeMargins(node) {
336
336
  return nodeMargins[nodeTypeName] || nodeMargins['default'];
337
337
  };
338
338
  export var DragHandle = function DragHandle(_ref) {
339
- var _api$core4;
339
+ var _api$core4, _api$blockControls8;
340
340
  var view = _ref.view,
341
341
  api = _ref.api,
342
342
  formatMessage = _ref.formatMessage,
@@ -460,8 +460,10 @@ export var DragHandle = function DragHandle(_ref) {
460
460
  if (startPos === undefined) {
461
461
  return tr;
462
462
  }
463
- if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
464
- tr.setMeta('toggleLayoutColumnMenu', {});
463
+ if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
464
+ tr.setMeta('toggleLayoutColumnMenu', {
465
+ isOpen: true
466
+ });
465
467
  }
466
468
  var resolvedStartPos = tr.doc.resolve(startPos);
467
469
  var selection = ((_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection) || tr.selection;
@@ -511,8 +513,10 @@ export var DragHandle = function DragHandle(_ref) {
511
513
  if (startPos === undefined) {
512
514
  return tr;
513
515
  }
514
- if (nodeType === 'layoutColumn' && expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
515
- tr.setMeta('toggleLayoutColumnMenu', {});
516
+ if (nodeType === 'layoutColumn' && expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
517
+ tr.setMeta('toggleLayoutColumnMenu', {
518
+ isOpen: true
519
+ });
516
520
  }
517
521
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
518
522
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
@@ -892,7 +896,7 @@ export var DragHandle = function DragHandle(_ref) {
892
896
  } else {
893
897
  setDragHandleDisabled(false);
894
898
  }
895
- }, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isShiftDown, isTopLevelNodeValue, view]);
899
+ }, [api === null || api === void 0 || (_api$blockControls8 = api.blockControls) === null || _api$blockControls8 === void 0 ? void 0 : _api$blockControls8.sharedState, isShiftDown, isTopLevelNodeValue, view]);
896
900
  var dragHandleMessage = editorExperiment('platform_editor_block_menu', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
897
901
  br: jsx("br", null)
898
902
  }) : formatMessage(blockControlsMessages.dragToMove);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "11.2.20",
3
+ "version": "11.3.1",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,18 +32,18 @@
32
32
  "@atlaskit/button": "^23.11.0",
33
33
  "@atlaskit/editor-plugin-accessibility-utils": "^10.1.0",
34
34
  "@atlaskit/editor-plugin-analytics": "^10.0.0",
35
- "@atlaskit/editor-plugin-editor-disabled": "^10.0.0",
36
- "@atlaskit/editor-plugin-editor-viewmode": "^12.0.0",
37
- "@atlaskit/editor-plugin-feature-flags": "^9.0.0",
38
- "@atlaskit/editor-plugin-interaction": "^19.0.0",
39
- "@atlaskit/editor-plugin-limited-mode": "^7.1.0",
40
- "@atlaskit/editor-plugin-metrics": "^11.0.0",
41
- "@atlaskit/editor-plugin-quick-insert": "^10.3.0",
42
- "@atlaskit/editor-plugin-selection": "^10.0.0",
43
- "@atlaskit/editor-plugin-toolbar": "^7.2.0",
44
- "@atlaskit/editor-plugin-type-ahead": "^10.0.0",
45
- "@atlaskit/editor-plugin-user-intent": "^8.1.0",
46
- "@atlaskit/editor-plugin-width": "^11.0.0",
35
+ "@atlaskit/editor-plugin-editor-disabled": "^10.1.0",
36
+ "@atlaskit/editor-plugin-editor-viewmode": "^12.1.0",
37
+ "@atlaskit/editor-plugin-feature-flags": "^9.1.0",
38
+ "@atlaskit/editor-plugin-interaction": "^19.1.0",
39
+ "@atlaskit/editor-plugin-limited-mode": "^7.2.0",
40
+ "@atlaskit/editor-plugin-metrics": "^11.1.0",
41
+ "@atlaskit/editor-plugin-quick-insert": "^10.4.0",
42
+ "@atlaskit/editor-plugin-selection": "^10.1.0",
43
+ "@atlaskit/editor-plugin-toolbar": "^7.3.0",
44
+ "@atlaskit/editor-plugin-type-ahead": "^10.1.0",
45
+ "@atlaskit/editor-plugin-user-intent": "^8.2.0",
46
+ "@atlaskit/editor-plugin-width": "^11.1.0",
47
47
  "@atlaskit/editor-prosemirror": "^7.3.0",
48
48
  "@atlaskit/editor-shared-styles": "^3.10.0",
49
49
  "@atlaskit/editor-tables": "^2.9.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
57
57
  "@atlaskit/primitives": "^19.0.0",
58
58
  "@atlaskit/theme": "^23.2.0",
59
- "@atlaskit/tmp-editor-statsig": "^80.0.0",
59
+ "@atlaskit/tmp-editor-statsig": "^80.1.0",
60
60
  "@atlaskit/tokens": "^13.0.0",
61
61
  "@atlaskit/tooltip": "^22.2.0",
62
62
  "@babel/runtime": "^7.0.0",