@atlaskit/editor-plugin-block-controls 17.4.2 → 17.4.4

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-block-controls
2
2
 
3
+ ## 17.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f3766cc0ca65e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f3766cc0ca65e) -
8
+ Fix drag handle incorrectly showing on the first child of a `panel_c1` node. The hover guard that
9
+ suppresses block controls for the first child of a panel with an icon only matched the `panel`
10
+ node type, so the nestable `panel_c1` variant fell through and rendered a drag handle behind the
11
+ panel icon. Both panel node types are now treated the same when the
12
+ `platform_editor_controls_reliable_anchor` experiment and the
13
+ `platform_editor_controls_reliable_anchor_patch_1` feature gate are enabled.
14
+
15
+ ## 17.4.3
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 17.4.2
4
22
 
5
23
  ### Patch Changes
@@ -46,6 +46,18 @@ var getDefaultNodeSelector = (0, _memoizeOne.default)(function () {
46
46
  return getNodeSelector([].concat((0, _toConsumableArray2.default)(_decorationsAnchor.IGNORE_NODES_NEXT), ['media']), [].concat((0, _toConsumableArray2.default)(_decorationsAnchor.IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT), ['table']));
47
47
  });
48
48
 
49
+ /**
50
+ * `panel_c1` is the nestable panel variant and renders the same DOM as `panel`, so it must
51
+ * suppress block controls on its first child too. No-exposure check as this runs on every
52
+ * mouseover.
53
+ */
54
+ var isPanelNodeTypeName = function isPanelNodeTypeName(nodeTypeName) {
55
+ if (nodeTypeName === 'panel') {
56
+ return true;
57
+ }
58
+ return nodeTypeName === 'panel_c1' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls_reliable_anchor', 'isEnabled', true) && (0, _fg.fg)('platform_editor_controls_reliable_anchor_patch_1');
59
+ };
60
+
49
61
  // Block marks (e.g. font-size) wrap paragraphs in an extra div, making parentRootElement
50
62
  // the mark wrapper instead of the panel content container. When that happens, recalculate
51
63
  // the index relative to the panel content so the first-child check stays accurate.
@@ -234,7 +246,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
234
246
  var panelIndex = getBlockMarkPanelIndexAdjustment(parentRootElement, index);
235
247
  // We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
