@atlaskit/editor-plugin-block-menu 7.0.11 → 7.0.13
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 +12 -0
- package/dist/cjs/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js +1 -0
- package/dist/cjs/ui/block-menu-components.js +5 -1
- package/dist/cjs/ui/block-menu-provider.js +1 -0
- package/dist/cjs/ui/block-menu.js +6 -2
- package/dist/cjs/ui/copy-section.js +3 -1
- package/dist/cjs/ui/utils/checkIsFormatMenuHidden.js +7 -1
- package/dist/es2019/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js +1 -0
- package/dist/es2019/ui/block-menu-components.js +3 -1
- package/dist/es2019/ui/block-menu-provider.js +1 -0
- package/dist/es2019/ui/block-menu.js +6 -2
- package/dist/es2019/ui/copy-section.js +3 -1
- package/dist/es2019/ui/utils/checkIsFormatMenuHidden.js +7 -1
- package/dist/esm/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js +1 -0
- package/dist/esm/ui/block-menu-components.js +5 -1
- package/dist/esm/ui/block-menu-provider.js +1 -0
- package/dist/esm/ui/block-menu.js +6 -2
- package/dist/esm/ui/copy-section.js +3 -1
- package/dist/esm/ui/utils/checkIsFormatMenuHidden.js +7 -1
- package/dist/types/blockMenuPluginType.d.ts +1 -0
- package/dist/types/ui/copy-section.d.ts +1 -1
- package/dist/types-ts4.5/blockMenuPluginType.d.ts +1 -0
- package/dist/types-ts4.5/ui/copy-section.d.ts +1 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js
CHANGED
|
@@ -68,6 +68,7 @@ var transformOrderedUnorderedListToBlockNodes = exports.transformOrderedUnordere
|
|
|
68
68
|
// Convert codeblocks to block nodes
|
|
69
69
|
if (node.type === schema.nodes.codeBlock) {
|
|
70
70
|
var _targetAttrs$level;
|
|
71
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
|
|
71
72
|
var _textContent = node.textContent.split('\n');
|
|
72
73
|
var attributes = targetNodeType === schema.nodes.heading ? {
|
|
73
74
|
level: (_targetAttrs$level = targetAttrs === null || targetAttrs === void 0 ? void 0 : targetAttrs.level) !== null && _targetAttrs$level !== void 0 ? _targetAttrs$level : 1
|
|
@@ -24,6 +24,7 @@ var _moveUp = require("./move-up");
|
|
|
24
24
|
var _suggestedItemsMenuSection = require("./suggested-items-menu-section");
|
|
25
25
|
var _suggestedMenuItems = require("./suggested-menu-items");
|
|
26
26
|
var _checkHasPreviousSectionContent = require("./utils/checkHasPreviousSectionContent");
|
|
27
|
+
var _checkIsFormatMenuHidden = require("./utils/checkIsFormatMenuHidden");
|
|
27
28
|
var _createMenuItemsMap = require("./utils/createMenuItemsMap");
|
|
28
29
|
var _getSuggestedItemsFromSelection = require("./utils/getSuggestedItemsFromSelection");
|
|
29
30
|
var MIN_NUMBER_OF_AVAILABLE_NATIVE_TRANSFORMS = 7;
|
|
@@ -86,7 +87,10 @@ var getTurnIntoMenuComponents = function getTurnIntoMenuComponents(api) {
|
|
|
86
87
|
return /*#__PURE__*/_react.default.createElement(_formatMenuNested.FormatMenuComponent, {
|
|
87
88
|
api: api
|
|
88
89
|
}, children);
|
|
89
|
-
}
|
|
90
|
+
},
|
|
91
|
+
isHidden: (0, _platformFeatureFlags.fg)('platform_editor_block_menu_divider_patch') ? function () {
|
|
92
|
+
return (0, _checkIsFormatMenuHidden.checkIsFormatMenuHidden)(api);
|
|
93
|
+
} : undefined
|
|
90
94
|
}, {
|
|
91
95
|
type: 'block-menu-section',
|
|
92
96
|
key: _blockMenu.TRANSFORM_SUGGESTED_MENU_SECTION.key,
|
|
@@ -51,6 +51,7 @@ var BlockMenuProvider = exports.BlockMenuProvider = function BlockMenuProvider(_
|
|
|
51
51
|
}
|
|
52
52
|
}, [api]);
|
|
53
53
|
return /*#__PURE__*/_react.default.createElement(BlockMenuContext.Provider, {
|
|
54
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-inline-context-value, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
54
55
|
value: {
|
|
55
56
|
onDropdownOpenChanged: onDropdownOpenChanged,
|
|
56
57
|
moveDownRef: moveDownRef,
|
|
@@ -106,7 +106,9 @@ var BlockMenuContent = function BlockMenuContent(_ref2) {
|
|
|
106
106
|
ref: ref,
|
|
107
107
|
xcss: (0, _css.cx)(styles.base, (0, _platformFeatureFlags.fg)('platform_editor_block_menu_v2_patch_2') && styles.maxWidthStyles, (0, _experiments.editorExperiment)('platform_synced_block', true) && styles.emptyMenuSectionStyles)
|
|
108
108
|
}, /*#__PURE__*/_react.default.createElement(_uiMenu.ArrowKeyNavigationProvider, {
|
|
109
|
-
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
109
|
+
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
110
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
111
|
+
,
|
|
110
112
|
handleClose: function handleClose(e) {
|
|
111
113
|
return e.preventDefault();
|
|
112
114
|
},
|
|
@@ -255,7 +257,9 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
255
257
|
fitWidth: DEFAULT_MENU_WIDTH,
|
|
256
258
|
fitHeight: menuHeight,
|
|
257
259
|
preventOverflow: true,
|
|
258
|
-
stick: true
|
|
260
|
+
stick: true
|
|
261
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
262
|
+
,
|
|
259
263
|
offset: [_styles.DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, targetHandleHeightOffset],
|
|
260
264
|
focusTrap: openedViaKeyboard ?
|
|
261
265
|
// Only enable focus trap when opened via keyboard to make sure the focus is on the first focusable menu item
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.CopySection = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
12
|
var _checkIsFormatMenuHidden = require("./utils/checkIsFormatMenuHidden");
|
|
12
13
|
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); }
|
|
@@ -16,7 +17,8 @@ var CopySection = exports.CopySection = function CopySection(_ref) {
|
|
|
16
17
|
var isFormatMenuHidden = (0, _react.useCallback)(function () {
|
|
17
18
|
return (0, _checkIsFormatMenuHidden.checkIsFormatMenuHidden)(api);
|
|
18
19
|
}, [api]);
|
|
20
|
+
var hasSeparator = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_divider_patch') ? true : (0, _experiments.editorExperiment)('platform_synced_block', true) ? true : !isFormatMenuHidden();
|
|
19
21
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
20
|
-
hasSeparator:
|
|
22
|
+
hasSeparator: hasSeparator
|
|
21
23
|
}, children);
|
|
22
24
|
};
|
|
@@ -5,12 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.checkIsFormatMenuHidden = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema) {
|
|
9
10
|
var nodes = schema.nodes;
|
|
10
11
|
if (!nodes) {
|
|
11
12
|
return false;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
// When platform_editor_block_menu_divider_patch is enabled, the "Copy synced block"
|
|
16
|
+
// item is placed inside TRANSFORM_MENU_SECTION, so we must not hide the section for
|
|
17
|
+
// syncBlock/bodiedSyncBlock nodes — the "Turn into" nested item has its own isHidden
|
|
18
|
+
// guard that will still hide it for those node types.
|
|
19
|
+
var disabledOnNodes = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_divider_patch') ? [nodes.rule] : [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
14
20
|
var disabledNode = (0, _utils.findSelectedNodeOfType)(disabledOnNodes)(selection);
|
|
15
21
|
return !!disabledNode;
|
|
16
22
|
};
|
package/dist/es2019/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js
CHANGED
|
@@ -64,6 +64,7 @@ export const transformOrderedUnorderedListToBlockNodes = context => {
|
|
|
64
64
|
// Convert codeblocks to block nodes
|
|
65
65
|
if (node.type === schema.nodes.codeBlock) {
|
|
66
66
|
var _targetAttrs$level;
|
|
67
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
|
|
67
68
|
const textContent = node.textContent.split('\n');
|
|
68
69
|
const attributes = targetNodeType === schema.nodes.heading ? {
|
|
69
70
|
level: (_targetAttrs$level = targetAttrs === null || targetAttrs === void 0 ? void 0 : targetAttrs.level) !== null && _targetAttrs$level !== void 0 ? _targetAttrs$level : 1
|
|
@@ -16,6 +16,7 @@ import { MoveUpDropdownItem } from './move-up';
|
|
|
16
16
|
import { SuggestedItemsMenuSection } from './suggested-items-menu-section';
|
|
17
17
|
import { SuggestedMenuItems } from './suggested-menu-items';
|
|
18
18
|
import { hasContentBeforeCreate, hasContentBeforeStructure, hasContentBeforeHeadings } from './utils/checkHasPreviousSectionContent';
|
|
19
|
+
import { checkIsFormatMenuHidden } from './utils/checkIsFormatMenuHidden';
|
|
19
20
|
import { createMenuItemsMap } from './utils/createMenuItemsMap';
|
|
20
21
|
import { getSuggestedItemsFromSelection } from './utils/getSuggestedItemsFromSelection';
|
|
21
22
|
const MIN_NUMBER_OF_AVAILABLE_NATIVE_TRANSFORMS = 7;
|
|
@@ -72,7 +73,8 @@ const getTurnIntoMenuComponents = api => {
|
|
|
72
73
|
return /*#__PURE__*/React.createElement(FormatMenuComponent, {
|
|
73
74
|
api: api
|
|
74
75
|
}, children);
|
|
75
|
-
}
|
|
76
|
+
},
|
|
77
|
+
isHidden: fg('platform_editor_block_menu_divider_patch') ? () => checkIsFormatMenuHidden(api) : undefined
|
|
76
78
|
}, {
|
|
77
79
|
type: 'block-menu-section',
|
|
78
80
|
key: TRANSFORM_SUGGESTED_MENU_SECTION.key,
|
|
@@ -40,6 +40,7 @@ export const BlockMenuProvider = ({
|
|
|
40
40
|
}
|
|
41
41
|
}, [api]);
|
|
42
42
|
return /*#__PURE__*/React.createElement(BlockMenuContext.Provider, {
|
|
43
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-inline-context-value, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
43
44
|
value: {
|
|
44
45
|
onDropdownOpenChanged,
|
|
45
46
|
moveDownRef,
|
|
@@ -99,7 +99,9 @@ const BlockMenuContent = ({
|
|
|
99
99
|
ref: ref,
|
|
100
100
|
xcss: cx(styles.base, fg('platform_editor_block_menu_v2_patch_2') && styles.maxWidthStyles, editorExperiment('platform_synced_block', true) && styles.emptyMenuSectionStyles)
|
|
101
101
|
}, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
102
|
-
type: ArrowKeyNavigationType.MENU
|
|
102
|
+
type: ArrowKeyNavigationType.MENU
|
|
103
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
104
|
+
,
|
|
103
105
|
handleClose: e => e.preventDefault(),
|
|
104
106
|
disableArrowKeyNavigation: shouldDisableArrowKeyNavigation
|
|
105
107
|
}, /*#__PURE__*/React.createElement(BlockMenuRenderer, {
|
|
@@ -247,7 +249,9 @@ const BlockMenu = ({
|
|
|
247
249
|
fitWidth: DEFAULT_MENU_WIDTH,
|
|
248
250
|
fitHeight: menuHeight,
|
|
249
251
|
preventOverflow: true,
|
|
250
|
-
stick: true
|
|
252
|
+
stick: true
|
|
253
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
254
|
+
,
|
|
251
255
|
offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, targetHandleHeightOffset],
|
|
252
256
|
focusTrap: openedViaKeyboard ?
|
|
253
257
|
// Only enable focus trap when opened via keyboard to make sure the focus is on the first focusable menu item
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
import { checkIsFormatMenuHidden } from './utils/checkIsFormatMenuHidden';
|
|
5
6
|
export const CopySection = ({
|
|
@@ -9,7 +10,8 @@ export const CopySection = ({
|
|
|
9
10
|
const isFormatMenuHidden = useCallback(() => {
|
|
10
11
|
return checkIsFormatMenuHidden(api);
|
|
11
12
|
}, [api]);
|
|
13
|
+
const hasSeparator = fg('platform_editor_block_menu_divider_patch') ? true : editorExperiment('platform_synced_block', true) ? true : !isFormatMenuHidden();
|
|
12
14
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
13
|
-
hasSeparator:
|
|
15
|
+
hasSeparator: hasSeparator
|
|
14
16
|
}, children);
|
|
15
17
|
};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
const getIsFormatMenuHidden = (selection, schema) => {
|
|
3
4
|
const nodes = schema.nodes;
|
|
4
5
|
if (!nodes) {
|
|
5
6
|
return false;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
// When platform_editor_block_menu_divider_patch is enabled, the "Copy synced block"
|
|
10
|
+
// item is placed inside TRANSFORM_MENU_SECTION, so we must not hide the section for
|
|
11
|
+
// syncBlock/bodiedSyncBlock nodes — the "Turn into" nested item has its own isHidden
|
|
12
|
+
// guard that will still hide it for those node types.
|
|
13
|
+
const disabledOnNodes = fg('platform_editor_block_menu_divider_patch') ? [nodes.rule] : [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
8
14
|
const disabledNode = findSelectedNodeOfType(disabledOnNodes)(selection);
|
|
9
15
|
return !!disabledNode;
|
|
10
16
|
};
|
package/dist/esm/editor-commands/transforms/list/transformOrderedUnorderedListToBlockNodes.js
CHANGED
|
@@ -61,6 +61,7 @@ export var transformOrderedUnorderedListToBlockNodes = function transformOrdered
|
|
|
61
61
|
// Convert codeblocks to block nodes
|
|
62
62
|
if (node.type === schema.nodes.codeBlock) {
|
|
63
63
|
var _targetAttrs$level;
|
|
64
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
|
|
64
65
|
var _textContent = node.textContent.split('\n');
|
|
65
66
|
var attributes = targetNodeType === schema.nodes.heading ? {
|
|
66
67
|
level: (_targetAttrs$level = targetAttrs === null || targetAttrs === void 0 ? void 0 : targetAttrs.level) !== null && _targetAttrs$level !== void 0 ? _targetAttrs$level : 1
|
|
@@ -17,6 +17,7 @@ import { MoveUpDropdownItem } from './move-up';
|
|
|
17
17
|
import { SuggestedItemsMenuSection } from './suggested-items-menu-section';
|
|
18
18
|
import { SuggestedMenuItems } from './suggested-menu-items';
|
|
19
19
|
import { hasContentBeforeCreate, hasContentBeforeStructure, hasContentBeforeHeadings } from './utils/checkHasPreviousSectionContent';
|
|
20
|
+
import { checkIsFormatMenuHidden } from './utils/checkIsFormatMenuHidden';
|
|
20
21
|
import { createMenuItemsMap } from './utils/createMenuItemsMap';
|
|
21
22
|
import { getSuggestedItemsFromSelection } from './utils/getSuggestedItemsFromSelection';
|
|
22
23
|
var MIN_NUMBER_OF_AVAILABLE_NATIVE_TRANSFORMS = 7;
|
|
@@ -79,7 +80,10 @@ var getTurnIntoMenuComponents = function getTurnIntoMenuComponents(api) {
|
|
|
79
80
|
return /*#__PURE__*/React.createElement(FormatMenuComponent, {
|
|
80
81
|
api: api
|
|
81
82
|
}, children);
|
|
82
|
-
}
|
|
83
|
+
},
|
|
84
|
+
isHidden: fg('platform_editor_block_menu_divider_patch') ? function () {
|
|
85
|
+
return checkIsFormatMenuHidden(api);
|
|
86
|
+
} : undefined
|
|
83
87
|
}, {
|
|
84
88
|
type: 'block-menu-section',
|
|
85
89
|
key: TRANSFORM_SUGGESTED_MENU_SECTION.key,
|
|
@@ -43,6 +43,7 @@ export var BlockMenuProvider = function BlockMenuProvider(_ref) {
|
|
|
43
43
|
}
|
|
44
44
|
}, [api]);
|
|
45
45
|
return /*#__PURE__*/React.createElement(BlockMenuContext.Provider, {
|
|
46
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-inline-context-value, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
46
47
|
value: {
|
|
47
48
|
onDropdownOpenChanged: onDropdownOpenChanged,
|
|
48
49
|
moveDownRef: moveDownRef,
|
|
@@ -97,7 +97,9 @@ var BlockMenuContent = function BlockMenuContent(_ref2) {
|
|
|
97
97
|
ref: ref,
|
|
98
98
|
xcss: cx(styles.base, fg('platform_editor_block_menu_v2_patch_2') && styles.maxWidthStyles, editorExperiment('platform_synced_block', true) && styles.emptyMenuSectionStyles)
|
|
99
99
|
}, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
100
|
-
type: ArrowKeyNavigationType.MENU
|
|
100
|
+
type: ArrowKeyNavigationType.MENU
|
|
101
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
102
|
+
,
|
|
101
103
|
handleClose: function handleClose(e) {
|
|
102
104
|
return e.preventDefault();
|
|
103
105
|
},
|
|
@@ -246,7 +248,9 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
246
248
|
fitWidth: DEFAULT_MENU_WIDTH,
|
|
247
249
|
fitHeight: menuHeight,
|
|
248
250
|
preventOverflow: true,
|
|
249
|
-
stick: true
|
|
251
|
+
stick: true
|
|
252
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
253
|
+
,
|
|
250
254
|
offset: [DRAG_HANDLE_WIDTH + DRAG_HANDLE_OFFSET_PADDING, targetHandleHeightOffset],
|
|
251
255
|
focusTrap: openedViaKeyboard ?
|
|
252
256
|
// Only enable focus trap when opened via keyboard to make sure the focus is on the first focusable menu item
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
import { checkIsFormatMenuHidden } from './utils/checkIsFormatMenuHidden';
|
|
5
6
|
export var CopySection = function CopySection(_ref) {
|
|
@@ -8,7 +9,8 @@ export var CopySection = function CopySection(_ref) {
|
|
|
8
9
|
var isFormatMenuHidden = useCallback(function () {
|
|
9
10
|
return checkIsFormatMenuHidden(api);
|
|
10
11
|
}, [api]);
|
|
12
|
+
var hasSeparator = fg('platform_editor_block_menu_divider_patch') ? true : editorExperiment('platform_synced_block', true) ? true : !isFormatMenuHidden();
|
|
11
13
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
12
|
-
hasSeparator:
|
|
14
|
+
hasSeparator: hasSeparator
|
|
13
15
|
}, children);
|
|
14
16
|
};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema) {
|
|
3
4
|
var nodes = schema.nodes;
|
|
4
5
|
if (!nodes) {
|
|
5
6
|
return false;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
// When platform_editor_block_menu_divider_patch is enabled, the "Copy synced block"
|
|
10
|
+
// item is placed inside TRANSFORM_MENU_SECTION, so we must not hide the section for
|
|
11
|
+
// syncBlock/bodiedSyncBlock nodes — the "Turn into" nested item has its own isHidden
|
|
12
|
+
// guard that will still hide it for those node types.
|
|
13
|
+
var disabledOnNodes = fg('platform_editor_block_menu_divider_patch') ? [nodes.rule] : [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
8
14
|
var disabledNode = findSelectedNodeOfType(disabledOnNodes)(selection);
|
|
9
15
|
return !!disabledNode;
|
|
10
16
|
};
|
|
@@ -95,6 +95,7 @@ export type BlockMenuNestedSectionComponent = (props: {
|
|
|
95
95
|
export type BlockMenuItemComponent = () => React.ReactNode;
|
|
96
96
|
export type RegisterBlockMenuNested = BlockMenuNested & {
|
|
97
97
|
component?: BlockMenuNestedComponent;
|
|
98
|
+
isHidden?: () => boolean;
|
|
98
99
|
parent: Parent<BlockMenuSection>;
|
|
99
100
|
};
|
|
100
101
|
export type RegisterBlockMenuSection = BlockMenuSection & {
|
|
@@ -2,6 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
4
|
export declare const CopySection: ({ api, children, }: {
|
|
5
|
-
api
|
|
5
|
+
api?: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}) => React.JSX.Element;
|
|
@@ -95,6 +95,7 @@ export type BlockMenuNestedSectionComponent = (props: {
|
|
|
95
95
|
export type BlockMenuItemComponent = () => React.ReactNode;
|
|
96
96
|
export type RegisterBlockMenuNested = BlockMenuNested & {
|
|
97
97
|
component?: BlockMenuNestedComponent;
|
|
98
|
+
isHidden?: () => boolean;
|
|
98
99
|
parent: Parent<BlockMenuSection>;
|
|
99
100
|
};
|
|
100
101
|
export type RegisterBlockMenuSection = BlockMenuSection & {
|
|
@@ -2,6 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
4
|
export declare const CopySection: ({ api, children, }: {
|
|
5
|
-
api
|
|
5
|
+
api?: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.13",
|
|
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/primitives": "^18.0.0",
|
|
46
46
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^44.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^11.1.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"bind-event-listener": "^3.0.0"
|
|
@@ -102,6 +102,9 @@
|
|
|
102
102
|
},
|
|
103
103
|
"platform_editor_block_menu_v2_patch_3": {
|
|
104
104
|
"type": "boolean"
|
|
105
|
+
},
|
|
106
|
+
"platform_editor_block_menu_divider_patch": {
|
|
107
|
+
"type": "boolean"
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
}
|