@atlaskit/editor-common 107.1.1 → 107.2.1

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-common
2
2
 
3
+ ## 107.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#174265](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/174265)
8
+ [`20a7224f572b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20a7224f572b5) -
9
+ [ux] ED-28338: Fix layout guideline not visible on full width page
10
+ - Updated dependencies
11
+
12
+ ## 107.2.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#172318](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/172318)
17
+ [`cb1aac3653c7e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cb1aac3653c7e) -
18
+ Fix breakout inline SSR parcel build issue
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 107.1.1
4
25
 
5
26
  ### Patch Changes
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "107.1.0";
19
+ var packageVersion = "107.2.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // Ignored via go/ees007
@@ -9,6 +9,8 @@ exports.useBreakoutGuidelines = useBreakoutGuidelines;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = require("react");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
14
  var SNAP_GAP = exports.SNAP_GAP = 8;
13
15
  var GUIDELINE_KEYS = {
14
16
  lineLength: 'grid',
@@ -34,13 +36,20 @@ function useBreakoutGuidelines(getEditorWidth, isResizing) {
34
36
  var _ref = widthState || {},
35
37
  width = _ref.width,
36
38
  lineLength = _ref.lineLength;
37
- var wide = lineLength ? Math.round(lineLength * _editorSharedStyles.breakoutWideScaleRatio) : undefined;
39
+ var wideCalWithRatio = lineLength ? Math.round(lineLength * _editorSharedStyles.breakoutWideScaleRatio) : undefined;
40
+ // When page is full width, lineLength from widthState can be much wider than 760.
41
+ // But the lineLength variable here is being used like a const 760.
42
+ // when the page is full width, the calculation of wide is wrong.
43
+ // Actuall the wide is the wide breakout point, which is
44
+ var wide = (0, _experiments.editorExperiment)('single_column_layouts', true) && (0, _platformFeatureFlags.fg)('platform_editor_layout_guideline_full_width_fix') ? _editorSharedStyles.akEditorCalculatedWideLayoutWidth : wideCalWithRatio;
38
45
  var layoutCalculatedWidth = width ? width - ((0, _editorSharedStyles.akEditorGutterPaddingDynamic)() + dynamicFullWidthGuidelineOffset) * 2 : undefined;
39
46
  var fullWidth = width && layoutCalculatedWidth ? Math.min(layoutCalculatedWidth, _editorSharedStyles.akEditorFullWidthLayoutWidth) : undefined;
40
47
  return {
41
48
  wide: wide,
42
49
  fullWidth: fullWidth,
43
- lineLength: lineLength
50
+ // When page is full width, lineLength from widthState can be much wider than 760.
51
+ // But the lineLength variable here is being used like a const 760.
52
+ lineLength: (0, _experiments.editorExperiment)('single_column_layouts', true) && (0, _platformFeatureFlags.fg)('platform_editor_layout_guideline_full_width_fix') ? _editorSharedStyles.akEditorDefaultLayoutWidth : lineLength
44
53
  };
45
54
  }, [widthState, isResizing, dynamicFullWidthGuidelineOffset]),
46
55
  lineLength = _useMemo.lineLength,
