@atlaskit/editor-plugin-layout 1.9.6 → 1.9.7

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
+ ## 1.9.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#156974](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/156974)
8
+ [`e23605a60e753`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e23605a60e753) -
9
+ Add four and five column support for layout sections
10
+ - Updated dependencies
11
+
3
12
  ## 1.9.6
4
13
 
5
14
  ### Patch Changes
@@ -24,6 +24,26 @@ var ONE_COL_LAYOUTS = exports.ONE_COL_LAYOUTS = ['single'];
24
24
  var TWO_COL_LAYOUTS = exports.TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
25
25
  var THREE_COL_LAYOUTS = exports.THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
26
26
  var getWidthsForPreset = function getWidthsForPreset(presetLayout) {
27
+ if ((0, _preRelease.isPreRelease2)()) {
28
+ switch (presetLayout) {
29
+ case 'single':
30
+ return [100];
31
+ case 'two_equal':
32
+ return [50, 50];
33
+ case 'three_equal':
34
+ return [33.33, 33.33, 33.33];
35
+ case 'two_left_sidebar':
36
+ return [33.33, 66.66];
37
+ case 'two_right_sidebar':
38
+ return [66.66, 33.33];
39
+ case 'three_with_sidebars':
40
+ return [25, 50, 25];
41
+ case 'four_equal':
42
+ return [25, 25, 25, 25];
43
+ case 'five_equal':
44
+ return [20, 20, 20, 20, 20];
45
+ }
46
+ }
27
47
  switch (presetLayout) {
28
48
  case 'single':
29
49
  return [100];
@@ -38,6 +58,7 @@ var getWidthsForPreset = function getWidthsForPreset(presetLayout) {
38
58
  case 'three_with_sidebars':
39
59
  return [25, 50, 25];
40
60
  }
61
+ return [];
41
62
  };
42
63
 
43
64
  /**
@@ -48,6 +69,27 @@ var getPresetLayout = exports.getPresetLayout = function getPresetLayout(section
48
69
  var widths = (0, _utils.mapChildren)(section, function (column) {
49
70
  return column.attrs.width;
50
71
  }).join(',');
72
+ if ((0, _preRelease.isPreRelease2)()) {
73
+ switch (widths) {
74
+ case '100':
75
+ return 'single';
76
+ case '33.33,33.33,33.33':
77
+ return 'three_equal';
78
+ case '25,50,25':
79
+ return 'three_with_sidebars';
80
+ case '50,50':
81
+ return 'two_equal';
82
+ case '33.33,66.66':
83
+ return 'two_left_sidebar';
84
+ case '66.66,33.33':
85
+ return 'two_right_sidebar';
86
+ case '25,25,25,25':
87
+ return 'four_equal';
88
+ case '20,20,20,20,20':
89
+ return 'five_equal';
90
+ }
91
+ return;
92
+ }
51
93
  switch (widths) {
52
94
  case '100':
53
95
  return 'single';
@@ -377,6 +419,26 @@ var deleteActiveLayoutNode = exports.deleteActiveLayoutNode = function deleteAct
377
419
  };
378
420
  };
379
421
  var formatLayoutName = function formatLayoutName(layout) {
422
+ if ((0, _preRelease.isPreRelease2)()) {
423
+ switch (layout) {
424
+ case 'single':
425
+ return _analytics.LAYOUT_TYPE.SINGLE_COL;
426
+ case 'two_equal':
427
+ return _analytics.LAYOUT_TYPE.TWO_COLS_EQUAL;
428
+ case 'three_equal':
429
+ return _analytics.LAYOUT_TYPE.THREE_COLS_EQUAL;
430
+ case 'two_left_sidebar':
431
+ return _analytics.LAYOUT_TYPE.LEFT_SIDEBAR;
432
+ case 'two_right_sidebar':
433
+ return _analytics.LAYOUT_TYPE.RIGHT_SIDEBAR;
434
+ case 'three_with_sidebars':
435
+ return _analytics.LAYOUT_TYPE.THREE_WITH_SIDEBARS;
436
+ case 'four_equal':
437
+ return _analytics.LAYOUT_TYPE.FOUR_COLS_EQUAL;
438
+ case 'five_equal':
439
+ return _analytics.LAYOUT_TYPE.FIVE_COLS_EQUAL;
440
+ }
441
+ }
380
442
  switch (layout) {
381
443
  case 'single':
382
444
  return _analytics.LAYOUT_TYPE.SINGLE_COL;
@@ -12,6 +12,26 @@ export const ONE_COL_LAYOUTS = ['single'];
12
12
  export const TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
13
13
  export const THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
14
14
  const getWidthsForPreset = presetLayout => {
15
+ if (isPreRelease2()) {
16
+ switch (presetLayout) {
17
+ case 'single':
18
+ return [100];
19
+ case 'two_equal':
20
+ return [50, 50];
21
+ case 'three_equal':
22
+ return [33.33, 33.33, 33.33];
23
+ case 'two_left_sidebar':
24
+ return [33.33, 66.66];
25
+ case 'two_right_sidebar':
26
+ return [66.66, 33.33];
27
+ case 'three_with_sidebars':
28
+ return [25, 50, 25];
29
+ case 'four_equal':
30
+ return [25, 25, 25, 25];
31
+ case 'five_equal':
32
+ return [20, 20, 20, 20, 20];
33
+ }
34
+ }
15
35
  switch (presetLayout) {
16
36
  case 'single':
17
37
  return [100];
@@ -26,6 +46,7 @@ const getWidthsForPreset = presetLayout => {
26
46
  case 'three_with_sidebars':
27
47
  return [25, 50, 25];
28
48
  }
49
+ return [];
29
50
  };
30
51
 
31
52
  /**
@@ -34,6 +55,27 @@ const getWidthsForPreset = presetLayout => {
34
55
  */
35
56
  export const getPresetLayout = section => {
36
57
  const widths = mapChildren(section, column => column.attrs.width).join(',');
58
+ if (isPreRelease2()) {
59
+ switch (widths) {
60
+ case '100':
61
+ return 'single';
62
+ case '33.33,33.33,33.33':
63
+ return 'three_equal';
64
+ case '25,50,25':
65
+ return 'three_with_sidebars';
66
+ case '50,50':
67
+ return 'two_equal';
68
+ case '33.33,66.66':
69
+ return 'two_left_sidebar';
70
+ case '66.66,33.33':
71
+ return 'two_right_sidebar';
72
+ case '25,25,25,25':
73
+ return 'four_equal';
74
+ case '20,20,20,20,20':
75
+ return 'five_equal';
76
+ }
77
+ return;
78
+ }
37
79
  switch (widths) {
38
80
  case '100':
39
81
  return 'single';
@@ -360,6 +402,26 @@ export const deleteActiveLayoutNode = editorAnalyticsAPI => (state, dispatch) =>
360
402
  return false;
361
403
  };
362
404
  const formatLayoutName = layout => {
405
+ if (isPreRelease2()) {
406
+ switch (layout) {
407
+ case 'single':
408
+ return LAYOUT_TYPE.SINGLE_COL;
409
+ case 'two_equal':
410
+ return LAYOUT_TYPE.TWO_COLS_EQUAL;
411
+ case 'three_equal':
412
+ return LAYOUT_TYPE.THREE_COLS_EQUAL;
413
+ case 'two_left_sidebar':
414
+ return LAYOUT_TYPE.LEFT_SIDEBAR;
415
+ case 'two_right_sidebar':
416
+ return LAYOUT_TYPE.RIGHT_SIDEBAR;
417
+ case 'three_with_sidebars':
418
+ return LAYOUT_TYPE.THREE_WITH_SIDEBARS;
419
+ case 'four_equal':
420
+ return LAYOUT_TYPE.FOUR_COLS_EQUAL;
421
+ case 'five_equal':
422
+ return LAYOUT_TYPE.FIVE_COLS_EQUAL;
423
+ }
424
+ }
363
425
  switch (layout) {
364
426
  case 'single':
365
427
  return LAYOUT_TYPE.SINGLE_COL;
@@ -15,6 +15,26 @@ export var ONE_COL_LAYOUTS = ['single'];
15
15
  export var TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
16
16
  export var THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
17
17
  var getWidthsForPreset = function getWidthsForPreset(presetLayout) {
18
+ if (isPreRelease2()) {
19
+ switch (presetLayout) {
20
+ case 'single':
21
+ return [100];
22
+ case 'two_equal':
23
+ return [50, 50];
24
+ case 'three_equal':
25
+ return [33.33, 33.33, 33.33];
26
+ case 'two_left_sidebar':
27
+ return [33.33, 66.66];
28
+ case 'two_right_sidebar':
29
+ return [66.66, 33.33];
30
+ case 'three_with_sidebars':
31
+ return [25, 50, 25];
32
+ case 'four_equal':
33
+ return [25, 25, 25, 25];
34
+ case 'five_equal':
35
+ return [20, 20, 20, 20, 20];
36
+ }
37
+ }
18
38
  switch (presetLayout) {
19
39
  case 'single':
20
40
  return [100];
@@ -29,6 +49,7 @@ var getWidthsForPreset = function getWidthsForPreset(presetLayout) {
29
49
  case 'three_with_sidebars':
30
50
  return [25, 50, 25];
31
51
  }
52
+ return [];
32
53
  };
33
54
 
34
55
  /**
@@ -39,6 +60,27 @@ export var getPresetLayout = function getPresetLayout(section) {
39
60
  var widths = mapChildren(section, function (column) {
40
61
  return column.attrs.width;
41
62
  }).join(',');
63
+ if (isPreRelease2()) {
64
+ switch (widths) {
65
+ case '100':
66
+ return 'single';
67
+ case '33.33,33.33,33.33':
68
+ return 'three_equal';
69
+ case '25,50,25':
70
+ return 'three_with_sidebars';
71
+ case '50,50':
72
+ return 'two_equal';
73
+ case '33.33,66.66':
74
+ return 'two_left_sidebar';
75
+ case '66.66,33.33':
76
+ return 'two_right_sidebar';
77
+ case '25,25,25,25':
78
+ return 'four_equal';
79
+ case '20,20,20,20,20':
80
+ return 'five_equal';
81
+ }
82
+ return;
83
+ }
42
84
  switch (widths) {
43
85
  case '100':
44
86
  return 'single';
@@ -368,6 +410,26 @@ export var deleteActiveLayoutNode = function deleteActiveLayoutNode(editorAnalyt
368
410
  };
369
411
  };
370
412
  var formatLayoutName = function formatLayoutName(layout) {
413
+ if (isPreRelease2()) {
414
+ switch (layout) {
415
+ case 'single':
416
+ return LAYOUT_TYPE.SINGLE_COL;
417
+ case 'two_equal':
418
+ return LAYOUT_TYPE.TWO_COLS_EQUAL;
419
+ case 'three_equal':
420
+ return LAYOUT_TYPE.THREE_COLS_EQUAL;
421
+ case 'two_left_sidebar':
422
+ return LAYOUT_TYPE.LEFT_SIDEBAR;
423
+ case 'two_right_sidebar':
424
+ return LAYOUT_TYPE.RIGHT_SIDEBAR;
425
+ case 'three_with_sidebars':
426
+ return LAYOUT_TYPE.THREE_WITH_SIDEBARS;
427
+ case 'four_equal':
428
+ return LAYOUT_TYPE.FOUR_COLS_EQUAL;
429
+ case 'five_equal':
430
+ return LAYOUT_TYPE.FIVE_COLS_EQUAL;
431
+ }
432
+ }
371
433
  switch (layout) {
372
434
  case 'single':
373
435
  return LAYOUT_TYPE.SINGLE_COL;
@@ -5,7 +5,7 @@ export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
5
5
  UNSAFE_addSidebarLayouts?: boolean;
6
6
  UNSAFE_allowSingleColumnLayout?: boolean;
7
7
  }
8
- export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars';
8
+ export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars' | 'four_equal' | 'five_equal';
9
9
  export interface Change {
10
10
  from: number;
11
11
  to: number;
@@ -5,7 +5,7 @@ export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
5
5
  UNSAFE_addSidebarLayouts?: boolean;
6
6
  UNSAFE_allowSingleColumnLayout?: boolean;
7
7
  }
8
- export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars';
8
+ export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars' | 'four_equal' | 'five_equal';
9
9
  export interface Change {
10
10
  from: number;
11
11
  to: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
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": "^42.3.1",
35
- "@atlaskit/editor-common": "^94.3.0",
35
+ "@atlaskit/editor-common": "^94.4.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
38
38
  "@atlaskit/editor-prosemirror": "6.0.0",