@atlaskit/editor-plugin-extension 4.1.1 → 4.1.2
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,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 4.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#121993](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121993)
|
|
8
|
+
[`296e666dbaca2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/296e666dbaca2) -
|
|
9
|
+
[ux] [ED-26819] This change removes the breakout options from the floating toolbar for non-bodied
|
|
10
|
+
macros that are nested inside blockquotes, lists and panels. This change is behind an experiment
|
|
11
|
+
flag.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 4.1.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -28,14 +28,30 @@ var _commands = require("../editor-commands/commands");
|
|
|
28
28
|
var _pluginKey = require("./macro/plugin-key");
|
|
29
29
|
var _pluginFactory = require("./plugin-factory");
|
|
30
30
|
var _utils3 = require("./utils");
|
|
31
|
-
|
|
31
|
+
// non-bodied extensions nested inside panels, blockquotes and lists do not support layouts
|
|
32
|
+
var isNestedNBM = function isNestedNBM(state, selectedExtNode) {
|
|
32
33
|
var _state$schema$nodes = state.schema.nodes,
|
|
33
|
-
bodiedExtension = _state$schema$nodes.bodiedExtension,
|
|
34
34
|
extension = _state$schema$nodes.extension,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
panel = _state$schema$nodes.panel,
|
|
36
|
+
blockquote = _state$schema$nodes.blockquote,
|
|
37
|
+
listItem = _state$schema$nodes.listItem,
|
|
38
|
+
selection = state.selection;
|
|
39
|
+
if (!(0, _experiments.editorExperiment)('platform_editor_nested_non_bodied_macros', 'test')) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (!selectedExtNode) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return selectedExtNode.node.type === extension && (0, _utils2.hasParentNodeOfType)([panel, blockquote, listItem].filter(Boolean))(selection);
|
|
46
|
+
};
|
|
47
|
+
var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
|
|
48
|
+
var _state$schema$nodes2 = state.schema.nodes,
|
|
49
|
+
bodiedExtension = _state$schema$nodes2.bodiedExtension,
|
|
50
|
+
extension = _state$schema$nodes2.extension,
|
|
51
|
+
layoutSection = _state$schema$nodes2.layoutSection,
|
|
52
|
+
table = _state$schema$nodes2.table,
|
|
53
|
+
expand = _state$schema$nodes2.expand,
|
|
54
|
+
multiBodiedExtension = _state$schema$nodes2.multiBodiedExtension,
|
|
39
55
|
selection = state.selection;
|
|
40
56
|
if (!selectedExtNode) {
|
|
41
57
|
return false;
|
|
@@ -52,7 +68,7 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
|
|
|
52
68
|
var nodeWithPos = (0, _utils3.getSelectedExtension)(state, true);
|
|
53
69
|
|
|
54
70
|
// we should only return breakout options when breakouts are enabled and the node supports them
|
|
55
|
-
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos)) {
|
|
71
|
+
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos) && !isNestedNBM(state, nodeWithPos)) {
|
|
56
72
|
var layout = nodeWithPos.node.attrs.layout;
|
|
57
73
|
return [{
|
|
58
74
|
type: 'button',
|
|
@@ -20,6 +20,27 @@ import { removeDescendantNodes, removeExtension, updateExtensionLayout } from '.
|
|
|
20
20
|
import { pluginKey as macroPluginKey } from './macro/plugin-key';
|
|
21
21
|
import { getPluginState } from './plugin-factory';
|
|
22
22
|
import { getSelectedExtension } from './utils';
|
|
23
|
+
// non-bodied extensions nested inside panels, blockquotes and lists do not support layouts
|
|
24
|
+
const isNestedNBM = (state, selectedExtNode) => {
|
|
25
|
+
const {
|
|
26
|
+
schema: {
|
|
27
|
+
nodes: {
|
|
28
|
+
extension,
|
|
29
|
+
panel,
|
|
30
|
+
blockquote,
|
|
31
|
+
listItem
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
selection
|
|
35
|
+
} = state;
|
|
36
|
+
if (!editorExperiment('platform_editor_nested_non_bodied_macros', 'test')) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (!selectedExtNode) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return selectedExtNode.node.type === extension && hasParentNodeOfType([panel, blockquote, listItem].filter(Boolean))(selection);
|
|
43
|
+
};
|
|
23
44
|
const isLayoutSupported = (state, selectedExtNode) => {
|
|
24
45
|
const {
|
|
25
46
|
schema: {
|
|
@@ -49,7 +70,7 @@ const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled,
|
|
|
49
70
|
const nodeWithPos = getSelectedExtension(state, true);
|
|
50
71
|
|
|
51
72
|
// we should only return breakout options when breakouts are enabled and the node supports them
|
|
52
|
-
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos)) {
|
|
73
|
+
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos) && !isNestedNBM(state, nodeWithPos)) {
|
|
53
74
|
const {
|
|
54
75
|
layout
|
|
55
76
|
} = nodeWithPos.node.attrs;
|
|
@@ -21,14 +21,30 @@ import { removeDescendantNodes, removeExtension, updateExtensionLayout } from '.
|
|
|
21
21
|
import { pluginKey as macroPluginKey } from './macro/plugin-key';
|
|
22
22
|
import { getPluginState } from './plugin-factory';
|
|
23
23
|
import { getSelectedExtension } from './utils';
|
|
24
|
-
|
|
24
|
+
// non-bodied extensions nested inside panels, blockquotes and lists do not support layouts
|
|
25
|
+
var isNestedNBM = function isNestedNBM(state, selectedExtNode) {
|
|
25
26
|
var _state$schema$nodes = state.schema.nodes,
|
|
26
|
-
bodiedExtension = _state$schema$nodes.bodiedExtension,
|
|
27
27
|
extension = _state$schema$nodes.extension,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
panel = _state$schema$nodes.panel,
|
|
29
|
+
blockquote = _state$schema$nodes.blockquote,
|
|
30
|
+
listItem = _state$schema$nodes.listItem,
|
|
31
|
+
selection = state.selection;
|
|
32
|
+
if (!editorExperiment('platform_editor_nested_non_bodied_macros', 'test')) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!selectedExtNode) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return selectedExtNode.node.type === extension && hasParentNodeOfType([panel, blockquote, listItem].filter(Boolean))(selection);
|
|
39
|
+
};
|
|
40
|
+
var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
|
|
41
|
+
var _state$schema$nodes2 = state.schema.nodes,
|
|
42
|
+
bodiedExtension = _state$schema$nodes2.bodiedExtension,
|
|
43
|
+
extension = _state$schema$nodes2.extension,
|
|
44
|
+
layoutSection = _state$schema$nodes2.layoutSection,
|
|
45
|
+
table = _state$schema$nodes2.table,
|
|
46
|
+
expand = _state$schema$nodes2.expand,
|
|
47
|
+
multiBodiedExtension = _state$schema$nodes2.multiBodiedExtension,
|
|
32
48
|
selection = state.selection;
|
|
33
49
|
if (!selectedExtNode) {
|
|
34
50
|
return false;
|
|
@@ -45,7 +61,7 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
|
|
|
45
61
|
var nodeWithPos = getSelectedExtension(state, true);
|
|
46
62
|
|
|
47
63
|
// we should only return breakout options when breakouts are enabled and the node supports them
|
|
48
|
-
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos)) {
|
|
64
|
+
if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos) && !isNestedNBM(state, nodeWithPos)) {
|
|
49
65
|
var layout = nodeWithPos.node.attrs.layout;
|
|
50
66
|
return [{
|
|
51
67
|
type: 'button',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/button": "^21.1.0",
|
|
33
33
|
"@atlaskit/checkbox": "^17.0.0",
|
|
34
34
|
"@atlaskit/datetime-picker": "^16.0.0",
|
|
35
|
-
"@atlaskit/editor-common": "^101.
|
|
35
|
+
"@atlaskit/editor-common": "^101.1.0",
|
|
36
36
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-context-identifier": "^2.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@atlaskit/tabs": "^18.0.0",
|
|
58
58
|
"@atlaskit/textarea": "^8.0.0",
|
|
59
59
|
"@atlaskit/textfield": "^8.0.0",
|
|
60
|
-
"@atlaskit/theme": "^
|
|
60
|
+
"@atlaskit/theme": "^18.0.0",
|
|
61
61
|
"@atlaskit/tmp-editor-statsig": "^3.4.0",
|
|
62
62
|
"@atlaskit/toggle": "^15.0.0",
|
|
63
63
|
"@atlaskit/tokens": "^4.3.0",
|