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

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
+ ## 5.2.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3356921b0b0ff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3356921b0b0ff) -
8
+ [ux] Enables 'Copy link to block' feature for nested nodes
9
+ - Updated dependencies
10
+
3
11
  ## 5.2.21
4
12
 
5
13
  ### 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, {
@@ -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, {
@@ -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, {
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.22",
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/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
  },