236
248
  var firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 || (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
237
- if (parentElement && parentElementType === 'panel' && !parentElement.classList.contains('ak-editor-panel__no-icon') && (panelIndex === 0 || firstChildIsWidget && panelIndex === 1)) {
249
+ if (parentElement && isPanelNodeTypeName(parentElementType) && !parentElement.classList.contains('ak-editor-panel__no-icon') && (panelIndex === 0 || firstChildIsWidget && panelIndex === 1)) {
238
250
  return false;
239
251
  }
240
252
  } else {
@@ -36,6 +36,18 @@ const getDefaultNodeSelector = memoizeOne(() => {
36
36
  return getNodeSelector([...IGNORE_NODES_NEXT, 'media'], [...IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, 'table']);
37
37
  });
38
38
 
39
+ /**
40
+ * `panel_c1` is the nestable panel variant and renders the same DOM as `panel`, so it must
41
+ * suppress block controls on its first child too. No-exposure check as this runs on every
42
+ * mouseover.
43
+ */
44
+ const isPanelNodeTypeName = nodeTypeName => {
45
+ if (nodeTypeName === 'panel') {
46
+ return true;
47
+ }
48
+ return nodeTypeName === 'panel_c1' && expValEqualsNoExposure('platform_editor_controls_reliable_anchor', 'isEnabled', true) && fg('platform_editor_controls_reliable_anchor_patch_1');
49
+ };
50
+
39
51
  // Block marks (e.g. font-size) wrap paragraphs in an extra div, making parentRootElement
40
52
  // the mark wrapper instead of the panel content container. When that happens, recalculate
41
53
  // the index relative to the panel content so the first-child check stays accurate.
@@ -226,7 +238,7 @@ export const handleMouseOver = (view, event, api) => {
226
238
  const panelIndex = getBlockMarkPanelIndexAdjustment(parentRootElement, index);
227
239
  // We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
228
240
  const firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 ? void 0 : (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
229
- if (parentElement && parentElementType === 'panel' && !parentElement.classList.contains('ak-editor-panel__no-icon') && (panelIndex === 0 || firstChildIsWidget && panelIndex === 1)) {
241
+ if (parentElement && isPanelNodeTypeName(parentElementType) && !parentElement.classList.contains('ak-editor-panel__no-icon') && (panelIndex === 0 || firstChildIsWidget && panelIndex === 1)) {
230
242
  return false;
231
243
  }
232
244
  } else {
@@ -39,6 +39,18 @@ var getDefaultNodeSelector = memoizeOne(function () {
39
39
  return getNodeSelector([].concat(_toConsumableArray(IGNORE_NODES_NEXT), ['media']), [].concat(_toConsumableArray(IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT), ['table']));
40
40
  });
41
41
 
42
+ /**
43
+ * `panel_c1` is the nestable panel variant and renders the same DOM as `panel`, so it must
44
+ * suppress block controls on its first child too. No-exposure check as this runs on every
45
+ * mouseover.
46
+ */
47
+ var isPanelNodeTypeName = function isPanelNodeTypeName(nodeTypeName) {
48
+ if (nodeTypeName === 'panel') {
49
+ return true;
50
+ }
51
+ return nodeTypeName === 'panel_c1' && expValEqualsNoExposure('platform_editor_controls_reliable_anchor', 'isEnabled', true) && fg('platform_editor_controls_reliable_anchor_patch_1');
52
+ };
53
+
42
54
  // Block marks (e.g. font-size) wrap paragraphs in an extra div, making parentRootElement
43
55
  // the mark wrapper instead of the panel content container. When that happens, recalculate
44
56
  // the index relative to the panel content so the first-child check stays accurate.
@@ -227,7 +239,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
227
239
  var panelIndex = getBlockMarkPanelIndexAdjustment(parentRootElement, index);
228
240
  // We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
229
241
  var firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 || (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
230
- if (parentElement && parentElementType === 'panel' && !parentElement.classList.contains('ak-editor-panel__no-icon') && (panelIndex === 0 || firstChildIsWidget && panelIndex === 1)) {
242
+ if (parentElement && isPanelNodeTypeName(parentElementType) && !parentElement.classList.contains('ak-editor-panel__no-icon') && (panelIndex === 0 || firstChildIsWidget && panelIndex === 1)) {
231
243
  return false;
232
244
  }
233
245
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "17.4.2",
3
+ "version": "17.4.4",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/editor-plugin-metrics": "^17.0.0",
35
35
  "@atlaskit/editor-plugin-quick-insert": "^16.3.0",
36
36
  "@atlaskit/editor-plugin-selection": "^16.1.0",
37
- "@atlaskit/editor-plugin-show-diff": "^14.4.0",
37
+ "@atlaskit/editor-plugin-show-diff": "^14.5.0",
38
38
  "@atlaskit/editor-plugin-toolbar": "^13.0.0",
39
39
  "@atlaskit/editor-plugin-type-ahead": "^17.1.0",
40
40
  "@atlaskit/editor-plugin-ui-control-registry": "^10.0.0",
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/primitives": "^22.5.0",
56
56
  "@atlaskit/section-message": "^10.2.0",
57
57
  "@atlaskit/theme": "^28.2.0",
58
- "@atlaskit/tmp-editor-statsig": "^176.0.0",
58
+ "@atlaskit/tmp-editor-statsig": "^177.0.0",
59
59
  "@atlaskit/tokens": "^16.11.0",
60
60
  "@atlaskit/tooltip": "^24.3.0",
61
61
  "@babel/runtime": "^7.0.0",
@@ -94,6 +94,9 @@
94
94
  "confluence_remix_button_right_side_block_fg": {
95
95
  "type": "boolean"
96
96
  },
97
+ "platform_editor_controls_reliable_anchor_patch_1": {
98
+ "type": "boolean"
99
+ },
97
100
  "platform_editor_layout_column_menu_kill_switch_1": {
98
101
  "type": "boolean",
99
102
  "referenceOnly": true