@atlaskit/editor-plugin-layout 2.3.1 → 2.4.0

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,26 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#132381](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132381)
8
+ [`19e52e77d3cfc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/19e52e77d3cfc) -
9
+ ED-27195 enable guildeline for breakout resizer
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 2.3.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#128309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128309)
20
+ [`5668591816f6a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5668591816f6a) -
21
+ Clean up platform_editor_advanced_layouts_dnd_remove_layout
22
+ - Updated dependencies
23
+
3
24
  ## 2.3.1
4
25
 
5
26
  ### Patch Changes
@@ -16,6 +16,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
16
16
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
17
17
  var _resizer = require("@atlaskit/editor-common/resizer");
18
18
  var _model = require("@atlaskit/editor-prosemirror/model");
19
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
19
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
22
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
@@ -61,6 +62,12 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
61
62
  var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
62
63
  return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
63
64
  }, [pluginInjectionApi]);
65
+ var displayGuidelines = (0, _react.useCallback)(function (guidelines) {
66
+ var _pluginInjectionApi$g;
67
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g === void 0 || (_pluginInjectionApi$g = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g === void 0 || _pluginInjectionApi$g.displayGuideline(view)({
68
+ guidelines: guidelines
69
+ });
70
+ }, [pluginInjectionApi, view]);
64
71
  return /*#__PURE__*/_react.default.createElement(_resizer.BreakoutResizer, {
65
72
  getRef: forwardRef,
66
73
  getPos: getPos,
@@ -70,6 +77,7 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
70
77
  disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true || !isBreakoutAvailable(view.state.schema),
71
78
  parentRef: parentRef,
72
79
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
80
+ displayGuidelines: (0, _experiments.editorExperiment)('single_column_layouts', true) ? displayGuidelines : undefined,
73
81
  displayGapCursor: displayGapCursor
74
82
  });
75
83
  };
@@ -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
@@ -3,6 +3,7 @@ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
3
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
4
4
  import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
5
5
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
7
  const isEmptyParagraph = node => {
7
8
  return !!node && node.type.name === 'paragraph' && !node.childCount;
8
9
  };
@@ -46,6 +47,12 @@ const LayoutBreakoutResizer = ({
46
47
  var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
47
48
  return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
48
49
  }, [pluginInjectionApi]);
50
+ const displayGuidelines = useCallback(guidelines => {
51
+ var _pluginInjectionApi$g, _pluginInjectionApi$g2;
52
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g === void 0 ? void 0 : (_pluginInjectionApi$g2 = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : _pluginInjectionApi$g2.displayGuideline(view)({
53
+ guidelines
54
+ });
55
+ }, [pluginInjectionApi, view]);
49
56
  return /*#__PURE__*/React.createElement(BreakoutResizer, {
50
57
  getRef: forwardRef,
51
58
  getPos: getPos,
@@ -55,6 +62,7 @@ const LayoutBreakoutResizer = ({
55
62
  disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true || !isBreakoutAvailable(view.state.schema),
56
63
  parentRef: parentRef,
57
64
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
65
+ displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
58
66
  displayGapCursor: displayGapCursor
59
67
  });
60
68
  };
@@ -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
@@ -10,6 +10,7 @@ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
10
10
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
11
11
  import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
12
12
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
13
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
14
  var isEmptyParagraph = function isEmptyParagraph(node) {
14
15
  return !!node && node.type.name === 'paragraph' && !node.childCount;
15
16
  };
@@ -51,6 +52,12 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
51
52
  var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
52
53
  return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
53
54
  }, [pluginInjectionApi]);
55
+ var displayGuidelines = useCallback(function (guidelines) {
56
+ var _pluginInjectionApi$g;
57
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g === void 0 || (_pluginInjectionApi$g = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g === void 0 || _pluginInjectionApi$g.displayGuideline(view)({
58
+ guidelines: guidelines
59
+ });
60
+ }, [pluginInjectionApi, view]);
54
61
  return /*#__PURE__*/React.createElement(BreakoutResizer, {
55
62
  getRef: forwardRef,
56
63
  getPos: getPos,
@@ -60,6 +67,7 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
60
67
  disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true || !isBreakoutAvailable(view.state.schema),
61
68
  parentRef: parentRef,
62
69
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
70
+ displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
63
71
  displayGapCursor: displayGapCursor
64
72
  });
65
73
  };
@@ -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
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
4
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
+ import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
5
6
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
6
7
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
7
8
  import type { insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
@@ -11,7 +12,8 @@ export type LayoutPluginDependencies = [
11
12
  SelectionPlugin,
12
13
  OptionalPlugin<AnalyticsPlugin>,
13
14
  OptionalPlugin<WidthPlugin>,
14
- OptionalPlugin<EditorDisabledPlugin>
15
+ OptionalPlugin<EditorDisabledPlugin>,
16
+ OptionalPlugin<GuidelinePlugin>
15
17
  ];
16
18
  export type LayoutPlugin = NextEditorPlugin<'layout', {
17
19
  pluginConfiguration: LayoutPluginOptions | undefined;
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
4
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
+ import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
5
6
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
6
7
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
7
8
  import type { insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
@@ -11,7 +12,8 @@ export type LayoutPluginDependencies = [
11
12
  SelectionPlugin,
12
13
  OptionalPlugin<AnalyticsPlugin>,
13
14
  OptionalPlugin<WidthPlugin>,
14
- OptionalPlugin<EditorDisabledPlugin>
15
+ OptionalPlugin<EditorDisabledPlugin>,
16
+ OptionalPlugin<GuidelinePlugin>
15
17
  ];
16
18
  export type LayoutPlugin = NextEditorPlugin<'layout', {
17
19
  pluginConfiguration: LayoutPluginOptions | undefined;
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.4.0",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,16 +34,17 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
- "@atlaskit/editor-common": "^102.13.0",
37
+ "@atlaskit/editor-common": "^102.14.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",
41
+ "@atlaskit/editor-plugin-guideline": "^2.0.0",
41
42
  "@atlaskit/editor-plugin-selection": "^2.1.0",
42
43
  "@atlaskit/editor-plugin-width": "^3.0.0",
43
44
  "@atlaskit/editor-prosemirror": "7.0.0",
44
- "@atlaskit/icon": "^25.0.0",
45
+ "@atlaskit/icon": "^25.2.0",
45
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^4.2.0",
47
+ "@atlaskit/tmp-editor-statsig": "^4.4.0",
47
48
  "@atlaskit/tokens": "^4.5.0",
48
49
  "@babel/runtime": "^7.0.0",
49
50
  "@emotion/react": "^11.7.1"
@@ -99,9 +100,6 @@
99
100
  "platform-feature-flags": {
100
101
  "platform-visual-refresh-icons": {
101
102
  "type": "boolean"
102
- },
103
- "platform_editor_advanced_layouts_dnd_remove_layout": {
104
- "type": "boolean"
105
103
  }
106
104
  }
107
105
  }