@atlaskit/editor-plugin-layout 2.5.0 → 2.5.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
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 2.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142936](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142936)
|
|
8
|
+
[`9d1e16eaadf95`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d1e16eaadf95) -
|
|
9
|
+
ED-26662: Delete layout column can create a single column layout
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 2.5.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -80,7 +80,7 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
|
|
|
80
80
|
// see packages/editor/editor-plugin-layout-tests/src/__tests__/unit/delete.ts
|
|
81
81
|
var handleDeleteLayoutColumn = function handleDeleteLayoutColumn(state, dispatch) {
|
|
82
82
|
var sel = state.selection;
|
|
83
|
-
if (sel instanceof _state.NodeSelection && sel.node.type.name === 'layoutColumn' && sel.$from.parent.type.name === 'layoutSection' && sel.$from.parent.childCount === 2 && dispatch && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
83
|
+
if (sel instanceof _state.NodeSelection && sel.node.type.name === 'layoutColumn' && sel.$from.parent.type.name === 'layoutSection' && sel.$from.parent.childCount === 2 && dispatch && (0, _experiments.editorExperiment)('advanced_layouts', true) && !(0, _experiments.editorExperiment)('single_column_layouts', true)) {
|
|
84
84
|
var _sel$$from$parent$las, _sel$$from$parent$fir;
|
|
85
85
|
var tr = state.tr;
|
|
86
86
|
var layoutContentFragment = sel.$from.parentOffset === 0 ? _model.Fragment.from((_sel$$from$parent$las = sel.$from.parent.lastChild) === null || _sel$$from$parent$las === void 0 ? void 0 : _sel$$from$parent$las.content) : _model.Fragment.from((_sel$$from$parent$fir = sel.$from.parent.firstChild) === null || _sel$$from$parent$fir === void 0 ? void 0 : _sel$$from$parent$fir.content);
|
|
@@ -172,12 +172,10 @@ var _default = exports.default = function _default(options) {
|
|
|
172
172
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true) && changes.length === 1) {
|
|
173
173
|
var _change$slice$content, _change$slice$content2;
|
|
174
174
|
var change = changes[0];
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
-
// when a user deletes a layoutColumn
|
|
180
|
-
if (change.slice.content.childCount === 1 && ((_change$slice$content = change.slice.content.firstChild) === null || _change$slice$content === void 0 ? void 0 : _change$slice$content.type.name) === 'layoutColumn' && ((_change$slice$content2 = change.slice.content.firstChild) === null || _change$slice$content2 === void 0 ? void 0 : _change$slice$content2.attrs.width) === _consts.EVEN_DISTRIBUTED_COL_WIDTHS[1]) {
|
|
175
|
+
// When editorExperiment('single_column_layouts', true) is on
|
|
176
|
+
// delete can create a single column layout
|
|
177
|
+
// otherwise we replace the single column layout with its content
|
|
178
|
+
if (!(0, _experiments.editorExperiment)('single_column_layouts', true) && change.slice.content.childCount === 1 && ((_change$slice$content = change.slice.content.firstChild) === null || _change$slice$content === void 0 ? void 0 : _change$slice$content.type.name) === 'layoutColumn' && ((_change$slice$content2 = change.slice.content.firstChild) === null || _change$slice$content2 === void 0 ? void 0 : _change$slice$content2.attrs.width) === _consts.EVEN_DISTRIBUTED_COL_WIDTHS[1]) {
|
|
181
179
|
var tr = newState.tr;
|
|
182
180
|
var content = change.slice.content.firstChild.content;
|
|
183
181
|
tr.replaceWith(change.from - 1, change.to, content);
|
|
@@ -75,7 +75,7 @@ const getInitialPluginState = (options, state) => {
|
|
|
75
75
|
// see packages/editor/editor-plugin-layout-tests/src/__tests__/unit/delete.ts
|
|
76
76
|
const handleDeleteLayoutColumn = (state, dispatch) => {
|
|
77
77
|
const sel = state.selection;
|
|
78
|
-
if (sel instanceof NodeSelection && sel.node.type.name === 'layoutColumn' && sel.$from.parent.type.name === 'layoutSection' && sel.$from.parent.childCount === 2 && dispatch && editorExperiment('advanced_layouts', true)) {
|
|
78
|
+
if (sel instanceof NodeSelection && sel.node.type.name === 'layoutColumn' && sel.$from.parent.type.name === 'layoutSection' && sel.$from.parent.childCount === 2 && dispatch && editorExperiment('advanced_layouts', true) && !editorExperiment('single_column_layouts', true)) {
|
|
79
79
|
var _sel$$from$parent$las, _sel$$from$parent$fir;
|
|
80
80
|
const tr = state.tr;
|
|
81
81
|
const layoutContentFragment = sel.$from.parentOffset === 0 ? Fragment.from((_sel$$from$parent$las = sel.$from.parent.lastChild) === null || _sel$$from$parent$las === void 0 ? void 0 : _sel$$from$parent$las.content) : Fragment.from((_sel$$from$parent$fir = sel.$from.parent.firstChild) === null || _sel$$from$parent$fir === void 0 ? void 0 : _sel$$from$parent$fir.content);
|
|
@@ -162,12 +162,10 @@ export default (options => new SafePlugin({
|
|
|
162
162
|
if (editorExperiment('advanced_layouts', true) && changes.length === 1) {
|
|
163
163
|
var _change$slice$content, _change$slice$content2;
|
|
164
164
|
const change = changes[0];
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
// when a user deletes a layoutColumn
|
|
170
|
-
if (change.slice.content.childCount === 1 && ((_change$slice$content = change.slice.content.firstChild) === null || _change$slice$content === void 0 ? void 0 : _change$slice$content.type.name) === 'layoutColumn' && ((_change$slice$content2 = change.slice.content.firstChild) === null || _change$slice$content2 === void 0 ? void 0 : _change$slice$content2.attrs.width) === EVEN_DISTRIBUTED_COL_WIDTHS[1]) {
|
|
165
|
+
// When editorExperiment('single_column_layouts', true) is on
|
|
166
|
+
// delete can create a single column layout
|
|
167
|
+
// otherwise we replace the single column layout with its content
|
|
168
|
+
if (!editorExperiment('single_column_layouts', true) && change.slice.content.childCount === 1 && ((_change$slice$content = change.slice.content.firstChild) === null || _change$slice$content === void 0 ? void 0 : _change$slice$content.type.name) === 'layoutColumn' && ((_change$slice$content2 = change.slice.content.firstChild) === null || _change$slice$content2 === void 0 ? void 0 : _change$slice$content2.attrs.width) === EVEN_DISTRIBUTED_COL_WIDTHS[1]) {
|
|
171
169
|
const tr = newState.tr;
|
|
172
170
|
const {
|
|
173
171
|
content
|
|
@@ -73,7 +73,7 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
|
|
|
73
73
|
// see packages/editor/editor-plugin-layout-tests/src/__tests__/unit/delete.ts
|
|
74
74
|
var handleDeleteLayoutColumn = function handleDeleteLayoutColumn(state, dispatch) {
|
|
75
75
|
var sel = state.selection;
|
|
76
|
-
if (sel instanceof NodeSelection && sel.node.type.name === 'layoutColumn' && sel.$from.parent.type.name === 'layoutSection' && sel.$from.parent.childCount === 2 && dispatch && editorExperiment('advanced_layouts', true)) {
|
|
76
|
+
if (sel instanceof NodeSelection && sel.node.type.name === 'layoutColumn' && sel.$from.parent.type.name === 'layoutSection' && sel.$from.parent.childCount === 2 && dispatch && editorExperiment('advanced_layouts', true) && !editorExperiment('single_column_layouts', true)) {
|
|
77
77
|
var _sel$$from$parent$las, _sel$$from$parent$fir;
|
|
78
78
|
var tr = state.tr;
|
|
79
79
|
var layoutContentFragment = sel.$from.parentOffset === 0 ? Fragment.from((_sel$$from$parent$las = sel.$from.parent.lastChild) === null || _sel$$from$parent$las === void 0 ? void 0 : _sel$$from$parent$las.content) : Fragment.from((_sel$$from$parent$fir = sel.$from.parent.firstChild) === null || _sel$$from$parent$fir === void 0 ? void 0 : _sel$$from$parent$fir.content);
|
|
@@ -165,12 +165,10 @@ export default (function (options) {
|
|
|
165
165
|
if (editorExperiment('advanced_layouts', true) && changes.length === 1) {
|
|
166
166
|
var _change$slice$content, _change$slice$content2;
|
|
167
167
|
var change = changes[0];
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
// when a user deletes a layoutColumn
|
|
173
|
-
if (change.slice.content.childCount === 1 && ((_change$slice$content = change.slice.content.firstChild) === null || _change$slice$content === void 0 ? void 0 : _change$slice$content.type.name) === 'layoutColumn' && ((_change$slice$content2 = change.slice.content.firstChild) === null || _change$slice$content2 === void 0 ? void 0 : _change$slice$content2.attrs.width) === EVEN_DISTRIBUTED_COL_WIDTHS[1]) {
|
|
168
|
+
// When editorExperiment('single_column_layouts', true) is on
|
|
169
|
+
// delete can create a single column layout
|
|
170
|
+
// otherwise we replace the single column layout with its content
|
|
171
|
+
if (!editorExperiment('single_column_layouts', true) && change.slice.content.childCount === 1 && ((_change$slice$content = change.slice.content.firstChild) === null || _change$slice$content === void 0 ? void 0 : _change$slice$content.type.name) === 'layoutColumn' && ((_change$slice$content2 = change.slice.content.firstChild) === null || _change$slice$content2 === void 0 ? void 0 : _change$slice$content2.attrs.width) === EVEN_DISTRIBUTED_COL_WIDTHS[1]) {
|
|
174
172
|
var tr = newState.tr;
|
|
175
173
|
var content = change.slice.content.firstChild.content;
|
|
176
174
|
tr.replaceWith(change.from - 1, change.to, content);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^103.
|
|
37
|
+
"@atlaskit/editor-common": "^103.12.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
46
46
|
"@atlaskit/icon": "^25.6.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
49
|
-
"@atlaskit/tokens": "^4.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^4.12.0",
|
|
49
|
+
"@atlaskit/tokens": "^4.8.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1"
|
|
52
52
|
},
|