@atlaskit/editor-plugin-block-menu 5.0.8 → 5.0.10
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 +15 -0
- package/afm-jira/tsconfig.json +1 -1
- package/dist/cjs/editor-commands/formatNode.js +1 -2
- package/dist/cjs/editor-commands/transforms/container-transforms.js +2 -3
- package/dist/cjs/ui/copy-block.js +1 -1
- package/dist/cjs/ui/utils/checkIsFormatMenuHidden.js +12 -1
- package/dist/es2019/editor-commands/formatNode.js +1 -2
- package/dist/es2019/editor-commands/transforms/container-transforms.js +2 -3
- package/dist/es2019/ui/copy-block.js +1 -1
- package/dist/es2019/ui/utils/checkIsFormatMenuHidden.js +12 -1
- package/dist/esm/editor-commands/formatNode.js +1 -2
- package/dist/esm/editor-commands/transforms/container-transforms.js +2 -3
- package/dist/esm/ui/copy-block.js +1 -1
- package/dist/esm/ui/utils/checkIsFormatMenuHidden.js +12 -1
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 5.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c0f06bd1a9b63`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0f06bd1a9b63) -
|
|
8
|
+
Feature flag removal platform_editor_block_menu_patch_2
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 5.0.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`d43ebcd35ce11`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d43ebcd35ce11) -
|
|
16
|
+
[ux] Enable block menu on all top level nodes by default
|
|
17
|
+
|
|
3
18
|
## 5.0.8
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../tsDist/@atlaskit__editor-plugin-block-menu/app",
|
|
5
|
+
"outDir": "../../../../../jira/tsDist/@atlaskit__editor-plugin-block-menu/app",
|
|
6
6
|
"rootDir": "../",
|
|
7
7
|
"composite": true
|
|
8
8
|
},
|
|
@@ -8,7 +8,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
8
8
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
12
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
14
13
|
var _selection = require("./selection");
|
|
@@ -124,7 +123,7 @@ var formatNode = exports.formatNode = function formatNode(api) {
|
|
|
124
123
|
});
|
|
125
124
|
// get the first list node as when click on drag handle if there are list node
|
|
126
125
|
// can only select one list at a time, so we just need to find the first one
|
|
127
|
-
if (listNodes.length > 0
|
|
126
|
+
if (listNodes.length > 0) {
|
|
128
127
|
var firstChild = listNodes[0];
|
|
129
128
|
var newTr = formatNodeSelectEmptyList(tr, targetType, firstChild, schema);
|
|
130
129
|
if (newTr) {
|
|
@@ -8,7 +8,6 @@ exports.unwrapAndConvertToList = exports.unwrapAndConvertToBlockType = exports.t
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _inlineNodeTransforms = require("./inline-node-transforms");
|
|
13
12
|
var _utils2 = require("./utils");
|
|
14
13
|
var convertInvalidNodeToValidNodeType = function convertInvalidNodeToValidNodeType(sourceContent, sourceNodeType, validNodeType, withMarks) {
|
|
@@ -204,7 +203,7 @@ var unwrapAndConvertToList = exports.unwrapAndConvertToList = function unwrapAnd
|
|
|
204
203
|
heading = _schema$nodes2.heading;
|
|
205
204
|
var isTargetTaskList = targetNodeType === taskList;
|
|
206
205
|
var createListItemFromInline = function createListItemFromInline(content) {
|
|
207
|
-
if (!content
|
|
206
|
+
if (!content) {
|
|
208
207
|
return isTargetTaskList ? taskItem.create() : listItem.create(null, paragraph.create());
|
|
209
208
|
} else {
|
|
210
209
|
return isTargetTaskList ? taskItem.create(null, content) : listItem.create(null, paragraph.create(null, content));
|
|
@@ -243,7 +242,7 @@ var unwrapAndConvertToList = exports.unwrapAndConvertToList = function unwrapAnd
|
|
|
243
242
|
var isOnlyNewLines = function isOnlyNewLines(codeText) {
|
|
244
243
|
return codeText.replace(/\n/g, '').trim() === '';
|
|
245
244
|
};
|
|
246
|
-
if (
|
|
245
|
+
if (!codeText || isOnlyNewLines(codeText)) {
|
|
247
246
|
// Empty code block - create an empty list item
|
|
248
247
|
currentListItems.push(createListItemFromInline());
|
|
249
248
|
}
|
|
@@ -76,7 +76,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
76
76
|
// if text is inside of an expand or extension, the selection contains an expand or extension for some reason
|
|
77
77
|
// the expandNode or extensionNode always and only have one child, no matter how much contents are inside the expand or extension,
|
|
78
78
|
// and the one child is the line that is being selected, so we can use the .firstChild again
|
|
79
|
-
if ((_fragment2 = fragment) !== null && _fragment2 !== void 0 && _fragment2.firstChild && (fragment.firstChild.type.name === 'expand' || fragment.firstChild.type.name === 'bodiedExtension'
|
|
79
|
+
if ((_fragment2 = fragment) !== null && _fragment2 !== void 0 && _fragment2.firstChild && (fragment.firstChild.type.name === 'expand' || fragment.firstChild.type.name === 'bodiedExtension')) {
|
|
80
80
|
var expandOrExtensionNode = fragment.firstChild;
|
|
81
81
|
var actualNodeToCopy = expandOrExtensionNode.firstChild;
|
|
82
82
|
fragment = _model.Fragment.from(actualNodeToCopy) || _model.Fragment.empty;
|
|
@@ -9,11 +9,18 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
9
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
10
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
11
11
|
var _isNestedNode = require("./isNestedNode");
|
|
12
|
+
var TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES = true;
|
|
12
13
|
var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, menuTriggerBy) {
|
|
13
14
|
var nodes = schema.nodes;
|
|
14
15
|
if (!nodes) {
|
|
15
16
|
return false;
|
|
16
17
|
}
|
|
18
|
+
var isNested = (0, _isNestedNode.isNestedNode)(selection, menuTriggerBy);
|
|
19
|
+
if (TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES) {
|
|
20
|
+
var disabledOnNodes = [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
21
|
+
var disabledNode = (0, _utils.findSelectedNodeOfType)(disabledOnNodes)(selection);
|
|
22
|
+
return !!disabledNode || isNested && !(0, _platformFeatureFlags.fg)('platform_editor_block_menu_transform_nested_node');
|
|
23
|
+
}
|
|
17
24
|
var content;
|
|
18
25
|
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
19
26
|
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
@@ -31,7 +38,6 @@ var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, me
|
|
|
31
38
|
content = listTypeOrBlockQuoteNode.node;
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
|
-
var isNested = (0, _isNestedNode.isNestedNode)(selection, menuTriggerBy);
|
|
35
41
|
return !content || isNested && !(0, _platformFeatureFlags.fg)('platform_editor_block_menu_transform_nested_node');
|
|
36
42
|
};
|
|
37
43
|
var getIsFormatMenuHiddenEmptyLine = function getIsFormatMenuHiddenEmptyLine(selection, schema, menuTriggerBy) {
|
|
@@ -40,6 +46,11 @@ var getIsFormatMenuHiddenEmptyLine = function getIsFormatMenuHiddenEmptyLine(sel
|
|
|
40
46
|
return false;
|
|
41
47
|
}
|
|
42
48
|
var isNested = (0, _isNestedNode.isNestedNode)(selection, menuTriggerBy);
|
|
49
|
+
if (TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES) {
|
|
50
|
+
var disabledOnNodes = [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
51
|
+
var disabledNode = (0, _utils.findSelectedNodeOfType)(disabledOnNodes)(selection);
|
|
52
|
+
return !!disabledNode || isNested && !(0, _platformFeatureFlags.fg)('platform_editor_block_menu_transform_nested_node');
|
|
53
|
+
}
|
|
43
54
|
if (selection.empty || selection.content().size === 0) {
|
|
44
55
|
// if empty selection, show format menu
|
|
45
56
|
return false;
|
|
@@ -2,7 +2,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
2
2
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfType, findSelectedNodeOfType, safeInsert as pmSafeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
6
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
8
7
|
import { setSelectionAfterTransform } from './selection';
|
|
@@ -129,7 +128,7 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
|
|
|
129
128
|
});
|
|
130
129
|
// get the first list node as when click on drag handle if there are list node
|
|
131
130
|
// can only select one list at a time, so we just need to find the first one
|
|
132
|
-
if (listNodes.length > 0
|
|
131
|
+
if (listNodes.length > 0) {
|
|
133
132
|
const firstChild = listNodes[0];
|
|
134
133
|
const newTr = formatNodeSelectEmptyList(tr, targetType, firstChild, schema);
|
|
135
134
|
if (newTr) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { getInlineNodeTextContent } from './inline-node-transforms';
|
|
5
4
|
import { isBlockNodeType, isListNodeType, isContainerNodeType, isBlockNodeForExtraction, convertNodeToInlineContent, getContentSupportChecker, convertCodeBlockContentToParagraphs, filterMarksForTargetNodeType, getMarksWithBreakout } from './utils';
|
|
6
5
|
const convertInvalidNodeToValidNodeType = (sourceContent, sourceNodeType, validNodeType, withMarks) => {
|
|
@@ -205,7 +204,7 @@ export const unwrapAndConvertToList = ({
|
|
|
205
204
|
} = schema.nodes;
|
|
206
205
|
const isTargetTaskList = targetNodeType === taskList;
|
|
207
206
|
const createListItemFromInline = content => {
|
|
208
|
-
if (!content
|
|
207
|
+
if (!content) {
|
|
209
208
|
return isTargetTaskList ? taskItem.create() : listItem.create(null, paragraph.create());
|
|
210
209
|
} else {
|
|
211
210
|
return isTargetTaskList ? taskItem.create(null, content) : listItem.create(null, paragraph.create(null, content));
|
|
@@ -242,7 +241,7 @@ export const unwrapAndConvertToList = ({
|
|
|
242
241
|
// check if code block only contains newline characters
|
|
243
242
|
// eslint-disable-next-line require-unicode-regexp
|
|
244
243
|
const isOnlyNewLines = codeText => codeText.replace(/\n/g, '').trim() === '';
|
|
245
|
-
if (
|
|
244
|
+
if (!codeText || isOnlyNewLines(codeText)) {
|
|
246
245
|
// Empty code block - create an empty list item
|
|
247
246
|
currentListItems.push(createListItemFromInline());
|
|
248
247
|
}
|
|
@@ -70,7 +70,7 @@ const CopyBlockMenuItem = ({
|
|
|
70
70
|
// if text is inside of an expand or extension, the selection contains an expand or extension for some reason
|
|
71
71
|
// the expandNode or extensionNode always and only have one child, no matter how much contents are inside the expand or extension,
|
|
72
72
|
// and the one child is the line that is being selected, so we can use the .firstChild again
|
|
73
|
-
if ((_fragment2 = fragment) !== null && _fragment2 !== void 0 && _fragment2.firstChild && (fragment.firstChild.type.name === 'expand' || fragment.firstChild.type.name === 'bodiedExtension'
|
|
73
|
+
if ((_fragment2 = fragment) !== null && _fragment2 !== void 0 && _fragment2.firstChild && (fragment.firstChild.type.name === 'expand' || fragment.firstChild.type.name === 'bodiedExtension')) {
|
|
74
74
|
const expandOrExtensionNode = fragment.firstChild;
|
|
75
75
|
const actualNodeToCopy = expandOrExtensionNode.firstChild;
|
|
76
76
|
fragment = Fragment.from(actualNodeToCopy) || Fragment.empty;
|
|
@@ -3,11 +3,18 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
4
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
5
|
import { isNestedNode } from './isNestedNode';
|
|
6
|
+
const TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES = true;
|
|
6
7
|
const getIsFormatMenuHidden = (selection, schema, menuTriggerBy) => {
|
|
7
8
|
const nodes = schema.nodes;
|
|
8
9
|
if (!nodes) {
|
|
9
10
|
return false;
|
|
10
11
|
}
|
|
12
|
+
const isNested = isNestedNode(selection, menuTriggerBy);
|
|
13
|
+
if (TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES) {
|
|
14
|
+
const disabledOnNodes = [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
15
|
+
const disabledNode = findSelectedNodeOfType(disabledOnNodes)(selection);
|
|
16
|
+
return !!disabledNode || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
17
|
+
}
|
|
11
18
|
let content;
|
|
12
19
|
const allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
13
20
|
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
@@ -25,7 +32,6 @@ const getIsFormatMenuHidden = (selection, schema, menuTriggerBy) => {
|
|
|
25
32
|
content = listTypeOrBlockQuoteNode.node;
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
|
-
const isNested = isNestedNode(selection, menuTriggerBy);
|
|
29
35
|
return !content || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
30
36
|
};
|
|
31
37
|
const getIsFormatMenuHiddenEmptyLine = (selection, schema, menuTriggerBy) => {
|
|
@@ -34,6 +40,11 @@ const getIsFormatMenuHiddenEmptyLine = (selection, schema, menuTriggerBy) => {
|
|
|
34
40
|
return false;
|
|
35
41
|
}
|
|
36
42
|
const isNested = isNestedNode(selection, menuTriggerBy);
|
|
43
|
+
if (TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES) {
|
|
44
|
+
const disabledOnNodes = [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
45
|
+
const disabledNode = findSelectedNodeOfType(disabledOnNodes)(selection);
|
|
46
|
+
return !!disabledNode || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
47
|
+
}
|
|
37
48
|
if (selection.empty || selection.content().size === 0) {
|
|
38
49
|
// if empty selection, show format menu
|
|
39
50
|
return false;
|
|
@@ -2,7 +2,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
2
2
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfType, findSelectedNodeOfType, safeInsert as pmSafeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
6
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
8
7
|
import { setSelectionAfterTransform } from './selection';
|
|
@@ -119,7 +118,7 @@ export var formatNode = function formatNode(api) {
|
|
|
119
118
|
});
|
|
120
119
|
// get the first list node as when click on drag handle if there are list node
|
|
121
120
|
// can only select one list at a time, so we just need to find the first one
|
|
122
|
-
if (listNodes.length > 0
|
|
121
|
+
if (listNodes.length > 0) {
|
|
123
122
|
var firstChild = listNodes[0];
|
|
124
123
|
var newTr = formatNodeSelectEmptyList(tr, targetType, firstChild, schema);
|
|
125
124
|
if (newTr) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { getInlineNodeTextContent } from './inline-node-transforms';
|
|
6
5
|
import { isBlockNodeType, isListNodeType, isContainerNodeType, isBlockNodeForExtraction, convertNodeToInlineContent, getContentSupportChecker, convertCodeBlockContentToParagraphs, filterMarksForTargetNodeType, getMarksWithBreakout } from './utils';
|
|
7
6
|
var convertInvalidNodeToValidNodeType = function convertInvalidNodeToValidNodeType(sourceContent, sourceNodeType, validNodeType, withMarks) {
|
|
@@ -197,7 +196,7 @@ export var unwrapAndConvertToList = function unwrapAndConvertToList(_ref3) {
|
|
|
197
196
|
heading = _schema$nodes2.heading;
|
|
198
197
|
var isTargetTaskList = targetNodeType === taskList;
|
|
199
198
|
var createListItemFromInline = function createListItemFromInline(content) {
|
|
200
|
-
if (!content
|
|
199
|
+
if (!content) {
|
|
201
200
|
return isTargetTaskList ? taskItem.create() : listItem.create(null, paragraph.create());
|
|
202
201
|
} else {
|
|
203
202
|
return isTargetTaskList ? taskItem.create(null, content) : listItem.create(null, paragraph.create(null, content));
|
|
@@ -236,7 +235,7 @@ export var unwrapAndConvertToList = function unwrapAndConvertToList(_ref3) {
|
|
|
236
235
|
var isOnlyNewLines = function isOnlyNewLines(codeText) {
|
|
237
236
|
return codeText.replace(/\n/g, '').trim() === '';
|
|
238
237
|
};
|
|
239
|
-
if (
|
|
238
|
+
if (!codeText || isOnlyNewLines(codeText)) {
|
|
240
239
|
// Empty code block - create an empty list item
|
|
241
240
|
currentListItems.push(createListItemFromInline());
|
|
242
241
|
}
|
|
@@ -69,7 +69,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
69
69
|
// if text is inside of an expand or extension, the selection contains an expand or extension for some reason
|
|
70
70
|
// the expandNode or extensionNode always and only have one child, no matter how much contents are inside the expand or extension,
|
|
71
71
|
// and the one child is the line that is being selected, so we can use the .firstChild again
|
|
72
|
-
if ((_fragment2 = fragment) !== null && _fragment2 !== void 0 && _fragment2.firstChild && (fragment.firstChild.type.name === 'expand' || fragment.firstChild.type.name === 'bodiedExtension'
|
|
72
|
+
if ((_fragment2 = fragment) !== null && _fragment2 !== void 0 && _fragment2.firstChild && (fragment.firstChild.type.name === 'expand' || fragment.firstChild.type.name === 'bodiedExtension')) {
|
|
73
73
|
var expandOrExtensionNode = fragment.firstChild;
|
|
74
74
|
var actualNodeToCopy = expandOrExtensionNode.firstChild;
|
|
75
75
|
fragment = Fragment.from(actualNodeToCopy) || Fragment.empty;
|
|
@@ -3,11 +3,18 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
4
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
5
|
import { isNestedNode } from './isNestedNode';
|
|
6
|
+
var TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES = true;
|
|
6
7
|
var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, menuTriggerBy) {
|
|
7
8
|
var nodes = schema.nodes;
|
|
8
9
|
if (!nodes) {
|
|
9
10
|
return false;
|
|
10
11
|
}
|
|
12
|
+
var isNested = isNestedNode(selection, menuTriggerBy);
|
|
13
|
+
if (TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES) {
|
|
14
|
+
var disabledOnNodes = [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
15
|
+
var disabledNode = findSelectedNodeOfType(disabledOnNodes)(selection);
|
|
16
|
+
return !!disabledNode || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
17
|
+
}
|
|
11
18
|
var content;
|
|
12
19
|
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
13
20
|
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
@@ -25,7 +32,6 @@ var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, me
|
|
|
25
32
|
content = listTypeOrBlockQuoteNode.node;
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
|
-
var isNested = isNestedNode(selection, menuTriggerBy);
|
|
29
35
|
return !content || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
30
36
|
};
|
|
31
37
|
var getIsFormatMenuHiddenEmptyLine = function getIsFormatMenuHiddenEmptyLine(selection, schema, menuTriggerBy) {
|
|
@@ -34,6 +40,11 @@ var getIsFormatMenuHiddenEmptyLine = function getIsFormatMenuHiddenEmptyLine(sel
|
|
|
34
40
|
return false;
|
|
35
41
|
}
|
|
36
42
|
var isNested = isNestedNode(selection, menuTriggerBy);
|
|
43
|
+
if (TRANSFORM_MENU_ENABLED_FOR_ALL_TOP_LEVEL_NODES) {
|
|
44
|
+
var disabledOnNodes = [nodes.syncBlock, nodes.bodiedSyncBlock, nodes.rule];
|
|
45
|
+
var disabledNode = findSelectedNodeOfType(disabledOnNodes)(selection);
|
|
46
|
+
return !!disabledNode || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
47
|
+
}
|
|
37
48
|
if (selection.empty || selection.content().size === 0) {
|
|
38
49
|
// if empty selection, show format menu
|
|
39
50
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.10",
|
|
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.15.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.
|
|
34
|
+
"@atlaskit/editor-plugin-block-controls": "^7.7.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": "^16.1.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^13.38.0",
|
|
48
48
|
"@atlaskit/tokens": "^8.0.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^110.
|
|
52
|
+
"@atlaskit/editor-common": "^110.31.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
55
55
|
},
|
|
@@ -102,9 +102,6 @@
|
|
|
102
102
|
"platform_editor_block_menu_for_disabled_nodes": {
|
|
103
103
|
"type": "boolean"
|
|
104
104
|
},
|
|
105
|
-
"platform_editor_block_menu_patch_2": {
|
|
106
|
-
"type": "boolean"
|
|
107
|
-
},
|
|
108
105
|
"platform_editor_block_menu_shouldfitcontainer": {
|
|
109
106
|
"type": "boolean"
|
|
110
107
|
},
|