@atlaskit/editor-common 102.13.11 → 102.14.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,20 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 102.14.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
+ - [#132269](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132269)
14
+ [`f6984f0b31c02`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f6984f0b31c02) -
15
+ [ux] Fixed alignment of the icon in OpenButtonOverlay on header link.
16
+ - Updated dependencies
17
+
3
18
  ## 102.13.11
4
19
 
5
20
  ### Patch Changes
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  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; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "102.13.11";
20
+ var packageVersion = "102.14.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -16,6 +16,7 @@ var _analytics = require("../analytics");
16
16
  var _styles = require("../styles");
17
17
  var _browser = require("../utils/browser");
18
18
  var _Resizer = _interopRequireDefault(require("./Resizer"));
19
+ var _useBreakoutGuidelines = require("./useBreakoutGuidelines");
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
  var breakoutSupportedNodes = ['layoutSection', 'expand', 'codeBlock'];
@@ -89,6 +90,7 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
89
90
  disabled = _ref.disabled,
90
91
  getEditorWidth = _ref.getEditorWidth,
91
92
  parentRef = _ref.parentRef,
93
+ displayGuidelines = _ref.displayGuidelines,
92
94
  editorAnalyticsApi = _ref.editorAnalyticsApi,
93
95
  displayGapCursor = _ref.displayGapCursor;
94
96
  var _useState = (0, _react.useState)({
@@ -104,6 +106,16 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
104
106
  setResizingState = _useState2[1];
105
107
  var areResizeMetaKeysPressed = (0, _react.useRef)(false);
106
108
  var resizerRef = (0, _react.useRef)(null);
109
+ var _useBreakoutGuideline = (0, _useBreakoutGuidelines.useBreakoutGuidelines)(getEditorWidth, isResizing && (0, _experiments.editorExperiment)('single_column_layouts', true)),
110
+ snaps = _useBreakoutGuideline.snaps,
111
+ currentLayout = _useBreakoutGuideline.currentLayout,
112
+ guidelines = _useBreakoutGuideline.guidelines,
113
+ setCurrentWidth = _useBreakoutGuideline.setCurrentWidth;
114
+ (0, _react.useEffect)(function () {
115
+ if (displayGuidelines) {
116
+ displayGuidelines(guidelines || []);
117
+ }
118
+ }, [displayGuidelines, guidelines]);
107
119
 
108
120
  // Relying on re-renders caused by selection changes inside/around node
109
121
  var isSelectionInNode = (0, _react.useMemo)(function () {
@@ -140,6 +152,12 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
140
152
  });
141
153
  dispatch(state.tr.setMeta('is-resizer-resizing', true));
142
154
  }, [getEditorWidth, editorView, displayGapCursor]);
155
+ var handleResize = (0, _react.useCallback)(function (originalState, delta) {
156
+ if ((0, _experiments.editorExperiment)('single_column_layouts', true)) {
157
+ var newWidth = originalState.width + delta.width;
158
+ setCurrentWidth(newWidth);
159
+ }
160
+ }, [setCurrentWidth]);
143
161
  var handleResizeStop = (0, _react.useCallback)(function (originalState, delta) {
144
162
  var newWidth = originalState.width + delta.width;
145
163
  var pos = getPos();
@@ -152,21 +170,29 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
152
170
  var node = state.doc.nodeAt(pos);
153
171
  var newTr = state.tr;
154
172
  if (node && breakoutSupportedNodes.includes(node.type.name)) {
155
- var newBreakoutWidth = Math.max(newWidth, _editorSharedStyles.akEditorDefaultLayoutWidth);
156
- newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
157
- width: newBreakoutWidth
158
- })]);
159
- var breakoutResizePayload = {
160
- action: _analytics.ACTION.RESIZED,
161
- actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
162
- eventType: _analytics.EVENT_TYPE.TRACK,
163
- attributes: {
164
- nodeType: node.type.name,
165
- prevWidth: originalState.width,
166
- newWidth: newBreakoutWidth
167
- }
168
- };
169
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
173
+ if (currentLayout && ['wide', 'full-width'].includes(currentLayout) && (0, _experiments.editorExperiment)('single_column_layouts', true)) {
174
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
175
+ mode: currentLayout,
176
+ width: null
177
+ })]);
178
+ } else {
179
+ var newBreakoutWidth = Math.max(newWidth, _editorSharedStyles.akEditorDefaultLayoutWidth);
180
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
181
+ width: newBreakoutWidth,
182
+ mode: null
183
+ })]);
184
+ var breakoutResizePayload = {
185
+ action: _analytics.ACTION.RESIZED,
186
+ actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
187
+ eventType: _analytics.EVENT_TYPE.TRACK,
188
+ attributes: {
189
+ nodeType: node.type.name,
190
+ prevWidth: originalState.width,
191
+ newWidth: newBreakoutWidth
192
+ }
193
+ };
194
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
195
+ }
170
196
  }
171
197
  newTr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
172
198
  displayGapCursor(true);
@@ -176,7 +202,8 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
176
202
  minWidth: undefined,
177
203
  maxWidth: undefined
178
204
  });
