@atlaskit/editor-plugin-block-menu 5.2.21 → 5.2.23

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,20 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 5.2.23
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6c9c4e73b1c39`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6c9c4e73b1c39) -
8
+ EDITOR-4037 Block menu selection extension tests
9
+
10
+ ## 5.2.22
11
+
12
+ ### Patch Changes
13
+
14
+ - [`3356921b0b0ff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3356921b0b0ff) -
15
+ [ux] Enables 'Copy link to block' feature for nested nodes
16
+ - Updated dependencies
17
+
3
18
  ## 5.2.21
4
19
 
5
20
  ### Patch Changes
@@ -19,7 +19,6 @@ var _main = require("../pm-plugins/main");
19
19
  var _blockMenuProvider = require("./block-menu-provider");
20
20
  var _consts = require("./consts");
21
21
  var _copyLink = require("./utils/copyLink");
22
- var _isNestedNode = require("./utils/isNestedNode");
23
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
23
  var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
25
24
  var api = _ref.api,
@@ -35,14 +34,12 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
35
34
  var blockControlsState = _ref3.blockControlsState,
36
35
  selectionState = _ref3.selectionState;
37
36
  return {
38
- menuTriggerBy: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.menuTriggerBy,
39
37
  preservedSelection: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.preservedSelection,
40
38
  defaultSelection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
41
39
  };
42
40
  }),
43
41
  preservedSelection = _useSharedPluginState.preservedSelection,
44
- defaultSelection = _useSharedPluginState.defaultSelection,
45
- menuTriggerBy = _useSharedPluginState.menuTriggerBy;
42
+ defaultSelection = _useSharedPluginState.defaultSelection;
46
43
  var selection = preservedSelection || defaultSelection;
47
44
  var handleClick = (0, _react.useCallback)(function () {
48
45
  if (!selection) {
@@ -85,8 +82,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
85
82
  });
86
83
  }, [api, blockLinkHashPrefix, getLinkPath, onDropdownOpenChanged, selection]);
87
84
 
88
- // Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
89
- if (!(0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') || !!menuTriggerBy && (0, _isNestedNode.isNestedNode)(selection, menuTriggerBy)) {
85
+ // Hide copy link when `platform_editor_adf_with_localid` feature flag is off
86
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid')) {
90
87
  return null;
91
88
  }
92
89
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
@@ -46,7 +46,7 @@ var FormatMenuComponent = exports.FormatMenuComponent = function FormatMenuCompo
46
46
  }),
47
47
  enableMaxHeight: true,
48
48
  onClick: handleClick,
49
- dropdownTestId: "editor-nested-turn-into-menu",
49
+ dropdownTestId: "editor-turn-into-menu",
50
50
  shouldFitContainer: true
51
51
  }, children);
52
52
  };
@@ -11,7 +11,6 @@ import { blockMenuPluginKey } from '../pm-plugins/main';
11
11
  import { useBlockMenu } from './block-menu-provider';
12
12
  import { BLOCK_MENU_ITEM_NAME } from './consts';
13
13
  import { copyLink } from './utils/copyLink';