@@ -49,7 +58,7 @@ function useBreakoutGuidelines(getEditorWidth, isResizing) {
49
58
 
50
59
  // calculate snapping width
51
60
  var defaultSnappingWidths = (0, _react.useMemo)(function () {
52
- if (!fullWidth || !wide || !lineLength || fullWidth <= lineLength) {
61
+ if (!fullWidth || !wide || !lineLength || fullWidth <= ((0, _experiments.editorExperiment)('single_column_layouts', true) && (0, _platformFeatureFlags.fg)('platform_editor_layout_guideline_full_width_fix') ? _editorSharedStyles.akEditorDefaultLayoutWidth : lineLength)) {
53
62
  return null;
54
63
  }
55
64
  if (fullWidth - wide > SNAP_GAP) {
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "107.1.0";
26
+ var packageVersion = "107.2.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -32,48 +32,56 @@ var breakoutConsts = exports.breakoutConsts = {
32
32
  /**
33
33
  * This function can return percentage value or px value depending upon the inputs
34
34
  */
35
- calcBreakoutWidth: function calcBreakoutWidth(layout, containerWidth, padding) {
36
- var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
37
- switch (layout) {
38
- case 'full-width':
39
- return "".concat(Math.min(effectiveFullWidth, breakoutConsts.fullWidthLayoutWidth), "px");
40
- case 'wide':
41
- if (effectiveFullWidth <= 0) {
42
- return '100%';
43
- }
44
- var wideWidth = breakoutConsts.calcWideWidth(containerWidth, undefined, undefined, padding);
45
- if (wideWidth.endsWith('%')) {
35
+ calcBreakoutWidth: function calcBreakoutWidth(breakoutConsts) {
36
+ return function (layout, containerWidth, padding) {
37
+ var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
38
+ switch (layout) {
39
+ case 'full-width':
46
40
  return "".concat(Math.min(effectiveFullWidth, breakoutConsts.fullWidthLayoutWidth), "px");
47
- }
48
- return wideWidth;
49
- default:
50
- return '100%';
51
- }
41
+ case 'wide':
42
+ if (effectiveFullWidth <= 0) {
43
+ return '100%';
44
+ }
45
+ var wideWidth = breakoutConsts.calcWideWidth(breakoutConsts)(containerWidth, undefined, undefined, padding);
46
+ if (wideWidth.endsWith('%')) {
47
+ return "".concat(Math.min(effectiveFullWidth, breakoutConsts.fullWidthLayoutWidth), "px");
48
+ }
49
+ return wideWidth;
50
+ default:
51
+ return '100%';
52
+ }
53
+ };
52
54
  },
53
- calcBreakoutWithCustomWidth: function calcBreakoutWithCustomWidth(mode, width, editorContainerWidth) {
54
- if (width !== null && width > 0) {
55
- var effectiveFullWidth = editorContainerWidth - breakoutConsts.padding;
56
- // if below 0 then expect we're rendering in SSR
57
- return "".concat(Math.min(width, effectiveFullWidth), "px");
58
- }
59
- return breakoutConsts.calcBreakoutWidth(mode, editorContainerWidth);
55
+ calcBreakoutWithCustomWidth: function calcBreakoutWithCustomWidth(breakoutConsts) {
56
+ return function (mode, width, editorContainerWidth) {
57
+ if (width !== null && width > 0) {
58
+ var effectiveFullWidth = editorContainerWidth - breakoutConsts.padding;
59
+ // if below 0 then expect we're rendering in SSR
60
+ return "".concat(Math.min(width, effectiveFullWidth), "px");
61
+ }
62
+ return breakoutConsts.calcBreakoutWidth(breakoutConsts)(mode, editorContainerWidth);
63
+ };
60
64
  },
61
- calcLineLength: function calcLineLength() {
62
- return breakoutConsts.defaultLayoutWidth;
65
+ calcLineLength: function calcLineLength(breakoutConsts) {
66
+ return function () {
67
+ return breakoutConsts.defaultLayoutWidth;
68
+ };
63
69
  },
64
- calcWideWidth: function calcWideWidth() {
65
- var containerWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : breakoutConsts.defaultLayoutWidth;
66
- var maxWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
67
- var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '100%';
68
- var padding = arguments.length > 3 ? arguments[3] : undefined;
69
- var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
70
- var layoutMaxWidth = breakoutConsts.mapBreakpointToLayoutMaxWidth(breakoutConsts.getBreakpoint(containerWidth));
71
- var wideWidth = Math.min(Math.ceil(layoutMaxWidth * breakoutConsts.wideScaleRatio), effectiveFullWidth);
72
- return layoutMaxWidth > wideWidth ? fallback : "".concat(Math.min(maxWidth, wideWidth), "px");
70
+ calcWideWidth: function calcWideWidth(breakoutConsts) {
71
+ return function () {
72
+ var containerWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : breakoutConsts.defaultLayoutWidth;
73
+ var maxWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
74
+ var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '100%';
75
+ var padding = arguments.length > 3 ? arguments[3] : undefined;
76
+ var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
77
+ var layoutMaxWidth = breakoutConsts.mapBreakpointToLayoutMaxWidth(breakoutConsts.getBreakpoint(containerWidth));
78
+ var wideWidth = Math.min(Math.ceil(layoutMaxWidth * breakoutConsts.wideScaleRatio), effectiveFullWidth);
79
+ return layoutMaxWidth > wideWidth ? fallback : "".concat(Math.min(maxWidth, wideWidth), "px");
80
+ };
73
81
  }
74
82
  };
75
83
  var absoluteBreakoutWidth = exports.absoluteBreakoutWidth = function absoluteBreakoutWidth(layout, containerWidth) {
76
- var breakoutWidth = breakoutConsts.calcBreakoutWidth(layout, containerWidth);
84
+ var breakoutWidth = breakoutConsts.calcBreakoutWidth(breakoutConsts)(layout, containerWidth);
77
85
 
78
86
  // If it's percent, map to max layout size
79
87
  if (breakoutWidth.endsWith('%')) {
@@ -88,9 +96,9 @@ var absoluteBreakoutWidth = exports.absoluteBreakoutWidth = function absoluteBre
88
96
  }
89
97
  return parseInt(breakoutWidth, 10);
90
98
  };
91
- var calcWideWidth = exports.calcWideWidth = breakoutConsts.calcWideWidth;
92
- var calcBreakoutWidth = exports.calcBreakoutWidth = breakoutConsts.calcBreakoutWidth;
93
- var calcBreakoutWithCustomWidth = exports.calcBreakoutWithCustomWidth = breakoutConsts.calcBreakoutWithCustomWidth;
99
+ var calcWideWidth = exports.calcWideWidth = breakoutConsts.calcWideWidth(breakoutConsts);
100
+ var calcBreakoutWidth = exports.calcBreakoutWidth = breakoutConsts.calcBreakoutWidth(breakoutConsts);
101
+ var calcBreakoutWithCustomWidth = exports.calcBreakoutWithCustomWidth = breakoutConsts.calcBreakoutWithCustomWidth(breakoutConsts);
94
102
  function calculateBreakoutStyles(_ref) {
95
103
  var mode = _ref.mode,
96
104
  widthStateLineLength = _ref.widthStateLineLength,
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "107.1.0";
4
+ const packageVersion = "107.2.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -1,5 +1,7 @@
1
1
  import { useCallback, useMemo, useState } from 'react';
2
- import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
2
+ import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
5
  export const SNAP_GAP = 8;
4
6
  const GUIDELINE_KEYS = {
5
7
  lineLength: 'grid',
@@ -26,19 +28,26 @@ export function useBreakoutGuidelines(getEditorWidth, isResizing, dynamicFullWid
26
28
  width,
27
29
  lineLength
28
30
  } = widthState || {};
29
- const wide = lineLength ? Math.round(lineLength * breakoutWideScaleRatio) : undefined;
31
+ const wideCalWithRatio = lineLength ? Math.round(lineLength * breakoutWideScaleRatio) : undefined;
32
+ // When page is full width, lineLength from widthState can be much wider than 760.
33
+ // But the lineLength variable here is being used like a const 760.
34
+ // when the page is full width, the calculation of wide is wrong.
35
+ // Actuall the wide is the wide breakout point, which is
36
+ const wide = editorExperiment('single_column_layouts', true) && fg('platform_editor_layout_guideline_full_width_fix') ? akEditorCalculatedWideLayoutWidth : wideCalWithRatio;
30
37
  const layoutCalculatedWidth = width ? width - (akEditorGutterPaddingDynamic() + dynamicFullWidthGuidelineOffset) * 2 : undefined;
31
38
  const fullWidth = width && layoutCalculatedWidth ? Math.min(layoutCalculatedWidth, akEditorFullWidthLayoutWidth) : undefined;
32
39
  return {
33
40
  wide,
34
41
  fullWidth,
35
- lineLength
42
+ // When page is full width, lineLength from widthState can be much wider than 760.
43
+ // But the lineLength variable here is being used like a const 760.
44
+ lineLength: editorExperiment('single_column_layouts', true) && fg('platform_editor_layout_guideline_full_width_fix') ? akEditorDefaultLayoutWidth : lineLength
36
45
  };
37
46
  }, [widthState, isResizing, dynamicFullWidthGuidelineOffset]);
38
47
 
39
48
  // calculate snapping width
40
49
  const defaultSnappingWidths = useMemo(() => {
41
- if (!fullWidth || !wide || !lineLength || fullWidth <= lineLength) {
50
+ if (!fullWidth || !wide || !lineLength || fullWidth <= (editorExperiment('single_column_layouts', true) && fg('platform_editor_layout_guideline_full_width_fix') ? akEditorDefaultLayoutWidth : lineLength)) {
42
51
  return null;
43
52
  }
44
53
  if (fullWidth - wide > SNAP_GAP) {
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "107.1.0";
16
+ const packageVersion = "107.2.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -22,7 +22,7 @@ const breakoutConsts = {
22
22
  /**
23
23
  * This function can return percentage value or px value depending upon the inputs
24
24
  */
25
- calcBreakoutWidth: (layout, containerWidth, padding) => {
25
+ calcBreakoutWidth: breakoutConsts => (layout, containerWidth, padding) => {
26
26
  const effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
27
27
  switch (layout) {
28
28
  case 'full-width':
@@ -31,7 +31,7 @@ const breakoutConsts = {
31
31
  if (effectiveFullWidth <= 0) {
32
32
  return '100%';
33
33
  }
34
- const wideWidth = breakoutConsts.calcWideWidth(containerWidth, undefined, undefined, padding);
34
+ const wideWidth = breakoutConsts.calcWideWidth(breakoutConsts)(containerWidth, undefined, undefined, padding);
35
35
  if (wideWidth.endsWith('%')) {
36
36
  return `${Math.min(effectiveFullWidth, breakoutConsts.fullWidthLayoutWidth)}px`;
37
37
  }
@@ -40,16 +40,16 @@ const breakoutConsts = {
40
40
  return '100%';
41
41
  }
42
42
  },
43
- calcBreakoutWithCustomWidth: (mode, width, editorContainerWidth) => {
43
+ calcBreakoutWithCustomWidth: breakoutConsts => (mode, width, editorContainerWidth) => {
44
44
  if (width !== null && width > 0) {
45
45
  const effectiveFullWidth = editorContainerWidth - breakoutConsts.padding;
46
46
  // if below 0 then expect we're rendering in SSR
47
47
  return `${Math.min(width, effectiveFullWidth)}px`;
48
48
  }
49
- return breakoutConsts.calcBreakoutWidth(mode, editorContainerWidth);
49
+ return breakoutConsts.calcBreakoutWidth(breakoutConsts)(mode, editorContainerWidth);
50
50
  },
51
- calcLineLength: () => breakoutConsts.defaultLayoutWidth,
52
- calcWideWidth: (containerWidth = breakoutConsts.defaultLayoutWidth, maxWidth = Infinity, fallback = '100%', padding) => {
51
+ calcLineLength: breakoutConsts => () => breakoutConsts.defaultLayoutWidth,
52
+ calcWideWidth: breakoutConsts => (containerWidth = breakoutConsts.defaultLayoutWidth, maxWidth = Infinity, fallback = '100%', padding) => {
53
53
  const effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
54
54
  const layoutMaxWidth = breakoutConsts.mapBreakpointToLayoutMaxWidth(breakoutConsts.getBreakpoint(containerWidth));
55
55
  const wideWidth = Math.min(Math.ceil(layoutMaxWidth * breakoutConsts.wideScaleRatio), effectiveFullWidth);
@@ -57,7 +57,7 @@ const breakoutConsts = {
57
57
  }
58
58
  };
59
59
  export const absoluteBreakoutWidth = (layout, containerWidth) => {
60
- const breakoutWidth = breakoutConsts.calcBreakoutWidth(layout, containerWidth);
60
+ const breakoutWidth = breakoutConsts.calcBreakoutWidth(breakoutConsts)(layout, containerWidth);
61
61
 
62
62
  // If it's percent, map to max layout size
63
63
  if (breakoutWidth.endsWith('%')) {
@@ -73,9 +73,9 @@ export const absoluteBreakoutWidth = (layout, containerWidth) => {
73
73
  return parseInt(breakoutWidth, 10);
74
74
  };
75
75
  export { breakoutConsts };
76
- export const calcWideWidth = breakoutConsts.calcWideWidth;
77
- export const calcBreakoutWidth = breakoutConsts.calcBreakoutWidth;
78
- export const calcBreakoutWithCustomWidth = breakoutConsts.calcBreakoutWithCustomWidth;
76
+ export const calcWideWidth = breakoutConsts.calcWideWidth(breakoutConsts);
77
+ export const calcBreakoutWidth = breakoutConsts.calcBreakoutWidth(breakoutConsts);
78
+ export const calcBreakoutWithCustomWidth = breakoutConsts.calcBreakoutWithCustomWidth(breakoutConsts);
79
79
  export function calculateBreakoutStyles({
80
80
  mode,
81
81
  widthStateLineLength,
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "107.1.0";
10
+ var packageVersion = "107.2.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -1,6 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useCallback, useMemo, useState } from 'react';
3
- import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
3
+ import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
6
  export var SNAP_GAP = 8;
5
7
  var GUIDELINE_KEYS = {
6
8
  lineLength: 'grid',
@@ -26,13 +28,20 @@ export function useBreakoutGuidelines(getEditorWidth, isResizing) {
26
28
  var _ref = widthState || {},
27
29
  width = _ref.width,
28
30
  lineLength = _ref.lineLength;
29
- var wide = lineLength ? Math.round(lineLength * breakoutWideScaleRatio) : undefined;
31
+ var wideCalWithRatio = lineLength ? Math.round(lineLength * breakoutWideScaleRatio) : undefined;
32
+ // When page is full width, lineLength from widthState can be much wider than 760.
33
+ // But the lineLength variable here is being used like a const 760.
34
+ // when the page is full width, the calculation of wide is wrong.
35
+ // Actuall the wide is the wide breakout point, which is
36
+ var wide = editorExperiment('single_column_layouts', true) && fg('platform_editor_layout_guideline_full_width_fix') ? akEditorCalculatedWideLayoutWidth : wideCalWithRatio;
30
37
  var layoutCalculatedWidth = width ? width - (akEditorGutterPaddingDynamic() + dynamicFullWidthGuidelineOffset) * 2 : undefined;
31
38
  var fullWidth = width && layoutCalculatedWidth ? Math.min(layoutCalculatedWidth, akEditorFullWidthLayoutWidth) : undefined;
32
39
  return {
33
40
  wide: wide,
34
41
  fullWidth: fullWidth,
35
- lineLength: lineLength
42
+ // When page is full width, lineLength from widthState can be much wider than 760.
43
+ // But the lineLength variable here is being used like a const 760.
44
+ lineLength: editorExperiment('single_column_layouts', true) && fg('platform_editor_layout_guideline_full_width_fix') ? akEditorDefaultLayoutWidth : lineLength
36
45
  };
37
46
  }, [widthState, isResizing, dynamicFullWidthGuidelineOffset]),
38
47
  lineLength = _useMemo.lineLength,
@@ -41,7 +50,7 @@ export function useBreakoutGuidelines(getEditorWidth, isResizing) {
41
50
 
42
51
  // calculate snapping width
43
52
  var defaultSnappingWidths = useMemo(function () {
44
- if (!fullWidth || !wide || !lineLength || fullWidth <= lineLength) {
53
+ if (!fullWidth || !wide || !lineLength || fullWidth <= (editorExperiment('single_column_layouts', true) && fg('platform_editor_layout_guideline_full_width_fix') ? akEditorDefaultLayoutWidth : lineLength)) {
45
54
  return null;
46
55
  }
47
56
  if (fullWidth - wide > SNAP_GAP) {
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "107.1.0";
23
+ var packageVersion = "107.2.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -22,48 +22,56 @@ var breakoutConsts = {
22
22
  /**
23
23
  * This function can return percentage value or px value depending upon the inputs
24
24
  */
25
- calcBreakoutWidth: function calcBreakoutWidth(layout, containerWidth, padding) {
26
- var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
27
- switch (layout) {
28
- case 'full-width':
29
- return "".concat(Math.min(effectiveFullWidth, breakoutConsts.fullWidthLayoutWidth), "px");
30
- case 'wide':
31
- if (effectiveFullWidth <= 0) {
32
- return '100%';
33
- }
34
- var wideWidth = breakoutConsts.calcWideWidth(containerWidth, undefined, undefined, padding);
35
- if (wideWidth.endsWith('%')) {
25
+ calcBreakoutWidth: function calcBreakoutWidth(breakoutConsts) {
26
+ return function (layout, containerWidth, padding) {
27
+ var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
28
+ switch (layout) {
29
+ case 'full-width':
36
30
  return "".concat(Math.min(effectiveFullWidth, breakoutConsts.fullWidthLayoutWidth), "px");
37
- }
38
- return wideWidth;
39
- default:
40
- return '100%';
41
- }
31
+ case 'wide':
32
+ if (effectiveFullWidth <= 0) {
33
+ return '100%';
34
+ }
35
+ var wideWidth = breakoutConsts.calcWideWidth(breakoutConsts)(containerWidth, undefined, undefined, padding);
36
+ if (wideWidth.endsWith('%')) {
37
+ return "".concat(Math.min(effectiveFullWidth, breakoutConsts.fullWidthLayoutWidth), "px");
38
+ }
39
+ return wideWidth;
40
+ default:
41
+ return '100%';
42
+ }
43
+ };
42
44
  },
43
- calcBreakoutWithCustomWidth: function calcBreakoutWithCustomWidth(mode, width, editorContainerWidth) {
44
- if (width !== null && width > 0) {
45
- var effectiveFullWidth = editorContainerWidth - breakoutConsts.padding;
46
- // if below 0 then expect we're rendering in SSR
47
- return "".concat(Math.min(width, effectiveFullWidth), "px");
48
- }
49
- return breakoutConsts.calcBreakoutWidth(mode, editorContainerWidth);
45
+ calcBreakoutWithCustomWidth: function calcBreakoutWithCustomWidth(breakoutConsts) {
46
+ return function (mode, width, editorContainerWidth) {
47
+ if (width !== null && width > 0) {
48
+ var effectiveFullWidth = editorContainerWidth - breakoutConsts.padding;
49
+ // if below 0 then expect we're rendering in SSR
50
+ return "".concat(Math.min(width, effectiveFullWidth), "px");
51
+ }
52
+ return breakoutConsts.calcBreakoutWidth(breakoutConsts)(mode, editorContainerWidth);
53
+ };
50
54
  },
51
- calcLineLength: function calcLineLength() {
52
- return breakoutConsts.defaultLayoutWidth;
55
+ calcLineLength: function calcLineLength(breakoutConsts) {
56
+ return function () {
57
+ return breakoutConsts.defaultLayoutWidth;
58
+ };
53
59
  },
54
- calcWideWidth: function calcWideWidth() {
55
- var containerWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : breakoutConsts.defaultLayoutWidth;
56
- var maxWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
57
- var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '100%';
58
- var padding = arguments.length > 3 ? arguments[3] : undefined;
59
- var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
60
- var layoutMaxWidth = breakoutConsts.mapBreakpointToLayoutMaxWidth(breakoutConsts.getBreakpoint(containerWidth));
61
- var wideWidth = Math.min(Math.ceil(layoutMaxWidth * breakoutConsts.wideScaleRatio), effectiveFullWidth);
62
- return layoutMaxWidth > wideWidth ? fallback : "".concat(Math.min(maxWidth, wideWidth), "px");
60
+ calcWideWidth: function calcWideWidth(breakoutConsts) {
61
+ return function () {
62
+ var containerWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : breakoutConsts.defaultLayoutWidth;
63
+ var maxWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
64
+ var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '100%';
65
+ var padding = arguments.length > 3 ? arguments[3] : undefined;
66
+ var effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
67
+ var layoutMaxWidth = breakoutConsts.mapBreakpointToLayoutMaxWidth(breakoutConsts.getBreakpoint(containerWidth));
68
+ var wideWidth = Math.min(Math.ceil(layoutMaxWidth * breakoutConsts.wideScaleRatio), effectiveFullWidth);
69
+ return layoutMaxWidth > wideWidth ? fallback : "".concat(Math.min(maxWidth, wideWidth), "px");
70
+ };
63
71
  }
64
72
  };
65
73
  export var absoluteBreakoutWidth = function absoluteBreakoutWidth(layout, containerWidth) {
66
- var breakoutWidth = breakoutConsts.calcBreakoutWidth(layout, containerWidth);
74
+ var breakoutWidth = breakoutConsts.calcBreakoutWidth(breakoutConsts)(layout, containerWidth);
67
75
 
68
76
  // If it's percent, map to max layout size
69
77
  if (breakoutWidth.endsWith('%')) {
@@ -79,9 +87,9 @@ export var absoluteBreakoutWidth = function absoluteBreakoutWidth(layout, contai
79
87
  return parseInt(breakoutWidth, 10);
80
88
  };
81
89
  export { breakoutConsts };
82
- export var calcWideWidth = breakoutConsts.calcWideWidth;
83
- export var calcBreakoutWidth = breakoutConsts.calcBreakoutWidth;
84
- export var calcBreakoutWithCustomWidth = breakoutConsts.calcBreakoutWithCustomWidth;
90
+ export var calcWideWidth = breakoutConsts.calcWideWidth(breakoutConsts);
91
+ export var calcBreakoutWidth = breakoutConsts.calcBreakoutWidth(breakoutConsts);
92
+ export var calcBreakoutWithCustomWidth = breakoutConsts.calcBreakoutWithCustomWidth(breakoutConsts);
85
93
  export function calculateBreakoutStyles(_ref) {
86
94
  var mode = _ref.mode,
87
95
  widthStateLineLength = _ref.widthStateLineLength,
@@ -17,9 +17,9 @@ export type BreakoutConstsType = {
17
17
  mapBreakpointToLayoutMaxWidth: typeof mapBreakpointToLayoutMaxWidth;
18
18
  getBreakpoint: typeof getBreakpoint;
19
19
  calcBreakoutWidth: any;
20
- calcBreakoutWithCustomWidth: (mode: 'full-width' | 'wide', width: number | null, editorContainerWidth: number) => string;
21
- calcLineLength: () => number;
22
- calcWideWidth: (containerWidth?: number, maxWidth?: number, fallback?: string, padding?: number) => string;
20
+ calcBreakoutWithCustomWidth: (breakoutConsts: BreakoutConstsType) => (mode: 'full-width' | 'wide', width: number | null, editorContainerWidth: number) => string;
21
+ calcLineLength: (breakoutConsts: BreakoutConstsType) => () => number;
22
+ calcWideWidth: (breakoutConsts: BreakoutConstsType) => (containerWidth?: number, maxWidth?: number, fallback?: string, padding?: number) => string;
23
23
  };
24
24
  declare const breakoutConsts: BreakoutConstsType;
25
25
  export declare const absoluteBreakoutWidth: (layout: 'full-width' | 'wide' | string, containerWidth: number) => number;
@@ -17,9 +17,9 @@ export type BreakoutConstsType = {
17
17
  mapBreakpointToLayoutMaxWidth: typeof mapBreakpointToLayoutMaxWidth;
18
18
  getBreakpoint: typeof getBreakpoint;
19
19
  calcBreakoutWidth: any;
20
- calcBreakoutWithCustomWidth: (mode: 'full-width' | 'wide', width: number | null, editorContainerWidth: number) => string;
21
- calcLineLength: () => number;
22
- calcWideWidth: (containerWidth?: number, maxWidth?: number, fallback?: string, padding?: number) => string;
20
+ calcBreakoutWithCustomWidth: (breakoutConsts: BreakoutConstsType) => (mode: 'full-width' | 'wide', width: number | null, editorContainerWidth: number) => string;
21
+ calcLineLength: (breakoutConsts: BreakoutConstsType) => () => number;
22
+ calcWideWidth: (breakoutConsts: BreakoutConstsType) => (containerWidth?: number, maxWidth?: number, fallback?: string, padding?: number) => string;
23
23
  };
24
24
  declare const breakoutConsts: BreakoutConstsType;
25
25
  export declare const absoluteBreakoutWidth: (layout: 'full-width' | 'wide' | string, containerWidth: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "107.1.1",
3
+ "version": "107.2.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -147,12 +147,12 @@
147
147
  "@atlaskit/link-datasource": "^4.11.0",
148
148
  "@atlaskit/link-picker": "^3.5.0",
149
149
  "@atlaskit/media-card": "^79.3.0",
150
- "@atlaskit/media-client": "^34.0.0",
150
+ "@atlaskit/media-client": "^34.1.0",
151
151
  "@atlaskit/media-client-react": "^4.1.0",
152
152
  "@atlaskit/media-common": "^12.2.0",
153
153
  "@atlaskit/media-file-preview": "^0.11.0",
154
154
  "@atlaskit/media-picker": "^70.0.0",
155
- "@atlaskit/media-ui": "^28.3.0",
155
+ "@atlaskit/media-ui": "^28.4.0",
156
156
  "@atlaskit/media-viewer": "^52.3.0",
157
157
  "@atlaskit/mention": "^24.2.0",
158
158
  "@atlaskit/menu": "^8.0.0",
@@ -161,16 +161,16 @@
161
161
  "@atlaskit/platform-feature-flags-react": "^0.2.0",
162
162
  "@atlaskit/popper": "^7.0.0",
163
163
  "@atlaskit/primitives": "^14.9.0",
164
- "@atlaskit/profilecard": "^23.20.0",
164
+ "@atlaskit/profilecard": "^23.21.0",
165
165
  "@atlaskit/react-ufo": "^3.13.0",
166
166
  "@atlaskit/section-message": "^8.2.0",
167
- "@atlaskit/smart-card": "^38.13.0",
167
+ "@atlaskit/smart-card": "^38.14.0",
168
168
  "@atlaskit/smart-user-picker": "^8.0.0",
169
169
  "@atlaskit/spinner": "^18.0.0",
170
170
  "@atlaskit/task-decision": "^19.2.0",
171
171
  "@atlaskit/textfield": "^8.0.0",
172
172
  "@atlaskit/theme": "^18.0.0",
173
- "@atlaskit/tmp-editor-statsig": "^8.0.0",
173
+ "@atlaskit/tmp-editor-statsig": "^8.1.0",
174
174
  "@atlaskit/tokens": "^5.4.0",
175
175
  "@atlaskit/tooltip": "^20.3.0",
176
176
  "@atlaskit/width-detector": "^5.0.0",
@@ -299,6 +299,9 @@
299
299
  "platform_editor_inline_node_virt_threshold_override": {
300
300
  "type": "boolean"
301
301
  },
302
+ "platform_editor_layout_guideline_full_width_fix": {
303
+ "type": "boolean"
304
+ },
302
305
  "confluence-issue-terminology-refresh": {
303
306
  "type": "boolean"
304
307
  },
@@ -314,9 +317,6 @@
314
317
  "platform_editor_nested_dnd_styles_changes": {
315
318
  "type": "boolean"
316
319
  },
317
- "platform_editor_lcm_nested_panel_icon_fix": {
318
- "type": "boolean"
319
- },
320
320
  "editor_a11y_aria_label_removal_popup": {
321
321
  "type": "boolean"
322
322
  },