179
- }, [getPos, editorView, displayGapCursor, editorAnalyticsApi]);
205
+ setCurrentWidth(null);
206
+ }, [getPos, editorView, displayGapCursor, setCurrentWidth, currentLayout, editorAnalyticsApi]);
180
207
  var handleEscape = (0, _react.useCallback)(function () {
181
208
  editorView === null || editorView === void 0 || editorView.focus();
182
209
  }, [editorView]);
@@ -282,6 +309,8 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
282
309
  left: true,
283
310
  right: true
284
311
  },
312
+ snap: snaps || undefined,
313
+ snapGap: _useBreakoutGuidelines.SNAP_GAP,
285
314
  handleStyles: getHandleStyle(nodeType),
286
315
  minWidth: minWidth,
287
316
  maxWidth: maxWidth
@@ -290,6 +319,7 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
290
319
  style: isResizing ? resizingStyles : defaultStyles,
291
320
  handleResizeStart: handleResizeStart,
292
321
  handleResizeStop: handleResizeStop,
322
+ handleResize: handleResize,
293
323
  childrenDOMRef: getRef,
294
324
  resizeRatio: 2,
295
325
  isHandleVisible: isSelectionInNode,
@@ -22,5 +22,12 @@ Object.defineProperty(exports, "ignoreResizerMutations", {
22
22
  return _BreakoutResizer.ignoreResizerMutations;
23
23
  }
24
24
  });
25
+ Object.defineProperty(exports, "useBreakoutGuidelines", {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _useBreakoutGuidelines.useBreakoutGuidelines;
29
+ }
30
+ });
25
31
  var _Resizer = _interopRequireDefault(require("./Resizer"));
26
- var _BreakoutResizer = require("./BreakoutResizer");
32
+ var _BreakoutResizer = require("./BreakoutResizer");
33
+ var _useBreakoutGuidelines = require("./useBreakoutGuidelines");
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SNAP_GAP = void 0;
8
+ exports.useBreakoutGuidelines = useBreakoutGuidelines;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = require("react");
11
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
+ var SNAP_GAP = exports.SNAP_GAP = 8;
13
+ var roundToNearest = function roundToNearest(value) {
14
+ var interval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5;
15
+ return Math.round(value / interval) * interval;
16
+ };
17
+ function useBreakoutGuidelines(getEditorWidth, isResizing) {
18
+ var widthState = getEditorWidth();
19
+ var _useMemo = (0, _react.useMemo)(function () {
20
+ if (!isResizing) {
21
+ return {};
22
+ }
23
+ var _ref = widthState || {},
24
+ width = _ref.width,
25
+ lineLength = _ref.lineLength;
26
+ var wide = lineLength ? Math.round(lineLength * _editorSharedStyles.breakoutWideScaleRatio) : undefined;
27
+ var fullWidth = width ? Math.min(width - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2) : undefined;
28
+ return {
29
+ wide: wide,
30
+ fullWidth: fullWidth,
31
+ lineLength: lineLength
32
+ };
33
+ }, [widthState, isResizing]),
34
+ lineLength = _useMemo.lineLength,
35
+ wide = _useMemo.wide,
36
+ fullWidth = _useMemo.fullWidth;
37
+ var snaps = (0, _react.useMemo)(function () {
38
+ if (!isResizing) {
39
+ return null;
40
+ }
41
+ var xSnaps = [];
42
+ if (typeof lineLength === 'number') {
43
+ xSnaps.push(lineLength);
44
+ }
45
+ if (typeof wide === 'number') {
46
+ xSnaps.push(wide);
47
+ }
48
+ if (typeof fullWidth === 'number') {
49
+ xSnaps.push(fullWidth - _editorSharedStyles.akEditorGutterPadding);
50
+ }
51
+ return {
52
+ x: xSnaps
53
+ };
54
+ }, [isResizing, wide, fullWidth, lineLength]);
55
+ var _useState = (0, _react.useState)(null),
56
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
57
+ currentLayout = _useState2[0],
58
+ setCurrentLayout = _useState2[1];
59
+ var guidelines = (0, _react.useMemo)(function () {
60
+ var guidelines = [];
61
+ if (!isResizing) {
62
+ return guidelines;
63
+ }
64
+ if (lineLength) {
65
+ guidelines.push({
66
+ key: 'grid_left',
67
+ position: {
68
+ x: -roundToNearest(lineLength / 2)
69
+ },
70
+ active: currentLayout === 'center'
71
+ });
72
+ guidelines.push({
73
+ key: 'grid_right',
74
+ position: {
75
+ x: roundToNearest(lineLength / 2)
76
+ },
77
+ active: currentLayout === 'center'
78
+ });
79
+ }
80
+ if (wide) {
81
+ guidelines.push({
82
+ key: 'wide_left',
83
+ position: {
84
+ x: -roundToNearest(wide / 2)
85
+ },
86
+ active: currentLayout === 'wide'
87
+ });
88
+ guidelines.push({
89
+ key: 'wide_right',
90
+ position: {
91
+ x: roundToNearest(wide / 2)
92
+ },
93
+ active: currentLayout === 'wide'
94
+ });
95
+ }
96
+ if (fullWidth) {
97
+ guidelines.push({
98
+ key: 'full_width_left',
99
+ position: {
100
+ x: -roundToNearest(fullWidth / 2)
101
+ },
102
+ active: currentLayout === 'full-width'
103
+ });
104
+ guidelines.push({
105
+ key: 'full_width_right',
106
+ position: {
107
+ x: roundToNearest(fullWidth) / 2
108
+ },
109
+ active: currentLayout === 'full-width'
110
+ });
111
+ }
112
+ return guidelines;
113
+ }, [isResizing, lineLength, wide, fullWidth, currentLayout]);
114
+ var setCurrentWidth = (0, _react.useCallback)(function (newWidth) {
115
+ if (typeof newWidth !== 'number') {
116
+ setCurrentLayout(null);
117
+ return;
118
+ }
119
+ if (lineLength && Math.abs(newWidth - lineLength) < SNAP_GAP / 2) {
120
+ setCurrentLayout('center');
121
+ } else if (wide && Math.abs(newWidth - wide) < SNAP_GAP / 2) {
122
+ setCurrentLayout('wide');
123
+ } else if (fullWidth && (Math.abs(newWidth - fullWidth + _editorSharedStyles.akEditorGutterPadding) < SNAP_GAP / 2 || newWidth >= fullWidth)) {
124
+ setCurrentLayout('full-width');
125
+ } else {
126
+ setCurrentLayout(null);
127
+ }
128
+ }, [lineLength, wide, fullWidth]);
129
+ return {
130
+ snaps: snaps,
131
+ currentLayout: currentLayout,
132
+ guidelines: guidelines,
133
+ setCurrentWidth: setCurrentWidth
134
+ };
135
+ }
@@ -9,6 +9,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = require("@emotion/react");
10
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
13
  var _smartCard = require("./smart-card");
