@atlaskit/editor-plugin-block-controls 8.0.9 → 8.0.10

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,13 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 8.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [`df9b89b4945d1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/df9b89b4945d1) -
8
+ Editor-4255: "Fix heading with alignment nested inside layout not showing block menu"
9
+ - Updated dependencies
10
+
3
11
  ## 8.0.9
4
12
 
5
13
  ### Patch Changes
@@ -96,11 +96,21 @@ var newGetSelection = exports.newGetSelection = function newGetSelection(doc, se
96
96
  var nodeSize = node ? node.nodeSize : 1;
97
97
  var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
98
98
  if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
99
+ var _doc$nodeAt;
99
100
  // if mediaGroup only has a single child, we want to select the child
100
101
  if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
101
102
  var $mediaStartPos = doc.resolve(start + 1);
102
103
  return new _state.NodeSelection($mediaStartPos);
103
104
  }
105
+
106
+ // if heading with alignment nested inside a layout column, return TextSelection
107
+ // As NodeSelection cause the desc.selectNode is not a function error in the syncNodeSelection in prosemirror view
108
+ // Results in block menu not open on the first 2 clicks for a heading with alignment nested inside a layout column
109
+ if (nodeName === 'heading' && node !== null && node !== void 0 && node.marks.some(function (mark) {
110
+ return mark.type.name === 'alignment';
111
+ }) && ((_doc$nodeAt = doc.nodeAt(start - 1)) === null || _doc$nodeAt === void 0 ? void 0 : _doc$nodeAt.type.name) === 'layoutColumn') {
112
+ return _state.TextSelection.create(doc, start, start + nodeSize);
113
+ }
104
114
  return new _state.NodeSelection(doc.resolve(start));
105
115
  }
106
116
 
@@ -91,11 +91,19 @@ export const newGetSelection = (doc, selectionEmpty, start) => {
91
91
  const nodeSize = node ? node.nodeSize : 1;
92
92
  const nodeName = node === null || node === void 0 ? void 0 : node.type.name;
93
93
  if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
94
+ var _doc$nodeAt;
94
95
  // if mediaGroup only has a single child, we want to select the child
95
96
  if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
96
97
  const $mediaStartPos = doc.resolve(start + 1);
97
98
  return new NodeSelection($mediaStartPos);
98
99
  }
100
+
101
+ // if heading with alignment nested inside a layout column, return TextSelection
102
+ // As NodeSelection cause the desc.selectNode is not a function error in the syncNodeSelection in prosemirror view
103
+ // Results in block menu not open on the first 2 clicks for a heading with alignment nested inside a layout column
104
+ if (nodeName === 'heading' && node !== null && node !== void 0 && node.marks.some(mark => mark.type.name === 'alignment') && ((_doc$nodeAt = doc.nodeAt(start - 1)) === null || _doc$nodeAt === void 0 ? void 0 : _doc$nodeAt.type.name) === 'layoutColumn') {
105
+ return TextSelection.create(doc, start, start + nodeSize);
106
+ }
99
107
  return new NodeSelection(doc.resolve(start));
100
108
  }
101
109
 
@@ -90,11 +90,21 @@ export var newGetSelection = function newGetSelection(doc, selectionEmpty, start
90
90
  var nodeSize = node ? node.nodeSize : 1;
91
91
  var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
92
92
  if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
93
+ var _doc$nodeAt;
93
94
  // if mediaGroup only has a single child, we want to select the child
94
95
  if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
95
96
  var $mediaStartPos = doc.resolve(start + 1);
96
97
  return new NodeSelection($mediaStartPos);
97
98
  }
99
+
100
+ // if heading with alignment nested inside a layout column, return TextSelection
101
+ // As NodeSelection cause the desc.selectNode is not a function error in the syncNodeSelection in prosemirror view
102
+ // Results in block menu not open on the first 2 clicks for a heading with alignment nested inside a layout column
103
+ if (nodeName === 'heading' && node !== null && node !== void 0 && node.marks.some(function (mark) {
104
+ return mark.type.name === 'alignment';
105
+ }) && ((_doc$nodeAt = doc.nodeAt(start - 1)) === null || _doc$nodeAt === void 0 ? void 0 : _doc$nodeAt.type.name) === 'layoutColumn') {
106
+ return TextSelection.create(doc, start, start + nodeSize);
107
+ }
98
108
  return new NodeSelection(doc.resolve(start));
99
109
  }
100
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "8.0.9",
3
+ "version": "8.0.10",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
55
55
  "@atlaskit/primitives": "^17.0.0",
56
56
  "@atlaskit/theme": "^21.0.0",
57
- "@atlaskit/tmp-editor-statsig": "^16.15.0",
57
+ "@atlaskit/tmp-editor-statsig": "^16.18.0",
58
58
  "@atlaskit/tokens": "^9.1.0",
59
59
  "@atlaskit/tooltip": "^20.14.0",
60
60
  "@babel/runtime": "^7.0.0",