@atlaskit/editor-plugin-block-menu 4.0.16 → 4.0.18

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,21 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 4.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [`64b94b53839de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64b94b53839de) -
8
+ Fix the outdated Turn into disabled state in block menu
9
+ - Updated dependencies
10
+
11
+ ## 4.0.17
12
+
13
+ ### Patch Changes
14
+
15
+ - [`dc211dc1927b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dc211dc1927b5) -
16
+ [ux] ED-29232: Fixed issues with block menu for file
17
+ - Updated dependencies
18
+
3
19
  ## 4.0.16
4
20
 
5
21
  ### Patch Changes
@@ -24,9 +24,7 @@ var FormatMenuComponent = exports.FormatMenuComponent = function FormatMenuCompo
24
24
  var _useIntl = (0, _reactIntlNext.useIntl)(),
25
25
  formatMessage = _useIntl.formatMessage;
26
26
  var text = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockMenuMessages.turnInto) : formatMessage(_blockMenu.messages.turnInto);
27
- var isDisabled = (0, _react.useMemo)(function () {
28
- return (0, _platformFeatureFlags.fg)('platform_editor_block_menu_for_disabled_nodes') ? (0, _checkIsFormatMenuHidden.checkIsFormatMenuHidden)(api) : false;
29
- }, [api]);
27
+ var isDisabled = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_for_disabled_nodes') ? (0, _checkIsFormatMenuHidden.checkIsFormatMenuHidden)(api) : false;
30
28
  var handleClick = (0, _react.useCallback)(function () {
31
29
  api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
32
30
  var _api$analytics;
@@ -24,6 +24,11 @@ var isNestedNode = exports.isNestedNode = function isNestedNode(selection, menuT
24
24
  }
25
25
  var $from = selection.$from;
26
26
  var depth = $from.depth;
27
+
28
+ // When a file is in card view, selection.$from has a depth of 1, but it is not a nested node, should return false
29
+ if ($from.depth === 1 && selection instanceof _state.NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
30
+ return false;
31
+ }
27
32
  if ($from.depth > 0 && selection instanceof _state.NodeSelection) {
28
33
  return true;
29
34
  }
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useCallback } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { messages } from '@atlaskit/editor-common/block-menu';
@@ -17,9 +17,7 @@ export const FormatMenuComponent = ({
17
17
  formatMessage
18
18
  } = useIntl();
19
19
  const text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.turnInto) : formatMessage(messages.turnInto);
20
- const isDisabled = useMemo(() => {
21
- return fg('platform_editor_block_menu_for_disabled_nodes') ? checkIsFormatMenuHidden(api) : false;
22
- }, [api]);
20
+ const isDisabled = fg('platform_editor_block_menu_for_disabled_nodes') ? checkIsFormatMenuHidden(api) : false;
23
21
  const handleClick = useCallback(() => {
24
22
  api === null || api === void 0 ? void 0 : api.core.actions.execute(({
25
23
  tr
@@ -21,6 +21,11 @@ export const isNestedNode = (selection, menuTriggerBy) => {
21
21
  $from
22
22
  } = selection;
23
23
  const depth = $from.depth;
24
+
25
+ // When a file is in card view, selection.$from has a depth of 1, but it is not a nested node, should return false
26
+ if ($from.depth === 1 && selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
27
+ return false;
28
+ }
24
29
  if ($from.depth > 0 && selection instanceof NodeSelection) {
25
30
  return true;
26
31
  }
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useCallback } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { messages } from '@atlaskit/editor-common/block-menu';
@@ -15,9 +15,7 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
15
15
  var _useIntl = useIntl(),
16
16
  formatMessage = _useIntl.formatMessage;
17
17
  var text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.turnInto) : formatMessage(messages.turnInto);
18
- var isDisabled = useMemo(function () {
19
- return fg('platform_editor_block_menu_for_disabled_nodes') ? checkIsFormatMenuHidden(api) : false;
20
- }, [api]);
18
+ var isDisabled = fg('platform_editor_block_menu_for_disabled_nodes') ? checkIsFormatMenuHidden(api) : false;
21
19
  var handleClick = useCallback(function () {
22
20
  api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
23
21
  var _api$analytics;
@@ -19,6 +19,11 @@ export var isNestedNode = function isNestedNode(selection, menuTriggerBy) {
19
19
  }
20
20
  var $from = selection.$from;
21
21
  var depth = $from.depth;
22
+
23
+ // When a file is in card view, selection.$from has a depth of 1, but it is not a nested node, should return false
24
+ if ($from.depth === 1 && selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
25
+ return false;
26
+ }
22
27
  if ($from.depth > 0 && selection instanceof NodeSelection) {
23
28
  return true;
24
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "4.0.16",
3
+ "version": "4.0.18",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,8 +39,8 @@
39
39
  "@atlaskit/editor-shared-styles": "^3.6.0",
40
40
  "@atlaskit/editor-tables": "^2.9.0",
41
41
  "@atlaskit/editor-toolbar": "^0.14.0",
42
- "@atlaskit/icon": "^28.4.0",
43
- "@atlaskit/icon-lab": "^5.9.0",
42
+ "@atlaskit/icon": "^28.5.0",
43
+ "@atlaskit/icon-lab": "^5.10.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/primitives": "^14.15.0",
46
46
  "@atlaskit/tmp-editor-statsig": "^13.4.0",