13
14
  var _templateObject; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
15
  var DATASOURCE_INNER_CONTAINER_CLASSNAME = exports.DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-wrap';
@@ -16,7 +17,7 @@ var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = exports.FLOATING_TOOLBAR_LINKPICKER_
16
17
 
17
18
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
18
19
  var smartCardStyles = exports.smartCardStyles = function smartCardStyles() {
19
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\n\t\t\t\tinput::selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t\tinput::-moz-selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), _smartCard.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, #F8E6A0)", ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, #B38600)", ";\n box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)", ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER,
20
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\n\t\t\t\tinput::selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t\tinput::-moz-selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), _smartCard.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, #F8E6A0)", ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, #B38600)", ";\n box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)", ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? "[data-inlinecard-button-overlay='icon-wrapper-line-height'] span {\n\t\t\t\tline-height: 0;\n\t\t\t}" : '', _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER,
20
21
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
21
22
  (0, _platformFeatureFlags.fg)('linking_platform_smart_links_in_live_pages') ? 'text' : 'pointer',
22
23
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
@@ -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 = "102.13.11";
26
+ var packageVersion = "102.14.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -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 = "102.13.11";
4
+ const packageVersion = "102.14.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useMemo, useRef, useState, useLayoutEffect } from 'react';
1
+ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
2
2
  import { bind, bindAll } from 'bind-event-listener';
3
3
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -7,6 +7,7 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
7
7
  import { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '../styles';
8
8
  import { browser } from '../utils/browser';
9
9
  import Resizer from './Resizer';
10
+ import { SNAP_GAP, useBreakoutGuidelines } from './useBreakoutGuidelines';
10
11
  const breakoutSupportedNodes = ['layoutSection', 'expand', 'codeBlock'];
11
12
  const getHandleStyle = node => {
12
13
  const layoutMarginOffset = 12;
@@ -78,6 +79,7 @@ const BreakoutResizer = ({
78
79
  disabled,
79
80
  getEditorWidth,
80
81
  parentRef,
82
+ displayGuidelines,
81
83
  editorAnalyticsApi,
82
84
  displayGapCursor
83
85
  }) => {
@@ -92,6 +94,17 @@ const BreakoutResizer = ({
92
94
  });
93
95
  const areResizeMetaKeysPressed = useRef(false);
94
96
  const resizerRef = useRef(null);
97
+ const {
98
+ snaps,
99
+ currentLayout,
100
+ guidelines,
101
+ setCurrentWidth
102
+ } = useBreakoutGuidelines(getEditorWidth, isResizing && editorExperiment('single_column_layouts', true));
103
+ useEffect(() => {
104
+ if (displayGuidelines) {
105
+ displayGuidelines(guidelines || []);
106
+ }
107
+ }, [displayGuidelines, guidelines]);
95
108
 
96
109
  // Relying on re-renders caused by selection changes inside/around node
97
110
  const isSelectionInNode = useMemo(() => {
@@ -131,6 +144,12 @@ const BreakoutResizer = ({
131
144
  });
132
145
  dispatch(state.tr.setMeta('is-resizer-resizing', true));
133
146
  }, [getEditorWidth, editorView, displayGapCursor]);
147
+ const handleResize = useCallback((originalState, delta) => {
148
+ if (editorExperiment('single_column_layouts', true)) {
149
+ const newWidth = originalState.width + delta.width;
150
+ setCurrentWidth(newWidth);
151
+ }
152
+ }, [setCurrentWidth]);
134
153
  const handleResizeStop = useCallback((originalState, delta) => {
135
154
  const newWidth = originalState.width + delta.width;
136
155
  const pos = getPos();
@@ -147,21 +166,29 @@ const BreakoutResizer = ({
147
166
  const node = state.doc.nodeAt(pos);
148
167
  const newTr = state.tr;
149
168
  if (node && breakoutSupportedNodes.includes(node.type.name)) {
150
- const newBreakoutWidth = Math.max(newWidth, akEditorDefaultLayoutWidth);
151
- newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
152
- width: newBreakoutWidth
153
- })]);
154
- const breakoutResizePayload = {
155
- action: ACTION.RESIZED,
156
- actionSubject: ACTION_SUBJECT.ELEMENT,
157
- eventType: EVENT_TYPE.TRACK,
158
- attributes: {
159
- nodeType: node.type.name,
160
- prevWidth: originalState.width,
161
- newWidth: newBreakoutWidth
162
- }
163
- };
164
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
169
+ if (currentLayout && ['wide', 'full-width'].includes(currentLayout) && editorExperiment('single_column_layouts', true)) {
170
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
171
+ mode: currentLayout,
172
+ width: null
173
+ })]);
174
+ } else {
175
+ const newBreakoutWidth = Math.max(newWidth, akEditorDefaultLayoutWidth);
176
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
177
+ width: newBreakoutWidth,
178
+ mode: null
179
+ })]);
180
+ const breakoutResizePayload = {
181
+ action: ACTION.RESIZED,
182
+ actionSubject: ACTION_SUBJECT.ELEMENT,
183
+ eventType: EVENT_TYPE.TRACK,
184
+ attributes: {
185
+ nodeType: node.type.name,
186
+ prevWidth: originalState.width,
187
+ newWidth: newBreakoutWidth
188
+ }
189
+ };
190
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
191
+ }
165
192
  }
