@atlaskit/editor-plugin-layout 2.3.1 → 2.3.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,14 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 2.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128309)
8
+ [`5668591816f6a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5668591816f6a) -
9
+ Clean up platform_editor_advanced_layouts_dnd_remove_layout
10
+ - Updated dependencies
11
+
3
12
  ## 2.3.1
4
13
 
5
14
  ### Patch Changes
@@ -14,7 +14,6 @@ var _utils = require("@atlaskit/editor-common/utils");
14
14
  var _model = require("@atlaskit/editor-prosemirror/model");
15
15
  var _state = require("@atlaskit/editor-prosemirror/state");
16
16
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
19
18
  var _consts = require("./consts");
20
19
  var _pluginKey = require("./plugin-key");
@@ -386,15 +385,11 @@ function layoutNeedChanges(node) {
386
385
  var getDefaultPresetLayout = function getDefaultPresetLayout(layoutNode) {
387
386
  var layoutColumnCount = layoutNode.childCount;
388
387
  if (layoutColumnCount <= 1) {
389
- if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_dnd_remove_layout')) {
390
- return 'single';
391
- }
392
-
393
- // This prevents the creation of a single column layout
394
- // once we support single column layout, we can return 'single'
395
- return 'two_equal';
388
+ return 'single';
396
389
  }
397
390
  switch (layoutColumnCount) {
391
+ case 1:
392
+ return 'single';
398
393
  case 2:
399
394
  return 'two_equal';
400
395
  case 3:
@@ -14,7 +14,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
16
16
  var _view = require("@atlaskit/editor-prosemirror/view");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
19
18
  var _actions = require("./actions");
20
19
  var _consts = require("./consts");
@@ -81,24 +80,19 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
81
80
  var handleDeleteLayoutColumn = function handleDeleteLayoutColumn(state, dispatch) {
82
81
  var sel = state.selection;
83
82
  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)) {
84
- if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_dnd_remove_layout')) {
85
- var _sel$$from$parent$las, _sel$$from$parent$fir;
86
- var tr = state.tr;
87
- 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);
88
- var parent = (0, _utils2.findParentNodeClosestToPos)(sel.$from, function (node) {
89
- return node.type.name === 'layoutSection';
90
- });
91
- if (parent) {
92
- var layoutSectionPos = tr.mapping.map(parent.pos);
93
- var layoutSectionNodeSize = parent.node.nodeSize;
94
- dispatch(state.tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment));
95
- return true;
96
- }
97
- return false;
98
- } else {
99
- dispatch(state.tr.deleteRange(sel.from + 1, sel.from + sel.node.content.size));
83
+ var _sel$$from$parent$las, _sel$$from$parent$fir;
84
+ var tr = state.tr;
85
+ 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);
86
+ var parent = (0, _utils2.findParentNodeClosestToPos)(sel.$from, function (node) {
87
+ return node.type.name === 'layoutSection';
88
+ });
89
+ if (parent) {
90
+ var layoutSectionPos = tr.mapping.map(parent.pos);
91
+ var layoutSectionNodeSize = parent.node.nodeSize;
92
+ dispatch(state.tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment));
93
+ return true;
100
94
  }
101
- return true;
95
+ return false;
102
96
  }
103
97
  return false;
104
98
  };
@@ -169,7 +163,7 @@ var _default = exports.default = function _default(options) {
169
163
  changes.push(change);
170
164
  }
171
165
  });
172
- if ((0, _experiments.editorExperiment)('advanced_layouts', true) && changes.length === 1 && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_dnd_remove_layout')) {
166
+ if ((0, _experiments.editorExperiment)('advanced_layouts', true) && changes.length === 1) {
173
167
  var _change$slice$content, _change$slice$content2;
174
168
  var change = changes[0];
175
169
  // when need to update a layoutColumn with width 100
@@ -4,7 +4,6 @@ import { flatmap, getStepRange, isEmptyDocument, mapChildren } from '@atlaskit/e
4
4
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
5
5
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
8
  import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
10
9
  import { pluginKey } from './plugin-key';
@@ -361,15 +360,11 @@ function layoutNeedChanges(node) {
361
360
  const getDefaultPresetLayout = layoutNode => {
362
361
  const layoutColumnCount = layoutNode.childCount;
363
362
  if (layoutColumnCount <= 1) {
364
- if (fg('platform_editor_advanced_layouts_dnd_remove_layout')) {
365
- return 'single';
366
- }
367
-
368
- // This prevents the creation of a single column layout
369
- // once we support single column layout, we can return 'single'
370
- return 'two_equal';
363
+ return 'single';
371
364
  }
372
365
  switch (layoutColumnCount) {
366
+ case 1:
367
+ return 'single';
373
368
  case 2:
374
369
  return 'two_equal';
375
370
  case 3:
@@ -6,7 +6,6 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
6
6
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { findParentNodeClosestToPos, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
10
  import { fixColumnSizes, fixColumnStructure, getSelectedLayout } from './actions';
12
11
  import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
@@ -76,24 +75,19 @@ const getInitialPluginState = (options, state) => {
76
75
  const handleDeleteLayoutColumn = (state, dispatch) => {
77
76
  const sel = state.selection;
78
77
  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)) {
79
- if (fg('platform_editor_advanced_layouts_dnd_remove_layout')) {
80
- var _sel$$from$parent$las, _sel$$from$parent$fir;
81
- const tr = state.tr;
82
- 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);
83
- const parent = findParentNodeClosestToPos(sel.$from, node => {
84
- return node.type.name === 'layoutSection';
85
- });
86
- if (parent) {
87
- const layoutSectionPos = tr.mapping.map(parent.pos);
88
- const layoutSectionNodeSize = parent.node.nodeSize;
89
- dispatch(state.tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment));
90
- return true;
91
- }
92
- return false;
93
- } else {
94
- dispatch(state.tr.deleteRange(sel.from + 1, sel.from + sel.node.content.size));
78
+ var _sel$$from$parent$las, _sel$$from$parent$fir;
79
+ const tr = state.tr;
80
+ 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);
81
+ const parent = findParentNodeClosestToPos(sel.$from, node => {
82
+ return node.type.name === 'layoutSection';
83
+ });
84
+ if (parent) {
85
+ const layoutSectionPos = tr.mapping.map(parent.pos);
86
+ const layoutSectionNodeSize = parent.node.nodeSize;
87
+ dispatch(state.tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment));
88
+ return true;
95
89
  }
96
- return true;
90
+ return false;
97
91
  }
98
92
  return false;
99
93
  };
@@ -158,7 +152,7 @@ export default (options => new SafePlugin({
158
152
  changes.push(change);
159
153
  }
160
154
  });
161
- if (editorExperiment('advanced_layouts', true) && changes.length === 1 && fg('platform_editor_advanced_layouts_dnd_remove_layout')) {
155
+ if (editorExperiment('advanced_layouts', true) && changes.length === 1) {
162
156
  var _change$slice$content, _change$slice$content2;
163
157
  const change = changes[0];
164
158
  // when need to update a layoutColumn with width 100
@@ -7,7 +7,6 @@ import { flatmap, getStepRange, isEmptyDocument, mapChildren } from '@atlaskit/e
7
7
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
8
8
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
11
  import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
13
12
  import { pluginKey } from './plugin-key';
@@ -377,15 +376,11 @@ function layoutNeedChanges(node) {
377
376
  var getDefaultPresetLayout = function getDefaultPresetLayout(layoutNode) {
378
377
  var layoutColumnCount = layoutNode.childCount;
379
378
  if (layoutColumnCount <= 1) {
380
- if (fg('platform_editor_advanced_layouts_dnd_remove_layout')) {
381
- return 'single';
382
- }
383
-
384
- // This prevents the creation of a single column layout
385
- // once we support single column layout, we can return 'single'
386
- return 'two_equal';
379
+ return 'single';
387
380
  }
388
381
  switch (layoutColumnCount) {
382
+ case 1:
383
+ return 'single';
389
384
  case 2:
390
385
  return 'two_equal';
391
386
  case 3:
@@ -9,7 +9,6 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
9
9
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
10
10
  import { findParentNodeClosestToPos, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
11
11
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
13
  import { fixColumnSizes, fixColumnStructure, getSelectedLayout } from './actions';
15
14
  import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
@@ -74,24 +73,19 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
74
73
  var handleDeleteLayoutColumn = function handleDeleteLayoutColumn(state, dispatch) {
75
74
  var sel = state.selection;
76
75
  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)) {
77
- if (fg('platform_editor_advanced_layouts_dnd_remove_layout')) {
78
- var _sel$$from$parent$las, _sel$$from$parent$fir;
79
- var tr = state.tr;
80
- 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);
81
- var parent = findParentNodeClosestToPos(sel.$from, function (node) {
82
- return node.type.name === 'layoutSection';
83
- });
84
- if (parent) {
85
- var layoutSectionPos = tr.mapping.map(parent.pos);
86
- var layoutSectionNodeSize = parent.node.nodeSize;
87
- dispatch(state.tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment));
88
- return true;
89
- }
90
- return false;
91
- } else {
92
- dispatch(state.tr.deleteRange(sel.from + 1, sel.from + sel.node.content.size));
76
+ var _sel$$from$parent$las, _sel$$from$parent$fir;
77
+ var tr = state.tr;
78
+ 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);
79
+ var parent = findParentNodeClosestToPos(sel.$from, function (node) {
80
+ return node.type.name === 'layoutSection';
81
+ });
82
+ if (parent) {
83
+ var layoutSectionPos = tr.mapping.map(parent.pos);
84
+ var layoutSectionNodeSize = parent.node.nodeSize;
85
+ dispatch(state.tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment));
86
+ return true;
93
87
  }
94
- return true;
88
+ return false;
95
89
  }
96
90
  return false;
97
91
  };
@@ -162,7 +156,7 @@ export default (function (options) {
162
156
  changes.push(change);
163
157
  }
164
158
  });
165
- if (editorExperiment('advanced_layouts', true) && changes.length === 1 && fg('platform_editor_advanced_layouts_dnd_remove_layout')) {
159
+ if (editorExperiment('advanced_layouts', true) && changes.length === 1) {
166
160
  var _change$slice$content, _change$slice$content2;
167
161
  var change = changes[0];
168
162
  // when need to update a layoutColumn with width 100
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/editor-prosemirror": "7.0.0",
44
44
  "@atlaskit/icon": "^25.0.0",
45
45
  "@atlaskit/platform-feature-flags": "^1.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^4.2.0",
46
+ "@atlaskit/tmp-editor-statsig": "^4.4.0",
47
47
  "@atlaskit/tokens": "^4.5.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1"
@@ -99,9 +99,6 @@
99
99
  "platform-feature-flags": {
100
100
  "platform-visual-refresh-icons": {
101
101
  "type": "boolean"
102
- },
103
- "platform_editor_advanced_layouts_dnd_remove_layout": {
104
- "type": "boolean"
105
102
  }
106
103
  }
107
104
  }