@atlaskit/editor-common 102.13.10 → 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 +23 -0
- package/dist/cjs/keymaps/index.js +3 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/resizer/BreakoutResizer.js +46 -16
- package/dist/cjs/resizer/index.js +8 -1
- package/dist/cjs/resizer/useBreakoutGuidelines.js +135 -0
- package/dist/cjs/styles/shared/smartCard.js +2 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/calculate-toolbar-position.js +8 -0
- package/dist/es2019/keymaps/index.js +1 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/resizer/BreakoutResizer.js +48 -17
- package/dist/es2019/resizer/index.js +2 -1
- package/dist/es2019/resizer/useBreakoutGuidelines.js +122 -0
- package/dist/es2019/styles/shared/smartCard.js +5 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/calculate-toolbar-position.js +8 -0
- package/dist/esm/keymaps/index.js +1 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/resizer/BreakoutResizer.js +47 -17
- package/dist/esm/resizer/index.js +2 -1
- package/dist/esm/resizer/useBreakoutGuidelines.js +127 -0
- package/dist/esm/styles/shared/smartCard.js +2 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/calculate-toolbar-position.js +8 -0
- package/dist/types/keymaps/index.d.ts +1 -0
- package/dist/types/resizer/BreakoutResizer.d.ts +3 -1
- package/dist/types/resizer/index.d.ts +1 -0
- package/dist/types/resizer/useBreakoutGuidelines.d.ts +10 -0
- package/dist/types/types/floating-toolbar.d.ts +7 -8
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types-ts4.5/keymaps/index.d.ts +1 -0
- package/dist/types-ts4.5/resizer/BreakoutResizer.d.ts +3 -1
- package/dist/types-ts4.5/resizer/index.d.ts +1 -0
- package/dist/types-ts4.5/resizer/useBreakoutGuidelines.d.ts +10 -0
- package/dist/types-ts4.5/types/floating-toolbar.d.ts +7 -8
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
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
|
+
|
|
18
|
+
## 102.13.11
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#133639](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/133639)
|
|
23
|
+
[`371bad9b8ae73`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/371bad9b8ae73) -
|
|
24
|
+
[ux] Increase the space between column drag handle and the Text Formatting toolbar.
|
|
25
|
+
|
|
3
26
|
## 102.13.10
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -102,8 +102,8 @@ Object.defineProperty(exports, "keymap", {
|
|
|
102
102
|
exports.makeKeyMapArrayWithCommon = makeKeyMapArrayWithCommon;
|
|
103
103
|
exports.makeKeyMapWithCommon = makeKeyMapWithCommon;
|
|
104
104
|
exports.makeKeymap = makeKeymap;
|
|
105
|
-
exports.
|
|
106
|
-
exports.toggleUnderline = exports.toggleTaskItemCheckbox = exports.toggleTable = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleOrderedList = exports.toggleItalic = exports.toggleHighlightPalette = exports.toggleHeading6 = exports.toggleHeading5 = exports.toggleHeading4 = exports.toggleHeading3 = exports.toggleHeading2 = exports.toggleHeading1 = exports.toggleCode = exports.toggleBulletList = exports.toggleBold = exports.toggleBlockQuote = exports.tab = exports.submit = exports.startColumnResizing = void 0;
|
|
105
|
+
exports.splitCodeBlock = exports.space = exports.showElementDragHandle = exports.shiftTab = exports.shiftEnter = exports.shiftBackspace = exports.shiftArrowUp = exports.setNormalText = exports.selectTable = exports.selectRow = exports.selectNode = exports.selectColumn = exports.redoAlt = exports.redo = exports.previousCell = exports.pastePlainText = exports.paste = exports.outdentList = exports.outdent = exports.openHelp = exports.nextCell = exports.navToFloatingToolbar = exports.navToEditorToolbar = exports.moveUp = exports.moveRowUp = exports.moveRowDown = exports.moveRight = exports.moveLeft = exports.moveDown = exports.moveColumnRight = exports.moveColumnLeft = void 0;
|
|
106
|
+
exports.toggleUnderline = exports.toggleTaskItemCheckbox = exports.toggleTable = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleOrderedList = exports.toggleItalic = exports.toggleHighlightPalette = exports.toggleHeading6 = exports.toggleHeading5 = exports.toggleHeading4 = exports.toggleHeading3 = exports.toggleHeading2 = exports.toggleHeading1 = exports.toggleCode = exports.toggleBulletList = exports.toggleBold = exports.toggleBlockQuote = exports.tab = exports.submit = exports.startColumnResizing = exports.splitListItem = void 0;
|
|
107
107
|
exports.tooltip = tooltip;
|
|
108
108
|
exports.undo = void 0;
|
|
109
109
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -158,6 +158,7 @@ var moveLeft = exports.moveLeft = makeKeyMapWithCommon('Move left', 'ArrowLeft')
|
|
|
158
158
|
var moveRight = exports.moveRight = makeKeyMapWithCommon('Move right', 'ArrowRight');
|
|
159
159
|
var indentList = exports.indentList = makeKeyMapWithCommon('Indent List', 'Tab');
|
|
160
160
|
var outdentList = exports.outdentList = makeKeyMapWithCommon('Outdent List', 'Shift-Tab');
|
|
161
|
+
var redoAlt = exports.redoAlt = makeKeyMapWithCommon('Redo', 'Mod-y');
|
|
161
162
|
var redo = exports.redo = makeKeymap('Redo', 'Ctrl-y', 'Mod-Shift-z');
|
|
162
163
|
var openHelp = exports.openHelp = makeKeyMapWithCommon('Open Help', 'Mod-/');
|
|
163
164
|
var addLink = exports.addLink = makeKeyMapWithCommon('Link', 'Mod-k');
|
|
@@ -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.
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
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.
|
|
26
|
+
var packageVersion = "102.14.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.calculateToolbarPositionTrackHead = exports.calculateToolbarPositionOnCellSelection = exports.calculateToolbarPositionAboveSelection = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
8
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var MAXIMUM_BROWSER_SCROLLBAR_WIDTH = 20;
|
|
10
11
|
|
|
11
12
|
/*
|
|
@@ -160,6 +161,7 @@ var getCoordsBelowSelection = function getCoordsBelowSelection(bottomCoords, too
|
|
|
160
161
|
};
|
|
161
162
|
var cellSelectionToolbarCffsetTop = 10;
|
|
162
163
|
var scrollbarWidth = 20;
|
|
164
|
+
var offsetTopOnColumnSelection = 4;
|
|
163
165
|
var calculateToolbarPositionOnCellSelection = exports.calculateToolbarPositionOnCellSelection = function calculateToolbarPositionOnCellSelection(toolbarTitle) {
|
|
164
166
|
return function (editorView, nextPos) {
|
|
165
167
|
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
@@ -224,6 +226,12 @@ var calculateToolbarPositionOnCellSelection = exports.calculateToolbarPositionOn
|
|
|
224
226
|
} else {
|
|
225
227
|
left = anchorCellRect.left + (headCellRect.right - anchorCellRect.left) / 2;
|
|
226
228
|
}
|
|
229
|
+
|
|
230
|
+
// When column is selected, adjust top position to ensure that the toolbar does not
|
|
231
|
+
// touch column drag handle
|
|
232
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1')) {
|
|
233
|
+
top = top - offsetTopOnColumnSelection;
|
|
234
|
+
}
|
|
227
235
|
}
|
|
228
236
|
var adjustedLeft = Math.max(0, left - toolbarRect.width / 2 - wrapperBounds.left);
|
|
229
237
|
if (adjustedLeft + toolbarRect.width > wrapperBounds.width) {
|
|
@@ -44,6 +44,7 @@ export const moveLeft = makeKeyMapWithCommon('Move left', 'ArrowLeft');
|
|
|
44
44
|
export const moveRight = makeKeyMapWithCommon('Move right', 'ArrowRight');
|
|
45
45
|
export const indentList = makeKeyMapWithCommon('Indent List', 'Tab');
|
|
46
46
|
export const outdentList = makeKeyMapWithCommon('Outdent List', 'Shift-Tab');
|
|
47
|
+
export const redoAlt = makeKeyMapWithCommon('Redo', 'Mod-y');
|
|
47
48
|
export const redo = makeKeymap('Redo', 'Ctrl-y', 'Mod-Shift-z');
|
|
48
49
|
export const openHelp = makeKeyMapWithCommon('Open Help', 'Mod-/');
|
|
49
50
|
export const addLink = makeKeyMapWithCommon('Link', 'Mod-k');
|
|
@@ -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.
|
|
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
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
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';
|