166
193
  newTr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
167
194
  displayGapCursor(true);
@@ -171,7 +198,8 @@ const BreakoutResizer = ({
171
198
  minWidth: undefined,
172
199
  maxWidth: undefined
173
200
  });
174
- }, [getPos, editorView, displayGapCursor, editorAnalyticsApi]);
201
+ setCurrentWidth(null);
202
+ }, [getPos, editorView, displayGapCursor, setCurrentWidth, currentLayout, editorAnalyticsApi]);
175
203
  const handleEscape = useCallback(() => {
176
204
  editorView === null || editorView === void 0 ? void 0 : editorView.focus();
177
205
  }, [editorView]);
@@ -275,6 +303,8 @@ const BreakoutResizer = ({
275
303
  left: true,
276
304
  right: true
277
305
  },
306
+ snap: snaps || undefined,
307
+ snapGap: SNAP_GAP,
278
308
  handleStyles: getHandleStyle(nodeType),
279
309
  minWidth: minWidth,
280
310
  maxWidth: maxWidth
@@ -283,6 +313,7 @@ const BreakoutResizer = ({
283
313
  style: isResizing ? resizingStyles : defaultStyles,
284
314
  handleResizeStart: handleResizeStart,
285
315
  handleResizeStop: handleResizeStop,
316
+ handleResize: handleResize,
286
317
  childrenDOMRef: getRef,
287
318
  resizeRatio: 2,
288
319
  isHandleVisible: isSelectionInNode,
@@ -2,4 +2,5 @@
2
2
  /* eslint-disable @atlaskit/editor/no-re-export */
3
3
 
4
4
  export { default as ResizerNext } from './Resizer';
5
- export { BreakoutResizer, ignoreResizerMutations } from './BreakoutResizer';
5
+ export { BreakoutResizer, ignoreResizerMutations } from './BreakoutResizer';
6
+ export { useBreakoutGuidelines } from './useBreakoutGuidelines';
@@ -0,0 +1,122 @@
1
+ import { useCallback, useMemo, useState } from 'react';
2
+ import { akEditorGutterPadding, akEditorGutterPaddingDynamic, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
3
+ export const SNAP_GAP = 8;
4
+ const roundToNearest = (value, interval = 0.5) => Math.round(value / interval) * interval;
5
+ export function useBreakoutGuidelines(getEditorWidth, isResizing) {
6
+ const widthState = getEditorWidth();
7
+ const {
8
+ lineLength,
9
+ wide,
10
+ fullWidth
11
+ } = useMemo(() => {
12
+ if (!isResizing) {
13
+ return {};
14
+ }
15
+ const {
16
+ width,
17
+ lineLength
18
+ } = widthState || {};
19
+ const wide = lineLength ? Math.round(lineLength * breakoutWideScaleRatio) : undefined;
20
+ const fullWidth = width ? Math.min(width - akEditorGutterPaddingDynamic() * 2) : undefined;
21
+ return {
22
+ wide,
23
+ fullWidth,
24
+ lineLength
25
+ };
26
+ }, [widthState, isResizing]);
27
+ const snaps = useMemo(() => {
28
+ if (!isResizing) {
29
+ return null;
30
+ }
31
+ const xSnaps = [];
32
+ if (typeof lineLength === 'number') {
33
+ xSnaps.push(lineLength);
34
+ }
35
+ if (typeof wide === 'number') {
36
+ xSnaps.push(wide);
37
+ }
38
+ if (typeof fullWidth === 'number') {
39
+ xSnaps.push(fullWidth - akEditorGutterPadding);
40
+ }
41
+ return {
42
+ x: xSnaps
43
+ };
44
+ }, [isResizing, wide, fullWidth, lineLength]);
45
+ const [currentLayout, setCurrentLayout] = useState(null);
46
+ const guidelines = useMemo(() => {
47
+ const guidelines = [];
48
+ if (!isResizing) {
49
+ return guidelines;
50
+ }
51
+ if (lineLength) {
52
+ guidelines.push({
53
+ key: 'grid_left',
54
+ position: {
55
+ x: -roundToNearest(lineLength / 2)
56
+ },
57
+ active: currentLayout === 'center'
58
+ });
59
+ guidelines.push({
60
+ key: 'grid_right',
61
+ position: {
62
+ x: roundToNearest(lineLength / 2)
63
+ },
64
+ active: currentLayout === 'center'
65
+ });
66
+ }
67
+ if (wide) {
68
+ guidelines.push({
69
+ key: 'wide_left',
70
+ position: {
71
+ x: -roundToNearest(wide / 2)
72
+ },
73
+ active: currentLayout === 'wide'
74
+ });
75
+ guidelines.push({
76
+ key: 'wide_right',
77
+ position: {
78
+ x: roundToNearest(wide / 2)
79
+ },
80
+ active: currentLayout === 'wide'
81
+ });
82
+ }
83
+ if (fullWidth) {
84
+ guidelines.push({
85
+ key: 'full_width_left',
86
+ position: {
87
+ x: -roundToNearest(fullWidth / 2)
88
+ },
89
+ active: currentLayout === 'full-width'
90
+ });
91
+ guidelines.push({
92
+ key: 'full_width_right',
93
+ position: {
94
+ x: roundToNearest(fullWidth) / 2
95
+ },
96
+ active: currentLayout === 'full-width'
97
+ });
98
+ }
99
+ return guidelines;
100
+ }, [isResizing, lineLength, wide, fullWidth, currentLayout]);
101
+ const setCurrentWidth = useCallback(newWidth => {
102
+ if (typeof newWidth !== 'number') {
103
+ setCurrentLayout(null);
104
+ return;
105
+ }
106
+ if (lineLength && Math.abs(newWidth - lineLength) < SNAP_GAP / 2) {
107
+ setCurrentLayout('center');
108
+ } else if (wide && Math.abs(newWidth - wide) < SNAP_GAP / 2) {
109
+ setCurrentLayout('wide');
110
+ } else if (fullWidth && (Math.abs(newWidth - fullWidth + akEditorGutterPadding) < SNAP_GAP / 2 || newWidth >= fullWidth)) {
111
+ setCurrentLayout('full-width');
112
+ } else {
113
+ setCurrentLayout(null);
114
+ }
115
+ }, [lineLength, wide, fullWidth]);
116
+ return {
117
+ snaps,
118
+ currentLayout,
119
+ guidelines,
120
+ setCurrentWidth
121
+ };
122
+ }
@@ -2,6 +2,7 @@
2
2
  import { css } from '@emotion/react';
3
3
  import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedNodeClassName, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
6
  import { SmartCardSharedCssClassName } from './smart-card';
6
7
  export const DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-wrap';
7
8
  export const FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
@@ -29,6 +30,10 @@ export const smartCardStyles = () => css`
29
30
  }
30
31
  }
31
32
 
33
+ ${editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1') ? `[data-inlinecard-button-overlay='icon-wrapper-line-height'] span {
34
+ line-height: 0;
35
+ }` : ''}
36
+
32
37
  &.${akEditorSelectedNodeClassName} .${SmartCardSharedCssClassName.LOADER_WRAPPER} > a {
33
38
  ${getSelectionStyles([SelectionStyle.BoxShadow])}
34
39
  }
@@ -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 = "102.13.11";
16
+ const packageVersion = "102.14.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -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 = "102.13.11";
10
+ var packageVersion = "102.14.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useCallback, useMemo, useRef, useState, useLayoutEffect } from 'react';
2
+ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
3
  import { bind, bindAll } from 'bind-event-listener';
4
4
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -8,6 +8,7 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
8
8
  import { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '../styles';
9
9
  import { browser } from '../utils/browser';
10
10
  import Resizer from './Resizer';
11
+ import { SNAP_GAP, useBreakoutGuidelines } from './useBreakoutGuidelines';
11
12
  var breakoutSupportedNodes = ['layoutSection', 'expand', 'codeBlock'];
12
13
  var getHandleStyle = function getHandleStyle(node) {
13
14
  var layoutMarginOffset = 12;
@@ -79,6 +80,7 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
79
80
  disabled = _ref.disabled,
80
81
  getEditorWidth = _ref.getEditorWidth,
81
82
  parentRef = _ref.parentRef,
83
+ displayGuidelines = _ref.displayGuidelines,
82
84
  editorAnalyticsApi = _ref.editorAnalyticsApi,
83
85
  displayGapCursor = _ref.displayGapCursor;
84
86
  var _useState = useState({
@@ -94,6 +96,16 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
94
96
  setResizingState = _useState2[1];
95
97
  var areResizeMetaKeysPressed = useRef(false);
96
98
  var resizerRef = useRef(null);
99
+ var _useBreakoutGuideline = useBreakoutGuidelines(getEditorWidth, isResizing && editorExperiment('single_column_layouts', true)),
100
+ snaps = _useBreakoutGuideline.snaps,
101
+ currentLayout = _useBreakoutGuideline.currentLayout,
102
+ guidelines = _useBreakoutGuideline.guidelines,
103
+ setCurrentWidth = _useBreakoutGuideline.setCurrentWidth;
104
+ useEffect(function () {
105
+ if (displayGuidelines) {
106
+ displayGuidelines(guidelines || []);
107
+ }
108
+ }, [displayGuidelines, guidelines]);
97
109
 
98
110
  // Relying on re-renders caused by selection changes inside/around node
99
111
  var isSelectionInNode = useMemo(function () {
@@ -130,6 +142,12 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
130
142
  });
131
143
  dispatch(state.tr.setMeta('is-resizer-resizing', true));
132
144
  }, [getEditorWidth, editorView, displayGapCursor]);
145
+ var handleResize = useCallback(function (originalState, delta) {
146
+ if (editorExperiment('single_column_layouts', true)) {
147
+ var newWidth = originalState.width + delta.width;
148
+ setCurrentWidth(newWidth);
149
+ }
150
+ }, [setCurrentWidth]);
133
151
  var handleResizeStop = useCallback(function (originalState, delta) {
134
152
  var newWidth = originalState.width + delta.width;
135
153
  var pos = getPos();
@@ -142,21 +160,29 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
142
160
  var node = state.doc.nodeAt(pos);
143
161
  var newTr = state.tr;
144
162
  if (node && breakoutSupportedNodes.includes(node.type.name)) {
145
- var newBreakoutWidth = Math.max(newWidth, akEditorDefaultLayoutWidth);
146
- newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
147
- width: newBreakoutWidth
148
- })]);
149
- var breakoutResizePayload = {
150
- action: ACTION.RESIZED,
151
- actionSubject: ACTION_SUBJECT.ELEMENT,
152
- eventType: EVENT_TYPE.TRACK,
153
- attributes: {
154
- nodeType: node.type.name,
155
- prevWidth: originalState.width,
156
- newWidth: newBreakoutWidth
157
- }
158
- };
159
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
163
+ if (currentLayout && ['wide', 'full-width'].includes(currentLayout) && editorExperiment('single_column_layouts', true)) {
164
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
165
+ mode: currentLayout,
166
+ width: null
167
+ })]);
168
+ } else {
169
+ var newBreakoutWidth = Math.max(newWidth, akEditorDefaultLayoutWidth);
170
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
171
+ width: newBreakoutWidth,
172
+ mode: null
173
+ })]);
174
+ var breakoutResizePayload = {
175
+ action: ACTION.RESIZED,
176
+ actionSubject: ACTION_SUBJECT.ELEMENT,
177
+ eventType: EVENT_TYPE.TRACK,
178
+ attributes: {
179
+ nodeType: node.type.name,
180
+ prevWidth: originalState.width,
181
+ newWidth: newBreakoutWidth
182
+ }
183
+ };
184
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
185
+ }
160
186
  }
161
187
  newTr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
162
188
  displayGapCursor(true);
@@ -166,7 +192,8 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
166
192
  minWidth: undefined,
167
193
  maxWidth: undefined
168
194
  });
169
- }, [getPos, editorView, displayGapCursor, editorAnalyticsApi]);
195
+ setCurrentWidth(null);
196
+ }, [getPos, editorView, displayGapCursor, setCurrentWidth, currentLayout, editorAnalyticsApi]);
170
197
  var handleEscape = useCallback(function () {
171
198
  editorView === null || editorView === void 0 || editorView.focus();
172
199
  }, [editorView]);
@@ -272,6 +299,8 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
272
299
  left: true,
273
300
  right: true
274
301
  },
302
+ snap: snaps || undefined,
303
+ snapGap: SNAP_GAP,
275
304
  handleStyles: getHandleStyle(nodeType),
276
305
  minWidth: minWidth,
277
306
  maxWidth: maxWidth
@@ -280,6 +309,7 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
280
309
  style: isResizing ? resizingStyles : defaultStyles,
281
310
  handleResizeStart: handleResizeStart,
282
311
  handleResizeStop: handleResizeStop,
312
+ handleResize: handleResize,
283
313
  childrenDOMRef: getRef,
284
314
  resizeRatio: 2,
285
315
  isHandleVisible: isSelectionInNode,
@@ -2,4 +2,5 @@
2
2
  /* eslint-disable @atlaskit/editor/no-re-export */
3
3
 
4
4
  export { default as ResizerNext } from './Resizer';
5
- export { BreakoutResizer, ignoreResizerMutations } from './BreakoutResizer';
5
+ export { BreakoutResizer, ignoreResizerMutations } from './BreakoutResizer';
6
+ export { useBreakoutGuidelines } from './useBreakoutGuidelines';
@@ -0,0 +1,127 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useCallback, useMemo, useState } from 'react';
3
+ import { akEditorGutterPadding, akEditorGutterPaddingDynamic, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
4
+ export var SNAP_GAP = 8;
5
+ var roundToNearest = function roundToNearest(value) {
6
+ var interval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5;
7
+ return Math.round(value / interval) * interval;
8
+ };
9
+ export function useBreakoutGuidelines(getEditorWidth, isResizing) {
10
+ var widthState = getEditorWidth();
11
+ var _useMemo = useMemo(function () {
12
+ if (!isResizing) {
13
+ return {};
14
+ }
15
+ var _ref = widthState || {},
16
+ width = _ref.width,
17
+ lineLength = _ref.lineLength;
18
+ var wide = lineLength ? Math.round(lineLength * breakoutWideScaleRatio) : undefined;
19
+ var fullWidth = width ? Math.min(width - akEditorGutterPaddingDynamic() * 2) : undefined;
20
+ return {
21
+ wide: wide,
22
+ fullWidth: fullWidth,
23
+ lineLength: lineLength
24
+ };
25
+ }, [widthState, isResizing]),
26
+ lineLength = _useMemo.lineLength,
27
+ wide = _useMemo.wide,
28
+ fullWidth = _useMemo.fullWidth;
29
+ var snaps = useMemo(function () {
30
+ if (!isResizing) {
31
+ return null;
32
+ }
33
+ var xSnaps = [];
34
+ if (typeof lineLength === 'number') {
35
+ xSnaps.push(lineLength);
36
+ }
37
+ if (typeof wide === 'number') {
38
+ xSnaps.push(wide);
39
+ }
40
+ if (typeof fullWidth === 'number') {
41
+ xSnaps.push(fullWidth - akEditorGutterPadding);
42
+ }
43
+ return {
44
+ x: xSnaps
45
+ };
46
+ }, [isResizing, wide, fullWidth, lineLength]);
47
+ var _useState = useState(null),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ currentLayout = _useState2[0],
50
+ setCurrentLayout = _useState2[1];
51
+ var guidelines = useMemo(function () {
52
+ var guidelines = [];
53
+ if (!isResizing) {
54
+ return guidelines;
55
+ }
56
+ if (lineLength) {
57
+ guidelines.push({
58
+ key: 'grid_left',
59
+ position: {
60
+ x: -roundToNearest(lineLength / 2)
61
+ },
62
+ active: currentLayout === 'center'
63
+ });
64
+ guidelines.push({
65
+ key: 'grid_right',
66
+ position: {
67
+ x: roundToNearest(lineLength / 2)
68
+ },
69
+ active: currentLayout === 'center'
70
+ });
71
+ }
72
+ if (wide) {
73
+ guidelines.push({
74
+ key: 'wide_left',
75
+ position: {
76
+ x: -roundToNearest(wide / 2)
77
+ },
78
+ active: currentLayout === 'wide'
79
+ });
80
+ guidelines.push({
81
+ key: 'wide_right',
82
+ position: {
83
+ x: roundToNearest(wide / 2)
84
+ },
85
+ active: currentLayout === 'wide'
86
+ });
87
+ }
88
+ if (fullWidth) {
89
+ guidelines.push({
90
+ key: 'full_width_left',
91
+ position: {
92
+ x: -roundToNearest(fullWidth / 2)
93
+ },
94
+ active: currentLayout === 'full-width'
95
+ });
96
+ guidelines.push({
97
+ key: 'full_width_right',
98
+ position: {
99
+ x: roundToNearest(fullWidth) / 2
100
+ },
101
+ active: currentLayout === 'full-width'
102
+ });
103
+ }
104
+ return guidelines;
105
+ }, [isResizing, lineLength, wide, fullWidth, currentLayout]);
106
+ var setCurrentWidth = useCallback(function (newWidth) {
107
+ if (typeof newWidth !== 'number') {
108
+ setCurrentLayout(null);
109
+ return;
110
+ }
111
+ if (lineLength && Math.abs(newWidth - lineLength) < SNAP_GAP / 2) {
112
+ setCurrentLayout('center');
113
+ } else if (wide && Math.abs(newWidth - wide) < SNAP_GAP / 2) {
114
+ setCurrentLayout('wide');
115
+ } else if (fullWidth && (Math.abs(newWidth - fullWidth + akEditorGutterPadding) < SNAP_GAP / 2 || newWidth >= fullWidth)) {
116
+ setCurrentLayout('full-width');
117
+ } else {
118
+ setCurrentLayout(null);
119
+ }
120
+ }, [lineLength, wide, fullWidth]);
121
+ return {
122
+ snaps: snaps,
123
+ currentLayout: currentLayout,
124
+ guidelines: guidelines,
125
+ setCurrentWidth: setCurrentWidth
126
+ };
127
+ }
@@ -4,13 +4,14 @@ var _templateObject;
4
4
  import { css } from '@emotion/react';
5
5
  import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedNodeClassName, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
  import { SmartCardSharedCssClassName } from './smart-card';
8
9
  export var DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-wrap';
9
10
  export var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
10
11
 
11
12
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
12
13
  export var smartCardStyles = function smartCardStyles() {
13
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\n\t\t\t\tinput::selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t\tinput::-moz-selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, fg('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, #F8E6A0)", ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, #B38600)", ";\n box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)", ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER,
14
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\n\t\t\t\tinput::selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t\tinput::-moz-selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, fg('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, #F8E6A0)", ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, #B38600)", ";\n box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)", ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1') ? "[data-inlinecard-button-overlay='icon-wrapper-line-height'] span {\n\t\t\t\tline-height: 0;\n\t\t\t}" : '', akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER,
14
15
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
15
16
  fg('linking_platform_smart_links_in_live_pages') ? 'text' : 'pointer',
16
17
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
@@ -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 = "102.13.11";
23
+ var packageVersion = "102.14.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { EditorAnalyticsAPI } from '../analytics';
4
+ import { GuidelineConfig } from '../guideline';
4
5
  import { type EditorContainerWidth, type getPosHandlerNode } from '../types';
5
6
  type BreakoutSupportedNodes = 'layoutSection' | 'expand' | 'codeBlock';
6
7
  export declare const ignoreResizerMutations: (mutation: MutationRecord | {
@@ -13,7 +14,7 @@ export declare const ignoreResizerMutations: (mutation: MutationRecord | {
13
14
  *
14
15
  * use experiment platform_editor_advanced_layouts
15
16
  */
16
- declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, editorAnalyticsApi, displayGapCursor, }: {
17
+ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, displayGuidelines, editorAnalyticsApi, displayGapCursor, }: {
17
18
  editorView: EditorView;
18
19
  nodeType: BreakoutSupportedNodes;
19
20
  getPos: getPosHandlerNode;
@@ -22,6 +23,7 @@ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled
22
23
  getEditorWidth: () => EditorContainerWidth | undefined;
23
24
  parentRef?: HTMLElement | undefined;
24
25
  editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
26
+ displayGuidelines?: ((guidelines: GuidelineConfig[]) => void) | undefined;
25
27
  displayGapCursor: (toggle: boolean) => boolean;
26
28
  }) => React.JSX.Element;
27
29
  export { BreakoutResizer };
@@ -1,3 +1,4 @@
1
1
  export { default as ResizerNext } from './Resizer';
2
2
  export type { HandleAlignmentMethod, HandleHighlight, HandleSize, HandlePositioning, EnabledHandles, HandleResize, Position, Snap, HandleResizeStart, Dimensions, } from './types';
3
3
  export { BreakoutResizer, ignoreResizerMutations } from './BreakoutResizer';
4
+ export { useBreakoutGuidelines } from './useBreakoutGuidelines';
@@ -0,0 +1,10 @@
1
+ import type { GuidelineConfig } from '../guideline';
2
+ import type { EditorContainerWidth } from '../types';
3
+ import type { Snap } from './types';
4
+ export declare const SNAP_GAP = 8;
5
+ export declare function useBreakoutGuidelines(getEditorWidth: () => EditorContainerWidth | undefined, isResizing: boolean): {
6
+ snaps: Snap | null;
7
+ currentLayout: "wide" | "full-width" | "center" | null;
8
+ guidelines: GuidelineConfig[];
9
+ setCurrentWidth: (newWidth: number | null) => void;
10
+ };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { EditorAnalyticsAPI } from '../analytics';
4
+ import { GuidelineConfig } from '../guideline';
4
5
  import { type EditorContainerWidth, type getPosHandlerNode } from '../types';
5
6
  type BreakoutSupportedNodes = 'layoutSection' | 'expand' | 'codeBlock';
6
7
  export declare const ignoreResizerMutations: (mutation: MutationRecord | {
@@ -13,7 +14,7 @@ export declare const ignoreResizerMutations: (mutation: MutationRecord | {
13
14
  *
14
15
  * use experiment platform_editor_advanced_layouts
15
16
  */
16
- declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, editorAnalyticsApi, displayGapCursor, }: {
17
+ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, displayGuidelines, editorAnalyticsApi, displayGapCursor, }: {
17
18
  editorView: EditorView;
18
19
  nodeType: BreakoutSupportedNodes;
19
20
  getPos: getPosHandlerNode;
@@ -22,6 +23,7 @@ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled
22
23
  getEditorWidth: () => EditorContainerWidth | undefined;
23
24
  parentRef?: HTMLElement | undefined;
24
25
  editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
26
+ displayGuidelines?: ((guidelines: GuidelineConfig[]) => void) | undefined;
25
27
  displayGapCursor: (toggle: boolean) => boolean;
26
28
  }) => React.JSX.Element;
27
29
  export { BreakoutResizer };
@@ -1,3 +1,4 @@
1
1
  export { default as ResizerNext } from './Resizer';
2
2
  export type { HandleAlignmentMethod, HandleHighlight, HandleSize, HandlePositioning, EnabledHandles, HandleResize, Position, Snap, HandleResizeStart, Dimensions, } from './types';
3
3
  export { BreakoutResizer, ignoreResizerMutations } from './BreakoutResizer';
4
+ export { useBreakoutGuidelines } from './useBreakoutGuidelines';
@@ -0,0 +1,10 @@
1
+ import type { GuidelineConfig } from '../guideline';
2
+ import type { EditorContainerWidth } from '../types';
3
+ import type { Snap } from './types';
4
+ export declare const SNAP_GAP = 8;
5
+ export declare function useBreakoutGuidelines(getEditorWidth: () => EditorContainerWidth | undefined, isResizing: boolean): {
6
+ snaps: Snap | null;
7
+ currentLayout: "wide" | "full-width" | "center" | null;
8
+ guidelines: GuidelineConfig[];
9
+ setCurrentWidth: (newWidth: number | null) => void;
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "102.13.11",
3
+ "version": "102.14.0",
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/"