14
- import { isNestedNode } from './utils/isNestedNode';
15
14
  const CopyLinkDropdownItemContent = ({
16
15
  api,
17
16
  config
@@ -28,14 +27,12 @@ const CopyLinkDropdownItemContent = ({
28
27
  } = config || {};
29
28
  const {
30
29
  preservedSelection,
31
- defaultSelection,
32
- menuTriggerBy
30
+ defaultSelection
33
31
  } = useSharedPluginStateWithSelector(api, ['blockControls', 'selection'], ({
34
32
  blockControlsState,
35
33
  selectionState
36
34
  }) => {
37
35
  return {
38
- menuTriggerBy: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.menuTriggerBy,
39
36
  preservedSelection: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.preservedSelection,
40
37
  defaultSelection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
41
38
  };
@@ -84,8 +81,8 @@ const CopyLinkDropdownItemContent = ({
84
81
  });
85
82
  }, [api, blockLinkHashPrefix, getLinkPath, onDropdownOpenChanged, selection]);
86
83
 
87
- // Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
88
- if (!fg('platform_editor_adf_with_localid') || !!menuTriggerBy && isNestedNode(selection, menuTriggerBy)) {
84
+ // Hide copy link when `platform_editor_adf_with_localid` feature flag is off
85
+ if (!fg('platform_editor_adf_with_localid')) {
89
86
  return null;
90
87
  }
91
88
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -40,7 +40,7 @@ export const FormatMenuComponent = ({
40
40
  }),
41
41
  enableMaxHeight: true,
42
42
  onClick: handleClick,
43
- dropdownTestId: "editor-nested-turn-into-menu",
43
+ dropdownTestId: "editor-turn-into-menu",
44
44
  shouldFitContainer: true
45
45
  }, children);
46
46
  };
@@ -11,7 +11,6 @@ import { blockMenuPluginKey } from '../pm-plugins/main';
11
11
  import { useBlockMenu } from './block-menu-provider';
12
12
  import { BLOCK_MENU_ITEM_NAME } from './consts';
13
13
  import { copyLink } from './utils/copyLink';
14
- import { isNestedNode } from './utils/isNestedNode';
15
14
  var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
16
15
  var api = _ref.api,
17
16
  config = _ref.config;
@@ -26,14 +25,12 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
26
25
  var blockControlsState = _ref3.blockControlsState,
27
26
  selectionState = _ref3.selectionState;
28
27
  return {
29
- menuTriggerBy: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.menuTriggerBy,
30
28
  preservedSelection: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.preservedSelection,
31
29
  defaultSelection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
32
30
  };
33
31
  }),
34
32
  preservedSelection = _useSharedPluginState.preservedSelection,
35
- defaultSelection = _useSharedPluginState.defaultSelection,
36
- menuTriggerBy = _useSharedPluginState.menuTriggerBy;
33
+ defaultSelection = _useSharedPluginState.defaultSelection;
37
34
  var selection = preservedSelection || defaultSelection;
38
35
  var handleClick = useCallback(function () {
39
36
  if (!selection) {
@@ -76,8 +73,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
76
73
  });
77
74
  }, [api, blockLinkHashPrefix, getLinkPath, onDropdownOpenChanged, selection]);
78
75
 
79
- // Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
80
- if (!fg('platform_editor_adf_with_localid') || !!menuTriggerBy && isNestedNode(selection, menuTriggerBy)) {
76
+ // Hide copy link when `platform_editor_adf_with_localid` feature flag is off
77
+ if (!fg('platform_editor_adf_with_localid')) {
81
78
  return null;
82
79
  }
83
80
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -37,7 +37,7 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
37
37
  }),
38
38
  enableMaxHeight: true,
39
39
  onClick: handleClick,
40
- dropdownTestId: "editor-nested-turn-into-menu",
40
+ dropdownTestId: "editor-turn-into-menu",
41
41
  shouldFitContainer: true
42
42
  }, children);
43
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "5.2.21",
3
+ "version": "5.2.23",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/css": "^0.19.0",
32
32
  "@atlaskit/dropdown-menu": "^16.3.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
34
- "@atlaskit/editor-plugin-block-controls": "^7.17.0",
34
+ "@atlaskit/editor-plugin-block-controls": "^7.18.0",
35
35
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
36
36
  "@atlaskit/editor-plugin-selection": "^6.1.0",
37
37
  "@atlaskit/editor-plugin-user-intent": "^4.0.0",
@@ -44,12 +44,12 @@
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
46
46
  "@atlaskit/primitives": "^17.0.0",
47
- "@atlaskit/tmp-editor-statsig": "^16.1.0",
47
+ "@atlaskit/tmp-editor-statsig": "^16.2.0",
48
48
  "@atlaskit/tokens": "^9.0.0",
49
49
  "@babel/runtime": "^7.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^110.48.0",
52
+ "@atlaskit/editor-common": "^110.49.0",
53
53
  "react": "^18.2.0",
54
54
  "react-intl-next": "npm:react-intl@^5.18.1"
55
55
  },