@atlaskit/editor-plugin-block-menu 3.2.2 → 3.2.3

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-menu
2
2
 
3
+ ## 3.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d5e5b25fe885a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d5e5b25fe885a) -
8
+ [ux] ED-29226 Open block menu when drag handle is focussed and space or enter key is pressed
9
+ - Updated dependencies
10
+
3
11
  ## 3.2.2
4
12
 
5
13
  ### Patch Changes
@@ -56,7 +56,7 @@ var BlockMenuContent = function BlockMenuContent(_ref) {
56
56
  }));
57
57
  };
58
58
  var BlockMenu = function BlockMenu(_ref2) {
59
- var _editorView$hasFocus, _editorView$dom;
59
+ var _editorView$dom, _ref3, _editorView$hasFocus;
60
60
  var editorView = _ref2.editorView,
61
61
  api = _ref2.api,
62
62
  mountTo = _ref2.mountTo,
@@ -77,7 +77,8 @@ var BlockMenu = function BlockMenu(_ref2) {
77
77
  currentUserIntent = _useSharedPluginState.currentUserIntent;
78
78
  var _useBlockMenu = (0, _blockMenuProvider.useBlockMenu)(),
79
79
  onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
80
- var hasFocus = (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
80
+ var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(_styles.DRAG_HANDLE_SELECTOR);
81
+ var hasFocus = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_ref3 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) || document.activeElement === targetHandleRef) !== null && _ref3 !== void 0 ? _ref3 : false : (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
81
82
  var hasSelection = !!editorView && !editorView.state.selection.empty;
82
83
  var emptyLineEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true);
83
84
 
@@ -95,9 +96,9 @@ var BlockMenu = function BlockMenu(_ref2) {
95
96
  return null;
96
97
  }
97
98
  var closeMenu = function closeMenu() {
98
- api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
99
+ api === null || api === void 0 || api.core.actions.execute(function (_ref4) {
99
100
  var _api$blockControls, _api$userIntent2;
100
- var tr = _ref3.tr;
101
+ var tr = _ref4.tr;
101
102
  api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
102
103
  closeMenu: true
103
104
  })({
@@ -114,7 +115,6 @@ var BlockMenu = function BlockMenu(_ref2) {
114
115
  closeMenu();
115
116
  return null;
116
117
  }
117
- var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(_styles.DRAG_HANDLE_SELECTOR);
118
118
  if (targetHandleRef instanceof HTMLElement) {
119
119
  return /*#__PURE__*/_react.default.createElement(PopupWithListeners, {
120
120
  alignX: 'right',
@@ -49,7 +49,7 @@ const BlockMenu = ({
49
49
  boundariesElement,
50
50
  scrollableElement
51
51
  }) => {
52
- var _editorView$hasFocus, _editorView$dom;
52
+ var _editorView$dom, _ref, _editorView$hasFocus;
53
53
  const {
54
54
  menuTriggerBy,
55
55
  isSelectedViaDragHandle,
@@ -67,7 +67,8 @@ const BlockMenu = ({
67
67
  const {
68
68
  onDropdownOpenChanged
69
69
  } = useBlockMenu();
70
- const hasFocus = (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
70
+ const targetHandleRef = editorView === null || editorView === void 0 ? void 0 : (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
71
+ const hasFocus = expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_ref = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) || document.activeElement === targetHandleRef) !== null && _ref !== void 0 ? _ref : false : (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
71
72
  const hasSelection = !!editorView && !editorView.state.selection.empty;
72
73
  const emptyLineEnabled = expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
73
74
 
@@ -105,7 +106,6 @@ const BlockMenu = ({
105
106
  closeMenu();
106
107
  return null;
107
108
  }
108
- const targetHandleRef = editorView === null || editorView === void 0 ? void 0 : (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
109
109
  if (targetHandleRef instanceof HTMLElement) {
110
110
  return /*#__PURE__*/React.createElement(PopupWithListeners, {
111
111
  alignX: 'right',
@@ -48,7 +48,7 @@ var BlockMenuContent = function BlockMenuContent(_ref) {
48
48
  }));
49
49
  };
50
50
  var BlockMenu = function BlockMenu(_ref2) {
51
- var _editorView$hasFocus, _editorView$dom;
51
+ var _editorView$dom, _ref3, _editorView$hasFocus;
52
52
  var editorView = _ref2.editorView,
53
53
  api = _ref2.api,
54
54
  mountTo = _ref2.mountTo,
@@ -69,7 +69,8 @@ var BlockMenu = function BlockMenu(_ref2) {
69
69
  currentUserIntent = _useSharedPluginState.currentUserIntent;
70
70
  var _useBlockMenu = useBlockMenu(),
71
71
  onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
72
- var hasFocus = (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
72
+ var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
73
+ var hasFocus = expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_ref3 = (editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) || document.activeElement === targetHandleRef) !== null && _ref3 !== void 0 ? _ref3 : false : (_editorView$hasFocus = editorView === null || editorView === void 0 ? void 0 : editorView.hasFocus()) !== null && _editorView$hasFocus !== void 0 ? _editorView$hasFocus : false;
73
74
  var hasSelection = !!editorView && !editorView.state.selection.empty;
74
75
  var emptyLineEnabled = expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
75
76
 
@@ -87,9 +88,9 @@ var BlockMenu = function BlockMenu(_ref2) {
87
88
  return null;
88
89
  }
89
90
  var closeMenu = function closeMenu() {
90
- api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
91
+ api === null || api === void 0 || api.core.actions.execute(function (_ref4) {
91
92
  var _api$blockControls, _api$userIntent2;
92
- var tr = _ref3.tr;
93
+ var tr = _ref4.tr;
93
94
  api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
94
95
  closeMenu: true
95
96
  })({
@@ -106,7 +107,6 @@ var BlockMenu = function BlockMenu(_ref2) {
106
107
  closeMenu();
107
108
  return null;
108
109
  }
109
- var targetHandleRef = editorView === null || editorView === void 0 || (_editorView$dom = editorView.dom) === null || _editorView$dom === void 0 ? void 0 : _editorView$dom.querySelector(DRAG_HANDLE_SELECTOR);
110
110
  if (targetHandleRef instanceof HTMLElement) {
111
111
  return /*#__PURE__*/React.createElement(PopupWithListeners, {
112
112
  alignX: 'right',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/icon-lab": "^5.7.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/primitives": "^14.15.0",
45
- "@atlaskit/tmp-editor-statsig": "^12.26.0",
45
+ "@atlaskit/tmp-editor-statsig": "^12.27.0",
46
46
  "@atlaskit/tokens": "^6.3.0",
47
47
  "@babel/runtime": "^7.0.0"
48
48
  },