@atlaskit/editor-common 134.7.1 → 134.8.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 +40 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +3 -1
- package/dist/cjs/extensibility/MultiBodiedExtension/index.js +3 -1
- package/dist/cjs/extensibility/utils/get-breakout-width.js +27 -0
- package/dist/cjs/extensibility/utils/has-breakout-width.js +11 -0
- package/dist/cjs/extensibility/utils/should-extension-breakout.js +10 -1
- package/dist/cjs/extensions/messages.js +5 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +76 -103
- package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
- package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +9 -93
- package/dist/cjs/quick-insert/QuickInsertMenuItem.js +2 -1
- package/dist/cjs/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
- package/dist/cjs/quick-insert/QuickInsertPreviewContent.js +142 -0
- package/dist/cjs/quick-insert/QuickInsertShortcut.compiled.css +10 -0
- package/dist/cjs/quick-insert/QuickInsertShortcut.js +28 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/HoverLinkOverlay/index.js +45 -10
- package/dist/cjs/ui/Layer/index.js +14 -208
- package/dist/cjs/vanilla-tooltip/index.js +5 -14
- package/dist/es2019/extensibility/Extension/Extension/index.js +3 -1
- package/dist/es2019/extensibility/MultiBodiedExtension/index.js +3 -1
- package/dist/es2019/extensibility/utils/get-breakout-width.js +9 -0
- package/dist/es2019/extensibility/utils/has-breakout-width.js +4 -0
- package/dist/es2019/extensibility/utils/should-extension-breakout.js +9 -1
- package/dist/es2019/extensions/messages.js +5 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +74 -101
- package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
- package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +10 -86
- package/dist/es2019/quick-insert/QuickInsertMenuItem.js +2 -1
- package/dist/es2019/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
- package/dist/es2019/quick-insert/QuickInsertPreviewContent.js +126 -0
- package/dist/es2019/quick-insert/QuickInsertShortcut.compiled.css +10 -0
- package/dist/es2019/quick-insert/QuickInsertShortcut.js +19 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/HoverLinkOverlay/index.js +36 -3
- package/dist/es2019/ui/Layer/index.js +15 -192
- package/dist/es2019/vanilla-tooltip/index.js +7 -15
- package/dist/esm/extensibility/Extension/Extension/index.js +3 -1
- package/dist/esm/extensibility/MultiBodiedExtension/index.js +3 -1
- package/dist/esm/extensibility/utils/get-breakout-width.js +21 -0
- package/dist/esm/extensibility/utils/has-breakout-width.js +6 -0
- package/dist/esm/extensibility/utils/should-extension-breakout.js +10 -1
- package/dist/esm/extensions/messages.js +5 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +77 -104
- package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
- package/dist/esm/quick-insert/QuickInsertHoverPreview.js +10 -93
- package/dist/esm/quick-insert/QuickInsertMenuItem.js +2 -1
- package/dist/esm/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
- package/dist/esm/quick-insert/QuickInsertPreviewContent.js +135 -0
- package/dist/esm/quick-insert/QuickInsertShortcut.compiled.css +10 -0
- package/dist/esm/quick-insert/QuickInsertShortcut.js +21 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/HoverLinkOverlay/index.js +45 -10
- package/dist/esm/ui/Layer/index.js +15 -211
- package/dist/esm/vanilla-tooltip/index.js +7 -15
- package/dist/types/extensibility/utils/get-breakout-width.d.ts +3 -0
- package/dist/types/extensibility/utils/has-breakout-width.d.ts +3 -0
- package/dist/types/extensibility/utils/should-extension-breakout.d.ts +2 -1
- package/dist/types/extensions/messages.d.ts +24 -19
- package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +7 -1
- package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +0 -1
- package/dist/types/quick-insert/QuickInsertPreviewContent.d.ts +24 -0
- package/dist/types/quick-insert/QuickInsertShortcut.d.ts +13 -0
- package/dist/types/ui/Layer/index.d.ts +1 -15
- package/dist/types/vanilla-tooltip/index.d.ts +1 -1
- package/extensibility/get-breakout-width/package.json +10 -0
- package/extensibility/has-breakout-width/package.json +10 -0
- package/package.json +3 -8
|
@@ -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 = "134.7.
|
|
16
|
+
const packageVersion = "134.7.2";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -115,6 +115,7 @@ const HoverLinkOverlay = ({
|
|
|
115
115
|
const [showLabel, setShowLabel] = useState(true);
|
|
116
116
|
const [isHovered, setHovered] = useState(false);
|
|
117
117
|
const openTextWidthRef = useRef(null);
|
|
118
|
+
const shouldDeferMeasurement = isExperimentEnabled('platform_editor_improve_inp_batch_2');
|
|
118
119
|
const regularPadding = DYNAMIC_PADDING_BLOCK;
|
|
119
120
|
const memoizedHoverLinkStyles = useMemo(() => ({
|
|
120
121
|
paddingBlock: compactPadding ? '1px' : regularPadding
|
|
@@ -127,6 +128,38 @@ const HoverLinkOverlay = ({
|
|
|
127
128
|
if (!isVisible || !isHovered) {
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
131
|
+
if (shouldDeferMeasurement) {
|
|
132
|
+
const container = containerRef.current;
|
|
133
|
+
const button = hoverLinkButtonRef.current;
|
|
134
|
+
const hiddenText = hiddenTextRef.current;
|
|
135
|
+
if (!container || !button || !hiddenText) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const observer = new ResizeObserver(() => {
|
|
139
|
+
// One measurement per hover; hiding the label must not trigger another one.
|
|
140
|
+
observer.disconnect();
|
|
141
|
+
const cardWidth = container.offsetWidth;
|
|
142
|
+
const openButtonWidth = button.offsetWidth;
|
|
143
|
+
// Get the hidden text width
|
|
144
|
+
const openTextWidth = hiddenText.offsetWidth || DEFAULT_OPEN_TEXT_WIDTH;
|
|
145
|
+
if (!cardWidth || !openButtonWidth) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let canShowLabel = cardWidth - openTextWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY + ICON_WIDTH;
|
|
149
|
+
|
|
150
|
+
// When a smart link wraps to multiple lines in a constrained container (e.g. table cell),
|
|
151
|
+
// the hover button can overflow beyond the container bounds. We detect this by comparing
|
|
152
|
+
// the button's right edge to the container's right edge, and hide the label if it overflows.
|
|
153
|
+
const containerRight = container.getBoundingClientRect().right;
|
|
154
|
+
const buttonRight = button.getBoundingClientRect().right;
|
|
155
|
+
if (buttonRight > containerRight) {
|
|
156
|
+
canShowLabel = false;
|
|
157
|
+
}
|
|
158
|
+
setShowLabel(canShowLabel);
|
|
159
|
+
});
|
|
160
|
+
observer.observe(button);
|
|
161
|
+
return () => observer.disconnect();
|
|
162
|
+
}
|
|
130
163
|
const cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
|
|
131
164
|
const openButtonWidth = (_hoverLinkButtonRef$c = hoverLinkButtonRef.current) === null || _hoverLinkButtonRef$c === void 0 ? void 0 : _hoverLinkButtonRef$c.offsetWidth;
|
|
132
165
|
// Get the hidden text width
|
|
@@ -163,7 +196,7 @@ const HoverLinkOverlay = ({
|
|
|
163
196
|
}
|
|
164
197
|
}
|
|
165
198
|
setShowLabel(canShowLabel);
|
|
166
|
-
}, [isVisible, isHovered]);
|
|
199
|
+
}, [isVisible, isHovered, shouldDeferMeasurement]);
|
|
167
200
|
const handleOverlayChange = isHovered => {
|
|
168
201
|
setHovered(isHovered);
|
|
169
202
|
|
|
@@ -220,13 +253,13 @@ const HoverLinkOverlay = ({
|
|
|
220
253
|
,
|
|
221
254
|
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? () => {} : undefined,
|
|
222
255
|
onBlur: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? () => {} : undefined
|
|
223
|
-
}, children, jsx("span", {
|
|
256
|
+
}, children, (!shouldDeferMeasurement || isHovered) && jsx("span", {
|
|
224
257
|
css: hiddenTextStyle,
|
|
225
258
|
"aria-hidden": "true"
|
|
226
259
|
}, jsx(Text, {
|
|
227
260
|
ref: hiddenTextRef,
|
|
228
261
|
size: "small",
|
|
229
|
-
maxLines: 1
|
|
262
|
+
maxLines: shouldDeferMeasurement ? undefined : 1
|
|
230
263
|
}, label)), isHovered && jsx(Anchor, {
|
|
231
264
|
ref: hoverLinkButtonRef,
|
|
232
265
|
xcss: linkStylesCommon,
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { Component, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
// eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
|
|
4
|
-
import Popper from 'popper.js';
|
|
5
|
-
// eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
|
|
6
|
-
|
|
7
|
-
// eslint-disable-line import/extensions
|
|
8
|
-
import rafSchedule from 'raf-schd';
|
|
1
|
+
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
9
2
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
3
|
import { Popper as WrappedPopper } from '@atlaskit/popper/main';
|
|
4
|
+
import { Manager } from '@atlaskit/popper/manager';
|
|
11
5
|
import { positionPropToPopperPosition } from './internal/helpers';
|
|
12
|
-
const defaultState = {
|
|
13
|
-
hasExtractedStyles: false,
|
|
14
|
-
// We set these default offsets to prevent a flash of popper content in the wrong position
|
|
15
|
-
// which can cause incorrect height calculations. Popper will calculate these values
|
|
16
|
-
offsets: {
|
|
17
|
-
popper: {
|
|
18
|
-
left: -9999,
|
|
19
|
-
top: -9999,
|
|
20
|
-
position: null
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
cssPosition: 'absolute',
|
|
24
|
-
originalHeight: null,
|
|
25
|
-
maxHeight: null
|
|
26
|
-
};
|
|
27
6
|
function defaultOnPositioned() {}
|
|
28
7
|
const defaultProps = {
|
|
29
8
|
boundariesElement: 'viewport',
|
|
@@ -36,160 +15,6 @@ const defaultProps = {
|
|
|
36
15
|
isAlwaysFixed: false,
|
|
37
16
|
onPositioned: defaultOnPositioned
|
|
38
17
|
};
|
|
39
|
-
|
|
40
|
-
// Ignored via go/ees005
|
|
41
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
42
|
-
class LegacyLayer extends Component {
|
|
43
|
-
constructor(props) {
|
|
44
|
-
super(props);
|
|
45
|
-
_defineProperty(this, "targetRef", /*#__PURE__*/React.createRef());
|
|
46
|
-
_defineProperty(this, "contentRef", /*#__PURE__*/React.createRef());
|
|
47
|
-
_defineProperty(this, "extractStyles", state => {
|
|
48
|
-
if (state) {
|
|
49
|
-
const popperHeight = state.offsets.popper.height;
|
|
50
|
-
const left = Math.round(state.offsets.popper.left);
|
|
51
|
-
const top = Math.round(state.offsets.popper.top);
|
|
52
|
-
const cssPosition = 'absolute';
|
|
53
|
-
const originalHeight = this.state.originalHeight || popperHeight;
|
|
54
|
-
const maxHeight = this.calculateMaxHeight(originalHeight, popperHeight, top, cssPosition);
|
|
55
|
-
this.setState({
|
|
56
|
-
// position: fixed or absolute
|
|
57
|
-
cssPosition,
|
|
58
|
-
hasExtractedStyles: true,
|
|
59
|
-
transform: `translate3d(${left}px, ${top}px, 0px)`,
|
|
60
|
-
originalHeight,
|
|
61
|
-
maxHeight
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
this.state = defaultState;
|
|
66
|
-
this.extractStyles = rafSchedule(this.extractStyles.bind(this));
|
|
67
|
-
}
|
|
68
|
-
componentDidMount() {
|
|
69
|
-
this.applyPopper(this.props);
|
|
70
|
-
}
|
|
71
|
-
componentDidUpdate(prevProps, prevState) {
|
|
72
|
-
const {
|
|
73
|
-
onPositioned
|
|
74
|
-
} = this.props;
|
|
75
|
-
const {
|
|
76
|
-
hasExtractedStyles
|
|
77
|
-
} = this.state;
|
|
78
|
-
if (this.props !== prevProps) {
|
|
79
|
-
this.applyPopper(this.props);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// This flag is set the first time the position is calculated from Popper and applied to the content
|
|
83
|
-
if (!prevState.hasExtractedStyles && hasExtractedStyles && onPositioned) {
|
|
84
|
-
onPositioned();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
componentWillUnmount() {
|
|
88
|
-
// this.extractStyles.cancel();
|
|
89
|
-
if (this.popper) {
|
|
90
|
-
this.popper.destroy();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/* Calculate the max height of the popper if it's height is greater than the viewport to prevent
|
|
95
|
-
* the bottom of the popper not being viewable.
|
|
96
|
-
* Only works if the popper uses viewport as the boundary and has a fixed position ancestor.
|
|
97
|
-
*/
|
|
98
|
-
calculateMaxHeight(originalHeight, currentHeight, positionTop, cssPosition) {
|
|
99
|
-
let DocumentElementClientHeight = 0;
|
|
100
|
-
if (document.documentElement) {
|
|
101
|
-
DocumentElementClientHeight = document.documentElement.clientHeight;
|
|
102
|
-
}
|
|
103
|
-
if (cssPosition !== 'fixed') {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
const viewportHeight = Math.max(DocumentElementClientHeight, window.innerHeight || 0);
|
|
107
|
-
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ?
|
|
108
|
-
// allow some spacing either side of viewport height
|
|
109
|
-
viewportHeight - 12 : null;
|
|
110
|
-
}
|
|
111
|
-
applyPopper(props) {
|
|
112
|
-
if (!this.targetRef.current || !this.contentRef.current) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (this.popper) {
|
|
116
|
-
this.popper.destroy();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// "new Popper(...)" operation is very expensive when called on virtual DOM.
|
|
120
|
-
// This condition reduces the number of calls so we can run our tests faster
|
|
121
|
-
// (time was reduced from 100s to 13s).
|
|
122
|
-
if (!props.content) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// we wrap our target in a div so that we can safely get a reference to it, but we pass the
|
|
127
|
-
// actual target to popper
|
|
128
|
-
const isAlwaysFixed = false;
|
|
129
|
-
const actualTarget = this.targetRef.current.children[0];
|
|
130
|
-
const popperOpts = {
|
|
131
|
-
placement: positionPropToPopperPosition(props.position),
|
|
132
|
-
onCreate: this.extractStyles,
|
|
133
|
-
onUpdate: this.extractStyles,
|
|
134
|
-
modifiers: {
|
|
135
|
-
applyStyle: {
|
|
136
|
-
enabled: false
|
|
137
|
-
},
|
|
138
|
-
hide: {
|
|
139
|
-
enabled: false
|
|
140
|
-
},
|
|
141
|
-
offset: {
|
|
142
|
-
enabled: true,
|
|
143
|
-
offset: this.props.offset
|
|
144
|
-
},
|
|
145
|
-
flip: {
|
|
146
|
-
enabled: false,
|
|
147
|
-
flipVariations: true,
|
|
148
|
-
boundariesElement: 'viewport',
|
|
149
|
-
padding: 0 // leave 0 pixels between popper and the boundariesElement
|
|
150
|
-
},
|
|
151
|
-
preventOverflow: {
|
|
152
|
-
enabled: false,
|
|
153
|
-
escapeWithReference: true
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
positionFixed: isAlwaysFixed
|
|
157
|
-
};
|
|
158
|
-
if (actualTarget) {
|
|
159
|
-
this.popper = new Popper(actualTarget, this.contentRef.current, popperOpts);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
render() {
|
|
163
|
-
const {
|
|
164
|
-
transform,
|
|
165
|
-
hasExtractedStyles,
|
|
166
|
-
maxHeight
|
|
167
|
-
} = this.state;
|
|
168
|
-
const opacity = hasExtractedStyles ? {} : {
|
|
169
|
-
opacity: 0
|
|
170
|
-
};
|
|
171
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
172
|
-
ref: this.targetRef
|
|
173
|
-
}, this.props.children), /*#__PURE__*/React.createElement("div", {
|
|
174
|
-
ref: this.contentRef,
|
|
175
|
-
style: {
|
|
176
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
177
|
-
top: 0,
|
|
178
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
179
|
-
left: 0,
|
|
180
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
181
|
-
position: 'absolute',
|
|
182
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
183
|
-
transform,
|
|
184
|
-
maxHeight: maxHeight ? maxHeight : 'auto',
|
|
185
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
186
|
-
...opacity
|
|
187
|
-
}
|
|
188
|
-
}, this.props.content));
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// working with extract-react-types
|
|
192
|
-
_defineProperty(LegacyLayer, "defaultProps", defaultProps);
|
|
193
18
|
function parseOffset({
|
|
194
19
|
offset
|
|
195
20
|
}) {
|
|
@@ -267,11 +92,17 @@ function PopperInterop({
|
|
|
267
92
|
}, [children]);
|
|
268
93
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
269
94
|
ref: targetRef
|
|
270
|
-
}, children), content
|
|
95
|
+
}, children), content ?
|
|
96
|
+
/*#__PURE__*/
|
|
97
|
+
// Mount `content` in the same commit as the Layer, before `referenceElement` resolves.
|
|
98
|
+
// Callers act on the content DOM in that commit: DropList focuses it, and menus
|
|
99
|
+
// dispatch `ArrowDown` to focus their first item. The `Manager` stops Popper from
|
|
100
|
+
// using an ancestor `Manager`'s reference until `referenceElement` is set.
|
|
101
|
+
React.createElement(Manager, null, /*#__PURE__*/React.createElement(WrappedPopper, {
|
|
271
102
|
modifiers: modifiers,
|
|
272
103
|
offset: parsedOffset,
|
|
273
104
|
placement: positionPropToPopperPosition(position),
|
|
274
|
-
referenceElement: referenceElement,
|
|
105
|
+
referenceElement: referenceElement !== null && referenceElement !== void 0 ? referenceElement : undefined,
|
|
275
106
|
strategy: strategy
|
|
276
107
|
}, ({
|
|
277
108
|
ref,
|
|
@@ -279,10 +110,10 @@ function PopperInterop({
|
|
|
279
110
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
280
111
|
ref: ref,
|
|
281
112
|
style: style
|
|
282
|
-
}, content)) : /*#__PURE__*/React.createElement("div", null));
|
|
113
|
+
}, content))) : /*#__PURE__*/React.createElement("div", null));
|
|
283
114
|
}
|
|
284
115
|
|
|
285
|
-
/**
|
|
116
|
+
/** Positions `content` next to `children` with the ADS Popper wrapper. */
|
|
286
117
|
export default function Layer({
|
|
287
118
|
children = defaultProps.children,
|
|
288
119
|
content = defaultProps.content,
|
|
@@ -290,19 +121,11 @@ export default function Layer({
|
|
|
290
121
|
onPositioned = defaultProps.onPositioned,
|
|
291
122
|
position = defaultProps.position
|
|
292
123
|
}) {
|
|
293
|
-
|
|
294
|
-
return /*#__PURE__*/React.createElement(PopperInterop, {
|
|
295
|
-
content: content,
|
|
296
|
-
offset: offset,
|
|
297
|
-
onPositioned: onPositioned,
|
|
298
|
-
position: position,
|
|
299
|
-
strategy: "absolute"
|
|
300
|
-
}, children);
|
|
301
|
-
}
|
|
302
|
-
return /*#__PURE__*/React.createElement(LegacyLayer, {
|
|
124
|
+
return /*#__PURE__*/React.createElement(PopperInterop, {
|
|
303
125
|
content: content,
|
|
304
126
|
offset: offset,
|
|
305
127
|
onPositioned: onPositioned,
|
|
306
|
-
position: position
|
|
128
|
+
position: position,
|
|
129
|
+
strategy: "absolute"
|
|
307
130
|
}, children);
|
|
308
131
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
// eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { bind } from 'bind-event-listener';
|
|
5
5
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
|
-
import {
|
|
7
|
-
import { createPopper as createWrappedPopper } from '@atlaskit/popper/unsafe-imperative';
|
|
6
|
+
import { createPopper } from '@atlaskit/popper/unsafe-imperative';
|
|
8
7
|
import { logException } from '../monitoring/error';
|
|
9
8
|
const startingOffset = {
|
|
10
9
|
name: 'offset',
|
|
@@ -42,12 +41,6 @@ const generateTooltipId = (() => {
|
|
|
42
41
|
let count = 0;
|
|
43
42
|
return () => typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function' ? `${TOOLTIP_ID_PREFIX}-${crypto.randomUUID()}` : `${TOOLTIP_ID_PREFIX}-${count += 1}`;
|
|
44
43
|
})();
|
|
45
|
-
function getCreatePopper() {
|
|
46
|
-
if (fg('platform-dst-popper-consolidation')) {
|
|
47
|
-
return createWrappedPopper;
|
|
48
|
-
}
|
|
49
|
-
return createLegacyPopper;
|
|
50
|
-
}
|
|
51
44
|
|
|
52
45
|
/**
|
|
53
46
|
* A tooltip component similar to "@atlaskit/tooltip" but built for vanilla scenarios
|
|
@@ -263,7 +256,7 @@ export class VanillaTooltip {
|
|
|
263
256
|
}
|
|
264
257
|
}
|
|
265
258
|
createPopperInstance() {
|
|
266
|
-
this.popperInstance =
|
|
259
|
+
this.popperInstance = createPopper(this.trigger, this.tooltip, {
|
|
267
260
|
placement: this.placement,
|
|
268
261
|
modifiers: [startingOffset]
|
|
269
262
|
});
|
|
@@ -341,13 +334,12 @@ export class VanillaTooltip {
|
|
|
341
334
|
var _this$popperInstance2;
|
|
342
335
|
// Released rather than reconfigured. The instance was previously kept for the
|
|
343
336
|
// trigger's whole lifetime, so every element the pointer passed over retained
|
|
344
|
-
// one — and
|
|
345
|
-
//
|
|
337
|
+
// one — and an instance owns a detached React root, so that was a retained
|
|
338
|
+
// root per hovered trigger.
|
|
346
339
|
//
|
|
347
340
|
// Destroying is also the only way to release that root's capture-phase
|
|
348
|
-
// `scroll`/`resize` listeners
|
|
349
|
-
//
|
|
350
|
-
// does nothing.
|
|
341
|
+
// `scroll`/`resize` listeners, where the `eventListeners: false`
|
|
342
|
+
// reconfiguration in the control arm is accepted but does nothing.
|
|
351
343
|
(_this$popperInstance2 = this.popperInstance) === null || _this$popperInstance2 === void 0 ? void 0 : _this$popperInstance2.destroy();
|
|
352
344
|
this.popperInstance = undefined;
|
|
353
345
|
this.tooltip.style.opacity = '0';
|
|
@@ -23,6 +23,7 @@ import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
|
23
23
|
import { NodeViewContentHole } from '../../../react-node-view/NodeViewContentHole';
|
|
24
24
|
import { overflowShadow } from '../../../ui';
|
|
25
25
|
import { calculateBreakoutStyles } from '../../../utils';
|
|
26
|
+
import { hasBreakoutWidth } from '../../utils/has-breakout-width';
|
|
26
27
|
import { shouldExtensionBreakout } from '../../utils/should-extension-breakout';
|
|
27
28
|
import { ExtensionCommentBadge } from '../ExtensionCommentBadge';
|
|
28
29
|
import ExtensionLozenge from '../Lozenge';
|
|
@@ -106,7 +107,8 @@ function ExtensionWithPluginState(props) {
|
|
|
106
107
|
editorAppearance: editorAppearance,
|
|
107
108
|
hasBreakoutMark: (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.some(function (mark) {
|
|
108
109
|
return mark.type.name === 'breakout';
|
|
109
|
-
})
|
|
110
|
+
}),
|
|
111
|
+
hasBreakoutWidth: hasBreakoutWidth(node.marks)
|
|
110
112
|
});
|
|
111
113
|
|
|
112
114
|
// We don't want to show border for non-empty 1p bodied extensions in live pages
|
|
@@ -25,6 +25,7 @@ import { removeMarginsAndBorder, sharedMultiBodiedExtensionStyles } from '../../
|
|
|
25
25
|
import { calculateBreakoutStyles, getExtensionLozengeData } from '../../utils';
|
|
26
26
|
import ExtensionLozenge from '../Extension/Lozenge';
|
|
27
27
|
import { ExtensionFloatingLabel } from '../Extension/Lozenge/ExtensionFloatingLabel';
|
|
28
|
+
import { hasBreakoutWidth } from '../utils/has-breakout-width';
|
|
28
29
|
import { shouldExtensionBreakout } from '../utils/should-extension-breakout';
|
|
29
30
|
import { useMultiBodiedExtensionActions } from './action-api';
|
|
30
31
|
import { mbeExtensionWrapperCSSStyles, mbeExtensionWrapperCSSStylesOld, overlayStyles, overlayStylesOld } from './styles';
|
|
@@ -249,7 +250,8 @@ var MultiBodiedExtensionWithWidth = function MultiBodiedExtensionWithWidth(_ref2
|
|
|
249
250
|
isTopLevelNode: true,
|
|
250
251
|
hasBreakoutMark: (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.some(function (mark) {
|
|
251
252
|
return mark.type.name === 'breakout';
|
|
252
|
-
})
|
|
253
|
+
}),
|
|
254
|
+
hasBreakoutWidth: hasBreakoutWidth(node.marks)
|
|
253
255
|
});
|
|
254
256
|
var mbeWrapperStyles = {};
|
|
255
257
|
if (shouldBreakout) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
+
/** returns the breakout width if the node has a breakout mark with a positive breakout width. */
|
|
5
|
+
export var getBreakoutWidth = function getBreakoutWidth(marks) {
|
|
6
|
+
var _iterator = _createForOfIteratorHelper(marks !== null && marks !== void 0 ? marks : []),
|
|
7
|
+
_step;
|
|
8
|
+
try {
|
|
9
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
10
|
+
var mark = _step.value;
|
|
11
|
+
if (mark.type.name === 'breakout' && typeof mark.attrs.width === 'number' && mark.attrs.width > 0) {
|
|
12
|
+
return mark.attrs.width;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
} catch (err) {
|
|
16
|
+
_iterator.e(err);
|
|
17
|
+
} finally {
|
|
18
|
+
_iterator.f();
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
3
|
var breakoutLayouts = new Set(['full-width', 'wide']);
|
|
3
4
|
var shouldRespectBreakoutForAppearance = function shouldRespectBreakoutForAppearance(appearance) {
|
|
4
5
|
if (!appearance) {
|
|
@@ -18,8 +19,16 @@ export var shouldExtensionBreakout = function shouldExtensionBreakout(_ref) {
|
|
|
18
19
|
isTopLevelNode = _ref$isTopLevelNode === void 0 ? true : _ref$isTopLevelNode,
|
|
19
20
|
editorAppearance = _ref.editorAppearance,
|
|
20
21
|
_ref$hasBreakoutMark = _ref.hasBreakoutMark,
|
|
21
|
-
hasBreakoutMark = _ref$hasBreakoutMark === void 0 ? false : _ref$hasBreakoutMark
|
|
22
|
+
hasBreakoutMark = _ref$hasBreakoutMark === void 0 ? false : _ref$hasBreakoutMark,
|
|
23
|
+
_ref$hasBreakoutWidth = _ref.hasBreakoutWidth,
|
|
24
|
+
hasBreakoutWidth = _ref$hasBreakoutWidth === void 0 ? false : _ref$hasBreakoutWidth;
|
|
22
25
|
// the breakout mark wrapper owns the width, so the legacy layout must not size the node too
|
|
26
|
+
if (fg('platform_editor_lovability_resize_exts_gracefully') && isExperimentEnabled('platform_editor_lovability_resize_exts_patch_1') && hasBreakoutWidth) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// once platform_editor_lovability_resize_exts_patch_1 is rolled out, we can remove this redundant check.
|
|
31
|
+
// because the previous check should have returned false already for extensions with breakout widths.
|
|
23
32
|
if (hasBreakoutMark && isExperimentEnabled('platform_editor_lovability_resize_extensions')) {
|
|
24
33
|
return false;
|
|
25
34
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl';
|
|
2
2
|
export var messages = defineMessages({
|
|
3
|
+
customWidth: {
|
|
4
|
+
id: 'fabric.editor.extension.customWidth',
|
|
5
|
+
defaultMessage: 'Custom width',
|
|
6
|
+
description: 'Label for the layout button in the extension toolbar when the extension has been resized to a custom width.'
|
|
7
|
+
},
|
|
3
8
|
edit: {
|
|
4
9
|
id: 'fabric.editor.edit',
|
|
5
10
|
defaultMessage: 'Edit',
|
|
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
19
19
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "134.7.
|
|
22
|
+
var packageVersion = "134.7.2";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
-
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
1
|
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
4
2
|
._189ee4h9{border-width:var(--ds-border-width,1px)}
|
|
5
|
-
._18zr1b66{padding-inline:var(--ds-space-050,4px)}
|
|
6
3
|
._1dqonqa1{border-style:solid}
|
|
7
|
-
._1h6d1l7x{border-color:var(--ds-border,#0b120e24)}
|
|
8
|
-
._1rjcv77o{padding-block:var(--ds-space-025,2px)}
|
|
9
|
-
._16jlkb7n{flex-grow:1}
|
|
4
|
+
._1h6d1l7x{border-color:var(--ds-border,#0b120e24)}._16jlkb7n{flex-grow:1}
|
|
10
5
|
._18m915vq{overflow-y:hidden}
|
|
11
6
|
._1bah1h6o{justify-content:center}
|
|
12
7
|
._1bsbzwfg{width:2pc}
|
|
@@ -21,8 +16,6 @@
|
|
|
21
16
|
._4cvr1h6o{align-items:center}
|
|
22
17
|
._4t3izwfg{height:2pc}
|
|
23
18
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
24
|
-
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
25
19
|
._i0dlidpf{flex-basis:0}
|
|
26
20
|
._rpzpjdj5 [style*="--ds-icon-accent-gray"]{color:inherit!important}
|
|
27
|
-
._syaz1q3r{color:var(--ds-icon,#292a2e)}
|
|
28
|
-
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
21
|
+
._syaz1q3r{color:var(--ds-icon,#292a2e)}
|
|
@@ -12,12 +12,12 @@ import { Pressable } from '@atlaskit/primitives/pressable';
|
|
|
12
12
|
import { xcss } from '@atlaskit/primitives/xcss/xcss';
|
|
13
13
|
import { QuickInsertHoverPreview } from './QuickInsertHoverPreview';
|
|
14
14
|
import { useQuickInsertMenuItemSelection } from './quickInsertMenuItemUtils';
|
|
15
|
+
import { QuickInsertShortcut } from './QuickInsertShortcut';
|
|
15
16
|
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
16
17
|
var styles = {
|
|
17
18
|
iconContainer: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o _1tke1tcg _1ul91tcg",
|
|
18
19
|
content: "_16jlkb7n _1o9zkb7n _i0dlidpf _1ul9idpf",
|
|
19
|
-
iconLarge: "_2rko1mok _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg"
|
|
20
|
-
shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu"
|
|
20
|
+
iconLarge: "_2rko1mok _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg"
|
|
21
21
|
};
|
|
22
22
|
var iconColorStyles = null;
|
|
23
23
|
|
|
@@ -156,10 +156,10 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
|
|
|
156
156
|
}, lozenge ? /*#__PURE__*/React.createElement(Inline, {
|
|
157
157
|
alignBlock: "center",
|
|
158
158
|
space: "space.100"
|
|
159
|
-
}, rowTitle, lozenge) : rowTitle, shortcut && /*#__PURE__*/React.createElement(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
159
|
+
}, rowTitle, lozenge) : rowTitle, shortcut && /*#__PURE__*/React.createElement(QuickInsertShortcut, {
|
|
160
|
+
isDisabled: isDisabled,
|
|
161
|
+
shortcut: shortcut
|
|
162
|
+
}))), shouldRenderPreview && referenceElement && /*#__PURE__*/React.createElement(QuickInsertHoverPreview, {
|
|
163
163
|
key: (_ref3 = (_resolvedPreview$imag = (_resolvedPreview$imag2 = resolvedPreview.image) === null || _resolvedPreview$imag2 === void 0 ? void 0 : _resolvedPreview$imag2.light) !== null && _resolvedPreview$imag !== void 0 ? _resolvedPreview$imag : previewAttributionKey) !== null && _ref3 !== void 0 ? _ref3 : title,
|
|
164
164
|
id: previewId,
|
|
165
165
|
description: resolvedDescription,
|