@atlaskit/editor-plugin-breakout 30.0.15 → 30.0.17
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 +15 -0
- package/dist/cjs/pm-plugins/pragmatic-resizer.js +47 -128
- package/dist/cjs/pm-plugins/resizing-mark-view.js +1 -2
- package/dist/es2019/pm-plugins/pragmatic-resizer.js +36 -108
- package/dist/es2019/pm-plugins/resizing-mark-view.js +1 -2
- package/dist/esm/pm-plugins/pragmatic-resizer.js +47 -126
- package/dist/esm/pm-plugins/resizing-mark-view.js +1 -2
- package/dist/types/pm-plugins/pragmatic-resizer.d.ts +1 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-breakout
|
|
2
2
|
|
|
3
|
+
## 30.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 30.0.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`49fcffc905097`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/49fcffc905097) -
|
|
14
|
+
Clean up experiment `platform_editor_use_vanilla_components`, keeping the shipped vanilla DOM
|
|
15
|
+
tooltip implementations and removing the React-based control paths.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 30.0.15
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.resizeHandleMessage = exports.createPragmaticResizer = void 0;
|
|
9
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
9
|
var _bindEventListener = require("bind-event-listener");
|
|
13
10
|
var _breakout = require("@atlaskit/editor-common/messages/breakout");
|
|
14
11
|
var _vanillaTooltip = require("@atlaskit/editor-common/vanilla-tooltip");
|
|
@@ -18,8 +15,6 @@ var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/utils
|
|
|
18
15
|
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/utils/prevent-unhandled");
|
|
19
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
20
17
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
21
|
-
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
22
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
23
18
|
var getNodeName = function getNodeName(nodeName) {
|
|
24
19
|
if (nodeName === 'layoutSection') {
|
|
25
20
|
return 'layout';
|
|
@@ -51,36 +46,6 @@ var resizeHandleMessage = exports.resizeHandleMessage = {
|
|
|
51
46
|
bodiedExtension: _breakout.messages.resizeExtension,
|
|
52
47
|
multiBodiedExtension: _breakout.messages.resizeExtension
|
|
53
48
|
};
|
|
54
|
-
/**
|
|
55
|
-
* Remove during `platform_editor_use_vanilla_components` cleanup — replaced by
|
|
56
|
-
* `createHandleTooltip`, which does the same job without a React tree per resize handle.
|
|
57
|
-
*/
|
|
58
|
-
var RailWithTooltip = function RailWithTooltip(_ref) {
|
|
59
|
-
var rail = _ref.rail,
|
|
60
|
-
target = _ref.target,
|
|
61
|
-
intl = _ref.intl;
|
|
62
|
-
var _useState = (0, _react.useState)('node'),
|
|
63
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
64
|
-
nodeName = _useState2[0],
|
|
65
|
-
setNodeName = _useState2[1];
|
|
66
|
-
(0, _react.useLayoutEffect)(function () {
|
|
67
|
-
var node = target.querySelector('[data-prosemirror-node-name]');
|
|
68
|
-
var name = getNodeName(node === null || node === void 0 ? void 0 : node.dataset.prosemirrorNodeName);
|
|
69
|
-
setNodeName(name);
|
|
70
|
-
}, [target]);
|
|
71
|
-
return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
72
|
-
content: intl.formatMessage(resizeHandleMessage[nodeName]),
|
|
73
|
-
position: "mouse"
|
|
74
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
76
|
-
className: "pm-breakout-resize-handle-rail-inside-tooltip",
|
|
77
|
-
ref: function ref(el) {
|
|
78
|
-
if (el && rail.parentNode !== el) {
|
|
79
|
-
el.appendChild(rail);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}));
|
|
83
|
-
};
|
|
84
49
|
|
|
85
50
|
/** Identifies the vanilla tooltip for tests and debugging. */
|
|
86
51
|
var TOOLTIP_CLASS_NAME = 'pm-breakout-resize-tooltip';
|
|
@@ -93,17 +58,17 @@ var TOOLTIP_CLASS_NAME = 'pm-breakout-resize-tooltip';
|
|
|
93
58
|
var TOOLTIP_CLASS_NAMES = "".concat(_vanillaTooltip.VANILLA_TOOLTIP_DEFAULT_CLASS, " ").concat(TOOLTIP_CLASS_NAME);
|
|
94
59
|
|
|
95
60
|
/**
|
|
96
|
-
*
|
|
61
|
+
* Builds the resize handle's tooltip as plain DOM.
|
|
97
62
|
*
|
|
98
63
|
* Anchored to a point rather than to the rail, which spans the node's full height and would strand
|
|
99
|
-
* the tooltip at the top of a tall node. This reproduces the
|
|
64
|
+
* the tooltip at the top of a tall node. This reproduces the ADS tooltip's `position="mouse"`,
|
|
100
65
|
* which latches the cursor as the tooltip opens and does not move it afterwards — so no cursor
|
|
101
66
|
* tracking is needed, just one style write per hover.
|
|
102
67
|
*/
|
|
103
|
-
var createHandleTooltip = function createHandleTooltip(
|
|
104
|
-
var anchor =
|
|
105
|
-
intl =
|
|
106
|
-
target =
|
|
68
|
+
var createHandleTooltip = function createHandleTooltip(_ref) {
|
|
69
|
+
var anchor = _ref.anchor,
|
|
70
|
+
intl = _ref.intl,
|
|
71
|
+
target = _ref.target;
|
|
107
72
|
// Only correct once ProseMirror has populated `contentDOM`, so callers must build on first
|
|
108
73
|
// hover — earlier reads fall back to the generic 'node' label.
|
|
109
74
|
var node = target.querySelector('[data-prosemirror-node-name]');
|
|
@@ -117,16 +82,15 @@ var createHandleTooltip = function createHandleTooltip(_ref2) {
|
|
|
117
82
|
undefined,
|
|
118
83
|
// No `onShow`.
|
|
119
84
|
undefined,
|
|
120
|
-
// Below the cursor, matching the
|
|
85
|
+
// Below the cursor, matching the ADS tooltip's `position="mouse"`.
|
|
121
86
|
'bottom');
|
|
122
87
|
};
|
|
123
|
-
var createPragmaticResizer = exports.createPragmaticResizer = function createPragmaticResizer(
|
|
124
|
-
var target =
|
|
125
|
-
_onDragStart =
|
|
126
|
-
onDrag =
|
|
127
|
-
_onDrop =
|
|
128
|
-
intl =
|
|
129
|
-
nodeViewPortalProviderAPI = _ref3.nodeViewPortalProviderAPI;
|
|
88
|
+
var createPragmaticResizer = exports.createPragmaticResizer = function createPragmaticResizer(_ref2) {
|
|
89
|
+
var target = _ref2.target,
|
|
90
|
+
_onDragStart = _ref2.onDragStart,
|
|
91
|
+
onDrag = _ref2.onDrag,
|
|
92
|
+
_onDrop = _ref2.onDrop,
|
|
93
|
+
intl = _ref2.intl;
|
|
130
94
|
var state = 'default';
|
|
131
95
|
var isLeftResizeHandleDisabled = (0, _expValEquals.expValEquals)('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_resize_extensions') || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_left_resize_handle');
|
|
132
96
|
var createHandle = function createHandle(side) {
|
|
@@ -151,33 +115,19 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
|
|
|
151
115
|
rail.appendChild(thumb);
|
|
152
116
|
|
|
153
117
|
// Marks the point the pointer entered the rail, and anchors the tooltip there: zero height
|
|
154
|
-
// so it is a point not a box, full rail width so the tooltip centres
|
|
118
|
+
// so it is a point not a box, full rail width so the tooltip centres on the cursor.
|
|
155
119
|
//
|
|
156
120
|
// Must stay a child of `rail` — `openTooltipAt` sets `top` from the rail's `offsetY`, which
|
|
157
121
|
// only lines up while the rail is the containing block. jsdom cannot catch a wrong parent.
|
|
158
122
|
//
|
|
159
|
-
//
|
|
160
|
-
var tooltipAnchor;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
tooltipAnchor = document.createElement('div');
|
|
164
|
-
tooltipAnchor.classList.add('pm-breakout-resize-tooltip-anchor');
|
|
165
|
-
rail.appendChild(tooltipAnchor);
|
|
166
|
-
}
|
|
123
|
+
// Positioned by `.pm-breakout-resize-tooltip-anchor`; only the pointer's Y is passed in.
|
|
124
|
+
var tooltipAnchor = document.createElement('div');
|
|
125
|
+
tooltipAnchor.classList.add('pm-breakout-resize-tooltip-anchor');
|
|
126
|
+
rail.appendChild(tooltipAnchor);
|
|
167
127
|
var tooltipContainer = document.createElement('div');
|
|
168
128
|
tooltipContainer.classList.add('pm-breakout-resize-handle-rail-wrapper');
|
|
169
129
|
handle.appendChild(tooltipContainer);
|
|
170
130
|
handle.appendChild(handleHitBox);
|
|
171
|
-
var key = crypto.randomUUID();
|
|
172
|
-
var renderTooltip = function renderTooltip() {
|
|
173
|
-
return nodeViewPortalProviderAPI.render(function () {
|
|
174
|
-
return /*#__PURE__*/_react.default.createElement(RailWithTooltip, {
|
|
175
|
-
rail: rail,
|
|
176
|
-
target: target,
|
|
177
|
-
intl: intl
|
|
178
|
-
});
|
|
179
|
-
}, tooltipContainer, key);
|
|
180
|
-
};
|
|
181
131
|
var vanillaTooltip;
|
|
182
132
|
|
|
183
133
|
// Tracks whether there is anything to tear down: the tooltip mounts on first hover and so
|
|
@@ -188,34 +138,22 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
|
|
|
188
138
|
return;
|
|
189
139
|
}
|
|
190
140
|
isTooltipMounted = true;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
target: target,
|
|
197
|
-
intl: intl
|
|
198
|
-
});
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// `RailWithTooltip`'s ref moves `rail` into the tooltip wrapper, so the DOM ends up
|
|
203
|
-
// identical to the pre-mount state below.
|
|
204
|
-
renderTooltip();
|
|
141
|
+
vanillaTooltip = createHandleTooltip({
|
|
142
|
+
anchor: tooltipAnchor,
|
|
143
|
+
target: target,
|
|
144
|
+
intl: intl
|
|
145
|
+
});
|
|
205
146
|
};
|
|
206
147
|
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
148
|
+
// The tooltip is built on the first `mouseenter` of the node (see `registerEvents` below)
|
|
149
|
+
// rather than up front, so a handle that is never hovered costs nothing. The rail has
|
|
150
|
+
// `opacity: 0` until the pointer is inside the node, so the pre-mount DOM is never
|
|
151
|
+
// visible, and the `mouseenter` fires on the whole node — long before the pointer reaches
|
|
152
|
+
// the 7px handle.
|
|
211
153
|
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
// `mouseenter` fires on the whole node — long before the pointer reaches the 7px handle.
|
|
216
|
-
//
|
|
217
|
-
// Parking the rail also needs `width: 100%`: without the ADS tooltip's wrappers (stretched
|
|
218
|
-
// by `pragmaticResizerStylesForTooltip`) it would size to its content as a flex item.
|
|
154
|
+
// Parking the rail in the wrapper also needs `width: 100%`: without the ADS tooltip's
|
|
155
|
+
// wrappers (stretched by `pragmaticResizerStylesForTooltip`) it would size to its content
|
|
156
|
+
// as a flex item.
|
|
219
157
|
rail.style.width = '100%';
|
|
220
158
|
tooltipContainer.appendChild(rail);
|
|
221
159
|
return {
|
|
@@ -226,24 +164,11 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
|
|
|
226
164
|
handleHitBox: handleHitBox,
|
|
227
165
|
mountTooltip: mountTooltip,
|
|
228
166
|
destroyTooltip: function destroyTooltip() {
|
|
229
|
-
//
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (vanillaTooltip) {
|
|
234
|
-
vanillaTooltip.destroy();
|
|
235
|
-
vanillaTooltip = undefined;
|
|
236
|
-
}
|
|
237
|
-
isTooltipMounted = false;
|
|
238
|
-
return;
|
|
167
|
+
// May never have mounted, as the tooltip is built on first hover.
|
|
168
|
+
if (vanillaTooltip) {
|
|
169
|
+
vanillaTooltip.destroy();
|
|
170
|
+
vanillaTooltip = undefined;
|
|
239
171
|
}
|
|
240
|
-
|
|
241
|
-
// The tooltip mounts on first hover, so `destroyTooltip` can be reached without
|
|
242
|
-
// anything having been mounted.
|
|
243
|
-
if (!isTooltipMounted) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
nodeViewPortalProviderAPI.remove(key);
|
|
247
172
|
isTooltipMounted = false;
|
|
248
173
|
}
|
|
249
174
|
};
|
|
@@ -254,8 +179,8 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
|
|
|
254
179
|
var registerHandle = function registerHandle(handleElement, handleSide) {
|
|
255
180
|
return (0, _elementAdapter.draggable)({
|
|
256
181
|
element: handleElement,
|
|
257
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
258
|
-
var nativeSetDragImage =
|
|
182
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref3) {
|
|
183
|
+
var nativeSetDragImage = _ref3.nativeSetDragImage;
|
|
259
184
|
(0, _disableNativeDragPreview.disableNativeDragPreview)({
|
|
260
185
|
nativeSetDragImage: nativeSetDragImage
|
|
261
186
|
});
|
|
@@ -270,13 +195,11 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
|
|
|
270
195
|
state = 'resizing';
|
|
271
196
|
handleElement.classList.add('pm-breakout-resize-handle-container--active');
|
|
272
197
|
|
|
273
|
-
// The
|
|
274
|
-
//
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
leftHandle === null || leftHandle === void 0 || leftHandle.destroyTooltip();
|
|
279
|
-
}
|
|
198
|
+
// The tooltip has no pointer-press listener, and its anchor moves with the rail,
|
|
199
|
+
// so it would follow the drag. Tearing it down hides it immediately; the next
|
|
200
|
+
// hover rebuilds it.
|
|
201
|
+
rightHandle.destroyTooltip();
|
|
202
|
+
leftHandle === null || leftHandle === void 0 || leftHandle.destroyTooltip();
|
|
280
203
|
_onDragStart(args);
|
|
281
204
|
},
|
|
282
205
|
onDrag: onDrag,
|
|
@@ -316,24 +239,20 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
|
|
|
316
239
|
type: 'mouseenter',
|
|
317
240
|
listener: function listener(event) {
|
|
318
241
|
// Mounted on first hover rather than up front, so a handle that is never
|
|
319
|
-
// hovered costs
|
|
242
|
+
// hovered costs nothing.
|
|
320
243
|
rightHandle.mountTooltip();
|
|
321
244
|
leftHandle === null || leftHandle === void 0 || leftHandle.mountTooltip();
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
openTooltipAt(hoverAnchor, event);
|
|
325
|
-
}
|
|
245
|
+
// After the mount above, so the tooltip always exists to be opened.
|
|
246
|
+
openTooltipAt(hoverAnchor, event);
|
|
326
247
|
rightHandle.rail.style.setProperty('opacity', '1');
|
|
327
248
|
leftHandle === null || leftHandle === void 0 || leftHandle.rail.style.setProperty('opacity', '1');
|
|
328
249
|
}
|
|
329
250
|
}), (0, _bindEventListener.bind)(element, {
|
|
330
251
|
type: 'mouseleave',
|
|
331
252
|
listener: function listener() {
|
|
332
|
-
// Ahead of the resize guard below: the
|
|
253
|
+
// Ahead of the resize guard below: the tooltip hides whenever the pointer
|
|
333
254
|
// leaves the rail, including part-way through a resize.
|
|
334
|
-
|
|
335
|
-
closeTooltip(hoverAnchor);
|
|
336
|
-
}
|
|
255
|
+
closeTooltip(hoverAnchor);
|
|
337
256
|
if (state === 'resizing') {
|
|
338
257
|
return;
|
|
339
258
|
}
|
|
@@ -141,8 +141,7 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
|
|
|
141
141
|
var _createPragmaticResiz = (0, _pragmaticResizer.createPragmaticResizer)(_objectSpread(_objectSpread({
|
|
142
142
|
target: contentDOM
|
|
143
143
|
}, callbacks), {}, {
|
|
144
|
-
intl: this.intl
|
|
145
|
-
nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
|
|
144
|
+
intl: this.intl
|
|
146
145
|
})),
|
|
147
146
|
leftHandle = _createPragmaticResiz.leftHandle,
|
|
148
147
|
rightHandle = _createPragmaticResiz.rightHandle,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React, { useLayoutEffect, useState } from 'react';
|
|
2
1
|
import { bind } from 'bind-event-listener';
|
|
3
2
|
import { messages } from '@atlaskit/editor-common/messages/breakout';
|
|
4
3
|
import { VANILLA_TOOLTIP_DEFAULT_CLASS, VanillaTooltip } from '@atlaskit/editor-common/vanilla-tooltip';
|
|
@@ -8,7 +7,6 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util
|
|
|
8
7
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/utils/prevent-unhandled';
|
|
9
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
9
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
11
|
-
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
12
10
|
const getNodeName = nodeName => {
|
|
13
11
|
if (nodeName === 'layoutSection') {
|
|
14
12
|
return 'layout';
|
|
@@ -40,34 +38,6 @@ export const resizeHandleMessage = {
|
|
|
40
38
|
bodiedExtension: messages.resizeExtension,
|
|
41
39
|
multiBodiedExtension: messages.resizeExtension
|
|
42
40
|
};
|
|
43
|
-
/**
|
|
44
|
-
* Remove during `platform_editor_use_vanilla_components` cleanup — replaced by
|
|
45
|
-
* `createHandleTooltip`, which does the same job without a React tree per resize handle.
|
|
46
|
-
*/
|
|
47
|
-
const RailWithTooltip = ({
|
|
48
|
-
rail,
|
|
49
|
-
target,
|
|
50
|
-
intl
|
|
51
|
-
}) => {
|
|
52
|
-
const [nodeName, setNodeName] = useState('node');
|
|
53
|
-
useLayoutEffect(() => {
|
|
54
|
-
const node = target.querySelector('[data-prosemirror-node-name]');
|
|
55
|
-
const name = getNodeName(node === null || node === void 0 ? void 0 : node.dataset.prosemirrorNodeName);
|
|
56
|
-
setNodeName(name);
|
|
57
|
-
}, [target]);
|
|
58
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
59
|
-
content: intl.formatMessage(resizeHandleMessage[nodeName]),
|
|
60
|
-
position: "mouse"
|
|
61
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
63
|
-
className: "pm-breakout-resize-handle-rail-inside-tooltip",
|
|
64
|
-
ref: el => {
|
|
65
|
-
if (el && rail.parentNode !== el) {
|
|
66
|
-
el.appendChild(rail);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}));
|
|
70
|
-
};
|
|
71
41
|
|
|
72
42
|
/** Identifies the vanilla tooltip for tests and debugging. */
|
|
73
43
|
const TOOLTIP_CLASS_NAME = 'pm-breakout-resize-tooltip';
|
|
@@ -80,10 +50,10 @@ const TOOLTIP_CLASS_NAME = 'pm-breakout-resize-tooltip';
|
|
|
80
50
|
const TOOLTIP_CLASS_NAMES = `${VANILLA_TOOLTIP_DEFAULT_CLASS} ${TOOLTIP_CLASS_NAME}`;
|
|
81
51
|
|
|
82
52
|
/**
|
|
83
|
-
*
|
|
53
|
+
* Builds the resize handle's tooltip as plain DOM.
|
|
84
54
|
*
|
|
85
55
|
* Anchored to a point rather than to the rail, which spans the node's full height and would strand
|
|
86
|
-
* the tooltip at the top of a tall node. This reproduces the
|
|
56
|
+
* the tooltip at the top of a tall node. This reproduces the ADS tooltip's `position="mouse"`,
|
|
87
57
|
* which latches the cursor as the tooltip opens and does not move it afterwards — so no cursor
|
|
88
58
|
* tracking is needed, just one style write per hover.
|
|
89
59
|
*/
|
|
@@ -105,7 +75,7 @@ const createHandleTooltip = ({
|
|
|
105
75
|
undefined,
|
|
106
76
|
// No `onShow`.
|
|
107
77
|
undefined,
|
|
108
|
-
// Below the cursor, matching the
|
|
78
|
+
// Below the cursor, matching the ADS tooltip's `position="mouse"`.
|
|
109
79
|
'bottom');
|
|
110
80
|
};
|
|
111
81
|
export const createPragmaticResizer = ({
|
|
@@ -113,8 +83,7 @@ export const createPragmaticResizer = ({
|
|
|
113
83
|
onDragStart,
|
|
114
84
|
onDrag,
|
|
115
85
|
onDrop,
|
|
116
|
-
intl
|
|
117
|
-
nodeViewPortalProviderAPI
|
|
86
|
+
intl
|
|
118
87
|
}) => {
|
|
119
88
|
let state = 'default';
|
|
120
89
|
const isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) || isExperimentEnabled('platform_editor_lovability_resize_extensions') || isExperimentEnabled('platform_editor_remove_left_resize_handle');
|
|
@@ -140,29 +109,19 @@ export const createPragmaticResizer = ({
|
|
|
140
109
|
rail.appendChild(thumb);
|
|
141
110
|
|
|
142
111
|
// Marks the point the pointer entered the rail, and anchors the tooltip there: zero height
|
|
143
|
-
// so it is a point not a box, full rail width so the tooltip centres
|
|
112
|
+
// so it is a point not a box, full rail width so the tooltip centres on the cursor.
|
|
144
113
|
//
|
|
145
114
|
// Must stay a child of `rail` — `openTooltipAt` sets `top` from the rail's `offsetY`, which
|
|
146
115
|
// only lines up while the rail is the containing block. jsdom cannot catch a wrong parent.
|
|
147
116
|
//
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
tooltipAnchor = document.createElement('div');
|
|
153
|
-
tooltipAnchor.classList.add('pm-breakout-resize-tooltip-anchor');
|
|
154
|
-
rail.appendChild(tooltipAnchor);
|
|
155
|
-
}
|
|
117
|
+
// Positioned by `.pm-breakout-resize-tooltip-anchor`; only the pointer's Y is passed in.
|
|
118
|
+
const tooltipAnchor = document.createElement('div');
|
|
119
|
+
tooltipAnchor.classList.add('pm-breakout-resize-tooltip-anchor');
|
|
120
|
+
rail.appendChild(tooltipAnchor);
|
|
156
121
|
const tooltipContainer = document.createElement('div');
|
|
157
122
|
tooltipContainer.classList.add('pm-breakout-resize-handle-rail-wrapper');
|
|
158
123
|
handle.appendChild(tooltipContainer);
|
|
159
124
|
handle.appendChild(handleHitBox);
|
|
160
|
-
const key = crypto.randomUUID();
|
|
161
|
-
const renderTooltip = () => nodeViewPortalProviderAPI.render(() => /*#__PURE__*/React.createElement(RailWithTooltip, {
|
|
162
|
-
rail: rail,
|
|
163
|
-
target: target,
|
|
164
|
-
intl: intl
|
|
165
|
-
}), tooltipContainer, key);
|
|
166
125
|
let vanillaTooltip;
|
|
167
126
|
|
|
168
127
|
// Tracks whether there is anything to tear down: the tooltip mounts on first hover and so
|
|
@@ -173,34 +132,22 @@ export const createPragmaticResizer = ({
|
|
|
173
132
|
return;
|
|
174
133
|
}
|
|
175
134
|
isTooltipMounted = true;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
target,
|
|
182
|
-
intl
|
|
183
|
-
});
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// `RailWithTooltip`'s ref moves `rail` into the tooltip wrapper, so the DOM ends up
|
|
188
|
-
// identical to the pre-mount state below.
|
|
189
|
-
renderTooltip();
|
|
135
|
+
vanillaTooltip = createHandleTooltip({
|
|
136
|
+
anchor: tooltipAnchor,
|
|
137
|
+
target,
|
|
138
|
+
intl
|
|
139
|
+
});
|
|
190
140
|
};
|
|
191
141
|
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
// Instead, park `rail` directly in the wrapper and mount the tooltip on the first
|
|
198
|
-
// `mouseenter` of the node (see `registerEvents` below). The rail has `opacity: 0` until
|
|
199
|
-
// the pointer is inside the node, so the pre-mount DOM is never visible, and the
|
|
200
|
-
// `mouseenter` fires on the whole node — long before the pointer reaches the 7px handle.
|
|
142
|
+
// The tooltip is built on the first `mouseenter` of the node (see `registerEvents` below)
|
|
143
|
+
// rather than up front, so a handle that is never hovered costs nothing. The rail has
|
|
144
|
+
// `opacity: 0` until the pointer is inside the node, so the pre-mount DOM is never
|
|
145
|
+
// visible, and the `mouseenter` fires on the whole node — long before the pointer reaches
|
|
146
|
+
// the 7px handle.
|
|
201
147
|
//
|
|
202
|
-
// Parking the rail also needs `width: 100%`: without the ADS tooltip's
|
|
203
|
-
// by `pragmaticResizerStylesForTooltip`) it would size to its content
|
|
148
|
+
// Parking the rail in the wrapper also needs `width: 100%`: without the ADS tooltip's
|
|
149
|
+
// wrappers (stretched by `pragmaticResizerStylesForTooltip`) it would size to its content
|
|
150
|
+
// as a flex item.
|
|
204
151
|
rail.style.width = '100%';
|
|
205
152
|
tooltipContainer.appendChild(rail);
|
|
206
153
|
return {
|
|
@@ -211,24 +158,11 @@ export const createPragmaticResizer = ({
|
|
|
211
158
|
handleHitBox,
|
|
212
159
|
mountTooltip,
|
|
213
160
|
destroyTooltip: () => {
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (vanillaTooltip) {
|
|
219
|
-
vanillaTooltip.destroy();
|
|
220
|
-
vanillaTooltip = undefined;
|
|
221
|
-
}
|
|
222
|
-
isTooltipMounted = false;
|
|
223
|
-
return;
|
|
161
|
+
// May never have mounted, as the tooltip is built on first hover.
|
|
162
|
+
if (vanillaTooltip) {
|
|
163
|
+
vanillaTooltip.destroy();
|
|
164
|
+
vanillaTooltip = undefined;
|
|
224
165
|
}
|
|
225
|
-
|
|
226
|
-
// The tooltip mounts on first hover, so `destroyTooltip` can be reached without
|
|
227
|
-
// anything having been mounted.
|
|
228
|
-
if (!isTooltipMounted) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
nodeViewPortalProviderAPI.remove(key);
|
|
232
166
|
isTooltipMounted = false;
|
|
233
167
|
}
|
|
234
168
|
};
|
|
@@ -254,13 +188,11 @@ export const createPragmaticResizer = ({
|
|
|
254
188
|
state = 'resizing';
|
|
255
189
|
handleElement.classList.add('pm-breakout-resize-handle-container--active');
|
|
256
190
|
|
|
257
|
-
// The
|
|
258
|
-
//
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
leftHandle === null || leftHandle === void 0 ? void 0 : leftHandle.destroyTooltip();
|
|
263
|
-
}
|
|
191
|
+
// The tooltip has no pointer-press listener, and its anchor moves with the rail,
|
|
192
|
+
// so it would follow the drag. Tearing it down hides it immediately; the next
|
|
193
|
+
// hover rebuilds it.
|
|
194
|
+
rightHandle.destroyTooltip();
|
|
195
|
+
leftHandle === null || leftHandle === void 0 ? void 0 : leftHandle.destroyTooltip();
|
|
264
196
|
onDragStart(args);
|
|
265
197
|
},
|
|
266
198
|
onDrag,
|
|
@@ -300,24 +232,20 @@ export const createPragmaticResizer = ({
|
|
|
300
232
|
type: 'mouseenter',
|
|
301
233
|
listener: event => {
|
|
302
234
|
// Mounted on first hover rather than up front, so a handle that is never
|
|
303
|
-
// hovered costs
|
|
235
|
+
// hovered costs nothing.
|
|
304
236
|
rightHandle.mountTooltip();
|
|
305
237
|
leftHandle === null || leftHandle === void 0 ? void 0 : leftHandle.mountTooltip();
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
openTooltipAt(hoverAnchor, event);
|
|
309
|
-
}
|
|
238
|
+
// After the mount above, so the tooltip always exists to be opened.
|
|
239
|
+
openTooltipAt(hoverAnchor, event);
|
|
310
240
|
rightHandle.rail.style.setProperty('opacity', '1');
|
|
311
241
|
leftHandle === null || leftHandle === void 0 ? void 0 : leftHandle.rail.style.setProperty('opacity', '1');
|
|
312
242
|
}
|
|
313
243
|
}), bind(element, {
|
|
314
244
|
type: 'mouseleave',
|
|
315
245
|
listener: () => {
|
|
316
|
-
// Ahead of the resize guard below: the
|
|
246
|
+
// Ahead of the resize guard below: the tooltip hides whenever the pointer
|
|
317
247
|
// leaves the rail, including part-way through a resize.
|
|
318
|
-
|
|
319
|
-
closeTooltip(hoverAnchor);
|
|
320
|
-
}
|
|
248
|
+
closeTooltip(hoverAnchor);
|
|
321
249
|
if (state === 'resizing') {
|
|
322
250
|
return;
|
|
323
251
|
}
|
|
@@ -127,8 +127,7 @@ export class ResizingMarkView {
|
|
|
127
127
|
} = createPragmaticResizer({
|
|
128
128
|
target: contentDOM,
|
|
129
129
|
...callbacks,
|
|
130
|
-
intl: this.intl
|
|
131
|
-
nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
|
|
130
|
+
intl: this.intl
|
|
132
131
|
});
|
|
133
132
|
if (leftHandle) {
|
|
134
133
|
this.dom.prepend(leftHandle);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import React, { useLayoutEffect, useState } from 'react';
|
|
4
2
|
import { bind } from 'bind-event-listener';
|
|
5
3
|
import { messages } from '@atlaskit/editor-common/messages/breakout';
|
|
6
4
|
import { VANILLA_TOOLTIP_DEFAULT_CLASS, VanillaTooltip } from '@atlaskit/editor-common/vanilla-tooltip';
|
|
@@ -10,7 +8,6 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util
|
|
|
10
8
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/utils/prevent-unhandled';
|
|
11
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
10
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
13
|
-
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
14
11
|
var getNodeName = function getNodeName(nodeName) {
|
|
15
12
|
if (nodeName === 'layoutSection') {
|
|
16
13
|
return 'layout';
|
|
@@ -42,36 +39,6 @@ export var resizeHandleMessage = {
|
|
|
42
39
|
bodiedExtension: messages.resizeExtension,
|
|
43
40
|
multiBodiedExtension: messages.resizeExtension
|
|
44
41
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Remove during `platform_editor_use_vanilla_components` cleanup — replaced by
|
|
47
|
-
* `createHandleTooltip`, which does the same job without a React tree per resize handle.
|
|
48
|
-
*/
|
|
49
|
-
var RailWithTooltip = function RailWithTooltip(_ref) {
|
|
50
|
-
var rail = _ref.rail,
|
|
51
|
-
target = _ref.target,
|
|
52
|
-
intl = _ref.intl;
|
|
53
|
-
var _useState = useState('node'),
|
|
54
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
-
nodeName = _useState2[0],
|
|
56
|
-
setNodeName = _useState2[1];
|
|
57
|
-
useLayoutEffect(function () {
|
|
58
|
-
var node = target.querySelector('[data-prosemirror-node-name]');
|
|
59
|
-
var name = getNodeName(node === null || node === void 0 ? void 0 : node.dataset.prosemirrorNodeName);
|
|
60
|
-
setNodeName(name);
|
|
61
|
-
}, [target]);
|
|
62
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
63
|
-
content: intl.formatMessage(resizeHandleMessage[nodeName]),
|
|
64
|
-
position: "mouse"
|
|
65
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
67
|
-
className: "pm-breakout-resize-handle-rail-inside-tooltip",
|
|
68
|
-
ref: function ref(el) {
|
|
69
|
-
if (el && rail.parentNode !== el) {
|
|
70
|
-
el.appendChild(rail);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}));
|
|
74
|
-
};
|
|
75
42
|
|
|
76
43
|
/** Identifies the vanilla tooltip for tests and debugging. */
|
|
77
44
|
var TOOLTIP_CLASS_NAME = 'pm-breakout-resize-tooltip';
|
|
@@ -84,17 +51,17 @@ var TOOLTIP_CLASS_NAME = 'pm-breakout-resize-tooltip';
|
|
|
84
51
|
var TOOLTIP_CLASS_NAMES = "".concat(VANILLA_TOOLTIP_DEFAULT_CLASS, " ").concat(TOOLTIP_CLASS_NAME);
|
|
85
52
|
|
|
86
53
|
/**
|
|
87
|
-
*
|
|
54
|
+
* Builds the resize handle's tooltip as plain DOM.
|
|
88
55
|
*
|
|
89
56
|
* Anchored to a point rather than to the rail, which spans the node's full height and would strand
|
|
90
|
-
* the tooltip at the top of a tall node. This reproduces the
|
|
57
|
+
* the tooltip at the top of a tall node. This reproduces the ADS tooltip's `position="mouse"`,
|
|
91
58
|
* which latches the cursor as the tooltip opens and does not move it afterwards — so no cursor
|
|
92
59
|
* tracking is needed, just one style write per hover.
|
|
93
60
|
*/
|
|
94
|
-
var createHandleTooltip = function createHandleTooltip(
|
|
95
|
-
var anchor =
|
|
96
|
-
intl =
|
|
97
|
-
target =
|
|
61
|
+
var createHandleTooltip = function createHandleTooltip(_ref) {
|
|
62
|
+
var anchor = _ref.anchor,
|
|
63
|
+
intl = _ref.intl,
|
|
64
|
+
target = _ref.target;
|
|
98
65
|
// Only correct once ProseMirror has populated `contentDOM`, so callers must build on first
|
|
99
66
|
// hover — earlier reads fall back to the generic 'node' label.
|
|
100
67
|
var node = target.querySelector('[data-prosemirror-node-name]');
|
|
@@ -108,16 +75,15 @@ var createHandleTooltip = function createHandleTooltip(_ref2) {
|
|
|
108
75
|
undefined,
|
|
109
76
|
// No `onShow`.
|
|
110
77
|
undefined,
|
|
111
|
-
// Below the cursor, matching the
|
|
78
|
+
// Below the cursor, matching the ADS tooltip's `position="mouse"`.
|
|
112
79
|
'bottom');
|
|
113
80
|
};
|
|
114
|
-
export var createPragmaticResizer = function createPragmaticResizer(
|
|
115
|
-
var target =
|
|
116
|
-
_onDragStart =
|
|
117
|
-
onDrag =
|
|
118
|
-
_onDrop =
|
|
119
|
-
intl =
|
|
120
|
-
nodeViewPortalProviderAPI = _ref3.nodeViewPortalProviderAPI;
|
|
81
|
+
export var createPragmaticResizer = function createPragmaticResizer(_ref2) {
|
|
82
|
+
var target = _ref2.target,
|
|
83
|
+
_onDragStart = _ref2.onDragStart,
|
|
84
|
+
onDrag = _ref2.onDrag,
|
|
85
|
+
_onDrop = _ref2.onDrop,
|
|
86
|
+
intl = _ref2.intl;
|
|
121
87
|
var state = 'default';
|
|
122
88
|
var isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) || isExperimentEnabled('platform_editor_lovability_resize_extensions') || isExperimentEnabled('platform_editor_remove_left_resize_handle');
|
|
123
89
|
var createHandle = function createHandle(side) {
|
|
@@ -142,33 +108,19 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref3) {
|
|
|
142
108
|
rail.appendChild(thumb);
|
|
143
109
|
|
|
144
110
|
// Marks the point the pointer entered the rail, and anchors the tooltip there: zero height
|
|
145
|
-
// so it is a point not a box, full rail width so the tooltip centres
|
|
111
|
+
// so it is a point not a box, full rail width so the tooltip centres on the cursor.
|
|
146
112
|
//
|
|
147
113
|
// Must stay a child of `rail` — `openTooltipAt` sets `top` from the rail's `offsetY`, which
|
|
148
114
|
// only lines up while the rail is the containing block. jsdom cannot catch a wrong parent.
|
|
149
115
|
//
|
|
150
|
-
//
|
|
151
|
-
var tooltipAnchor;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
tooltipAnchor = document.createElement('div');
|
|
155
|
-
tooltipAnchor.classList.add('pm-breakout-resize-tooltip-anchor');
|
|
156
|
-
rail.appendChild(tooltipAnchor);
|
|
157
|
-
}
|
|
116
|
+
// Positioned by `.pm-breakout-resize-tooltip-anchor`; only the pointer's Y is passed in.
|
|
117
|
+
var tooltipAnchor = document.createElement('div');
|
|
118
|
+
tooltipAnchor.classList.add('pm-breakout-resize-tooltip-anchor');
|
|
119
|
+
rail.appendChild(tooltipAnchor);
|
|
158
120
|
var tooltipContainer = document.createElement('div');
|
|
159
121
|
tooltipContainer.classList.add('pm-breakout-resize-handle-rail-wrapper');
|
|
160
122
|
handle.appendChild(tooltipContainer);
|
|
161
123
|
handle.appendChild(handleHitBox);
|
|
162
|
-
var key = crypto.randomUUID();
|
|
163
|
-
var renderTooltip = function renderTooltip() {
|
|
164
|
-
return nodeViewPortalProviderAPI.render(function () {
|
|
165
|
-
return /*#__PURE__*/React.createElement(RailWithTooltip, {
|
|
166
|
-
rail: rail,
|
|
167
|
-
target: target,
|
|
168
|
-
intl: intl
|
|
169
|
-
});
|
|
170
|
-
}, tooltipContainer, key);
|
|
171
|
-
};
|
|
172
124
|
var vanillaTooltip;
|
|
173
125
|
|
|
174
126
|
// Tracks whether there is anything to tear down: the tooltip mounts on first hover and so
|
|
@@ -179,34 +131,22 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref3) {
|
|
|
179
131
|
return;
|
|
180
132
|
}
|
|
181
133
|
isTooltipMounted = true;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
target: target,
|
|
188
|
-
intl: intl
|
|
189
|
-
});
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// `RailWithTooltip`'s ref moves `rail` into the tooltip wrapper, so the DOM ends up
|
|
194
|
-
// identical to the pre-mount state below.
|
|
195
|
-
renderTooltip();
|
|
134
|
+
vanillaTooltip = createHandleTooltip({
|
|
135
|
+
anchor: tooltipAnchor,
|
|
136
|
+
target: target,
|
|
137
|
+
intl: intl
|
|
138
|
+
});
|
|
196
139
|
};
|
|
197
140
|
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
//
|
|
141
|
+
// The tooltip is built on the first `mouseenter` of the node (see `registerEvents` below)
|
|
142
|
+
// rather than up front, so a handle that is never hovered costs nothing. The rail has
|
|
143
|
+
// `opacity: 0` until the pointer is inside the node, so the pre-mount DOM is never
|
|
144
|
+
// visible, and the `mouseenter` fires on the whole node — long before the pointer reaches
|
|
145
|
+
// the 7px handle.
|
|
202
146
|
//
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
// `mouseenter` fires on the whole node — long before the pointer reaches the 7px handle.
|
|
207
|
-
//
|
|
208
|
-
// Parking the rail also needs `width: 100%`: without the ADS tooltip's wrappers (stretched
|
|
209
|
-
// by `pragmaticResizerStylesForTooltip`) it would size to its content as a flex item.
|
|
147
|
+
// Parking the rail in the wrapper also needs `width: 100%`: without the ADS tooltip's
|
|
148
|
+
// wrappers (stretched by `pragmaticResizerStylesForTooltip`) it would size to its content
|
|
149
|
+
// as a flex item.
|
|
210
150
|
rail.style.width = '100%';
|
|
211
151
|
tooltipContainer.appendChild(rail);
|
|
212
152
|
return {
|
|
@@ -217,24 +157,11 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref3) {
|
|
|
217
157
|
handleHitBox: handleHitBox,
|
|
218
158
|
mountTooltip: mountTooltip,
|
|
219
159
|
destroyTooltip: function destroyTooltip() {
|
|
220
|
-
//
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if (vanillaTooltip) {
|
|
225
|
-
vanillaTooltip.destroy();
|
|
226
|
-
vanillaTooltip = undefined;
|
|
227
|
-
}
|
|
228
|
-
isTooltipMounted = false;
|
|
229
|
-
return;
|
|
160
|
+
// May never have mounted, as the tooltip is built on first hover.
|
|
161
|
+
if (vanillaTooltip) {
|
|
162
|
+
vanillaTooltip.destroy();
|
|
163
|
+
vanillaTooltip = undefined;
|
|
230
164
|
}
|
|
231
|
-
|
|
232
|
-
// The tooltip mounts on first hover, so `destroyTooltip` can be reached without
|
|
233
|
-
// anything having been mounted.
|
|
234
|
-
if (!isTooltipMounted) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
nodeViewPortalProviderAPI.remove(key);
|
|
238
165
|
isTooltipMounted = false;
|
|
239
166
|
}
|
|
240
167
|
};
|
|
@@ -245,8 +172,8 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref3) {
|
|
|
245
172
|
var registerHandle = function registerHandle(handleElement, handleSide) {
|
|
246
173
|
return draggable({
|
|
247
174
|
element: handleElement,
|
|
248
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
249
|
-
var nativeSetDragImage =
|
|
175
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref3) {
|
|
176
|
+
var nativeSetDragImage = _ref3.nativeSetDragImage;
|
|
250
177
|
disableNativeDragPreview({
|
|
251
178
|
nativeSetDragImage: nativeSetDragImage
|
|
252
179
|
});
|
|
@@ -261,13 +188,11 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref3) {
|
|
|
261
188
|
state = 'resizing';
|
|
262
189
|
handleElement.classList.add('pm-breakout-resize-handle-container--active');
|
|
263
190
|
|
|
264
|
-
// The
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
leftHandle === null || leftHandle === void 0 || leftHandle.destroyTooltip();
|
|
270
|
-
}
|
|
191
|
+
// The tooltip has no pointer-press listener, and its anchor moves with the rail,
|
|
192
|
+
// so it would follow the drag. Tearing it down hides it immediately; the next
|
|
193
|
+
// hover rebuilds it.
|
|
194
|
+
rightHandle.destroyTooltip();
|
|
195
|
+
leftHandle === null || leftHandle === void 0 || leftHandle.destroyTooltip();
|
|
271
196
|
_onDragStart(args);
|
|
272
197
|
},
|
|
273
198
|
onDrag: onDrag,
|
|
@@ -307,24 +232,20 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref3) {
|
|
|
307
232
|
type: 'mouseenter',
|
|
308
233
|
listener: function listener(event) {
|
|
309
234
|
// Mounted on first hover rather than up front, so a handle that is never
|
|
310
|
-
// hovered costs
|
|
235
|
+
// hovered costs nothing.
|
|
311
236
|
rightHandle.mountTooltip();
|
|
312
237
|
leftHandle === null || leftHandle === void 0 || leftHandle.mountTooltip();
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
openTooltipAt(hoverAnchor, event);
|
|
316
|
-
}
|
|
238
|
+
// After the mount above, so the tooltip always exists to be opened.
|
|
239
|
+
openTooltipAt(hoverAnchor, event);
|
|
317
240
|
rightHandle.rail.style.setProperty('opacity', '1');
|
|
318
241
|
leftHandle === null || leftHandle === void 0 || leftHandle.rail.style.setProperty('opacity', '1');
|
|
319
242
|
}
|
|
320
243
|
}), bind(element, {
|
|
321
244
|
type: 'mouseleave',
|
|
322
245
|
listener: function listener() {
|
|
323
|
-
// Ahead of the resize guard below: the
|
|
246
|
+
// Ahead of the resize guard below: the tooltip hides whenever the pointer
|
|
324
247
|
// leaves the rail, including part-way through a resize.
|
|
325
|
-
|
|
326
|
-
closeTooltip(hoverAnchor);
|
|
327
|
-
}
|
|
248
|
+
closeTooltip(hoverAnchor);
|
|
328
249
|
if (state === 'resizing') {
|
|
329
250
|
return;
|
|
330
251
|
}
|
|
@@ -134,8 +134,7 @@ export var ResizingMarkView = /*#__PURE__*/function () {
|
|
|
134
134
|
var _createPragmaticResiz = createPragmaticResizer(_objectSpread(_objectSpread({
|
|
135
135
|
target: contentDOM
|
|
136
136
|
}, callbacks), {}, {
|
|
137
|
-
intl: this.intl
|
|
138
|
-
nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
|
|
137
|
+
intl: this.intl
|
|
139
138
|
})),
|
|
140
139
|
leftHandle = _createPragmaticResiz.leftHandle,
|
|
141
140
|
rightHandle = _createPragmaticResiz.rightHandle,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { IntlShape, MessageDescriptor } from 'react-intl';
|
|
2
|
-
import type { PortalProviderAPI } from '@atlaskit/editor-common/common';
|
|
3
2
|
import type { BaseEventPayload, ElementDragType } from '@atlaskit/pragmatic-drag-and-drop/internal-types';
|
|
4
3
|
export declare const resizeHandleMessage: Record<string, MessageDescriptor>;
|
|
5
|
-
export declare const createPragmaticResizer: ({ target, onDragStart, onDrag, onDrop, intl,
|
|
4
|
+
export declare const createPragmaticResizer: ({ target, onDragStart, onDrag, onDrop, intl, }: {
|
|
6
5
|
intl: IntlShape;
|
|
7
|
-
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
8
6
|
onDrag: (args: BaseEventPayload<ElementDragType>) => void;
|
|
9
7
|
onDragStart: (args: BaseEventPayload<ElementDragType>) => void;
|
|
10
8
|
onDrop: (args: BaseEventPayload<ElementDragType>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-breakout",
|
|
3
|
-
"version": "30.0.
|
|
3
|
+
"version": "30.0.17",
|
|
4
4
|
"description": "Breakout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
37
37
|
"@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
|
|
38
38
|
"@atlaskit/theme": "^28.2.0",
|
|
39
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
40
|
-
"@atlaskit/tokens": "^20.
|
|
39
|
+
"@atlaskit/tmp-editor-statsig": "^260.0.0",
|
|
40
|
+
"@atlaskit/tokens": "^20.10.0",
|
|
41
41
|
"@atlaskit/tooltip": "^24.4.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"@emotion/react": "^11.7.1",
|