@atlaskit/editor-plugin-block-menu 11.1.18 → 11.1.20

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,19 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 11.1.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 11.1.19
10
+
11
+ ### Patch Changes
12
+
13
+ - [`f5d036ef75faa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f5d036ef75faa) -
14
+ [EDITOR-8110] Fix block menu closing when opening the "Change format" nested submenu
15
+ - Updated dependencies
16
+
3
17
  ## 11.1.18
4
18
 
5
19
  ### Patch Changes
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.transformNode = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _analytics = require("@atlaskit/editor-common/analytics");
10
8
  var _expand = require("@atlaskit/editor-common/expand");
11
9
  var _monitoring = require("@atlaskit/editor-common/monitoring");
@@ -14,12 +12,9 @@ var _selection = require("@atlaskit/editor-common/selection");
14
12
  var _state = require("@atlaskit/editor-prosemirror/state");
15
13
  var _transform = require("@atlaskit/editor-prosemirror/transform");
16
14
  var _editorTables = require("@atlaskit/editor-tables");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
15
  var _isNestedNode = require("../ui/utils/isNestedNode");
19
16
  var _transform2 = require("./transform-node-utils/transform");
20
17
  var _utils = require("./transform-node-utils/utils");
21
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
18
  var transformNode = exports.transformNode = function transformNode(api) {
24
19
  return function (targetType, metadata) {
25
20
  return function (_ref) {
@@ -116,13 +111,11 @@ var transformNode = exports.transformNode = function transformNode(api) {
116
111
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
117
112
  action: _analytics.ACTION.TRANSFORMED,
118
113
  actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
119
- attributes: _objectSpread(_objectSpread({
114
+ attributes: {
120
115
  duration: duration,
121
116
  isEmptyLine: isEmptyLine,
122
- isNested: isNested
123
- }, (0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_2') ? {
124
- isSuggested: isSuggested
125
- } : {}), {}, {
117
+ isNested: isNested,
118
+ isSuggested: isSuggested,
126
119
  sourceNodesCount: sourceNodes.length,
127
120
  sourceNodesCountByType: sourceNodeTypes,
128
121
  sourceNodeType: sourceNodes.length === 1 ? sourceNodes[0].type.name : 'multiple',
@@ -130,7 +123,7 @@ var transformNode = exports.transformNode = function transformNode(api) {
130
123
  targetNodeType: targetType.name,
131
124
  outputNodesCount: content.length,
132
125
  inputMethod: _analytics.INPUT_METHOD.BLOCK_MENU
133
- }),
126
+ },
134
127
  eventType: _analytics.EVENT_TYPE.TRACK
135
128
  })(tr);
136
129
  });
@@ -23,6 +23,7 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
23
23
  var _uiReact = require("@atlaskit/editor-common/ui-react");
24
24
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
25
25
  var _toolbarMenuContainer = require("@atlaskit/editor-toolbar/toolbar-menu-container");
26
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
27
  var _compiled = require("@atlaskit/primitives/compiled");
27
28
  var _prosemirrorHistory = require("@atlaskit/prosemirror-history");
28
29
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
@@ -283,8 +284,8 @@ var BlockMenu = function BlockMenu(_ref5) {
283
284
  api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.handleKeyDownWithPreservedSelection(event));
284
285
  };
285
286
  var handleClickOutside = function handleClickOutside(e) {
286
- // check if the clicked element was another drag handle, if so don't close the menu
287
- if (e.target instanceof HTMLElement && e.target.closest(_styles.DRAG_HANDLE_SELECTOR)) {
287
+ // check if the clicked element was another drag handle or nested dropdown menu, if so don't close the menu
288
+ if (e.target instanceof HTMLElement && (e.target.closest(_styles.DRAG_HANDLE_SELECTOR) || e.target.closest(_styles.NESTED_DROPDOWN_MENU) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_jira_patch_5'))) {
288
289
  return;
289
290
  }
290
291
  closeMenu();
@@ -6,7 +6,6 @@ import { expandSelectionToBlockRange, getSourceNodesFromSelectionRange } from '@
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
8
8
  import { CellSelection } from '@atlaskit/editor-tables';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { isNestedNode } from '../ui/utils/isNestedNode';
11
10
  import { convertNodesToTargetType } from './transform-node-utils/transform';
12
11
  import { isListNode } from './transform-node-utils/utils';
@@ -110,9 +109,7 @@ export const transformNode = api => (targetType, metadata) => ({
110
109
  duration,
111
110
  isEmptyLine,
112
111
  isNested,
113
- ...(fg('platform_editor_blocks_patch_2') ? {
114
- isSuggested
115
- } : {}),
112
+ isSuggested,
116
113
  sourceNodesCount: sourceNodes.length,
117
114
  sourceNodesCountByType: sourceNodeTypes,
118
115
  sourceNodeType: sourceNodes.length === 1 ? sourceNodes[0].type.name : 'multiple',
@@ -8,12 +8,13 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/edit
8
8
  import { BLOCK_MENU_TEST_ID } from '@atlaskit/editor-common/block-menu';
9
9
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
10
10
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
- import { DRAG_HANDLE_SELECTOR, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
11
+ import { DRAG_HANDLE_SELECTOR, NESTED_DROPDOWN_MENU, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
12
12
  import { Popup } from '@atlaskit/editor-common/ui';
13
13
  import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
14
14
  import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
15
15
  import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
16
16
  import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import { Box } from '@atlaskit/primitives/compiled';
18
19
  import { redo, undo } from '@atlaskit/prosemirror-history';
19
20
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -271,8 +272,8 @@ const BlockMenu = ({
271
272
  api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$c = _api$blockControls2.commands) === null || _api$blockControls2$c === void 0 ? void 0 : _api$blockControls2$c.handleKeyDownWithPreservedSelection(event));
272
273
  };
273
274
  const handleClickOutside = e => {
274
- // check if the clicked element was another drag handle, if so don't close the menu
275
- if (e.target instanceof HTMLElement && e.target.closest(DRAG_HANDLE_SELECTOR)) {
275
+ // check if the clicked element was another drag handle or nested dropdown menu, if so don't close the menu
276
+ if (e.target instanceof HTMLElement && (e.target.closest(DRAG_HANDLE_SELECTOR) || e.target.closest(NESTED_DROPDOWN_MENU) && fg('platform_editor_block_menu_jira_patch_5'))) {
276
277
  return;
277
278
  }
278
279
  closeMenu();
@@ -1,6 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
2
  import { expandedState } from '@atlaskit/editor-common/expand';
6
3
  import { logException } from '@atlaskit/editor-common/monitoring';
@@ -9,7 +6,6 @@ import { expandSelectionToBlockRange, getSourceNodesFromSelectionRange } from '@
9
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
7
  import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
11
8
  import { CellSelection } from '@atlaskit/editor-tables';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
9
  import { isNestedNode } from '../ui/utils/isNestedNode';
14
10
  import { convertNodesToTargetType } from './transform-node-utils/transform';
15
11
  import { isListNode } from './transform-node-utils/utils';
@@ -109,13 +105,11 @@ export var transformNode = function transformNode(api) {
109
105
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
110
106
  action: ACTION.TRANSFORMED,
111
107
  actionSubject: ACTION_SUBJECT.ELEMENT,
112
- attributes: _objectSpread(_objectSpread({
108
+ attributes: {
113
109
  duration: duration,
114
110
  isEmptyLine: isEmptyLine,
115
- isNested: isNested
116
- }, fg('platform_editor_blocks_patch_2') ? {
117
- isSuggested: isSuggested
118
- } : {}), {}, {
111
+ isNested: isNested,
112
+ isSuggested: isSuggested,
119
113
  sourceNodesCount: sourceNodes.length,
120
114
  sourceNodesCountByType: sourceNodeTypes,
121
115
  sourceNodeType: sourceNodes.length === 1 ? sourceNodes[0].type.name : 'multiple',
@@ -123,7 +117,7 @@ export var transformNode = function transformNode(api) {
123
117
  targetNodeType: targetType.name,
124
118
  outputNodesCount: content.length,
125
119
  inputMethod: INPUT_METHOD.BLOCK_MENU
126
- }),
120
+ },
127
121
  eventType: EVENT_TYPE.TRACK
128
122
  })(tr);
129
123
  });
@@ -9,12 +9,13 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/edit
9
9
  import { BLOCK_MENU_TEST_ID } from '@atlaskit/editor-common/block-menu';
10
10
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
11
11
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
- import { DRAG_HANDLE_SELECTOR, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
12
+ import { DRAG_HANDLE_SELECTOR, NESTED_DROPDOWN_MENU, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
13
13
  import { Popup } from '@atlaskit/editor-common/ui';
14
14
  import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
15
15
  import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
16
16
  import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
17
17
  import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
18
19
  import { Box } from '@atlaskit/primitives/compiled';
19
20
  import { redo, undo } from '@atlaskit/prosemirror-history';
20
21
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -274,8 +275,8 @@ var BlockMenu = function BlockMenu(_ref5) {
274
275
  api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.handleKeyDownWithPreservedSelection(event));
275
276
  };
276
277
  var handleClickOutside = function handleClickOutside(e) {
277
- // check if the clicked element was another drag handle, if so don't close the menu
278
- if (e.target instanceof HTMLElement && e.target.closest(DRAG_HANDLE_SELECTOR)) {
278
+ // check if the clicked element was another drag handle or nested dropdown menu, if so don't close the menu
279
+ if (e.target instanceof HTMLElement && (e.target.closest(DRAG_HANDLE_SELECTOR) || e.target.closest(NESTED_DROPDOWN_MENU) && fg('platform_editor_block_menu_jira_patch_5'))) {
279
280
  return;
280
281
  }
281
282
  closeMenu();
@@ -105,9 +105,6 @@ export type BlockMenuNestedSectionComponent = (props: {
105
105
  children: React.ReactNode;
106
106
  }) => React.ReactNode;
107
107
  export type BlockMenuItemComponentProps = {
108
- /**
109
- * TODO: Make this required when cleaning up platform_editor_blocks_patch_2.
110
- */
111
108
  isSuggested?: boolean;
112
109
  };
113
110
  export type BlockMenuItemComponent = (props?: BlockMenuItemComponentProps) => React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "11.1.18",
3
+ "version": "11.1.20",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,20 +30,20 @@
30
30
  "@atlaskit/editor-prosemirror": "^8.0.0",
31
31
  "@atlaskit/editor-shared-styles": "^4.0.0",
32
32
  "@atlaskit/editor-tables": "^3.0.0",
33
- "@atlaskit/editor-toolbar": "^2.1.0",
33
+ "@atlaskit/editor-toolbar": "^2.2.0",
34
34
  "@atlaskit/flag": "^18.1.0",
35
35
  "@atlaskit/icon": "^37.0.0",
36
36
  "@atlaskit/platform-feature-flags": "^2.0.0",
37
- "@atlaskit/primitives": "^20.5.0",
37
+ "@atlaskit/primitives": "^20.6.0",
38
38
  "@atlaskit/prosemirror-history": "^1.0.0",
39
- "@atlaskit/tmp-editor-statsig": "^124.1.0",
40
- "@atlaskit/tokens": "^15.5.0",
39
+ "@atlaskit/tmp-editor-statsig": "^125.0.0",
40
+ "@atlaskit/tokens": "^15.8.0",
41
41
  "@babel/runtime": "^7.0.0",
42
42
  "bind-event-listener": "^3.0.0",
43
43
  "memoize-one": "^6.0.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "@atlaskit/editor-common": "^116.25.0",
46
+ "@atlaskit/editor-common": "^116.30.0",
47
47
  "react": "^18.2.0",
48
48
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
49
49
  },
@@ -93,7 +93,7 @@
93
93
  "platform_editor_block_menu_v2_patch_2": {
94
94
  "type": "boolean"
95
95
  },
96
- "platform_editor_blocks_patch_2": {
96
+ "platform_editor_block_menu_jira_patch_5": {
97
97
  "type": "boolean"
98
98
  },
99
99
  "cc-maui-phase-3": {