@atlaskit/editor-plugin-layout 1.12.18 → 1.12.20

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.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.12.19
10
+
11
+ ### Patch Changes
12
+
13
+ - [#98381](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98381)
14
+ [`3e23b2a14109d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3e23b2a14109d) -
15
+ ED-26121 fix single column layout change layout
16
+
3
17
  ## 1.12.18
4
18
 
5
19
  ### Patch Changes
@@ -357,13 +357,22 @@ var setPresetLayout = exports.setPresetLayout = function setPresetLayout(editorA
357
357
  var _ref = _pluginKey.pluginKey.getState(state),
358
358
  pos = _ref.pos,
359
359
  selectedLayout = _ref.selectedLayout;
360
- 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) {
361
365
  return false;
362
366
  }
363
367
  var node = state.doc.nodeAt(pos);
364
368
  if (!node) {
365
369
  return false;
366
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
+ }
367
376
  var tr = forceSectionToPresetLayout(state, node, pos, layout);
368
377
  if (tr) {
369
378
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
@@ -396,6 +405,7 @@ var getDefaultPresetLayout = function getDefaultPresetLayout(layoutNode) {
396
405
  if (layoutColumnCount <= 1) {
397
406
  // This prevents the creation of a single column layout
398
407
  // once we support single column layout, we can return 'single'
408
+
399
409
  return (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') ? 'two_equal' : 'single';
400
410
  }
401
411
  switch (layoutColumnCount) {
@@ -334,14 +334,23 @@ export const setPresetLayout = editorAnalyticsAPI => layout => (state, dispatch)
334
334
  pos,
335
335
  selectedLayout
336
336
  } = pluginKey.getState(state);
337
- 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) {
338
342
  return false;
339
343
  }
340
344
  const node = state.doc.nodeAt(pos);
341
345
  if (!node) {
342
346
  return false;
343
347
  }
344
- 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);
345
354
  if (tr) {
346
355
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
347
356
  action: ACTION.CHANGED_LAYOUT,
@@ -371,6 +380,7 @@ const getDefaultPresetLayout = layoutNode => {
371
380
  if (layoutColumnCount <= 1) {
372
381
  // This prevents the creation of a single column layout
373
382
  // once we support single column layout, we can return 'single'
383
+
374
384
  return fg('platform_editor_advanced_layouts_post_fix_patch_1') ? 'two_equal' : 'single';
375
385
  }
376
386
  switch (layoutColumnCount) {
@@ -462,7 +472,7 @@ export const deleteActiveLayoutNode = editorAnalyticsAPI => (state, dispatch) =>
462
472
  if (pos !== null) {
463
473
  const node = state.doc.nodeAt(pos);
464
474
  if (dispatch) {
465
- let tr = state.tr.delete(pos, pos + node.nodeSize);
475
+ const tr = state.tr.delete(pos, pos + node.nodeSize);
466
476
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
467
477
  action: ACTION.DELETED,
468
478
  actionSubject: ACTION_SUBJECT.LAYOUT,
@@ -123,7 +123,7 @@ export default (options => new SafePlugin({
123
123
  })
124
124
  },
125
125
  appendTransaction: (transactions, _oldState, newState) => {
126
- let changes = [];
126
+ const changes = [];
127
127
  transactions.forEach(prevTr => {
128
128
  // remap change segments across the transaction set
129
129
  changes.forEach(change => {
@@ -348,13 +348,22 @@ export var setPresetLayout = function setPresetLayout(editorAnalyticsAPI) {
348
348
  var _ref = pluginKey.getState(state),
349
349
  pos = _ref.pos,
350
350
  selectedLayout = _ref.selectedLayout;
351
- 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) {
352
356
  return false;
353
357
  }
354
358
  var node = state.doc.nodeAt(pos);
355
359
  if (!node) {
356
360
  return false;
357
361
  }
362
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_3')) {
363
+ if (selectedLayout === layout && node.childCount > 1) {
364
+ return false;
365
+ }
366
+ }
358
367
  var tr = forceSectionToPresetLayout(state, node, pos, layout);
359
368
  if (tr) {
360
369
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
@@ -387,6 +396,7 @@ var getDefaultPresetLayout = function getDefaultPresetLayout(layoutNode) {
387
396
  if (layoutColumnCount <= 1) {
388
397
  // This prevents the creation of a single column layout
389
398
  // once we support single column layout, we can return 'single'
399
+
390
400
  return fg('platform_editor_advanced_layouts_post_fix_patch_1') ? 'two_equal' : 'single';
391
401
  }
392
402
  switch (layoutColumnCount) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "1.12.18",
3
+ "version": "1.12.20",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^97.2.0",
35
+ "@atlaskit/editor-common": "^98.0.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",
@@ -41,7 +41,7 @@
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.31.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
  }