@atlaskit/editor-plugin-block-menu 6.1.0 → 6.1.1
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 +10 -0
- package/dist/cjs/editor-commands/transform-node-utils/wrapStep.js +1 -1
- package/dist/cjs/pm-plugins/experiences/block-menu-experiences.js +12 -10
- package/dist/cjs/pm-plugins/experiences/experience-check-utils.js +3 -2
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/pm-plugins/utils/shouldSuppressKeyboardEvent.js +1 -1
- package/dist/cjs/ui/block-menu-components.js +6 -3
- package/dist/cjs/ui/block-menu-renderer/fallbacks.js +7 -1
- package/dist/cjs/ui/block-menu.js +2 -1
- package/dist/cjs/ui/copy-link.js +13 -2
- package/dist/cjs/ui/delete-button.js +8 -1
- package/dist/cjs/ui/flag.js +8 -1
- package/dist/cjs/ui/format-menu-nested.js +10 -2
- package/dist/cjs/ui/move-down.js +8 -1
- package/dist/cjs/ui/move-up.js +8 -1
- package/dist/cjs/ui/suggested-items-menu-section.js +10 -1
- package/dist/cjs/ui/utils/checkHasPreviousSectionContent.js +66 -0
- package/dist/cjs/ui/utils/fixBlockMenuPositionAndScroll.js +2 -1
- package/dist/es2019/editor-commands/transform-node-utils/wrapStep.js +1 -1
- package/dist/es2019/pm-plugins/experiences/block-menu-experiences.js +15 -11
- package/dist/es2019/pm-plugins/experiences/experience-check-utils.js +3 -2
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/pm-plugins/utils/shouldSuppressKeyboardEvent.js +1 -1
- package/dist/es2019/ui/block-menu-components.js +6 -3
- package/dist/es2019/ui/block-menu-renderer/fallbacks.js +7 -1
- package/dist/es2019/ui/block-menu.js +2 -1
- package/dist/es2019/ui/copy-link.js +13 -2
- package/dist/es2019/ui/delete-button.js +8 -1
- package/dist/es2019/ui/flag.js +8 -1
- package/dist/es2019/ui/format-menu-nested.js +10 -2
- package/dist/es2019/ui/move-down.js +8 -1
- package/dist/es2019/ui/move-up.js +8 -1
- package/dist/es2019/ui/suggested-items-menu-section.js +10 -1
- package/dist/es2019/ui/utils/checkHasPreviousSectionContent.js +59 -0
- package/dist/es2019/ui/utils/fixBlockMenuPositionAndScroll.js +2 -1
- package/dist/esm/editor-commands/transform-node-utils/wrapStep.js +1 -1
- package/dist/esm/pm-plugins/experiences/block-menu-experiences.js +15 -13
- package/dist/esm/pm-plugins/experiences/experience-check-utils.js +3 -2
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/pm-plugins/utils/shouldSuppressKeyboardEvent.js +1 -1
- package/dist/esm/ui/block-menu-components.js +6 -3
- package/dist/esm/ui/block-menu-renderer/fallbacks.js +7 -1
- package/dist/esm/ui/block-menu.js +2 -1
- package/dist/esm/ui/copy-link.js +13 -2
- package/dist/esm/ui/delete-button.js +8 -1
- package/dist/esm/ui/flag.js +8 -1
- package/dist/esm/ui/format-menu-nested.js +10 -2
- package/dist/esm/ui/move-down.js +8 -1
- package/dist/esm/ui/move-up.js +8 -1
- package/dist/esm/ui/suggested-items-menu-section.js +10 -1
- package/dist/esm/ui/utils/checkHasPreviousSectionContent.js +61 -0
- package/dist/esm/ui/utils/fixBlockMenuPositionAndScroll.js +2 -1
- package/dist/types/pm-plugins/utils/shouldSuppressKeyboardEvent.d.ts +1 -1
- package/dist/types/ui/utils/checkHasPreviousSectionContent.d.ts +26 -0
- package/dist/types-ts4.5/pm-plugins/utils/shouldSuppressKeyboardEvent.d.ts +1 -1
- package/dist/types-ts4.5/ui/utils/checkHasPreviousSectionContent.d.ts +26 -0
- package/package.json +6 -3
|
@@ -5,6 +5,7 @@ import React, { useContext, useEffect, useRef } from 'react';
|
|
|
5
5
|
import { injectIntl } from 'react-intl-next';
|
|
6
6
|
import { cx } from '@atlaskit/css';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { BLOCK_MENU_TEST_ID } from '@atlaskit/editor-common/block-menu';
|
|
8
9
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
9
10
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
10
11
|
import { DRAG_HANDLE_SELECTOR, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
@@ -93,7 +94,7 @@ const BlockMenuContent = ({
|
|
|
93
94
|
return target.closest('[data-toolbar-nested-dropdown-menu]') !== null;
|
|
94
95
|
};
|
|
95
96
|
return /*#__PURE__*/React.createElement(Box, {
|
|
96
|
-
testId:
|
|
97
|
+
testId: BLOCK_MENU_TEST_ID,
|
|
97
98
|
role: expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? 'menu' : undefined,
|
|
98
99
|
ref: ref,
|
|
99
100
|
xcss: cx(styles.base, fg('platform_editor_block_menu_v2_patch_2') && styles.maxWidthStyles, editorExperiment('platform_synced_block', true) && styles.emptyMenuSectionStyles)
|
|
@@ -87,15 +87,26 @@ const CopyLinkDropdownItemContent = ({
|
|
|
87
87
|
if (!fg('platform_editor_adf_with_localid')) {
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
92
|
+
// Conditionally display message based on feature flag
|
|
93
|
+
// To clean up: remove the conditional and use only copyLinkToBlock message
|
|
94
|
+
const message = fg('platform_editor_block_menu_v2_patch_3') ? messages.copyLinkToBlock : messages.copyLinkToBlockOld;
|
|
95
|
+
|
|
96
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
97
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
98
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
99
|
+
const iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
90
100
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
91
101
|
onClick: handleClick,
|
|
92
102
|
elemBefore: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
93
|
-
label: ""
|
|
103
|
+
label: "",
|
|
104
|
+
size: iconSize
|
|
94
105
|
}),
|
|
95
106
|
elemAfter: shortcut ? /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
96
107
|
shortcut: shortcut
|
|
97
108
|
}) : undefined,
|
|
98
109
|
ariaKeyshortcuts: shortcut
|
|
99
|
-
}, formatMessage(
|
|
110
|
+
}, formatMessage(message));
|
|
100
111
|
};
|
|
101
112
|
export const CopyLinkDropdownItem = injectIntl(CopyLinkDropdownItemContent);
|
|
@@ -6,6 +6,7 @@ import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
|
6
6
|
import { deleteSelectedRange, getSourceNodesFromSelectionRange } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
8
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { Box } from '@atlaskit/primitives/box';
|
|
10
11
|
import Text from '@atlaskit/primitives/text';
|
|
11
12
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
@@ -92,6 +93,11 @@ const DeleteDropdownItemContent = ({
|
|
|
92
93
|
onRemoveHoverDecoration();
|
|
93
94
|
};
|
|
94
95
|
}, [onRemoveHoverDecoration]);
|
|
96
|
+
|
|
97
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
98
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
99
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
100
|
+
const iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
95
101
|
return /*#__PURE__*/React.createElement(Box, {
|
|
96
102
|
onMouseEnter: onShowHoverDecoration,
|
|
97
103
|
onMouseLeave: onRemoveHoverDecoration,
|
|
@@ -100,7 +106,8 @@ const DeleteDropdownItemContent = ({
|
|
|
100
106
|
}, /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
101
107
|
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
102
108
|
color: "var(--ds-icon-danger, #C9372C)",
|
|
103
|
-
label: ""
|
|
109
|
+
label: "",
|
|
110
|
+
size: iconSize
|
|
104
111
|
}),
|
|
105
112
|
onClick: onClick,
|
|
106
113
|
testId: BLOCK_MENU_ACTION_TEST_ID.DELETE
|
package/dist/es2019/ui/flag.js
CHANGED
|
@@ -4,6 +4,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import AkFlag, { FlagGroup, AutoDismissFlag } from '@atlaskit/flag';
|
|
6
6
|
import SuccessIcon from '@atlaskit/icon/core/check-circle';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { FLAG_ID } from '../blockMenuPluginType';
|
|
8
9
|
import { blockMenuPluginKey } from '../pm-plugins/main';
|
|
9
10
|
const flagMap = {
|
|
@@ -44,6 +45,11 @@ export const Flag = ({
|
|
|
44
45
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
45
46
|
};
|
|
46
47
|
const FlagComponent = flagMap[showFlag].autoDismiss ? AutoDismissFlag : AkFlag;
|
|
48
|
+
|
|
49
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
50
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
51
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
52
|
+
const iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
47
53
|
return /*#__PURE__*/React.createElement(FlagGroup, null, /*#__PURE__*/React.createElement(FlagComponent, {
|
|
48
54
|
onDismissed: onDismissed,
|
|
49
55
|
title: formatMessage(title),
|
|
@@ -51,7 +57,8 @@ export const Flag = ({
|
|
|
51
57
|
testId: showFlag,
|
|
52
58
|
icon: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
53
59
|
label: "",
|
|
54
|
-
color: "var(--ds-icon-success, #6A9A23)"
|
|
60
|
+
color: "var(--ds-icon-success, #6A9A23)",
|
|
61
|
+
size: iconSize
|
|
55
62
|
})
|
|
56
63
|
}));
|
|
57
64
|
};
|
|
@@ -5,6 +5,7 @@ import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
|
5
5
|
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
7
7
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
9
10
|
export const FormatMenuComponent = ({
|
|
10
11
|
api,
|
|
@@ -30,13 +31,20 @@ export const FormatMenuComponent = ({
|
|
|
30
31
|
return tr;
|
|
31
32
|
});
|
|
32
33
|
}, [api]);
|
|
34
|
+
|
|
35
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
36
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
37
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
38
|
+
const iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
33
39
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
34
40
|
text: formatMessage(blockMenuMessages.turnInto),
|
|
35
41
|
elemBefore: /*#__PURE__*/React.createElement(ChangesIcon, {
|
|
36
|
-
label: ""
|
|
42
|
+
label: "",
|
|
43
|
+
size: iconSize
|
|
37
44
|
}),
|
|
38
45
|
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
39
|
-
label: ""
|
|
46
|
+
label: "",
|
|
47
|
+
size: iconSize
|
|
40
48
|
}),
|
|
41
49
|
enableMaxHeight: true,
|
|
42
50
|
onClick: handleClick,
|
|
@@ -8,6 +8,7 @@ import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages'
|
|
|
8
8
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
9
9
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { useBlockMenu } from './block-menu-provider';
|
|
12
13
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
13
14
|
import { fixBlockMenuPositionAndScroll } from './utils/fixBlockMenuPositionAndScroll';
|
|
@@ -64,11 +65,17 @@ const MoveDownDropdownItemContent = ({
|
|
|
64
65
|
fixBlockMenuPositionAndScroll(newFirstNode);
|
|
65
66
|
});
|
|
66
67
|
};
|
|
68
|
+
|
|
69
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
70
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
71
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
72
|
+
const iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
67
73
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
68
74
|
triggerRef: moveDownRef,
|
|
69
75
|
onClick: handleClick,
|
|
70
76
|
elemBefore: /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
71
|
-
label: ""
|
|
77
|
+
label: "",
|
|
78
|
+
size: iconSize
|
|
72
79
|
}),
|
|
73
80
|
isDisabled: !canMoveDown,
|
|
74
81
|
testId: BLOCK_MENU_ACTION_TEST_ID.MOVE_DOWN
|
|
@@ -8,6 +8,7 @@ import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages'
|
|
|
8
8
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
9
9
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import ArrowUpIcon from '@atlaskit/icon/core/arrow-up';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { useBlockMenu } from './block-menu-provider';
|
|
12
13
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
13
14
|
import { fixBlockMenuPositionAndScroll } from './utils/fixBlockMenuPositionAndScroll';
|
|
@@ -62,11 +63,17 @@ const MoveUpDropdownItemContent = ({
|
|
|
62
63
|
fixBlockMenuPositionAndScroll(newFirstNode);
|
|
63
64
|
});
|
|
64
65
|
};
|
|
66
|
+
|
|
67
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
68
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
69
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
70
|
+
const iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
65
71
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
66
72
|
triggerRef: moveUpRef,
|
|
67
73
|
onClick: handleClick,
|
|
68
74
|
elemBefore: /*#__PURE__*/React.createElement(ArrowUpIcon, {
|
|
69
|
-
label: ""
|
|
75
|
+
label: "",
|
|
76
|
+
size: iconSize
|
|
70
77
|
}),
|
|
71
78
|
isDisabled: !canMoveUp,
|
|
72
79
|
testId: BLOCK_MENU_ACTION_TEST_ID.MOVE_UP
|
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { useSuggestedItems } from './hooks/useSuggestedItems';
|
|
7
|
+
import { hasCreateSectionContent, hasStructureSectionContent } from './utils/checkHasPreviousSectionContent';
|
|
6
8
|
export const SuggestedItemsMenuSection = /*#__PURE__*/React.memo(({
|
|
7
9
|
api,
|
|
8
10
|
children
|
|
@@ -14,7 +16,14 @@ export const SuggestedItemsMenuSection = /*#__PURE__*/React.memo(({
|
|
|
14
16
|
if (suggestedItems.length === 0) {
|
|
15
17
|
return null;
|
|
16
18
|
}
|
|
19
|
+
|
|
20
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
21
|
+
// Conditionally show separator based on whether there's content after this section.
|
|
22
|
+
// Old behavior: always show separator (true).
|
|
23
|
+
// To clean up: remove conditional, keep only the hasCreateSectionContent || hasStructureSectionContent logic.
|
|
24
|
+
const hasSeparator = fg('platform_editor_block_menu_v2_patch_3') ? hasCreateSectionContent(api) || hasStructureSectionContent(api) : true;
|
|
17
25
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
18
|
-
title: formatMessage(blockMenuMessages.suggested)
|
|
26
|
+
title: formatMessage(blockMenuMessages.suggested),
|
|
27
|
+
hasSeparator: hasSeparator
|
|
19
28
|
}, children);
|
|
20
29
|
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION } from '@atlaskit/editor-common/block-menu';
|
|
2
|
+
import { buildChildrenMap, getChildrenMapKey, willComponentRender } from '../block-menu-renderer/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a section has any visible content (items that will render)
|
|
6
|
+
*/
|
|
7
|
+
const hasSectionContent = (sectionKey, api) => {
|
|
8
|
+
var _api$blockMenu;
|
|
9
|
+
const blockMenuComponents = api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.getBlockMenuComponents();
|
|
10
|
+
if (!blockMenuComponents) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const childrenMap = buildChildrenMap(blockMenuComponents);
|
|
14
|
+
const sectionMapKey = getChildrenMapKey(sectionKey, 'block-menu-section');
|
|
15
|
+
const sectionChildren = childrenMap.get(sectionMapKey) || [];
|
|
16
|
+
return sectionChildren.some(child => willComponentRender(child, childrenMap));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the Suggested section has any visible content
|
|
21
|
+
*/
|
|
22
|
+
export const hasSuggestedSectionContent = api => {
|
|
23
|
+
return hasSectionContent(TRANSFORM_SUGGESTED_MENU_SECTION.key, api);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the Create section has any visible content
|
|
28
|
+
*/
|
|
29
|
+
export const hasCreateSectionContent = api => {
|
|
30
|
+
return hasSectionContent(TRANSFORM_CREATE_MENU_SECTION.key, api);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the Structure section has any visible content
|
|
35
|
+
*/
|
|
36
|
+
export const hasStructureSectionContent = api => {
|
|
37
|
+
return hasSectionContent(TRANSFORM_STRUCTURE_MENU_SECTION.key, api);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Checks if there's any content before the Create section (i.e., Suggested section has content)
|
|
42
|
+
*/
|
|
43
|
+
export const hasContentBeforeCreate = api => {
|
|
44
|
+
return hasSuggestedSectionContent(api);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Checks if there's any content before the Structure section (i.e., Create or Suggested sections have content)
|
|
49
|
+
*/
|
|
50
|
+
export const hasContentBeforeStructure = api => {
|
|
51
|
+
return hasCreateSectionContent(api) || hasSuggestedSectionContent(api);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Checks if there's any content before the Headings section (i.e., Structure, Create, or Suggested sections have content)
|
|
56
|
+
*/
|
|
57
|
+
export const hasContentBeforeHeadings = api => {
|
|
58
|
+
return hasStructureSectionContent(api) || hasCreateSectionContent(api) || hasSuggestedSectionContent(api);
|
|
59
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getDocument } from '@atlaskit/browser-apis';
|
|
2
|
+
import { BLOCK_MENU_TEST_ID } from '@atlaskit/editor-common/block-menu';
|
|
2
3
|
export const fixBlockMenuPositionAndScroll = firstSelectedNode => {
|
|
3
4
|
const doc = getDocument();
|
|
4
5
|
if (!doc) {
|
|
5
6
|
return;
|
|
6
7
|
}
|
|
7
|
-
const blockMenuEl = doc.querySelector(
|
|
8
|
+
const blockMenuEl = doc.querySelector(`[data-testid="${BLOCK_MENU_TEST_ID}"]`);
|
|
8
9
|
if (!(blockMenuEl !== null && blockMenuEl !== void 0 && blockMenuEl.parentElement)) {
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
@@ -7,7 +7,7 @@ import { convertExpandToNestedExpand } from './utils';
|
|
|
7
7
|
* Wraps nodes into the target container type.
|
|
8
8
|
* When wrapping into expand, any expand children are converted to nestedExpand
|
|
9
9
|
* since expand cannot be a direct child of expand.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* Preserves breakout marks when both source and target nodes support resizing
|
|
12
12
|
* (codeBlock, expand, layoutSection).
|
|
13
13
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { bind } from 'bind-event-listener';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { BLOCK_MENU_ACTION_TEST_ID } from '@atlaskit/editor-common/block-menu';
|
|
4
|
-
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckTimeout, getPopupContainerFromEditorView } from '@atlaskit/editor-common/experiences';
|
|
3
|
+
import { BLOCK_MENU_ACTION_TEST_ID, BLOCK_MENU_TEST_ID } from '@atlaskit/editor-common/block-menu';
|
|
4
|
+
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckPopupMutation, ExperienceCheckTimeout, getPopupContainerFromEditorView } from '@atlaskit/editor-common/experiences';
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { getParentDOMAtSelection, handleDeleteDomMutation,
|
|
7
|
+
import { getParentDOMAtSelection, handleDeleteDomMutation, handleMoveDomMutation, handleTransformDomMutation, isBlockMenuVisible, isDragHandleElement } from './experience-check-utils';
|
|
8
8
|
var TIMEOUT_DURATION = 1000;
|
|
9
9
|
var pluginKey = new PluginKey('blockMenuExperiences');
|
|
10
10
|
var START_METHOD = {
|
|
@@ -27,21 +27,23 @@ export var getBlockMenuExperiencesPlugin = function getBlockMenuExperiencesPlugi
|
|
|
27
27
|
}
|
|
28
28
|
return popupTargetEl;
|
|
29
29
|
};
|
|
30
|
+
var getEditorDom = function getEditorDom() {
|
|
31
|
+
var _editorView2;
|
|
32
|
+
if (((_editorView2 = editorView) === null || _editorView2 === void 0 ? void 0 : _editorView2.dom) instanceof HTMLElement) {
|
|
33
|
+
return editorView.dom;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
30
37
|
var blockMenuOpenExperience = new Experience(EXPERIENCE_ID.MENU_OPEN, {
|
|
31
38
|
actionSubjectId: ACTION_SUBJECT_ID.BLOCK_MENU,
|
|
32
39
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
33
40
|
checks: [new ExperienceCheckTimeout({
|
|
34
41
|
durationMs: TIMEOUT_DURATION
|
|
35
|
-
}), new
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
options: {
|
|
41
|
-
childList: true
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
42
|
+
}), new ExperienceCheckPopupMutation({
|
|
43
|
+
nestedElementQuery: "[data-testid=\"".concat(BLOCK_MENU_TEST_ID, "\"]"),
|
|
44
|
+
getTarget: getPopupsTarget,
|
|
45
|
+
getEditorDom: getEditorDom,
|
|
46
|
+
type: 'editorContent'
|
|
45
47
|
})]
|
|
46
48
|
});
|
|
47
49
|
var actionObserveConfig = function actionObserveConfig() {
|
|
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
4
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
import { BLOCK_MENU_TEST_ID } from '@atlaskit/editor-common/block-menu';
|
|
5
6
|
import { popupWithNestedElement } from '@atlaskit/editor-common/experiences';
|
|
6
7
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
8
|
|
|
@@ -25,7 +26,7 @@ export var isBlockMenuVisible = function isBlockMenuVisible(popupsTarget) {
|
|
|
25
26
|
if (!popupsTarget) {
|
|
26
27
|
return false;
|
|
27
28
|
}
|
|
28
|
-
return popupWithNestedElement(popupsTarget,
|
|
29
|
+
return popupWithNestedElement(popupsTarget, "[data-testid=\"".concat(BLOCK_MENU_TEST_ID, "\"]")) !== null;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -65,7 +66,7 @@ var isBlockMenuAddedInMutation = function isBlockMenuAddedInMutation(_ref) {
|
|
|
65
66
|
return type === 'childList' && _toConsumableArray(addedNodes).some(isBlockMenuWithinNode);
|
|
66
67
|
};
|
|
67
68
|
var isBlockMenuWithinNode = function isBlockMenuWithinNode(node) {
|
|
68
|
-
return popupWithNestedElement(node,
|
|
69
|
+
return popupWithNestedElement(node, "[data-testid=\"".concat(BLOCK_MENU_TEST_ID, "\"]")) !== null;
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
/**
|
|
@@ -30,7 +30,7 @@ export var createPlugin = function createPlugin(api) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// Block further handling of key events when block menu is open
|
|
33
|
-
// Except for backspace/delete/copy/cut/paste/undo/redo/copy-link-to-
|
|
33
|
+
// Except for backspace/delete/copy/cut/paste/undo/redo/copy-link-to-selection which should be handled by the selection preservation plugin
|
|
34
34
|
return shouldSuppressKeyboardEvent(event);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Backspace/Delete: Allow deleting selected content
|
|
7
7
|
* - Copy/Cut/Paste: Allow clipboard operations (Cmd/Ctrl+C, Cmd/Ctrl+X, Cmd/Ctrl+V)
|
|
8
8
|
* - Undo/Redo: Allow undo/redo operations (Cmd/Ctrl+Z, Cmd/Ctrl+Y)
|
|
9
|
-
* - Copy Link to
|
|
9
|
+
* - Copy Link to Selection: Allow the keyboard shortcut (Cmd/Ctrl+Alt+A)
|
|
10
10
|
*
|
|
11
11
|
* @param event - The keyboard event to check
|
|
12
12
|
* @returns true if the event should be suppressed, false if it should be allowed
|
|
@@ -15,6 +15,7 @@ import { MoveDownDropdownItem } from './move-down';
|
|
|
15
15
|
import { MoveUpDropdownItem } from './move-up';
|
|
16
16
|
import { SuggestedItemsMenuSection } from './suggested-items-menu-section';
|
|
17
17
|
import { SuggestedMenuItems } from './suggested-menu-items';
|
|
18
|
+
import { hasContentBeforeCreate, hasContentBeforeStructure, hasContentBeforeHeadings } from './utils/checkHasPreviousSectionContent';
|
|
18
19
|
import { createMenuItemsMap } from './utils/createMenuItemsMap';
|
|
19
20
|
import { getSuggestedItemsFromSelection } from './utils/getSuggestedItemsFromSelection';
|
|
20
21
|
var MIN_NUMBER_OF_AVAILABLE_NATIVE_TRANSFORMS = 7;
|
|
@@ -135,7 +136,8 @@ var getTurnIntoMenuComponents = function getTurnIntoMenuComponents(api) {
|
|
|
135
136
|
},
|
|
136
137
|
children = _ref3.children;
|
|
137
138
|
return /*#__PURE__*/React.createElement(MenuSection, {
|
|
138
|
-
title: blockMenuMessages.create
|
|
139
|
+
title: blockMenuMessages.create,
|
|
140
|
+
hasSeparator: hasContentBeforeCreate(api)
|
|
139
141
|
}, children);
|
|
140
142
|
}
|
|
141
143
|
}, {
|
|
@@ -152,7 +154,8 @@ var getTurnIntoMenuComponents = function getTurnIntoMenuComponents(api) {
|
|
|
152
154
|
},
|
|
153
155
|
children = _ref4.children;
|
|
154
156
|
return /*#__PURE__*/React.createElement(MenuSection, {
|
|
155
|
-
title: blockMenuMessages.structure
|
|
157
|
+
title: blockMenuMessages.structure,
|
|
158
|
+
hasSeparator: hasContentBeforeStructure(api)
|
|
156
159
|
}, children);
|
|
157
160
|
}
|
|
158
161
|
}, {
|
|
@@ -170,7 +173,7 @@ var getTurnIntoMenuComponents = function getTurnIntoMenuComponents(api) {
|
|
|
170
173
|
children = _ref5.children;
|
|
171
174
|
return /*#__PURE__*/React.createElement(MenuSection, {
|
|
172
175
|
title: blockMenuMessages.headings,
|
|
173
|
-
hasSeparator:
|
|
176
|
+
hasSeparator: hasContentBeforeHeadings(api)
|
|
174
177
|
}, children);
|
|
175
178
|
}
|
|
176
179
|
}, {
|
|
@@ -3,14 +3,20 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
var FallbackNestedMenu = function FallbackNestedMenu(_ref) {
|
|
7
8
|
var children = _ref.children;
|
|
8
9
|
var _useIntl = useIntl(),
|
|
9
10
|
formatMessage = _useIntl.formatMessage;
|
|
11
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
12
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
13
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
14
|
+
var iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
10
15
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
11
16
|
elemBefore: undefined,
|
|
12
17
|
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
13
|
-
label: ""
|
|
18
|
+
label: "",
|
|
19
|
+
size: iconSize
|
|
14
20
|
}),
|
|
15
21
|
text: formatMessage(blockMenuMessages.fallbackNestedMenu),
|
|
16
22
|
enableMaxHeight: true,
|
|
@@ -6,6 +6,7 @@ import React, { useContext, useEffect, useRef } from 'react';
|
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { cx } from '@atlaskit/css';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
|
+
import { BLOCK_MENU_TEST_ID } from '@atlaskit/editor-common/block-menu';
|
|
9
10
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
10
11
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
12
|
import { DRAG_HANDLE_SELECTOR, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
@@ -91,7 +92,7 @@ var BlockMenuContent = function BlockMenuContent(_ref2) {
|
|
|
91
92
|
return target.closest('[data-toolbar-nested-dropdown-menu]') !== null;
|
|
92
93
|
};
|
|
93
94
|
return /*#__PURE__*/React.createElement(Box, {
|
|
94
|
-
testId:
|
|
95
|
+
testId: BLOCK_MENU_TEST_ID,
|
|
95
96
|
role: expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? 'menu' : undefined,
|
|
96
97
|
ref: ref,
|
|
97
98
|
xcss: cx(styles.base, fg('platform_editor_block_menu_v2_patch_2') && styles.maxWidthStyles, editorExperiment('platform_synced_block', true) && styles.emptyMenuSectionStyles)
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -79,15 +79,26 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
79
79
|
if (!fg('platform_editor_adf_with_localid')) {
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
84
|
+
// Conditionally display message based on feature flag
|
|
85
|
+
// To clean up: remove the conditional and use only copyLinkToBlock message
|
|
86
|
+
var message = fg('platform_editor_block_menu_v2_patch_3') ? messages.copyLinkToBlock : messages.copyLinkToBlockOld;
|
|
87
|
+
|
|
88
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
89
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
90
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
91
|
+
var iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
82
92
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
83
93
|
onClick: handleClick,
|
|
84
94
|
elemBefore: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
85
|
-
label: ""
|
|
95
|
+
label: "",
|
|
96
|
+
size: iconSize
|
|
86
97
|
}),
|
|
87
98
|
elemAfter: shortcut ? /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
88
99
|
shortcut: shortcut
|
|
89
100
|
}) : undefined,
|
|
90
101
|
ariaKeyshortcuts: shortcut
|
|
91
|
-
}, formatMessage(
|
|
102
|
+
}, formatMessage(message));
|
|
92
103
|
};
|
|
93
104
|
export var CopyLinkDropdownItem = injectIntl(CopyLinkDropdownItemContent);
|
|
@@ -6,6 +6,7 @@ import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
|
6
6
|
import { deleteSelectedRange, getSourceNodesFromSelectionRange } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
8
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { Box } from '@atlaskit/primitives/box';
|
|
10
11
|
import Text from '@atlaskit/primitives/text';
|
|
11
12
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
@@ -87,6 +88,11 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
87
88
|
onRemoveHoverDecoration();
|
|
88
89
|
};
|
|
89
90
|
}, [onRemoveHoverDecoration]);
|
|
91
|
+
|
|
92
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
93
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
94
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
95
|
+
var iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
90
96
|
return /*#__PURE__*/React.createElement(Box, {
|
|
91
97
|
onMouseEnter: onShowHoverDecoration,
|
|
92
98
|
onMouseLeave: onRemoveHoverDecoration,
|
|
@@ -95,7 +101,8 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
95
101
|
}, /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
96
102
|
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
97
103
|
color: "var(--ds-icon-danger, #C9372C)",
|
|
98
|
-
label: ""
|
|
104
|
+
label: "",
|
|
105
|
+
size: iconSize
|
|
99
106
|
}),
|
|
100
107
|
onClick: onClick,
|
|
101
108
|
testId: BLOCK_MENU_ACTION_TEST_ID.DELETE
|
package/dist/esm/ui/flag.js
CHANGED
|
@@ -5,6 +5,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import AkFlag, { FlagGroup, AutoDismissFlag } from '@atlaskit/flag';
|
|
7
7
|
import SuccessIcon from '@atlaskit/icon/core/check-circle';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { FLAG_ID } from '../blockMenuPluginType';
|
|
9
10
|
import { blockMenuPluginKey } from '../pm-plugins/main';
|
|
10
11
|
var flagMap = _defineProperty({}, FLAG_ID.LINK_COPIED_TO_CLIPBOARD, {
|
|
@@ -37,6 +38,11 @@ export var Flag = function Flag(_ref) {
|
|
|
37
38
|
api === null || api === void 0 || api.core.actions.focus();
|
|
38
39
|
};
|
|
39
40
|
var FlagComponent = flagMap[showFlag].autoDismiss ? AutoDismissFlag : AkFlag;
|
|
41
|
+
|
|
42
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
43
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
44
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
45
|
+
var iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
40
46
|
return /*#__PURE__*/React.createElement(FlagGroup, null, /*#__PURE__*/React.createElement(FlagComponent, {
|
|
41
47
|
onDismissed: onDismissed,
|
|
42
48
|
title: formatMessage(title),
|
|
@@ -44,7 +50,8 @@ export var Flag = function Flag(_ref) {
|
|
|
44
50
|
testId: showFlag,
|
|
45
51
|
icon: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
46
52
|
label: "",
|
|
47
|
-
color: "var(--ds-icon-success, #6A9A23)"
|
|
53
|
+
color: "var(--ds-icon-success, #6A9A23)",
|
|
54
|
+
size: iconSize
|
|
48
55
|
})
|
|
49
56
|
}));
|
|
50
57
|
};
|
|
@@ -5,6 +5,7 @@ import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
|
5
5
|
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
7
7
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
9
10
|
export var FormatMenuComponent = function FormatMenuComponent(_ref) {
|
|
10
11
|
var api = _ref.api,
|
|
@@ -27,13 +28,20 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
|
|
|
27
28
|
return tr;
|
|
28
29
|
});
|
|
29
30
|
}, [api]);
|
|
31
|
+
|
|
32
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
33
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
34
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
35
|
+
var iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
30
36
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
31
37
|
text: formatMessage(blockMenuMessages.turnInto),
|
|
32
38
|
elemBefore: /*#__PURE__*/React.createElement(ChangesIcon, {
|
|
33
|
-
label: ""
|
|
39
|
+
label: "",
|
|
40
|
+
size: iconSize
|
|
34
41
|
}),
|
|
35
42
|
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
36
|
-
label: ""
|
|
43
|
+
label: "",
|
|
44
|
+
size: iconSize
|
|
37
45
|
}),
|
|
38
46
|
enableMaxHeight: true,
|
|
39
47
|
onClick: handleClick,
|
package/dist/esm/ui/move-down.js
CHANGED
|
@@ -8,6 +8,7 @@ import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages'
|
|
|
8
8
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
9
9
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { useBlockMenu } from './block-menu-provider';
|
|
12
13
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
13
14
|
import { fixBlockMenuPositionAndScroll } from './utils/fixBlockMenuPositionAndScroll';
|
|
@@ -58,11 +59,17 @@ var MoveDownDropdownItemContent = function MoveDownDropdownItemContent(_ref) {
|
|
|
58
59
|
fixBlockMenuPositionAndScroll(newFirstNode);
|
|
59
60
|
});
|
|
60
61
|
};
|
|
62
|
+
|
|
63
|
+
// [FEATURE FLAG: platform_editor_block_menu_v2_patch_3]
|
|
64
|
+
// Adds size="small" to icons for better visual consistency in block menu.
|
|
65
|
+
// To clean up: remove conditional, keep only size="small" version.
|
|
66
|
+
var iconSize = fg('platform_editor_block_menu_v2_patch_3') ? 'small' : undefined;
|
|
61
67
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
62
68
|
triggerRef: moveDownRef,
|
|
63
69
|
onClick: handleClick,
|
|
64
70
|
elemBefore: /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
65
|
-
label: ""
|
|
71
|
+
label: "",
|
|
72
|
+
size: iconSize
|
|
66
73
|
}),
|
|
67
74
|
isDisabled: !canMoveDown,
|
|
68
75
|
testId: BLOCK_MENU_ACTION_TEST_ID.MOVE_DOWN
|