@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,15 +13,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactDom = require("react-dom");
|
|
15
15
|
var _bindEventListener = require("bind-event-listener");
|
|
16
|
-
var _reactIntl = require("react-intl");
|
|
17
16
|
var _reactPopper = require("@atlaskit/popper/react-popper");
|
|
18
|
-
var
|
|
19
|
-
var _inline = require("@atlaskit/primitives/compiled/inline");
|
|
20
|
-
var _text = require("@atlaskit/primitives/compiled/text");
|
|
21
|
-
var _useThemeObserver2 = require("@atlaskit/tokens/use-theme-observer");
|
|
22
|
-
var _messages = require("./messages");
|
|
17
|
+
var _QuickInsertPreviewContent = require("./QuickInsertPreviewContent");
|
|
23
18
|
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); }
|
|
24
|
-
// Viewport calculations
|
|
19
|
+
// Viewport calculations require styles outside @atlaskit/css's schema.
|
|
25
20
|
// Viewport clamping requires modifiers, which the top-layer adapter does not support.
|
|
26
21
|
var PREVIEW_MODIFIERS = [{
|
|
27
22
|
name: 'offset',
|
|
@@ -47,25 +42,9 @@ var PREVIEW_MODIFIERS = [{
|
|
|
47
42
|
rootBoundary: 'viewport'
|
|
48
43
|
}
|
|
49
44
|
}];
|
|
50
|
-
var layoutStyles = {
|
|
51
|
-
titleRow: "_1ul9idpf",
|
|
52
|
-
titleIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o",
|
|
53
|
-
attributionText: "_16jlkb7n _1o9zkb7n _i0dl1wug _1ul9idpf _1i4qfg65"
|
|
54
|
-
};
|
|
55
45
|
var styles = {
|
|
56
46
|
positioner: "_c71lk6is _p12f1oec _1pby16oo",
|
|
57
|
-
panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg"
|
|
58
|
-
content: "_zulpu2gc _1e0c1txw _2lx21bp4",
|
|
59
|
-
title: "_11c81qyo _16jlkb7n _1o9zkb7n _i0dl1wug _1reo15vq _18m915vq _syazazsu _1ul9idpf _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
|
|
60
|
-
unclampedTitle: "_11c8fhey _16jlkb7n _1o9zkb7n _i0dl1wug _syazi7uo _k48pwu06 _1ul9idpf _1i4qfg65",
|
|
61
|
-
description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
|
|
62
|
-
unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
|
|
63
|
-
imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _p12f1osq _1bsbp3fh",
|
|
64
|
-
image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
|
|
65
|
-
imageHidden: "_3um015vq",
|
|
66
|
-
attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
|
|
67
|
-
compactAttribution: "_11c8wadc",
|
|
68
|
-
attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
|
|
47
|
+
panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg"
|
|
69
48
|
};
|
|
70
49
|
|
|
71
50
|
/** The selected item's description and attribution are announced through its aria-describedby. */
|
|
@@ -80,9 +59,6 @@ var QuickInsertHoverPreview = exports.QuickInsertHoverPreview = function QuickIn
|
|
|
80
59
|
shouldClampText = _ref$shouldClampText === void 0 ? true : _ref$shouldClampText,
|
|
81
60
|
title = _ref.title,
|
|
82
61
|
titleContent = _ref.titleContent;
|
|
83
|
-
var _useThemeObserver = (0, _useThemeObserver2.useThemeObserver)(),
|
|
84
|
-
colorMode = _useThemeObserver.colorMode;
|
|
85
|
-
var imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
|
|
86
62
|
var hasAccessibleContent = Boolean(description || preview.attribution);
|
|
87
63
|
var portalTarget = popupsMountPoint !== null && popupsMountPoint !== void 0 ? popupsMountPoint : referenceElement.ownerDocument.body;
|
|
88
64
|
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, {
|
|
@@ -102,7 +78,6 @@ var QuickInsertHoverPreview = exports.QuickInsertHoverPreview = function QuickIn
|
|
|
102
78
|
description: description,
|
|
103
79
|
icon: icon,
|
|
104
80
|
id: hasAccessibleContent ? id : undefined,
|
|
105
|
-
imageUrl: imageUrl,
|
|
106
81
|
preview: preview,
|
|
107
82
|
popupsMountPoint: popupsMountPoint,
|
|
108
83
|
referenceElement: referenceElement,
|
|
@@ -114,11 +89,9 @@ var QuickInsertHoverPreview = exports.QuickInsertHoverPreview = function QuickIn
|
|
|
114
89
|
}), portalTarget);
|
|
115
90
|
};
|
|
116
91
|
var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
|
|
117
|
-
var _preview$attribution, _preview$attribution2;
|
|
118
92
|
var description = _ref3.description,
|
|
119
93
|
icon = _ref3.icon,
|
|
120
94
|
id = _ref3.id,
|
|
121
|
-
imageUrl = _ref3.imageUrl,
|
|
122
95
|
preview = _ref3.preview,
|
|
123
96
|
popupsMountPoint = _ref3.popupsMountPoint,
|
|
124
97
|
referenceElement = _ref3.referenceElement,
|
|
@@ -126,15 +99,10 @@ var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
|
|
|
126
99
|
title = _ref3.title,
|
|
127
100
|
titleContent = _ref3.titleContent,
|
|
128
101
|
update = _ref3.update;
|
|
129
|
-
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
130
|
-
formatMessage = _useIntl.formatMessage;
|
|
131
102
|
var _useState = (0, _react.useState)(null),
|
|
132
103
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
133
104
|
panelElement = _useState2[0],
|
|
134
105
|
setPanelElement = _useState2[1];
|
|
135
|
-
var AttributionIcon = (_preview$attribution = preview.attribution) === null || _preview$attribution === void 0 ? void 0 : _preview$attribution.icon;
|
|
136
|
-
var attributionName = (_preview$attribution2 = preview.attribution) === null || _preview$attribution2 === void 0 ? void 0 : _preview$attribution2.name;
|
|
137
|
-
var formattedAttributionName = typeof attributionName === 'string' ? attributionName : attributionName ? formatMessage(attributionName) : '';
|
|
138
106
|
(0, _react.useLayoutEffect)(function () {
|
|
139
107
|
var _ownerDocument$defaul;
|
|
140
108
|
void update();
|
|
@@ -170,63 +138,11 @@ var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
|
|
|
170
138
|
role: id ? 'tooltip' : undefined,
|
|
171
139
|
"data-testid": "quick-insert-preview-panel",
|
|
172
140
|
className: (0, _runtime.ax)([styles.panel])
|
|
173
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
alignBlock: "center",
|
|
180
|
-
space: "space.100",
|
|
181
|
-
xcss: layoutStyles.titleRow,
|
|
182
|
-
"aria-hidden": "true"
|
|
183
|
-
}, icon && /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
184
|
-
as: "span",
|
|
185
|
-
"aria-hidden": "true",
|
|
186
|
-
xcss: layoutStyles.titleIcon
|
|
187
|
-
}, icon), /*#__PURE__*/_react.default.createElement("span", {
|
|
188
|
-
className: (0, _runtime.ax)([shouldClampText && styles.title, !shouldClampText && styles.unclampedTitle])
|
|
189
|
-
}, titleContent !== null && titleContent !== void 0 ? titleContent : title)), description && /*#__PURE__*/_react.default.createElement("div", {
|
|
190
|
-
className: (0, _runtime.ax)([shouldClampText && styles.description, !shouldClampText && styles.unclampedDescription])
|
|
191
|
-
}, description), preview.attribution && /*#__PURE__*/_react.default.createElement("div", {
|
|
192
|
-
className: (0, _runtime.ax)([styles.attribution, shouldClampText && styles.compactAttribution])
|
|
193
|
-
}, AttributionIcon && /*#__PURE__*/_react.default.createElement("span", {
|
|
194
|
-
"aria-hidden": "true",
|
|
195
|
-
className: (0, _runtime.ax)([styles.attributionIcon])
|
|
196
|
-
}, /*#__PURE__*/_react.default.createElement(AttributionIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
|
|
197
|
-
className: (0, _runtime.ax)([layoutStyles.attributionText])
|
|
198
|
-
}, /*#__PURE__*/_react.default.createElement(_text.Text, {
|
|
199
|
-
size: "small",
|
|
200
|
-
color: "color.text.subtle"
|
|
201
|
-
}, AttributionIcon ? formattedAttributionName : formatMessage(_messages.messages.previewAttributionBy, {
|
|
202
|
-
name: formattedAttributionName
|
|
203
|
-
})))))));
|
|
204
|
-
};
|
|
205
|
-
var PreviewImage = function PreviewImage(_ref4) {
|
|
206
|
-
var imageUrl = _ref4.imageUrl;
|
|
207
|
-
var _useState3 = (0, _react.useState)(false),
|
|
208
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
209
|
-
hasFailed = _useState4[0],
|
|
210
|
-
setHasFailed = _useState4[1];
|
|
211
|
-
var _useState5 = (0, _react.useState)(false),
|
|
212
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
213
|
-
hasLoaded = _useState6[0],
|
|
214
|
-
setHasLoaded = _useState6[1];
|
|
215
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
216
|
-
"aria-hidden": "true",
|
|
217
|
-
"data-testid": "quick-insert-preview-image-area",
|
|
218
|
-
className: (0, _runtime.ax)([styles.imageArea])
|
|
219
|
-
}, !hasFailed && /*#__PURE__*/_react.default.createElement("img", {
|
|
220
|
-
"aria-hidden": "true",
|
|
221
|
-
"data-testid": "quick-insert-hover-preview",
|
|
222
|
-
src: imageUrl,
|
|
223
|
-
alt: "",
|
|
224
|
-
onLoad: function onLoad() {
|
|
225
|
-
return setHasLoaded(true);
|
|
226
|
-
},
|
|
227
|
-
onError: function onError() {
|
|
228
|
-
return setHasFailed(true);
|
|
229
|
-
},
|
|
230
|
-
className: (0, _runtime.ax)([styles.image, !hasLoaded && styles.imageHidden])
|
|
141
|
+
}, /*#__PURE__*/_react.default.createElement(_QuickInsertPreviewContent.QuickInsertPreviewContent, {
|
|
142
|
+
description: description,
|
|
143
|
+
icon: icon,
|
|
144
|
+
preview: preview,
|
|
145
|
+
shouldClampText: shouldClampText,
|
|
146
|
+
title: titleContent !== null && titleContent !== void 0 ? titleContent : title
|
|
231
147
|
}));
|
|
232
148
|
};
|
|
@@ -37,9 +37,10 @@ var QuickInsertMenuItem = exports.QuickInsertMenuItem = function QuickInsertMenu
|
|
|
37
37
|
isDisabled: isDisabled,
|
|
38
38
|
lozenge: lozenge,
|
|
39
39
|
onSelect: onSelect,
|
|
40
|
+
preview: preview,
|
|
41
|
+
previewImageUrls: previewImageUrls,
|
|
40
42
|
shortcut: shortcut,
|
|
41
43
|
titleContent: titleContent,
|
|
42
|
-
shouldWrapIcon: shouldWrapIcon,
|
|
43
44
|
title: title
|
|
44
45
|
}) : /*#__PURE__*/_react.default.createElement(_CompactQuickInsertMenuItem.CompactQuickInsertMenuItem, {
|
|
45
46
|
ariaLabel: ariaLabel,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
._11c81qyo{font:var(--ds-font-heading-xsmall,normal 653 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
3
|
+
._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)}
|
|
4
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
5
|
+
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
6
|
+
._zulpu2gc{gap:var(--ds-space-100,8px)}
|
|
7
|
+
._16jlidpf{flex-grow:0}
|
|
8
|
+
._16jlkb7n{flex-grow:1}
|
|
9
|
+
._18m915vq{overflow-y:hidden}
|
|
10
|
+
._1bah1h6o{justify-content:center}
|
|
11
|
+
._1bsb1osq{width:100%}
|
|
12
|
+
._1bsb7vkz{width:1pc}
|
|
13
|
+
._1e0c1txw{display:flex}
|
|
14
|
+
._1e0c1ule{display:block}
|
|
15
|
+
._1e0ccj1k{display:-webkit-box}
|
|
16
|
+
._1i4qfg65{overflow-wrap:anywhere}
|
|
17
|
+
._1o9zidpf{flex-shrink:0}
|
|
18
|
+
._1o9zkb7n{flex-shrink:1}
|
|
19
|
+
._1pfh1wug{margin-block-start:auto}
|
|
20
|
+
._1reo15vq{overflow-x:hidden}
|
|
21
|
+
._1ul9idpf{min-width:0}
|
|
22
|
+
._1yyjcs5v{-webkit-line-clamp:2}
|
|
23
|
+
._1yyjegat{-webkit-line-clamp:4}
|
|
24
|
+
._2lx21bp4{flex-direction:column}
|
|
25
|
+
._3um015vq{visibility:hidden}
|
|
26
|
+
._4cvr1h6o{align-items:center}
|
|
27
|
+
._4t3i1osq{height:100%}
|
|
28
|
+
._4t3i68cl{height:90pt}
|
|
29
|
+
._4t3i7vkz{height:1pc}
|
|
30
|
+
._5ral1f51{object-fit:contain}
|
|
31
|
+
._6rthu2gc{margin-block-end:var(--ds-space-100,8px)}
|
|
32
|
+
._bfhkhfxm{background-color:var(--ds-surface-sunken,#f8f8f8)}
|
|
33
|
+
._i0dl1wug{flex-basis:auto}
|
|
34
|
+
._i0dlexct{flex-basis:16px}
|
|
35
|
+
._sudp1e54{-webkit-box-orient:vertical}
|
|
36
|
+
._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
|
|
37
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
38
|
+
._syazi7uo{color:var(--ds-text,#292a2e)}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* QuickInsertPreviewContent.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.QuickInsertPreviewContent = void 0;
|
|
10
|
+
require("./QuickInsertPreviewContent.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _reactIntl = require("react-intl");
|
|
15
|
+
var _box = require("@atlaskit/primitives/compiled/box");
|
|
16
|
+
var _inline = require("@atlaskit/primitives/compiled/inline");
|
|
17
|
+
var _text = require("@atlaskit/primitives/compiled/text");
|
|
18
|
+
var _useThemeObserver2 = require("@atlaskit/tokens/use-theme-observer");
|
|
19
|
+
var _messages = require("./messages");
|
|
20
|
+
var _QuickInsertShortcut = require("./QuickInsertShortcut");
|
|
21
|
+
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); }
|
|
22
|
+
// Multiline clamping requires styles outside @atlaskit/css's schema.
|
|
23
|
+
var layoutStyles = {
|
|
24
|
+
titleRow: "_1ul9idpf",
|
|
25
|
+
titleIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o",
|
|
26
|
+
attributionText: "_16jlkb7n _1o9zkb7n _i0dl1wug _1ul9idpf _1i4qfg65"
|
|
27
|
+
};
|
|
28
|
+
var styles = {
|
|
29
|
+
root: "_1e0c1txw _2lx21bp4 _16jlkb7n _1ul9idpf",
|
|
30
|
+
content: "_zulpu2gc _1e0c1txw _2lx21bp4 _16jlkb7n",
|
|
31
|
+
title: "_11c81qyo _16jlidpf _1o9zkb7n _i0dl1wug _syazazsu _1ul9idpf _1i4qfg65",
|
|
32
|
+
clampedTitle: "_1reo15vq _18m915vq _1e0ccj1k _sudp1e54 _1yyjcs5v",
|
|
33
|
+
description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
|
|
34
|
+
unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
|
|
35
|
+
disabledText: "_syaz1gmx",
|
|
36
|
+
imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _1bsb1osq",
|
|
37
|
+
image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
|
|
38
|
+
imageHidden: "_3um015vq",
|
|
39
|
+
attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1pfh1wug _1i4qfg65",
|
|
40
|
+
compactAttribution: "_11c8wadc",
|
|
41
|
+
attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The image, title, description, and attribution shared by the Quick Insert hover preview and
|
|
46
|
+
* Element Browser tiles. It fills its container; callers own its width and accessible name.
|
|
47
|
+
*/
|
|
48
|
+
var QuickInsertPreviewContent = exports.QuickInsertPreviewContent = function QuickInsertPreviewContent(_ref) {
|
|
49
|
+
var _preview$attribution, _preview$attribution2;
|
|
50
|
+
var description = _ref.description,
|
|
51
|
+
icon = _ref.icon,
|
|
52
|
+
id = _ref.id,
|
|
53
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
54
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
55
|
+
lozenge = _ref.lozenge,
|
|
56
|
+
preview = _ref.preview,
|
|
57
|
+
shortcut = _ref.shortcut,
|
|
58
|
+
_ref$shouldClampText = _ref.shouldClampText,
|
|
59
|
+
shouldClampText = _ref$shouldClampText === void 0 ? true : _ref$shouldClampText,
|
|
60
|
+
title = _ref.title;
|
|
61
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
62
|
+
formatMessage = _useIntl.formatMessage;
|
|
63
|
+
var _useThemeObserver = (0, _useThemeObserver2.useThemeObserver)(),
|
|
64
|
+
colorMode = _useThemeObserver.colorMode;
|
|
65
|
+
var imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
|
|
66
|
+
var AttributionIcon = (_preview$attribution = preview.attribution) === null || _preview$attribution === void 0 ? void 0 : _preview$attribution.icon;
|
|
67
|
+
var attributionName = (_preview$attribution2 = preview.attribution) === null || _preview$attribution2 === void 0 ? void 0 : _preview$attribution2.name;
|
|
68
|
+
var formattedAttributionName = typeof attributionName === 'string' ? attributionName : attributionName ? formatMessage(attributionName) : '';
|
|
69
|
+
var titleRow = /*#__PURE__*/_react.default.createElement(_inline.Inline, {
|
|
70
|
+
alignBlock: "center",
|
|
71
|
+
space: "space.100",
|
|
72
|
+
xcss: layoutStyles.titleRow
|
|
73
|
+
}, icon && /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
74
|
+
as: "span",
|
|
75
|
+
"aria-hidden": "true",
|
|
76
|
+
xcss: layoutStyles.titleIcon
|
|
77
|
+
}, icon), /*#__PURE__*/_react.default.createElement("span", {
|
|
78
|
+
"aria-hidden": "true",
|
|
79
|
+
className: (0, _runtime.ax)([styles.title, shouldClampText && styles.clampedTitle, isDisabled && styles.disabledText])
|
|
80
|
+
}, title), lozenge);
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
id: id,
|
|
83
|
+
className: (0, _runtime.ax)([styles.root])
|
|
84
|
+
}, imageUrl && /*#__PURE__*/_react.default.createElement(PreviewImage, {
|
|
85
|
+
key: imageUrl,
|
|
86
|
+
imageUrl: imageUrl
|
|
87
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
88
|
+
className: (0, _runtime.ax)([styles.content])
|
|
89
|
+
}, shortcut ? /*#__PURE__*/_react.default.createElement(_inline.Inline, {
|
|
90
|
+
alignBlock: "start",
|
|
91
|
+
space: "space.100",
|
|
92
|
+
spread: "space-between"
|
|
93
|
+
}, titleRow, /*#__PURE__*/_react.default.createElement(_QuickInsertShortcut.QuickInsertShortcut, {
|
|
94
|
+
isDisabled: isDisabled,
|
|
95
|
+
shortcut: shortcut
|
|
96
|
+
})) : titleRow, description && /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
+
className: (0, _runtime.ax)([shouldClampText && styles.description, !shouldClampText && styles.unclampedDescription, isDisabled && styles.disabledText])
|
|
98
|
+
}, description), preview.attribution && /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: (0, _runtime.ax)([styles.attribution, shouldClampText && styles.compactAttribution, isDisabled && styles.disabledText])
|
|
100
|
+
}, AttributionIcon && /*#__PURE__*/_react.default.createElement("span", {
|
|
101
|
+
"aria-hidden": "true",
|
|
102
|
+
className: (0, _runtime.ax)([styles.attributionIcon])
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement(AttributionIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
|
|
104
|
+
className: (0, _runtime.ax)([layoutStyles.attributionText])
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_text.Text, {
|
|
106
|
+
size: "small",
|
|
107
|
+
color: isDisabled ? 'color.text.disabled' : 'color.text.subtle'
|
|
108
|
+
}, AttributionIcon ? formattedAttributionName : formatMessage(_messages.messages.previewAttributionBy, {
|
|
109
|
+
name: formattedAttributionName
|
|
110
|
+
}))))));
|
|
111
|
+
};
|
|
112
|
+
var PreviewImage = function PreviewImage(_ref2) {
|
|
113
|
+
var imageUrl = _ref2.imageUrl;
|
|
114
|
+
var _useState = (0, _react.useState)(false),
|
|
115
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
116
|
+
hasFailed = _useState2[0],
|
|
117
|
+
setHasFailed = _useState2[1];
|
|
118
|
+
var _useState3 = (0, _react.useState)(false),
|
|
119
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
120
|
+
hasLoaded = _useState4[0],
|
|
121
|
+
setHasLoaded = _useState4[1];
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
"aria-hidden": "true",
|
|
124
|
+
"data-testid": "quick-insert-preview-image-area",
|
|
125
|
+
className: (0, _runtime.ax)([styles.imageArea])
|
|
126
|
+
}, !hasFailed && /*#__PURE__*/_react.default.createElement("img", {
|
|
127
|
+
"aria-hidden": "true",
|
|
128
|
+
"data-testid": "quick-insert-hover-preview"
|
|
129
|
+
// Element Browser tiles below the fold load as they scroll into view.
|
|
130
|
+
,
|
|
131
|
+
loading: "lazy",
|
|
132
|
+
src: imageUrl,
|
|
133
|
+
alt: "",
|
|
134
|
+
onLoad: function onLoad() {
|
|
135
|
+
return setHasLoaded(true);
|
|
136
|
+
},
|
|
137
|
+
onError: function onError() {
|
|
138
|
+
return setHasFailed(true);
|
|
139
|
+
},
|
|
140
|
+
className: (0, _runtime.ax)([styles.image, !hasLoaded && styles.imageHidden])
|
|
141
|
+
}));
|
|
142
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
._18zr1b66{padding-inline:var(--ds-space-050,4px)}
|
|
4
|
+
._1rjcv77o{padding-block:var(--ds-space-025,2px)}
|
|
5
|
+
._1o9zidpf{flex-shrink:0}
|
|
6
|
+
._bfhk187o{background-color:var(--ds-background-disabled,#0515240f)}
|
|
7
|
+
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
8
|
+
._o5721q9c{white-space:nowrap}
|
|
9
|
+
._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
|
|
10
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* QuickInsertShortcut.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.QuickInsertShortcut = void 0;
|
|
9
|
+
require("./QuickInsertShortcut.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var styles = {
|
|
13
|
+
shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu _1o9zidpf _o5721q9c",
|
|
14
|
+
disabled: "_bfhk187o _syaz1gmx"
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The keyboard or markdown shortcut chip shown beside a Quick Insert item's title, in both the
|
|
19
|
+
* slash-menu row and the Element Browser tile.
|
|
20
|
+
*/
|
|
21
|
+
var QuickInsertShortcut = exports.QuickInsertShortcut = function QuickInsertShortcut(_ref) {
|
|
22
|
+
var _ref$isDisabled = _ref.isDisabled,
|
|
23
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
24
|
+
shortcut = _ref.shortcut;
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
26
|
+
className: (0, _runtime.ax)([styles.shortcut, isDisabled && styles.disabled])
|
|
27
|
+
}, shortcut);
|
|
28
|
+
};
|
|
@@ -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 = "134.7.
|
|
26
|
+
var packageVersion = "134.7.2";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -136,6 +136,7 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
|
|
|
136
136
|
isHovered = _useState4[0],
|
|
137
137
|
setHovered = _useState4[1];
|
|
138
138
|
var openTextWidthRef = (0, _react.useRef)(null);
|
|
139
|
+
var shouldDeferMeasurement = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_2');
|
|
139
140
|
var regularPadding = DYNAMIC_PADDING_BLOCK;
|
|
140
141
|
var memoizedHoverLinkStyles = (0, _react.useMemo)(function () {
|
|
141
142
|
return {
|
|
@@ -150,21 +151,55 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
|
|
|
150
151
|
if (!isVisible || !isHovered) {
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
154
|
+
if (shouldDeferMeasurement) {
|
|
155
|
+
var container = containerRef.current;
|
|
156
|
+
var button = hoverLinkButtonRef.current;
|
|
157
|
+
var hiddenText = hiddenTextRef.current;
|
|
158
|
+
if (!container || !button || !hiddenText) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
var observer = new ResizeObserver(function () {
|
|
162
|
+
// One measurement per hover; hiding the label must not trigger another one.
|
|
163
|
+
observer.disconnect();
|
|
164
|
+
var cardWidth = container.offsetWidth;
|
|
165
|
+
var openButtonWidth = button.offsetWidth;
|
|
166
|
+
// Get the hidden text width
|
|
167
|
+
var openTextWidth = hiddenText.offsetWidth || DEFAULT_OPEN_TEXT_WIDTH;
|
|
168
|
+
if (!cardWidth || !openButtonWidth) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
var canShowLabel = cardWidth - openTextWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY + ICON_WIDTH;
|
|
172
|
+
|
|
173
|
+
// When a smart link wraps to multiple lines in a constrained container (e.g. table cell),
|
|
174
|
+
// the hover button can overflow beyond the container bounds. We detect this by comparing
|
|
175
|
+
// the button's right edge to the container's right edge, and hide the label if it overflows.
|
|
176
|
+
var containerRight = container.getBoundingClientRect().right;
|
|
177
|
+
var buttonRight = button.getBoundingClientRect().right;
|
|
178
|
+
if (buttonRight > containerRight) {
|
|
179
|
+
canShowLabel = false;
|
|
180
|
+
}
|
|
181
|
+
setShowLabel(canShowLabel);
|
|
182
|
+
});
|
|
183
|
+
observer.observe(button);
|
|
184
|
+
return function () {
|
|
185
|
+
return observer.disconnect();
|
|
186
|
+
};
|
|
187
|
+
}
|
|
153
188
|
var cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
|
|
154
189
|
var openButtonWidth = (_hoverLinkButtonRef$c = hoverLinkButtonRef.current) === null || _hoverLinkButtonRef$c === void 0 ? void 0 : _hoverLinkButtonRef$c.offsetWidth;
|
|
155
190
|
// Get the hidden text width
|
|
156
191
|
if (!openTextWidthRef.current) {
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
192
|
+
var _hiddenText = hiddenTextRef.current;
|
|
193
|
+
if (_hiddenText) {
|
|
159
194
|
// Measure the width of the hidden text
|
|
160
195
|
// Temporarily make the element visible to measure its width
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
openTextWidthRef.current =
|
|
196
|
+
_hiddenText.style.visibility = 'hidden';
|
|
197
|
+
_hiddenText.style.display = 'inline';
|
|
198
|
+
openTextWidthRef.current = _hiddenText.offsetWidth;
|
|
164
199
|
|
|
165
200
|
// Reset the hiddenText's display property
|
|
166
|
-
|
|
167
|
-
|
|
201
|
+
_hiddenText.style.display = 'none';
|
|
202
|
+
_hiddenText.style.visibility = 'inherit';
|
|
168
203
|
} else {
|
|
169
204
|
openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
|
|
170
205
|
}
|
|
@@ -186,7 +221,7 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
|
|
|
186
221
|
}
|
|
187
222
|
}
|
|
188
223
|
setShowLabel(canShowLabel);
|
|
189
|
-
}, [isVisible, isHovered]);
|
|
224
|
+
}, [isVisible, isHovered, shouldDeferMeasurement]);
|
|
190
225
|
var handleOverlayChange = function handleOverlayChange(isHovered) {
|
|
191
226
|
setHovered(isHovered);
|
|
192
227
|
|
|
@@ -247,13 +282,13 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
|
|
|
247
282
|
,
|
|
248
283
|
onFocus: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined,
|
|
249
284
|
onBlur: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
250
|
-
}, children, (0, _react2.jsx)("span", {
|
|
285
|
+
}, children, (!shouldDeferMeasurement || isHovered) && (0, _react2.jsx)("span", {
|
|
251
286
|
css: hiddenTextStyle,
|
|
252
287
|
"aria-hidden": "true"
|
|
253
288
|
}, (0, _react2.jsx)(_text.Text, {
|
|
254
289
|
ref: hiddenTextRef,
|
|
255
290
|
size: "small",
|
|
256
|
-
maxLines: 1
|
|
291
|
+
maxLines: shouldDeferMeasurement ? undefined : 1
|
|
257
292
|
}, label)), isHovered && (0, _react2.jsx)(_anchor.Anchor, {
|
|
258
293
|
ref: hoverLinkButtonRef,
|
|
259
294
|
xcss: linkStylesCommon,
|