@atlaskit/editor-plugin-block-menu 9.2.9 → 9.2.11
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 +14 -0
- package/dist/cjs/editor-actions/isTransformToTargetDisabled.js +1 -1
- package/dist/cjs/editor-commands/selection.js +2 -1
- package/dist/cjs/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.js +272 -201
- package/dist/cjs/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +1 -1
- package/dist/cjs/editor-commands/transform-node-utils/transform.js +26 -6
- package/dist/cjs/editor-commands/transform-node-utils/types.js +1 -0
- package/dist/cjs/editor-commands/transform-node-utils/utils.js +14 -7
- package/dist/cjs/ui/utils/copyLink.js +17 -17
- package/dist/es2019/editor-actions/isTransformToTargetDisabled.js +1 -1
- package/dist/es2019/editor-commands/selection.js +2 -1
- package/dist/es2019/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.js +75 -7
- package/dist/es2019/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +1 -1
- package/dist/es2019/editor-commands/transform-node-utils/transform.js +25 -5
- package/dist/es2019/editor-commands/transform-node-utils/types.js +1 -0
- package/dist/es2019/editor-commands/transform-node-utils/utils.js +8 -1
- package/dist/esm/editor-actions/isTransformToTargetDisabled.js +1 -1
- package/dist/esm/editor-commands/selection.js +2 -1
- package/dist/esm/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.js +270 -200
- package/dist/esm/editor-commands/transform-node-utils/steps/wrapMixedContentStep.js +1 -1
- package/dist/esm/editor-commands/transform-node-utils/transform.js +25 -5
- package/dist/esm/editor-commands/transform-node-utils/types.js +1 -0
- package/dist/esm/editor-commands/transform-node-utils/utils.js +8 -1
- package/dist/esm/ui/utils/copyLink.js +17 -17
- package/dist/types/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.d.ts +4 -1
- package/dist/types/editor-commands/transform-node-utils/transform.d.ts +1 -0
- package/dist/types/editor-commands/transform-node-utils/types.d.ts +1 -1
- package/dist/types/editor-commands/transform-node-utils/utils.d.ts +1 -1
- package/dist/types/editor-commands/types.d.ts +1 -1
- package/dist/types-ts4.5/editor-commands/transform-node-utils/TRANSFORMATION_MATRIX.d.ts +4 -1
- package/dist/types-ts4.5/editor-commands/transform-node-utils/transform.d.ts +1 -0
- package/dist/types-ts4.5/editor-commands/transform-node-utils/types.d.ts +1 -1
- package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +1 -1
- package/dist/types-ts4.5/editor-commands/types.d.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 9.2.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.2.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`78c42f10ef772`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/78c42f10ef772) -
|
|
14
|
+
Add support in block menu for new panel_c1 variant which allows tables inside
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 9.2.9
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ var _transform = require("../editor-commands/transform-node-utils/transform");
|
|
|
10
10
|
var _types = require("../editor-commands/transform-node-utils/types");
|
|
11
11
|
var _utils = require("../editor-commands/transform-node-utils/utils");
|
|
12
12
|
var canParentContainNodeType = exports.canParentContainNodeType = function canParentContainNodeType(schema, selectedNodeTypeName, parentNode, nodeTypeName, nodeTypeAttrs) {
|
|
13
|
-
var adjustedNodeTypeName = (0, _utils.getTargetNodeTypeNameInContext)(nodeTypeName, true, parentNode);
|
|
13
|
+
var adjustedNodeTypeName = (0, _utils.getTargetNodeTypeNameInContext)(nodeTypeName, true, parentNode, schema);
|
|
14
14
|
if (!adjustedNodeTypeName) {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.setSelectionAfterTransform = void 0;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
/**
|
|
9
10
|
* Sets the appropriate selection after transforming a node to a target type
|
|
10
11
|
* @param newTr - The transaction containing the transformed node
|
|
@@ -23,7 +24,7 @@ var setSelectionAfterTransform = exports.setSelectionAfterTransform = function s
|
|
|
23
24
|
// Check if target type is other than list, text, heading, blockquotes
|
|
24
25
|
var isListNode = targetType === 'bulletList' || targetType === 'orderedList' || targetType === 'taskList';
|
|
25
26
|
var isBlockquote = targetType === 'blockquote';
|
|
26
|
-
var isContainer = ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
27
|
+
var isContainer = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? ['panel', 'panel_c1', 'expand', 'codeBlock', 'layoutSection'].includes(targetType) : ['panel', 'expand', 'codeBlock', 'layoutSection'].includes(targetType);
|
|
27
28
|
if (isListNode || isBlockquote) {
|
|
28
29
|
// For taskList, select all content within the list
|
|
29
30
|
var textStart = transformedNodePos.pos + 1; // Inside the taskList
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.TRANSFORMATION_MATRIX = void 0;
|
|
7
|
+
exports.TRANSFORMATION_MATRIX_PANEL_C1 = exports.TRANSFORMATION_MATRIX = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _applyTargetTextTypeStep = require("./steps/applyTargetTextTypeStep");
|
|
8
10
|
var _convertEachNodeStep = require("./steps/convertEachNodeStep");
|
|
9
11
|
var _decisionListToListStep = require("./steps/decisionListToListStep");
|
|
@@ -20,203 +22,272 @@ var _wrapBlockquoteToDecisionListStep = require("./steps/wrapBlockquoteToDecisio
|
|
|
20
22
|
var _wrapIntoListStep = require("./steps/wrapIntoListStep");
|
|
21
23
|
var _wrapMixedContentStep = require("./steps/wrapMixedContentStep");
|
|
22
24
|
var _wrapStep = require("./steps/wrapStep");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
nestedExpand:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
blockquote:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
+
/**
|
|
28
|
+
* Creates the transformation matrix for all node type pairs.
|
|
29
|
+
* When includePanelC1 is true (platform_editor_nest_table_in_panel experiment on),
|
|
30
|
+
* panel_c1 entries are included as both source and target types.
|
|
31
|
+
* If a transformation is not defined (undefined), it is not available.
|
|
32
|
+
*/
|
|
33
|
+
var createTransformationMatrix = function createTransformationMatrix(includePanelC1) {
|
|
34
|
+
return {
|
|
35
|
+
paragraph: _objectSpread(_objectSpread({
|
|
36
|
+
heading: [_flattenStep.flattenStep, _applyTargetTextTypeStep.applyTargetTextTypeStep],
|
|
37
|
+
blockquote: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
38
|
+
codeBlock: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
39
|
+
expand: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
40
|
+
nestedExpand: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
41
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
42
|
+
panel: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
43
|
+
}, includePanelC1 ? {
|
|
44
|
+
panel_c1: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
45
|
+
} : {}), {}, {
|
|
46
|
+
bulletList: [_wrapIntoListStep.wrapIntoListStep],
|
|
47
|
+
orderedList: [_wrapIntoListStep.wrapIntoListStep],
|
|
48
|
+
taskList: [_wrapIntoListStep.wrapIntoListStep],
|
|
49
|
+
decisionList: [_wrapIntoListStep.wrapIntoListStep]
|
|
50
|
+
}),
|
|
51
|
+
heading: _objectSpread(_objectSpread({
|
|
52
|
+
heading: [_flattenStep.flattenStep, _applyTargetTextTypeStep.applyTargetTextTypeStep],
|
|
53
|
+
paragraph: [_flattenStep.flattenStep, _applyTargetTextTypeStep.applyTargetTextTypeStep],
|
|
54
|
+
blockquote: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
55
|
+
codeBlock: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
56
|
+
expand: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
57
|
+
nestedExpand: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
58
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
59
|
+
panel: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
60
|
+
}, includePanelC1 ? {
|
|
61
|
+
panel_c1: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
62
|
+
} : {}), {}, {
|
|
63
|
+
bulletList: [_wrapIntoListStep.wrapIntoListStep],
|
|
64
|
+
orderedList: [_wrapIntoListStep.wrapIntoListStep],
|
|
65
|
+
taskList: [_wrapIntoListStep.wrapIntoListStep],
|
|
66
|
+
decisionList: [_wrapIntoListStep.wrapIntoListStep]
|
|
67
|
+
}),
|
|
68
|
+
panel: {
|
|
69
|
+
blockquote: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
70
|
+
codeBlock: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
71
|
+
expand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
|
|
72
|
+
nestedExpand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
|
|
73
|
+
layoutSection: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
74
|
+
paragraph: [_unwrapStep.unwrapStep]
|
|
75
|
+
},
|
|
76
|
+
panel_c1: includePanelC1 ? {
|
|
77
|
+
blockquote: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
78
|
+
codeBlock: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
79
|
+
expand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
|
|
80
|
+
nestedExpand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
|
|
81
|
+
layoutSection: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
82
|
+
paragraph: [_unwrapStep.unwrapStep]
|
|
83
|
+
} : {},
|
|
84
|
+
expand: _objectSpread(_objectSpread({
|
|
85
|
+
panel: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep]
|
|
86
|
+
}, includePanelC1 ? {
|
|
87
|
+
panel_c1: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep]
|
|
88
|
+
} : {}), {}, {
|
|
89
|
+
blockquote: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
90
|
+
layoutSection: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
91
|
+
nestedExpand: [_unwrapExpandStep.unwrapExpandStep, _wrapStep.wrapStep],
|
|
92
|
+
paragraph: [_unwrapExpandStep.unwrapExpandStep]
|
|
93
|
+
}),
|
|
94
|
+
nestedExpand: _objectSpread(_objectSpread({
|
|
95
|
+
panel: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep]
|
|
96
|
+
}, includePanelC1 ? {
|
|
97
|
+
panel_c1: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep]
|
|
98
|
+
} : {}), {}, {
|
|
99
|
+
blockquote: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
100
|
+
layoutSection: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
101
|
+
paragraph: [_unwrapExpandStep.unwrapExpandStep]
|
|
102
|
+
}),
|
|
103
|
+
blockquote: _objectSpread(_objectSpread({
|
|
104
|
+
expand: [_wrapStep.wrapStep],
|
|
105
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
106
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
107
|
+
panel: [_unwrapStep.unwrapStep, _wrapStep.wrapStep]
|
|
108
|
+
}, includePanelC1 ? {
|
|
109
|
+
panel_c1: [_unwrapStep.unwrapStep, _wrapStep.wrapStep]
|
|
110
|
+
} : {}), {}, {
|
|
111
|
+
paragraph: [_unwrapStep.unwrapStep],
|
|
112
|
+
decisionList: [_unwrapStep.unwrapStep, _wrapBlockquoteToDecisionListStep.wrapBlockquoteToDecisionListStep]
|
|
113
|
+
}),
|
|
114
|
+
layoutSection: _objectSpread(_objectSpread({
|
|
115
|
+
blockquote: [_unwrapLayoutStep.unwrapLayoutStep, _wrapMixedContentStep.wrapMixedContentStep],
|
|
116
|
+
expand: [_unwrapLayoutStep.unwrapLayoutStep, _wrapStep.wrapStep],
|
|
117
|
+
nestedExpand: [_unwrapLayoutStep.unwrapLayoutStep, _wrapStep.wrapStep],
|
|
118
|
+
panel: [_unwrapLayoutStep.unwrapLayoutStep, _wrapMixedContentStep.wrapMixedContentStep]
|
|
119
|
+
}, includePanelC1 ? {
|
|
120
|
+
panel_c1: [_unwrapLayoutStep.unwrapLayoutStep, _wrapMixedContentStep.wrapMixedContentStep]
|
|
121
|
+
} : {}), {}, {
|
|
122
|
+
paragraph: [_unwrapLayoutStep.unwrapLayoutStep]
|
|
123
|
+
}),
|
|
124
|
+
codeBlock: _objectSpread(_objectSpread({
|
|
125
|
+
blockquote: [_wrapStep.wrapStep],
|
|
126
|
+
expand: [_wrapStep.wrapStep],
|
|
127
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
128
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
129
|
+
panel: [_wrapStep.wrapStep]
|
|
130
|
+
}, includePanelC1 ? {
|
|
131
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
132
|
+
} : {}), {}, {
|
|
133
|
+
paragraph: [_applyTargetTextTypeStep.applyTargetTextTypeStep]
|
|
134
|
+
}),
|
|
135
|
+
bulletList: _objectSpread(_objectSpread({
|
|
136
|
+
orderedList: [_listToListStep.listToListStep],
|
|
137
|
+
taskList: [_listToListStep.listToListStep],
|
|
138
|
+
decisionList: [_flattenListStep.flattenListStep, _listToDecisionListStep.listToDecisionListStep],
|
|
139
|
+
blockquote: [_wrapStep.wrapStep],
|
|
140
|
+
expand: [_wrapStep.wrapStep],
|
|
141
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
142
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
143
|
+
panel: [_wrapStep.wrapStep]
|
|
144
|
+
}, includePanelC1 ? {
|
|
145
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
146
|
+
} : {}), {}, {
|
|
147
|
+
paragraph: [_flattenListStep.flattenListStep, _unwrapListStep.unwrapListStep, _applyTargetTextTypeStep.applyTargetTextTypeStep]
|
|
148
|
+
}),
|
|
149
|
+
orderedList: _objectSpread(_objectSpread({
|
|
150
|
+
bulletList: [_listToListStep.listToListStep],
|
|
151
|
+
taskList: [_listToListStep.listToListStep],
|
|
152
|
+
decisionList: [_flattenListStep.flattenListStep, _listToDecisionListStep.listToDecisionListStep],
|
|
153
|
+
blockquote: [_wrapStep.wrapStep],
|
|
154
|
+
expand: [_wrapStep.wrapStep],
|
|
155
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
156
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
157
|
+
panel: [_wrapStep.wrapStep]
|
|
158
|
+
}, includePanelC1 ? {
|
|
159
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
160
|
+
} : {}), {}, {
|
|
161
|
+
paragraph: [_flattenListStep.flattenListStep, _unwrapListStep.unwrapListStep, _applyTargetTextTypeStep.applyTargetTextTypeStep]
|
|
162
|
+
}),
|
|
163
|
+
taskList: _objectSpread(_objectSpread({
|
|
164
|
+
bulletList: [_listToListStep.listToListStep],
|
|
165
|
+
orderedList: [_listToListStep.listToListStep],
|
|
166
|
+
decisionList: [_flattenListStep.flattenListStep, _listToDecisionListStep.listToDecisionListStep],
|
|
167
|
+
expand: [_wrapStep.wrapStep],
|
|
168
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
169
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
170
|
+
panel: [_wrapStep.wrapStep]
|
|
171
|
+
}, includePanelC1 ? {
|
|
172
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
173
|
+
} : {}), {}, {
|
|
174
|
+
paragraph: [_flattenListStep.flattenListStep, _unwrapListStep.unwrapListStep, _applyTargetTextTypeStep.applyTargetTextTypeStep]
|
|
175
|
+
}),
|
|
176
|
+
table: {
|
|
177
|
+
expand: [_wrapStep.wrapStep],
|
|
178
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
179
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
180
|
+
},
|
|
181
|
+
mediaSingle: _objectSpread(_objectSpread({
|
|
182
|
+
blockquote: [_wrapStep.wrapStep],
|
|
183
|
+
expand: [_wrapStep.wrapStep],
|
|
184
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
185
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
186
|
+
panel: [_wrapStep.wrapStep]
|
|
187
|
+
}, includePanelC1 ? {
|
|
188
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
189
|
+
} : {}), {}, {
|
|
190
|
+
bulletList: [_wrapIntoListStep.wrapIntoListStep],
|
|
191
|
+
orderedList: [_wrapIntoListStep.wrapIntoListStep]
|
|
192
|
+
}),
|
|
193
|
+
mediaGroup: _objectSpread({
|
|
194
|
+
blockquote: [_wrapStep.wrapStep],
|
|
195
|
+
expand: [_wrapStep.wrapStep],
|
|
196
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
197
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
198
|
+
panel: [_wrapStep.wrapStep]
|
|
199
|
+
}, includePanelC1 ? {
|
|
200
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
201
|
+
} : {}),
|
|
202
|
+
media: _objectSpread(_objectSpread({
|
|
203
|
+
blockquote: [_wrapStep.wrapStep],
|
|
204
|
+
codeBlock: [_wrapStep.wrapStep],
|
|
205
|
+
expand: [_wrapStep.wrapStep],
|
|
206
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
207
|
+
layoutSection: [_wrapStep.wrapStep],
|
|
208
|
+
panel: [_wrapStep.wrapStep]
|
|
209
|
+
}, includePanelC1 ? {
|
|
210
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
211
|
+
} : {}), {}, {
|
|
212
|
+
bulletList: [_wrapIntoListStep.wrapIntoListStep],
|
|
213
|
+
orderedList: [_wrapIntoListStep.wrapIntoListStep],
|
|
214
|
+
taskList: [_wrapIntoListStep.wrapIntoListStep],
|
|
215
|
+
decisionList: [_wrapIntoListStep.wrapIntoListStep]
|
|
216
|
+
}),
|
|
217
|
+
decisionList: _objectSpread(_objectSpread({
|
|
218
|
+
bulletList: [_decisionListToListStep.decisionListToListStep],
|
|
219
|
+
orderedList: [_decisionListToListStep.decisionListToListStep],
|
|
220
|
+
taskList: [_decisionListToListStep.decisionListToListStep],
|
|
221
|
+
blockquote: [_unwrapListStep.unwrapListStep, _wrapStep.wrapStep],
|
|
222
|
+
expand: [_wrapStep.wrapStep],
|
|
223
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
224
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
225
|
+
panel: [_wrapStep.wrapStep]
|
|
226
|
+
}, includePanelC1 ? {
|
|
227
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
228
|
+
} : {}), {}, {
|
|
229
|
+
paragraph: [_flattenListStep.flattenListStep, _unwrapListStep.unwrapListStep, _applyTargetTextTypeStep.applyTargetTextTypeStep],
|
|
230
|
+
heading: [_flattenListStep.flattenListStep, _unwrapListStep.unwrapListStep, _applyTargetTextTypeStep.applyTargetTextTypeStep]
|
|
231
|
+
}),
|
|
232
|
+
blockCard: _objectSpread({
|
|
233
|
+
expand: [_wrapStep.wrapStep],
|
|
234
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
235
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
236
|
+
panel: [_wrapStep.wrapStep]
|
|
237
|
+
}, includePanelC1 ? {
|
|
238
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
239
|
+
} : {}),
|
|
240
|
+
embedCard: {
|
|
241
|
+
expand: [_wrapStep.wrapStep],
|
|
242
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
243
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
244
|
+
},
|
|
245
|
+
extension: _objectSpread({
|
|
246
|
+
blockquote: [_wrapStep.wrapStep],
|
|
247
|
+
expand: [_wrapStep.wrapStep],
|
|
248
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
249
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
250
|
+
panel: [_wrapStep.wrapStep]
|
|
251
|
+
}, includePanelC1 ? {
|
|
252
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
253
|
+
} : {}),
|
|
254
|
+
bodiedExtension: {
|
|
255
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
256
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
257
|
+
},
|
|
258
|
+
multiBodiedExtension: _objectSpread(_objectSpread({
|
|
259
|
+
blockquote: [_wrapStep.wrapStep],
|
|
260
|
+
codeBlock: [_wrapStep.wrapStep],
|
|
261
|
+
expand: [_wrapStep.wrapStep],
|
|
262
|
+
nestedExpand: [_wrapStep.wrapStep],
|
|
263
|
+
layoutSection: [_wrapStep.wrapStep],
|
|
264
|
+
panel: [_wrapStep.wrapStep]
|
|
265
|
+
}, includePanelC1 ? {
|
|
266
|
+
panel_c1: [_wrapStep.wrapStep]
|
|
267
|
+
} : {}), {}, {
|
|
268
|
+
bulletList: [_wrapIntoListStep.wrapIntoListStep],
|
|
269
|
+
orderedList: [_wrapIntoListStep.wrapIntoListStep],
|
|
270
|
+
taskList: [_wrapIntoListStep.wrapIntoListStep],
|
|
271
|
+
decisionList: [_wrapIntoListStep.wrapIntoListStep]
|
|
272
|
+
}),
|
|
273
|
+
multi: _objectSpread(_objectSpread({
|
|
274
|
+
blockquote: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
275
|
+
codeBlock: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
276
|
+
expand: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
277
|
+
nestedExpand: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
278
|
+
layoutSection: [_wrapMixedContentStep.wrapMixedContentStep],
|
|
279
|
+
panel: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
280
|
+
}, includePanelC1 ? {
|
|
281
|
+
panel_c1: [_wrapMixedContentStep.wrapMixedContentStep]
|
|
282
|
+
} : {}), {}, {
|
|
283
|
+
bulletList: [_convertEachNodeStep.convertEachNodeStep, _mergeNeighbourListsStep.mergeNeighbourListsStep],
|
|
284
|
+
orderedList: [_convertEachNodeStep.convertEachNodeStep, _mergeNeighbourListsStep.mergeNeighbourListsStep],
|
|
285
|
+
taskList: [_convertEachNodeStep.convertEachNodeStep, _mergeNeighbourListsStep.mergeNeighbourListsStep],
|
|
286
|
+
decisionList: [_convertEachNodeStep.convertEachNodeStep, _mergeNeighbourListsStep.mergeNeighbourListsStep],
|
|
287
|
+
paragraph: [_convertEachNodeStep.convertEachNodeStep],
|
|
288
|
+
heading: [_applyTargetTextTypeStep.applyTargetTextTypeStep]
|
|
289
|
+
})
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
var TRANSFORMATION_MATRIX = exports.TRANSFORMATION_MATRIX = createTransformationMatrix(false);
|
|
293
|
+
var TRANSFORMATION_MATRIX_PANEL_C1 = exports.TRANSFORMATION_MATRIX_PANEL_C1 = createTransformationMatrix(true);
|
|
@@ -203,7 +203,7 @@ var wrapMixedContentStep = exports.wrapMixedContentStep = function wrapMixedCont
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
// All other nodes that cannot be wrapped in the target node - break out
|
|
206
|
-
// Examples: same-type containers,
|
|
206
|
+
// Examples: same-type containers, layoutSections in layouts
|
|
207
207
|
handleUnsupportedNode(node);
|
|
208
208
|
};
|
|
209
209
|
nodes.forEach(processNode);
|
|
@@ -3,10 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isTransformDisabledBasedOnStepsConfig = exports.convertNodesToTargetType = void 0;
|
|
7
|
-
var _utils = require("
|
|
6
|
+
exports.upgradePanelNodesToPanelC1 = exports.isTransformDisabledBasedOnStepsConfig = exports.convertNodesToTargetType = void 0;
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
|
+
var _utils2 = require("../transform-node-utils/utils");
|
|
8
10
|
var _TRANSFORMATION_MATRIX = require("./TRANSFORMATION_MATRIX");
|
|
9
11
|
var _types = require("./types");
|
|
12
|
+
// Upgrade broken-out panel nodes to panel_c1 if the parent node allows it
|
|
13
|
+
var upgradePanelNodesToPanelC1 = exports.upgradePanelNodesToPanelC1 = function upgradePanelNodesToPanelC1(nodes, parentNode, schema) {
|
|
14
|
+
if (!schema.nodes['panel_c1'] || !(0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true)) {
|
|
15
|
+
return nodes;
|
|
16
|
+
}
|
|
17
|
+
return nodes.map(function (node) {
|
|
18
|
+
if (node.type.name === 'panel') {
|
|
19
|
+
var shouldUsePanelC1 = !parentNode || (0, _utils.isNodeTypeValidChildOf)('panel_c1', parentNode, schema);
|
|
20
|
+
if (shouldUsePanelC1) {
|
|
21
|
+
var _schema$nodes$panel_c;
|
|
22
|
+
return (_schema$nodes$panel_c = schema.nodes['panel_c1'].createAndFill(node.attrs, node.content, node.marks)) !== null && _schema$nodes$panel_c !== void 0 ? _schema$nodes$panel_c : node;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return node;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
10
29
|
/**
|
|
11
30
|
* Convert a list of nodes to a target node type.
|
|
12
31
|
* If no steps are found, the source nodes are returned unchanged.
|
|
@@ -35,11 +54,11 @@ var convertNodesToTargetType = exports.convertNodesToTargetType = function conve
|
|
|
35
54
|
}
|
|
36
55
|
var selectedNodeTypeName = (0, _types.toNodeTypeValue)((0, _types.getNodeName)(sourceNodes));
|
|
37
56
|
var initialTargetNodeTypeName = (0, _types.toNodeTypeValue)(targetNodeType.name);
|
|
38
|
-
var targetNodeTypeName = (0,
|
|
57
|
+
var targetNodeTypeName = (0, _utils2.getTargetNodeTypeNameInContext)(initialTargetNodeTypeName, isNested, parentNode, schema);
|
|
39
58
|
if (!selectedNodeTypeName || !targetNodeTypeName) {
|
|
40
59
|
return sourceNodes;
|
|
41
60
|
}
|
|
42
|
-
var steps = _TRANSFORMATION_MATRIX.TRANSFORMATION_MATRIX[selectedNodeTypeName][targetNodeTypeName];
|
|
61
|
+
var steps = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? _TRANSFORMATION_MATRIX.TRANSFORMATION_MATRIX_PANEL_C1[selectedNodeTypeName][targetNodeTypeName] : _TRANSFORMATION_MATRIX.TRANSFORMATION_MATRIX[selectedNodeTypeName][targetNodeTypeName];
|
|
43
62
|
var context = {
|
|
44
63
|
// sourceNode is incorrect now - what to do here?
|
|
45
64
|
fromNode: sourceNode,
|
|
@@ -50,11 +69,12 @@ var convertNodesToTargetType = exports.convertNodesToTargetType = function conve
|
|
|
50
69
|
if (!steps || steps.length === 0) {
|
|
51
70
|
return sourceNodes;
|
|
52
71
|
}
|
|
53
|
-
|
|
72
|
+
var resultNodes = steps.reduce(function (nodes, step) {
|
|
54
73
|
return step(nodes, context);
|
|
55
74
|
}, sourceNodes);
|
|
75
|
+
return upgradePanelNodesToPanelC1(resultNodes, parentNode, schema);
|
|
56
76
|
};
|
|
57
77
|
var isTransformDisabledBasedOnStepsConfig = exports.isTransformDisabledBasedOnStepsConfig = function isTransformDisabledBasedOnStepsConfig(selectedNodeType, targetNodeType) {
|
|
58
|
-
var steps = _TRANSFORMATION_MATRIX.TRANSFORMATION_MATRIX[selectedNodeType][targetNodeType];
|
|
78
|
+
var steps = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? _TRANSFORMATION_MATRIX.TRANSFORMATION_MATRIX_PANEL_C1[selectedNodeType][targetNodeType] : _TRANSFORMATION_MATRIX.TRANSFORMATION_MATRIX[selectedNodeType][targetNodeType];
|
|
59
79
|
return !steps || steps.length === 0;
|
|
60
80
|
};
|