@atlaskit/editor-plugin-block-menu 7.0.32 → 7.0.34

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,32 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 7.0.34
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 7.0.33
10
+
11
+ ### Patch Changes
12
+
13
+ - [`a9fb116e4a8d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a9fb116e4a8d8) -
14
+ fix(editor): fix paragraph nodes not highlighting on hover over block menu delete action
15
+
16
+ Two root causes fixed:
17
+ 1. CSS danger styles were gated behind
18
+ `expValNoExposure('platform_editor_block_menu', 'isEnabled', false)`, meaning they were
19
+ excluded when the new block menu was enabled. Removed the gate so danger styles are always
20
+ injected.
21
+
22
+ 2. `hoverDecorationCommand` used `tr.selection` directly, which for paragraphs is a collapsed
23
+ `TextSelection` (cursor inside text). This caused `getSourceNodesFromSelectionRange` to return
24
+ an empty array, so no decorations were created. Fixed by passing `preservedSelection` (a
25
+ `NodeSelection` pointing at the whole paragraph node) from `blockControls` shared state through
26
+ to `hoverDecoration`.
27
+
28
+ - Updated dependencies
29
+
3
30
  ## 7.0.32
4
31
 
5
32
  ### Patch Changes
@@ -77,10 +77,17 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
77
77
  };
78
78
  var onShowHoverDecoration = (0, _react.useCallback)(function () {
79
79
  api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
80
- var _api$decorations, _api$decorations$hove;
80
+ var _api$blockControls4, _api$decorations, _api$decorations$hove;
81
81
  var tr = _ref3.tr;
82
+ // [FEATURE FLAG: platform_editor_block_menu_jira_patch_1]
83
+ // Passes preservedSelection (NodeSelection) to hoverDecoration so paragraph nodes
84
+ // are correctly highlighted on hover over Delete. Without this, tr.selection is a
85
+ // collapsed TextSelection which produces no decorations for paragraphs.
86
+ // To clean up: always pass preservedSelection, remove the feature flag check.
87
+ var preservedSelection = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_jira_patch_1') ? api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || (_api$blockControls4 = _api$blockControls4.sharedState.currentState()) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.preservedSelection : undefined;
82
88
  api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 || (_api$decorations = _api$decorations.commands) === null || _api$decorations === void 0 || (_api$decorations$hove = _api$decorations.hoverDecoration) === null || _api$decorations$hove === void 0 || _api$decorations$hove.call(_api$decorations, {
83
- add: true
89
+ add: true,
90
+ selection: preservedSelection
84
91
  })({
85
92
  tr: tr
86
93
  });
@@ -73,9 +73,16 @@ const DeleteDropdownItemContent = ({
73
73
  api === null || api === void 0 ? void 0 : api.core.actions.execute(({
74
74
  tr
75
75
  }) => {
76
- var _api$decorations, _api$decorations$comm, _api$decorations$comm2;
76
+ var _api$blockControls4, _api$blockControls4$s, _api$decorations, _api$decorations$comm, _api$decorations$comm2;
77
+ // [FEATURE FLAG: platform_editor_block_menu_jira_patch_1]
78
+ // Passes preservedSelection (NodeSelection) to hoverDecoration so paragraph nodes
79
+ // are correctly highlighted on hover over Delete. Without this, tr.selection is a
80
+ // collapsed TextSelection which produces no decorations for paragraphs.
81
+ // To clean up: always pass preservedSelection, remove the feature flag check.
82
+ const preservedSelection = fg('platform_editor_block_menu_jira_patch_1') ? api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : (_api$blockControls4$s = _api$blockControls4.sharedState.currentState()) === null || _api$blockControls4$s === void 0 ? void 0 : _api$blockControls4$s.preservedSelection : undefined;
77
83
  api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : (_api$decorations$comm = _api$decorations.commands) === null || _api$decorations$comm === void 0 ? void 0 : (_api$decorations$comm2 = _api$decorations$comm.hoverDecoration) === null || _api$decorations$comm2 === void 0 ? void 0 : _api$decorations$comm2.call(_api$decorations$comm, {
78
- add: true
84
+ add: true,
85
+ selection: preservedSelection
79
86
  })({
80
87
  tr
81
88
  });
@@ -68,10 +68,17 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
68
68
  };
69
69
  var onShowHoverDecoration = useCallback(function () {
70
70
  api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
71
- var _api$decorations, _api$decorations$hove;
71
+ var _api$blockControls4, _api$decorations, _api$decorations$hove;
72
72
  var tr = _ref3.tr;
73
+ // [FEATURE FLAG: platform_editor_block_menu_jira_patch_1]
74
+ // Passes preservedSelection (NodeSelection) to hoverDecoration so paragraph nodes
75
+ // are correctly highlighted on hover over Delete. Without this, tr.selection is a
76
+ // collapsed TextSelection which produces no decorations for paragraphs.
77
+ // To clean up: always pass preservedSelection, remove the feature flag check.
78
+ var preservedSelection = fg('platform_editor_block_menu_jira_patch_1') ? api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || (_api$blockControls4 = _api$blockControls4.sharedState.currentState()) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.preservedSelection : undefined;
73
79
  api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 || (_api$decorations = _api$decorations.commands) === null || _api$decorations === void 0 || (_api$decorations$hove = _api$decorations.hoverDecoration) === null || _api$decorations$hove === void 0 || _api$decorations$hove.call(_api$decorations, {
74
- add: true
80
+ add: true,
81
+ selection: preservedSelection
75
82
  })({
76
83
  tr: tr
77
84
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "7.0.32",
3
+ "version": "7.0.34",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/primitives": "^19.0.0",
46
46
  "@atlaskit/prosemirror-history": "^0.2.0",
47
- "@atlaskit/tmp-editor-statsig": "^59.1.0",
47
+ "@atlaskit/tmp-editor-statsig": "^61.0.0",
48
48
  "@atlaskit/tokens": "^13.0.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "bind-event-listener": "^3.0.0"
@@ -94,6 +94,9 @@
94
94
  "platform_editor_adf_with_localid": {
95
95
  "type": "boolean"
96
96
  },
97
+ "platform_editor_block_menu_jira_patch_1": {
98
+ "type": "boolean"
99
+ },
97
100
  "platform_editor_block_menu_copy_section": {
98
101
  "type": "boolean"
99
102
  },
@@ -103,9 +106,6 @@
103
106
  "platform_editor_block_menu_v2_patch_3": {
104
107
  "type": "boolean"
105
108
  },
106
- "platform_editor_block_menu_jira_patch_1": {
107
- "type": "boolean"
108
- },
109
109
  "platform_editor_block_menu_divider_patch": {
110
110
  "type": "boolean"
111
111
  }