@atlaskit/editor-plugin-layout 1.12.17 → 1.12.19

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,19 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 1.12.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [#98381](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98381)
8
+ [`3e23b2a14109d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3e23b2a14109d) -
9
+ ED-26121 fix single column layout change layout
10
+
11
+ ## 1.12.18
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 1.12.17
4
18
 
5
19
  ### Patch Changes
@@ -96,6 +96,9 @@ var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function (_Reac
96
96
  var _ref2 = _model.DOMSerializer.renderSpec(document, toDOM()),
97
97
  container = _ref2.dom,
98
98
  contentDOM = _ref2.contentDOM;
99
+
100
+ // Ignored via go/ees005
101
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
99
102
  this.layoutDOM = container.querySelector('[data-layout-section]');
100
103
  this.layoutDOM.setAttribute('data-column-rule-style', this.node.attrs.columnRuleStyle);
101
104
  if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
@@ -260,6 +260,8 @@ var decreaseColumns = function decreaseColumns(node, insideRightEdgePos) {
260
260
  * Switching from 3 -> 2 moves all the content of the third col inside the second before
261
261
  * removing it
262
262
  */
263
+ // Ignored via go/ees005
264
+ // eslint-disable-next-line @typescript-eslint/max-params
263
265
  function forceColumnStructure(state, node, pos, presetLayout) {
264
266
  var tr = state.tr;
265
267
  var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
@@ -294,6 +296,9 @@ function forceColumnStructure(state, node, pos, presetLayout) {
294
296
  }
295
297
  return tr;
296
298
  }
299
+
300
+ // Ignored via go/ees005
301
+ // eslint-disable-next-line @typescript-eslint/max-params
297
302
  function forceColumnStructureNew(state, node, pos, presetLayout) {
298
303
  var tr = state.tr;
299
304
  var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
@@ -321,6 +326,9 @@ function columnWidth(node, schema, widths) {
321
326
  }
322
327
  });
323
328
  }
329
+
330
+ // Ignored via go/ees005
331
+ // eslint-disable-next-line @typescript-eslint/max-params
324
332
  function forceColumnWidths(state, tr, pos, presetLayout) {
325
333
  var node = tr.doc.nodeAt(pos);
326
334
  if (!node) {
@@ -328,6 +336,9 @@ function forceColumnWidths(state, tr, pos, presetLayout) {
328
336
  }
329
337
  return tr.replaceWith(pos + 1, pos + node.nodeSize - 1, columnWidth(node, state.schema, getWidthsForPreset(presetLayout)));
330
338
  }
339
+
340
+ // Ignored via go/ees005
341
+ // eslint-disable-next-line @typescript-eslint/max-params
331
342
  function forceSectionToPresetLayout(state, node, pos, presetLayout) {
332
343
  var forceColumnStructureFn = (0, _experiments.editorExperiment)('advanced_layouts', true) ? forceColumnStructureNew : forceColumnStructure;
333
344
  var tr = forceColumnStructureFn(state, node, pos, presetLayout);
@@ -346,13 +357,22 @@ var setPresetLayout = exports.setPresetLayout = function setPresetLayout(editorA
346
357
  var _ref = _pluginKey.pluginKey.getState(state),
347
358
  pos = _ref.pos,
348
359
  selectedLayout = _ref.selectedLayout;
349
- if (selectedLayout === layout || pos === null) {
360
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_3')) {
361
+ if (pos === null) {
362
+ return false;
363
+ }
364
+ } else if (selectedLayout === layout || pos === null) {
350
365
  return false;
351
366
  }
352
367
  var node = state.doc.nodeAt(pos);
353
368
  if (!node) {
354
369
  return false;
355
370
  }
371
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_3')) {
372
+ if (selectedLayout === layout && node.childCount > 1) {
373
+ return false;
374
+ }
375
+ }
356
376
  var tr = forceSectionToPresetLayout(state, node, pos, layout);
357
377
  if (tr) {
358
378
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
@@ -385,6 +405,7 @@ var getDefaultPresetLayout = function getDefaultPresetLayout(layoutNode) {
385
405
  if (layoutColumnCount <= 1) {
386
406
  // This prevents the creation of a single column layout
387
407
  // once we support single column layout, we can return 'single'
408
+
388
409
  return (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') ? 'two_equal' : 'single';
389
410
  }
390
411
  switch (layoutColumnCount) {
@@ -34,7 +34,11 @@ var moveCursorToNextColumn = function moveCursorToNextColumn(state, dispatch) {
34
34
  var _state$schema$nodes = state.schema.nodes,
35
35
  layoutColumn = _state$schema$nodes.layoutColumn,
36
36
  layoutSection = _state$schema$nodes.layoutSection;
37
+ // Ignored via go/ees005
38
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
39
  var section = (0, _utils2.findParentNodeOfType)(layoutSection)(selection);
40
+ // Ignored via go/ees005
41
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
38
42
  var column = (0, _utils2.findParentNodeOfType)(layoutColumn)(selection);
39
43
  if (column.node !== section.node.lastChild) {
40
44
  var $nextColumn = state.doc.resolve(column.pos + column.node.nodeSize);
@@ -88,12 +92,17 @@ var _default = exports.default = function _default(options) {
88
92
  init: function init(_, state) {
89
93
  return getInitialPluginState(options, state);
90
94
  },
95
+ // Ignored via go/ees005
96
+ // eslint-disable-next-line @typescript-eslint/max-params
91
97
  apply: function apply(tr, pluginState, _oldState, newState) {
92
98
  if (tr.docChanged || tr.selectionSet) {
93
99
  var maybeLayoutSection = (0, _utils3.getMaybeLayoutSection)(newState);
94
100
  var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
95
101
  pos: maybeLayoutSection ? maybeLayoutSection.pos : null,
96
- selectedLayout: (0, _actions.getSelectedLayout)(maybeLayoutSection && maybeLayoutSection.node, pluginState.selectedLayout)
102
+ selectedLayout: (0, _actions.getSelectedLayout)(maybeLayoutSection && maybeLayoutSection.node,
103
+ // Ignored via go/ees005
104
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
105
+ pluginState.selectedLayout)
97
106
  });
98
107
  return newPluginState;
99
108
  }
@@ -8,7 +8,10 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _nodeviews = require("../nodeviews");
10
10
  var pluginKey = exports.pluginKey = new _state.PluginKey('layoutResizingPlugin');
11
- var _default = exports.default = function _default(options, pluginInjectionApi, portalProviderAPI, eventDispatcher) {
11
+ var _default = exports.default = function _default(options, pluginInjectionApi, portalProviderAPI, eventDispatcher
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line @typescript-eslint/max-params
14
+ ) {
12
15
  return new _safePlugin.SafePlugin({
13
16
  key: pluginKey,
14
17
  props: {
@@ -23,6 +23,8 @@ var LayoutThreeWithLeftSidebarsGlyph = function LayoutThreeWithLeftSidebarsGlyph
23
23
  viewBox: "0 0 16 14",
24
24
  fill: "none",
25
25
  xmlns: "http://www.w3.org/2000/svg"
26
+ // Ignored via go/ees005
27
+ // eslint-disable-next-line react/jsx-props-no-spreading
26
28
  }, props), (0, _react.jsx)("path", {
27
29
  fillRule: "evenodd",
28
30
  clipRule: "evenodd",
@@ -36,6 +38,8 @@ var LayoutThreeWithLeftSidebarsGlyph = function LayoutThreeWithLeftSidebarsGlyph
36
38
  viewBox: "0 0 16 14",
37
39
  fill: "none",
38
40
  xmlns: "http://www.w3.org/2000/svg"
41
+ // Ignored via go/ees005
42
+ // eslint-disable-next-line react/jsx-props-no-spreading
39
43
  }, props), (0, _react.jsx)("path", {
40
44
  fillRule: "evenodd",
41
45
  clipRule: "evenodd",
@@ -52,5 +56,7 @@ var LayoutThreeWithLeftSidebarsIcon = exports.LayoutThreeWithLeftSidebarsIcon =
52
56
  css: floatingToolbarPadding
53
57
  }, (0, _react.jsx)(_icon.default, (0, _extends2.default)({
54
58
  glyph: LayoutThreeWithLeftSidebarsGlyph
59
+ // Ignored via go/ees005
60
+ // eslint-disable-next-line react/jsx-props-no-spreading
55
61
  }, props)));
56
62
  };
@@ -23,6 +23,8 @@ var LayoutThreeWithRightSidebarsGlyph = function LayoutThreeWithRightSidebarsGly
23
23
  viewBox: "0 0 16 14",
24
24
  fill: "none",
25
25
  xmlns: "http://www.w3.org/2000/svg"
26
+ // Ignored via go/ees005
27
+ // eslint-disable-next-line react/jsx-props-no-spreading
26
28
  }, props), (0, _react.jsx)("path", {
27
29
  fillRule: "evenodd",
28
30
  clipRule: "evenodd",
@@ -36,6 +38,8 @@ var LayoutThreeWithRightSidebarsGlyph = function LayoutThreeWithRightSidebarsGly
36
38
  viewBox: "0 0 16 14",
37
39
  fill: "none",
38
40
  xmlns: "http://www.w3.org/2000/svg"
41
+ // Ignored via go/ees005
42
+ // eslint-disable-next-line react/jsx-props-no-spreading
39
43
  }, props), (0, _react.jsx)("path", {
40
44
  fillRule: "evenodd",
41
45
  clipRule: "evenodd",
@@ -52,5 +56,7 @@ var LayoutThreeWithRightSidebarsIcon = exports.LayoutThreeWithRightSidebarsIcon
52
56
  css: floatingToolbarPadding
53
57
  }, (0, _react.jsx)(_icon.default, (0, _extends2.default)({
54
58
  glyph: LayoutThreeWithRightSidebarsGlyph
59
+ // Ignored via go/ees005
60
+ // eslint-disable-next-line react/jsx-props-no-spreading
55
61
  }, props)));
56
62
  };
@@ -115,7 +115,10 @@ var LAYOUT_WITH_THREE_COL_DISTRIBUTION = [{
115
115
  icon: _LayoutThreeWithLeftSidebars.LayoutThreeWithLeftSidebarsIcon,
116
116
  iconFallback: _LayoutThreeWithLeftSidebars.LayoutThreeWithLeftSidebarsIcon
117
117
  }];
118
- var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, editorAnalyticsAPI) {
118
+ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, editorAnalyticsAPI
119
+ // Ignored via go/ees005
120
+ // eslint-disable-next-line @typescript-eslint/max-params
121
+ ) {
119
122
  return {
120
123
  id: item.id,
121
124
  type: 'button',
@@ -197,7 +200,10 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
197
200
  }]
198
201
  }, separator, deleteButton]);
199
202
  };
200
- var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) {
203
+ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api
204
+ // Ignored via go/ees005
205
+ // eslint-disable-next-line @typescript-eslint/max-params
206
+ ) {
201
207
  var _api$decorations$acti, _api$decorations, _api$analytics;
202
208
  var _ref2 = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
203
209
  hoverDecoration = _ref2.hoverDecoration;
@@ -228,6 +234,8 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
228
234
  var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
229
235
  return {
230
236
  title: layoutToolbarTitle,
237
+ // Ignored via go/ees005
238
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
231
239
  getDomRef: function getDomRef(view) {
232
240
  return (0, _utils.findDomRefAtPos)(pos, view.domAtPos.bind(view));
233
241
  },
@@ -74,6 +74,9 @@ export class LayoutSectionView extends ReactNodeView {
74
74
  dom: container,
75
75
  contentDOM
76
76
  } = DOMSerializer.renderSpec(document, toDOM());
77
+
78
+ // Ignored via go/ees005
79
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
77
80
  this.layoutDOM = container.querySelector('[data-layout-section]');
78
81
  this.layoutDOM.setAttribute('data-column-rule-style', this.node.attrs.columnRuleStyle);
79
82
  if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
@@ -237,6 +237,8 @@ const decreaseColumns = (node, insideRightEdgePos, columnsNumberToRemove = 1) =>
237
237
  * Switching from 3 -> 2 moves all the content of the third col inside the second before
238
238
  * removing it
239
239
  */
240
+ // Ignored via go/ees005
241
+ // eslint-disable-next-line @typescript-eslint/max-params
240
242
  function forceColumnStructure(state, node, pos, presetLayout) {
241
243
  const tr = state.tr;
242
244
  const insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
@@ -271,6 +273,9 @@ function forceColumnStructure(state, node, pos, presetLayout) {
271
273
  }
272
274
  return tr;
273
275
  }
276
+
277
+ // Ignored via go/ees005
278
+ // eslint-disable-next-line @typescript-eslint/max-params
274
279
  function forceColumnStructureNew(state, node, pos, presetLayout) {
275
280
  const tr = state.tr;
276
281
  const insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
@@ -299,6 +304,9 @@ function columnWidth(node, schema, widths) {
299
304
  }
300
305
  });
301
306
  }
307
+
308
+ // Ignored via go/ees005
309
+ // eslint-disable-next-line @typescript-eslint/max-params
302
310
  function forceColumnWidths(state, tr, pos, presetLayout) {
303
311
  const node = tr.doc.nodeAt(pos);
304
312
  if (!node) {
@@ -306,6 +314,9 @@ function forceColumnWidths(state, tr, pos, presetLayout) {
306
314
  }
307
315
  return tr.replaceWith(pos + 1, pos + node.nodeSize - 1, columnWidth(node, state.schema, getWidthsForPreset(presetLayout)));
308
316
  }
317
+
318
+ // Ignored via go/ees005
319
+ // eslint-disable-next-line @typescript-eslint/max-params
309
320
  export function forceSectionToPresetLayout(state, node, pos, presetLayout) {
310
321
  const forceColumnStructureFn = editorExperiment('advanced_layouts', true) ? forceColumnStructureNew : forceColumnStructure;
311
322
  let tr = forceColumnStructureFn(state, node, pos, presetLayout);
@@ -323,14 +334,23 @@ export const setPresetLayout = editorAnalyticsAPI => layout => (state, dispatch)
323
334
  pos,
324
335
  selectedLayout
325
336
  } = pluginKey.getState(state);
326
- if (selectedLayout === layout || pos === null) {
337
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_3')) {
338
+ if (pos === null) {
339
+ return false;
340
+ }
341
+ } else if (selectedLayout === layout || pos === null) {
327
342
  return false;
328
343
  }
329
344
  const node = state.doc.nodeAt(pos);
330
345
  if (!node) {
331
346
  return false;
332
347
  }
333
- let tr = forceSectionToPresetLayout(state, node, pos, layout);
348
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_3')) {
349
+ if (selectedLayout === layout && node.childCount > 1) {
350
+ return false;
351
+ }
352
+ }
353
+ const tr = forceSectionToPresetLayout(state, node, pos, layout);
334
354
  if (tr) {
335
355
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
336
356
  action: ACTION.CHANGED_LAYOUT,
@@ -360,6 +380,7 @@ const getDefaultPresetLayout = layoutNode => {
360
380
  if (layoutColumnCount <= 1) {
361
381
  // This prevents the creation of a single column layout
362
382
  // once we support single column layout, we can return 'single'
383
+
363
384
  return fg('platform_editor_advanced_layouts_post_fix_patch_1') ? 'two_equal' : 'single';
364
385
  }
365
386
  switch (layoutColumnCount) {
@@ -451,7 +472,7 @@ export const deleteActiveLayoutNode = editorAnalyticsAPI => (state, dispatch) =>
451
472
  if (pos !== null) {
452
473
  const node = state.doc.nodeAt(pos);
453
474
  if (dispatch) {
454
- let tr = state.tr.delete(pos, pos + node.nodeSize);
475
+ const tr = state.tr.delete(pos, pos + node.nodeSize);
455
476
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
456
477
  action: ACTION.DELETED,
457
478
  actionSubject: ACTION_SUBJECT.LAYOUT,
@@ -31,7 +31,11 @@ const moveCursorToNextColumn = (state, dispatch) => {
31
31
  }
32
32
  }
33
33
  } = state;
34
+ // Ignored via go/ees005
35
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
34
36
  const section = findParentNodeOfType(layoutSection)(selection);
37
+ // Ignored via go/ees005
38
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
35
39
  const column = findParentNodeOfType(layoutColumn)(selection);
36
40
  if (column.node !== section.node.lastChild) {
37
41
  const $nextColumn = state.doc.resolve(column.pos + column.node.nodeSize);
@@ -80,13 +84,18 @@ export default (options => new SafePlugin({
80
84
  key: pluginKey,
81
85
  state: {
82
86
  init: (_, state) => getInitialPluginState(options, state),
87
+ // Ignored via go/ees005
88
+ // eslint-disable-next-line @typescript-eslint/max-params
83
89
  apply: (tr, pluginState, _oldState, newState) => {
84
90
  if (tr.docChanged || tr.selectionSet) {
85
91
  const maybeLayoutSection = getMaybeLayoutSection(newState);
86
92
  const newPluginState = {
87
93
  ...pluginState,
88
94
  pos: maybeLayoutSection ? maybeLayoutSection.pos : null,
89
- selectedLayout: getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, pluginState.selectedLayout)
95
+ selectedLayout: getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node,
96
+ // Ignored via go/ees005
97
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
98
+ pluginState.selectedLayout)
90
99
  };
91
100
  return newPluginState;
92
101
  }
@@ -2,7 +2,10 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { LayoutSectionView } from '../nodeviews';
4
4
  export const pluginKey = new PluginKey('layoutResizingPlugin');
5
- export default ((options, pluginInjectionApi, portalProviderAPI, eventDispatcher) => new SafePlugin({
5
+ export default ((options, pluginInjectionApi, portalProviderAPI, eventDispatcher
6
+ // Ignored via go/ees005
7
+ // eslint-disable-next-line @typescript-eslint/max-params
8
+ ) => new SafePlugin({
6
9
  key: pluginKey,
7
10
  props: {
8
11
  nodeViews: {
@@ -15,6 +15,8 @@ const LayoutThreeWithLeftSidebarsGlyph = props => {
15
15
  viewBox: "0 0 16 14",
16
16
  fill: "none",
17
17
  xmlns: "http://www.w3.org/2000/svg"
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line react/jsx-props-no-spreading
18
20
  }, props), jsx("path", {
19
21
  fillRule: "evenodd",
20
22
  clipRule: "evenodd",
@@ -28,6 +30,8 @@ const LayoutThreeWithLeftSidebarsGlyph = props => {
28
30
  viewBox: "0 0 16 14",
29
31
  fill: "none",
30
32
  xmlns: "http://www.w3.org/2000/svg"
33
+ // Ignored via go/ees005
34
+ // eslint-disable-next-line react/jsx-props-no-spreading
31
35
  }, props), jsx("path", {
32
36
  fillRule: "evenodd",
33
37
  clipRule: "evenodd",
@@ -43,4 +47,6 @@ export const LayoutThreeWithLeftSidebarsIcon = props => jsx("span", {
43
47
  css: floatingToolbarPadding
44
48
  }, jsx(Icon, _extends({
45
49
  glyph: LayoutThreeWithLeftSidebarsGlyph
50
+ // Ignored via go/ees005
51
+ // eslint-disable-next-line react/jsx-props-no-spreading
46
52
  }, props)));
@@ -15,6 +15,8 @@ const LayoutThreeWithRightSidebarsGlyph = props => {
15
15
  viewBox: "0 0 16 14",
16
16
  fill: "none",
17
17
  xmlns: "http://www.w3.org/2000/svg"
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line react/jsx-props-no-spreading
18
20
  }, props), jsx("path", {
19
21
  fillRule: "evenodd",
20
22
  clipRule: "evenodd",
@@ -28,6 +30,8 @@ const LayoutThreeWithRightSidebarsGlyph = props => {
28
30
  viewBox: "0 0 16 14",
29
31
  fill: "none",
30
32
  xmlns: "http://www.w3.org/2000/svg"
33
+ // Ignored via go/ees005
34
+ // eslint-disable-next-line react/jsx-props-no-spreading
31
35
  }, props), jsx("path", {
32
36
  fillRule: "evenodd",
33
37
  clipRule: "evenodd",
@@ -43,4 +47,6 @@ export const LayoutThreeWithRightSidebarsIcon = props => jsx("span", {
43
47
  css: floatingToolbarPadding
44
48
  }, jsx(Icon, _extends({
45
49
  glyph: LayoutThreeWithRightSidebarsGlyph
50
+ // Ignored via go/ees005
51
+ // eslint-disable-next-line react/jsx-props-no-spreading
46
52
  }, props)));
@@ -104,7 +104,10 @@ const LAYOUT_WITH_THREE_COL_DISTRIBUTION = [{
104
104
  icon: LayoutThreeWithLeftSidebarsIcon,
105
105
  iconFallback: LayoutThreeWithLeftSidebarsIcon
106
106
  }];
107
- const buildLayoutButton = (intl, item, currentLayout, editorAnalyticsAPI) => ({
107
+ const buildLayoutButton = (intl, item, currentLayout, editorAnalyticsAPI
108
+ // Ignored via go/ees005
109
+ // eslint-disable-next-line @typescript-eslint/max-params
110
+ ) => ({
108
111
  id: item.id,
109
112
  type: 'button',
110
113
  icon: item.icon,
@@ -183,7 +186,10 @@ const getAdvancedLayoutItems = ({
183
186
  }]
184
187
  }, separator, deleteButton];
185
188
  };
186
- export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) => {
189
+ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api
190
+ // Ignored via go/ees005
191
+ // eslint-disable-next-line @typescript-eslint/max-params
192
+ ) => {
187
193
  var _api$decorations$acti, _api$decorations, _api$analytics;
188
194
  const {
189
195
  hoverDecoration
@@ -215,6 +221,8 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
215
221
  const layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
216
222
  return {
217
223
  title: layoutToolbarTitle,
224
+ // Ignored via go/ees005
225
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
218
226
  getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
219
227
  nodeType,
220
228
  groupLabel: intl.formatMessage(toolbarMessages.floatingToolbarRadioGroupAriaLabel),
@@ -86,6 +86,9 @@ export var LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
86
86
  var _ref2 = DOMSerializer.renderSpec(document, toDOM()),
87
87
  container = _ref2.dom,
88
88
  contentDOM = _ref2.contentDOM;
89
+
90
+ // Ignored via go/ees005
91
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
89
92
  this.layoutDOM = container.querySelector('[data-layout-section]');
90
93
  this.layoutDOM.setAttribute('data-column-rule-style', this.node.attrs.columnRuleStyle);
91
94
  if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
@@ -251,6 +251,8 @@ var decreaseColumns = function decreaseColumns(node, insideRightEdgePos) {
251
251
  * Switching from 3 -> 2 moves all the content of the third col inside the second before
252
252
  * removing it
253
253
  */
254
+ // Ignored via go/ees005
255
+ // eslint-disable-next-line @typescript-eslint/max-params
254
256
  function forceColumnStructure(state, node, pos, presetLayout) {
255
257
  var tr = state.tr;
256
258
  var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
@@ -285,6 +287,9 @@ function forceColumnStructure(state, node, pos, presetLayout) {
285
287
  }
286
288
  return tr;
287
289
  }
290
+
291
+ // Ignored via go/ees005
292
+ // eslint-disable-next-line @typescript-eslint/max-params
288
293
  function forceColumnStructureNew(state, node, pos, presetLayout) {
289
294
  var tr = state.tr;
290
295
  var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
@@ -312,6 +317,9 @@ function columnWidth(node, schema, widths) {
312
317
  }
313
318
  });
314
319
  }
320
+
321
+ // Ignored via go/ees005
322
+ // eslint-disable-next-line @typescript-eslint/max-params
315
323
  function forceColumnWidths(state, tr, pos, presetLayout) {
316
324
  var node = tr.doc.nodeAt(pos);
317
325
  if (!node) {
@@ -319,6 +327,9 @@ function forceColumnWidths(state, tr, pos, presetLayout) {
319
327
  }
320
328
  return tr.replaceWith(pos + 1, pos + node.nodeSize - 1, columnWidth(node, state.schema, getWidthsForPreset(presetLayout)));
321
329
  }
330
+
331
+ // Ignored via go/ees005
332
+ // eslint-disable-next-line @typescript-eslint/max-params
322
333
  export function forceSectionToPresetLayout(state, node, pos, presetLayout) {
323
334
  var forceColumnStructureFn = editorExperiment('advanced_layouts', true) ? forceColumnStructureNew : forceColumnStructure;
324
335
  var tr = forceColumnStructureFn(state, node, pos, presetLayout);
@@ -337,13 +348,22 @@ export var setPresetLayout = function setPresetLayout(editorAnalyticsAPI) {
337
348
  var _ref = pluginKey.getState(state),
338
349
  pos = _ref.pos,
339
350
  selectedLayout = _ref.selectedLayout;
340
- if (selectedLayout === layout || pos === null) {
351
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_3')) {
352
+ if (pos === null) {
353
+ return false;
354
+ }
355
+ } else if (selectedLayout === layout || pos === null) {
341
356
  return false;
342
357
  }
343
358
  var node = state.doc.nodeAt(pos);
344
359
  if (!node) {
345
360
  return false;
346
361
  }
362
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_3')) {
363
+ if (selectedLayout === layout && node.childCount > 1) {
364
+ return false;
365
+ }
366
+ }
347
367
  var tr = forceSectionToPresetLayout(state, node, pos, layout);
348
368
  if (tr) {
349
369
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
@@ -376,6 +396,7 @@ var getDefaultPresetLayout = function getDefaultPresetLayout(layoutNode) {
376
396
  if (layoutColumnCount <= 1) {
377
397
  // This prevents the creation of a single column layout
378
398
  // once we support single column layout, we can return 'single'
399
+
379
400
  return fg('platform_editor_advanced_layouts_post_fix_patch_1') ? 'two_equal' : 'single';
380
401
  }
381
402
  switch (layoutColumnCount) {
@@ -27,7 +27,11 @@ var moveCursorToNextColumn = function moveCursorToNextColumn(state, dispatch) {
27
27
  var _state$schema$nodes = state.schema.nodes,
28
28
  layoutColumn = _state$schema$nodes.layoutColumn,
29
29
  layoutSection = _state$schema$nodes.layoutSection;
30
+ // Ignored via go/ees005
31
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
30
32
  var section = findParentNodeOfType(layoutSection)(selection);
33
+ // Ignored via go/ees005
34
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
31
35
  var column = findParentNodeOfType(layoutColumn)(selection);
32
36
  if (column.node !== section.node.lastChild) {
33
37
  var $nextColumn = state.doc.resolve(column.pos + column.node.nodeSize);
@@ -81,12 +85,17 @@ export default (function (options) {
81
85
  init: function init(_, state) {
82
86
  return getInitialPluginState(options, state);
83
87
  },
88
+ // Ignored via go/ees005
89
+ // eslint-disable-next-line @typescript-eslint/max-params
84
90
  apply: function apply(tr, pluginState, _oldState, newState) {
85
91
  if (tr.docChanged || tr.selectionSet) {
86
92
  var maybeLayoutSection = getMaybeLayoutSection(newState);
87
93
  var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
88
94
  pos: maybeLayoutSection ? maybeLayoutSection.pos : null,
89
- selectedLayout: getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, pluginState.selectedLayout)
95
+ selectedLayout: getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node,
96
+ // Ignored via go/ees005
97
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
98
+ pluginState.selectedLayout)
90
99
  });
91
100
  return newPluginState;
92
101
  }
@@ -2,7 +2,10 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { LayoutSectionView } from '../nodeviews';
4
4
  export var pluginKey = new PluginKey('layoutResizingPlugin');
5
- export default (function (options, pluginInjectionApi, portalProviderAPI, eventDispatcher) {
5
+ export default (function (options, pluginInjectionApi, portalProviderAPI, eventDispatcher
6
+ // Ignored via go/ees005
7
+ // eslint-disable-next-line @typescript-eslint/max-params
8
+ ) {
6
9
  return new SafePlugin({
7
10
  key: pluginKey,
8
11
  props: {
@@ -15,6 +15,8 @@ var LayoutThreeWithLeftSidebarsGlyph = function LayoutThreeWithLeftSidebarsGlyph
15
15
  viewBox: "0 0 16 14",
16
16
  fill: "none",
17
17
  xmlns: "http://www.w3.org/2000/svg"
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line react/jsx-props-no-spreading
18
20
  }, props), jsx("path", {
19
21
  fillRule: "evenodd",
20
22
  clipRule: "evenodd",
@@ -28,6 +30,8 @@ var LayoutThreeWithLeftSidebarsGlyph = function LayoutThreeWithLeftSidebarsGlyph
28
30
  viewBox: "0 0 16 14",
29
31
  fill: "none",
30
32
  xmlns: "http://www.w3.org/2000/svg"
33
+ // Ignored via go/ees005
34
+ // eslint-disable-next-line react/jsx-props-no-spreading
31
35
  }, props), jsx("path", {
32
36
  fillRule: "evenodd",
33
37
  clipRule: "evenodd",
@@ -44,5 +48,7 @@ export var LayoutThreeWithLeftSidebarsIcon = function LayoutThreeWithLeftSidebar
44
48
  css: floatingToolbarPadding
45
49
  }, jsx(Icon, _extends({
46
50
  glyph: LayoutThreeWithLeftSidebarsGlyph
51
+ // Ignored via go/ees005
52
+ // eslint-disable-next-line react/jsx-props-no-spreading
47
53
  }, props)));
48
54
  };
@@ -15,6 +15,8 @@ var LayoutThreeWithRightSidebarsGlyph = function LayoutThreeWithRightSidebarsGly
15
15
  viewBox: "0 0 16 14",
16
16
  fill: "none",
17
17
  xmlns: "http://www.w3.org/2000/svg"
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line react/jsx-props-no-spreading
18
20
  }, props), jsx("path", {
19
21
  fillRule: "evenodd",
20
22
  clipRule: "evenodd",
@@ -28,6 +30,8 @@ var LayoutThreeWithRightSidebarsGlyph = function LayoutThreeWithRightSidebarsGly
28
30
  viewBox: "0 0 16 14",
29
31
  fill: "none",
30
32
  xmlns: "http://www.w3.org/2000/svg"
33
+ // Ignored via go/ees005
34
+ // eslint-disable-next-line react/jsx-props-no-spreading
31
35
  }, props), jsx("path", {
32
36
  fillRule: "evenodd",
33
37
  clipRule: "evenodd",
@@ -44,5 +48,7 @@ export var LayoutThreeWithRightSidebarsIcon = function LayoutThreeWithRightSideb
44
48
  css: floatingToolbarPadding
45
49
  }, jsx(Icon, _extends({
46
50
  glyph: LayoutThreeWithRightSidebarsGlyph
51
+ // Ignored via go/ees005
52
+ // eslint-disable-next-line react/jsx-props-no-spreading
47
53
  }, props)));
48
54
  };
@@ -105,7 +105,10 @@ var LAYOUT_WITH_THREE_COL_DISTRIBUTION = [{
105
105
  icon: LayoutThreeWithLeftSidebarsIcon,
106
106
  iconFallback: LayoutThreeWithLeftSidebarsIcon
107
107
  }];
108
- var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, editorAnalyticsAPI) {
108
+ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, editorAnalyticsAPI
109
+ // Ignored via go/ees005
110
+ // eslint-disable-next-line @typescript-eslint/max-params
111
+ ) {
109
112
  return {
110
113
  id: item.id,
111
114
  type: 'button',
@@ -187,7 +190,10 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
187
190
  }]
188
191
  }, separator, deleteButton]);
189
192
  };
190
- export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) {
193
+ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api
194
+ // Ignored via go/ees005
195
+ // eslint-disable-next-line @typescript-eslint/max-params
196
+ ) {
191
197
  var _api$decorations$acti, _api$decorations, _api$analytics;
192
198
  var _ref2 = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
193
199
  hoverDecoration = _ref2.hoverDecoration;
@@ -218,6 +224,8 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
218
224
  var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
219
225
  return {
220
226
  title: layoutToolbarTitle,
227
+ // Ignored via go/ees005
228
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
221
229
  getDomRef: function getDomRef(view) {
222
230
  return findDomRefAtPos(pos, view.domAtPos.bind(view));
223
231
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "1.12.17",
3
+ "version": "1.12.19",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,16 +32,16 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^97.0.0",
35
+ "@atlaskit/editor-common": "^97.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
38
38
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
39
39
  "@atlaskit/editor-plugin-selection": "^1.6.0",
40
- "@atlaskit/editor-plugin-width": "^1.3.0",
40
+ "@atlaskit/editor-plugin-width": "^2.0.0",
41
41
  "@atlaskit/editor-prosemirror": "6.2.1",
42
42
  "@atlaskit/icon": "^23.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.3.0",
44
- "@atlaskit/tmp-editor-statsig": "^2.29.0",
44
+ "@atlaskit/tmp-editor-statsig": "^2.30.0",
45
45
  "@atlaskit/tokens": "^2.5.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1"
@@ -103,6 +103,9 @@
103
103
  },
104
104
  "platform_editor_advanced_layouts_post_fix_patch_1": {
105
105
  "type": "boolean"
106
+ },
107
+ "platform_editor_advanced_layouts_post_fix_patch_3": {
108
+ "type": "boolean"
106
109
  }
107
110
  }
108
111
  }