@atlaskit/editor-common 125.3.0 → 126.0.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 +55 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/analytics/types/enums.js +3 -0
- package/dist/cjs/extensions/buildMenuItem.js +6 -3
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.compiled.css +0 -1
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +22 -28
- package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +42 -1
- package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +147 -68
- package/dist/cjs/quick-insert/QuickInsertMenuItem.js +4 -0
- package/dist/cjs/quick-insert/QuickInsertMenuSection.js +11 -4
- package/dist/cjs/quick-insert/confluence-attribution-icon.js +18 -0
- package/dist/cjs/quick-insert/jira-attribution-icon.js +18 -0
- package/dist/cjs/quick-insert/messages.js +30 -0
- package/dist/cjs/quick-insert/preview.js +5 -0
- package/dist/cjs/quick-insert/snippetPreviewImageUrls.js +43 -43
- package/dist/cjs/quick-insert/use-menu-list-height.js +58 -0
- package/dist/cjs/quick-insert/use-menu-popup-sizing.js +60 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/cjs/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +2 -0
- package/dist/es2019/analytics/types/enums.js +3 -0
- package/dist/es2019/extensions/buildMenuItem.js +5 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.compiled.css +0 -1
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +20 -29
- package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +42 -1
- package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +130 -55
- package/dist/es2019/quick-insert/QuickInsertMenuItem.js +4 -0
- package/dist/es2019/quick-insert/QuickInsertMenuSection.js +11 -4
- package/dist/es2019/quick-insert/confluence-attribution-icon.js +10 -0
- package/dist/es2019/quick-insert/jira-attribution-icon.js +10 -0
- package/dist/es2019/quick-insert/messages.js +30 -0
- package/dist/es2019/quick-insert/preview.js +1 -0
- package/dist/es2019/quick-insert/snippetPreviewImageUrls.js +43 -43
- package/dist/es2019/quick-insert/use-menu-list-height.js +37 -0
- package/dist/es2019/quick-insert/use-menu-popup-sizing.js +49 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/es2019/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +3 -0
- package/dist/esm/analytics/types/enums.js +3 -0
- package/dist/esm/extensions/buildMenuItem.js +6 -3
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.compiled.css +0 -1
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +23 -29
- package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +42 -1
- package/dist/esm/quick-insert/QuickInsertHoverPreview.js +150 -68
- package/dist/esm/quick-insert/QuickInsertMenuItem.js +4 -0
- package/dist/esm/quick-insert/QuickInsertMenuSection.js +11 -4
- package/dist/esm/quick-insert/confluence-attribution-icon.js +12 -0
- package/dist/esm/quick-insert/jira-attribution-icon.js +12 -0
- package/dist/esm/quick-insert/messages.js +30 -0
- package/dist/esm/quick-insert/preview.js +1 -0
- package/dist/esm/quick-insert/snippetPreviewImageUrls.js +43 -43
- package/dist/esm/quick-insert/use-menu-list-height.js +51 -0
- package/dist/esm/quick-insert/use-menu-popup-sizing.js +53 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/esm/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +3 -0
- package/dist/types/analytics/index.d.ts +1 -1
- package/dist/types/analytics/types/ai-suggestions-events.d.ts +28 -2
- package/dist/types/analytics/types/enums.d.ts +3 -0
- package/dist/types/extensions/types/extension-manifest.d.ts +5 -0
- package/dist/types/extensions/types/utils.d.ts +2 -0
- package/dist/types/provider-factory/profile-card-provider.d.ts +14 -1
- package/dist/types/provider-factory/quick-insert-provider.d.ts +3 -0
- package/dist/types/quick-insert/CompactQuickInsertMenuItem.d.ts +1 -1
- package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +7 -6
- package/dist/types/quick-insert/QuickInsertMenuItem.d.ts +7 -2
- package/dist/types/quick-insert/confluence-attribution-icon.d.ts +3 -0
- package/dist/types/quick-insert/jira-attribution-icon.d.ts +3 -0
- package/dist/types/quick-insert/messages.d.ts +5 -2
- package/dist/types/quick-insert/preview.d.ts +16 -0
- package/dist/types/quick-insert/use-menu-list-height.d.ts +6 -0
- package/dist/types/quick-insert/use-menu-popup-sizing.d.ts +11 -0
- package/package.json +4 -3
- package/quick-insert/confluence-attribution-icon/package.json +10 -0
- package/quick-insert/jira-attribution-icon/package.json +10 -0
- package/quick-insert/preview/package.json +10 -0
- package/quick-insert/use-menu-list-height/package.json +10 -0
- package/quick-insert/use-menu-popup-sizing/package.json +10 -0
|
@@ -2,86 +2,161 @@
|
|
|
2
2
|
import "./QuickInsertHoverPreview.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useState } from 'react';
|
|
5
|
+
import { useLayoutEffect, useState } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
// Viewport calculations and multiline clamping require styles outside @atlaskit/css's schema.
|
|
9
|
+
|
|
10
|
+
import { useIntl } from 'react-intl';
|
|
11
|
+
|
|
12
|
+
// Viewport clamping requires modifiers, which the top-layer adapter does not support.
|
|
13
|
+
import { Popper } from '@atlaskit/popper/react-popper';
|
|
14
|
+
import { Text } from '@atlaskit/primitives/compiled/text';
|
|
8
15
|
import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
|
|
9
|
-
|
|
10
|
-
const PREVIEW_OFFSET = [-4, 4];
|
|
16
|
+
import { messages } from './messages';
|
|
11
17
|
const PREVIEW_MODIFIERS = [{
|
|
18
|
+
name: 'offset',
|
|
19
|
+
options: {
|
|
20
|
+
offset: [0, 4]
|
|
21
|
+
}
|
|
22
|
+
}, {
|
|
23
|
+
name: 'flip',
|
|
24
|
+
options: {
|
|
25
|
+
fallbackPlacements: ['left-start'],
|
|
26
|
+
// Choose the side by horizontal space; vertical overflow is shifted into view.
|
|
27
|
+
altAxis: false,
|
|
28
|
+
padding: 8,
|
|
29
|
+
rootBoundary: 'viewport'
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
12
32
|
name: 'preventOverflow',
|
|
13
33
|
options: {
|
|
14
|
-
mainAxis:
|
|
34
|
+
mainAxis: true,
|
|
35
|
+
altAxis: true,
|
|
36
|
+
tether: false,
|
|
37
|
+
padding: 8,
|
|
38
|
+
rootBoundary: 'viewport'
|
|
15
39
|
}
|
|
16
40
|
}];
|
|
17
41
|
const styles = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
positioner: "_c71lk6is _p12f1oec _1pby16oo",
|
|
43
|
+
panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg",
|
|
44
|
+
content: "_zulpu2gc _1e0c1txw _2lx21bp4",
|
|
45
|
+
title: "_11c81qyo _1reo15vq _18m915vq _syazazsu _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
|
|
46
|
+
description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
|
|
47
|
+
imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _p12f1osq _1bsbp3fh",
|
|
48
|
+
image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
|
|
49
|
+
imageHidden: "_3um015vq",
|
|
50
|
+
attribution: "_11c8wadc _zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
|
|
51
|
+
attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
|
|
21
52
|
};
|
|
22
53
|
|
|
23
|
-
/**
|
|
54
|
+
/** The selected item's description and attribution are announced through its aria-describedby. */
|
|
24
55
|
export const QuickInsertHoverPreview = ({
|
|
25
|
-
|
|
26
|
-
|
|
56
|
+
description,
|
|
57
|
+
id,
|
|
58
|
+
preview,
|
|
59
|
+
referenceElement,
|
|
60
|
+
title
|
|
27
61
|
}) => {
|
|
28
62
|
const {
|
|
29
63
|
colorMode
|
|
30
64
|
} = useThemeObserver();
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
key: previewImageUrl,
|
|
34
|
-
previewImageUrl: previewImageUrl,
|
|
35
|
-
referenceElement: referenceElement
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
const QuickInsertHoverPreviewImage = ({
|
|
39
|
-
previewImageUrl,
|
|
40
|
-
referenceElement
|
|
41
|
-
}) => {
|
|
42
|
-
const [hasFailed, setHasFailed] = useState(false);
|
|
43
|
-
const [dimensions, setDimensions] = useState();
|
|
44
|
-
if (hasFailed) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Unlike a dialog popup, this decorative preview must not introduce focus or ARIA ownership.
|
|
65
|
+
const imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
|
|
66
|
+
const hasAccessibleContent = Boolean(description || preview.attribution);
|
|
49
67
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Popper, {
|
|
50
|
-
offset: PREVIEW_OFFSET,
|
|
51
68
|
placement: "right-start",
|
|
52
69
|
referenceElement: referenceElement,
|
|
53
70
|
strategy: "fixed",
|
|
54
|
-
shouldFitViewport: true,
|
|
55
71
|
modifiers: PREVIEW_MODIFIERS
|
|
56
72
|
}, ({
|
|
57
73
|
ref,
|
|
58
|
-
style
|
|
59
|
-
|
|
74
|
+
style,
|
|
75
|
+
update
|
|
76
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
60
77
|
ref: ref,
|
|
61
|
-
style:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
style: style,
|
|
79
|
+
className: ax([styles.positioner])
|
|
80
|
+
}, /*#__PURE__*/React.createElement(QuickInsertPreviewPanel, {
|
|
81
|
+
description: description,
|
|
82
|
+
id: hasAccessibleContent ? id : undefined,
|
|
83
|
+
imageUrl: imageUrl,
|
|
84
|
+
preview: preview,
|
|
85
|
+
referenceElement: referenceElement,
|
|
86
|
+
title: title,
|
|
87
|
+
update: update
|
|
88
|
+
}))), referenceElement.ownerDocument.body);
|
|
89
|
+
};
|
|
90
|
+
const QuickInsertPreviewPanel = ({
|
|
91
|
+
description,
|
|
92
|
+
id,
|
|
93
|
+
imageUrl,
|
|
94
|
+
preview,
|
|
95
|
+
referenceElement,
|
|
96
|
+
title,
|
|
97
|
+
update
|
|
98
|
+
}) => {
|
|
99
|
+
var _preview$attribution;
|
|
100
|
+
const {
|
|
101
|
+
formatMessage
|
|
102
|
+
} = useIntl();
|
|
103
|
+
const [panelElement, setPanelElement] = useState(null);
|
|
104
|
+
const AttributionIcon = (_preview$attribution = preview.attribution) === null || _preview$attribution === void 0 ? void 0 : _preview$attribution.icon;
|
|
105
|
+
useLayoutEffect(() => {
|
|
106
|
+
var _referenceElement$own;
|
|
107
|
+
void update();
|
|
108
|
+
const ResizeObserverConstructor = (_referenceElement$own = referenceElement.ownerDocument.defaultView) === null || _referenceElement$own === void 0 ? void 0 : _referenceElement$own.ResizeObserver;
|
|
109
|
+
if (!panelElement || !ResizeObserverConstructor) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const observer = new ResizeObserverConstructor(() => void update());
|
|
113
|
+
observer.observe(panelElement);
|
|
114
|
+
return () => observer.disconnect();
|
|
115
|
+
}, [panelElement, referenceElement, update]);
|
|
116
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
117
|
+
ref: setPanelElement,
|
|
118
|
+
id: id,
|
|
119
|
+
role: id ? 'tooltip' : undefined,
|
|
120
|
+
"data-testid": "quick-insert-preview-panel",
|
|
121
|
+
className: ax([styles.panel])
|
|
122
|
+
}, imageUrl && /*#__PURE__*/React.createElement(PreviewImage, {
|
|
123
|
+
key: imageUrl,
|
|
124
|
+
imageUrl: imageUrl
|
|
125
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
className: ax([styles.content])
|
|
127
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
className: ax([styles.title])
|
|
130
|
+
}, title), description && /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: ax([styles.description])
|
|
132
|
+
}, description), preview.attribution && /*#__PURE__*/React.createElement("div", {
|
|
133
|
+
className: ax([styles.attribution])
|
|
134
|
+
}, AttributionIcon && /*#__PURE__*/React.createElement("span", {
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
className: ax([styles.attributionIcon])
|
|
137
|
+
}, /*#__PURE__*/React.createElement(AttributionIcon, null)), /*#__PURE__*/React.createElement(Text, {
|
|
138
|
+
size: "small",
|
|
139
|
+
color: "color.text.subtle"
|
|
140
|
+
}, AttributionIcon ? preview.attribution.name : formatMessage(messages.previewAttributionBy, {
|
|
141
|
+
name: preview.attribution.name
|
|
142
|
+
})))));
|
|
143
|
+
};
|
|
144
|
+
const PreviewImage = ({
|
|
145
|
+
imageUrl
|
|
146
|
+
}) => {
|
|
147
|
+
const [hasFailed, setHasFailed] = useState(false);
|
|
148
|
+
const [hasLoaded, setHasLoaded] = useState(false);
|
|
149
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
"data-testid": "quick-insert-preview-image-area",
|
|
152
|
+
className: ax([styles.imageArea])
|
|
153
|
+
}, !hasFailed && /*#__PURE__*/React.createElement("img", {
|
|
67
154
|
"aria-hidden": "true",
|
|
68
155
|
"data-testid": "quick-insert-hover-preview",
|
|
69
|
-
src:
|
|
156
|
+
src: imageUrl,
|
|
70
157
|
alt: "",
|
|
71
|
-
onLoad:
|
|
72
|
-
const {
|
|
73
|
-
naturalHeight,
|
|
74
|
-
naturalWidth
|
|
75
|
-
} = event.currentTarget;
|
|
76
|
-
if (naturalWidth === 0) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
setDimensions({
|
|
80
|
-
height: naturalHeight / naturalWidth * PREVIEW_WIDTH,
|
|
81
|
-
width: PREVIEW_WIDTH
|
|
82
|
-
});
|
|
83
|
-
},
|
|
158
|
+
onLoad: () => setHasLoaded(true),
|
|
84
159
|
onError: () => setHasFailed(true),
|
|
85
|
-
className: ax([styles.image,
|
|
86
|
-
}))
|
|
160
|
+
className: ax([styles.image, !hasLoaded && styles.imageHidden])
|
|
161
|
+
}));
|
|
87
162
|
};
|
|
@@ -8,8 +8,10 @@ export const QuickInsertMenuItem = ({
|
|
|
8
8
|
iconBefore,
|
|
9
9
|
isDisabled,
|
|
10
10
|
onSelect,
|
|
11
|
+
preview,
|
|
11
12
|
previewImageUrls,
|
|
12
13
|
shortcut,
|
|
14
|
+
shouldShowPreview,
|
|
13
15
|
shouldWrapIcon,
|
|
14
16
|
title
|
|
15
17
|
}) => {
|
|
@@ -31,8 +33,10 @@ export const QuickInsertMenuItem = ({
|
|
|
31
33
|
iconBefore: iconBefore,
|
|
32
34
|
isDisabled: isDisabled,
|
|
33
35
|
onSelect: onSelect,
|
|
36
|
+
preview: preview,
|
|
34
37
|
previewImageUrls: previewImageUrls,
|
|
35
38
|
shortcut: shortcut,
|
|
39
|
+
shouldShowPreview: shouldShowPreview,
|
|
36
40
|
shouldWrapIcon: shouldWrapIcon,
|
|
37
41
|
title: title
|
|
38
42
|
});
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import HeadingItem from '@atlaskit/menu/heading-item';
|
|
3
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
3
4
|
export const QuickInsertMenuSection = ({
|
|
4
5
|
children,
|
|
5
6
|
title
|
|
6
|
-
}) => /*#__PURE__*/React.createElement(
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
}) => /*#__PURE__*/React.createElement(Box, {
|
|
8
|
+
role: "group",
|
|
9
|
+
"aria-label": title
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
11
|
+
paddingBlockStart: "space.150",
|
|
12
|
+
paddingBlockEnd: "space.050"
|
|
13
|
+
}, /*#__PURE__*/React.createElement(HeadingItem, {
|
|
14
|
+
"aria-hidden": true
|
|
15
|
+
}, title)), children);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { confluenceIcon } from '@atlaskit/logo/raw-icons';
|
|
3
|
+
|
|
4
|
+
/** Decorative product icon accompanying the localized Confluence attribution name. */
|
|
5
|
+
export const ConfluenceAttributionIcon = () => /*#__PURE__*/React.createElement("img", {
|
|
6
|
+
src: confluenceIcon,
|
|
7
|
+
alt: "",
|
|
8
|
+
width: 16,
|
|
9
|
+
height: 16
|
|
10
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { jiraIcon } from '@atlaskit/logo/raw-icons';
|
|
3
|
+
|
|
4
|
+
/** Decorative product icon accompanying the localized Jira attribution name. */
|
|
5
|
+
export const JiraAttributionIcon = () => /*#__PURE__*/React.createElement("img", {
|
|
6
|
+
src: jiraIcon,
|
|
7
|
+
alt: "",
|
|
8
|
+
width: 16,
|
|
9
|
+
height: 16
|
|
10
|
+
});
|
|
@@ -129,5 +129,35 @@ export const messages = defineMessages({
|
|
|
129
129
|
id: 'editor-common.quick-insert.categoryOther',
|
|
130
130
|
defaultMessage: 'Other',
|
|
131
131
|
description: 'Other items in the Quick Insert menu.'
|
|
132
|
+
},
|
|
133
|
+
previewAttributionBy: {
|
|
134
|
+
id: 'editor-common.quick-insert.previewAttributionBy',
|
|
135
|
+
defaultMessage: 'By {name}',
|
|
136
|
+
description: 'Attribution shown in a Quick Insert item preview.'
|
|
137
|
+
},
|
|
138
|
+
previewAttributionAtlassian: {
|
|
139
|
+
id: 'editor-common.quick-insert.previewAttributionAtlassian.ai-non-final',
|
|
140
|
+
defaultMessage: 'Atlassian',
|
|
141
|
+
description: 'Atlassian company name shown as the creator in a slash-command preview attribution.'
|
|
142
|
+
},
|
|
143
|
+
previewAttributionAssets: {
|
|
144
|
+
id: 'editor-common.quick-insert.previewAttributionAssets.ai-non-final',
|
|
145
|
+
defaultMessage: 'Assets',
|
|
146
|
+
description: 'Assets product name shown as the creator in a slash-command preview attribution.'
|
|
147
|
+
},
|
|
148
|
+
previewAttributionConfluence: {
|
|
149
|
+
id: 'editor-common.quick-insert.previewAttributionConfluence.ai-non-final',
|
|
150
|
+
defaultMessage: 'Confluence',
|
|
151
|
+
description: 'Confluence product name shown as the creator in a slash-command preview attribution.'
|
|
152
|
+
},
|
|
153
|
+
previewAttributionJira: {
|
|
154
|
+
id: 'editor-common.quick-insert.previewAttributionJira.ai-non-final',
|
|
155
|
+
defaultMessage: 'Jira',
|
|
156
|
+
description: 'Jira product name shown as the creator in a slash-command preview attribution.'
|
|
157
|
+
},
|
|
158
|
+
previewAttributionMicrosoft: {
|
|
159
|
+
id: 'editor-common.quick-insert.previewAttributionMicrosoft.ai-non-final',
|
|
160
|
+
defaultMessage: 'Microsoft',
|
|
161
|
+
description: 'Microsoft company name shown as the creator in a slash-command preview attribution.'
|
|
132
162
|
}
|
|
133
163
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
const
|
|
1
|
+
const DAM_CDN_LINK = 'https://dam-cdn.atl.orangelogic.com/CDNLink';
|
|
2
2
|
const snippetPreviewImageUrlsByKey = {
|
|
3
3
|
// Action items
|
|
4
4
|
'019e5cd9-5ca1-7258-befd-4f50d491bb42': {
|
|
5
|
-
light: `${
|
|
6
|
-
dark: `${
|
|
5
|
+
light: `${DAM_CDN_LINK}/AT12OVLE.png`,
|
|
6
|
+
dark: `${DAM_CDN_LINK}/AT12OVJI.png`
|
|
7
7
|
},
|
|
8
8
|
// Bug report
|
|
9
9
|
'019e5cd9-5ca1-7258-befd-1c3c59b0aa00': {
|
|
10
|
-
light: `${
|
|
11
|
-
dark: `${
|
|
10
|
+
light: `${DAM_CDN_LINK}/AT12OVMN.png`,
|
|
11
|
+
dark: `${DAM_CDN_LINK}/AT12OVJ6.png`
|
|
12
12
|
},
|
|
13
13
|
// Campaign brief
|
|
14
14
|
'019e5cd9-5ca1-7258-befd-398bb4e40f15': {
|
|
15
|
-
light: `${
|
|
16
|
-
dark: `${
|
|
15
|
+
light: `${DAM_CDN_LINK}/AT12OVMY.png`,
|
|
16
|
+
dark: `${DAM_CDN_LINK}/AT12OVJE.png`
|
|
17
17
|
},
|
|
18
18
|
// Colorful layout
|
|
19
19
|
'019e5cd9-5ca1-7258-befd-53b6eec19427': {
|
|
20
|
-
light: `${
|
|
21
|
-
dark: `${
|
|
20
|
+
light: `${DAM_CDN_LINK}/AT12OVN6.png`,
|
|
21
|
+
dark: `${DAM_CDN_LINK}/AT12OVIG.png`
|
|
22
22
|
},
|
|
23
23
|
// Colorful numbered table
|
|
24
24
|
'019e5cd9-5ca1-7258-befd-70a282facf16': {
|
|
25
|
-
light: `${
|
|
26
|
-
dark: `${
|
|
25
|
+
light: `${DAM_CDN_LINK}/AT12OVN7.png`,
|
|
26
|
+
dark: `${DAM_CDN_LINK}/AT12OVJL.png`
|
|
27
27
|
},
|
|
28
28
|
// Colorful summary
|
|
29
29
|
'019e5cd9-5ca1-7258-befd-7e200502de8e': {
|
|
30
|
-
light: `${
|
|
31
|
-
dark: `${
|
|
30
|
+
light: `${DAM_CDN_LINK}/AT12OVN4.png`,
|
|
31
|
+
dark: `${DAM_CDN_LINK}/AT12OVIE.png`
|
|
32
32
|
},
|
|
33
33
|
// Colorful table
|
|
34
34
|
'019e5cd9-5ca1-7258-befd-5524d394ba0a': {
|
|
35
|
-
light: `${
|
|
36
|
-
dark: `${
|
|
35
|
+
light: `${DAM_CDN_LINK}/AT12OVMJ.png`,
|
|
36
|
+
dark: `${DAM_CDN_LINK}/AT12OVJM.png`
|
|
37
37
|
},
|
|
38
38
|
// Competitive snapshot
|
|
39
39
|
'019e5cd9-5ca1-7258-befd-40d1947b7b84': {
|
|
40
|
-
light: `${
|
|
41
|
-
dark: `${
|
|
40
|
+
light: `${DAM_CDN_LINK}/AT12OVMR.png`,
|
|
41
|
+
dark: `${DAM_CDN_LINK}/AT12OVJC.png`
|
|
42
42
|
},
|
|
43
43
|
// Criteria rubric
|
|
44
44
|
'019e5cd9-5ca1-7258-befd-84723a493931': {
|
|
45
|
-
light: `${
|
|
46
|
-
dark: `${
|
|
45
|
+
light: `${DAM_CDN_LINK}/AT12OVMA.png`,
|
|
46
|
+
dark: `${DAM_CDN_LINK}/AT12OVJ1.png`
|
|
47
47
|
},
|
|
48
48
|
// Customer quote
|
|
49
49
|
'019e5cd9-5ca1-7258-befd-5fcf6165870f': {
|
|
50
|
-
light: `${
|
|
51
|
-
dark: `${
|
|
50
|
+
light: `${DAM_CDN_LINK}/AT12OVLF.png`,
|
|
51
|
+
dark: `${DAM_CDN_LINK}/AT12OVJK.png`
|
|
52
52
|
},
|
|
53
53
|
// Decision log
|
|
54
54
|
'019e5cd9-5ca1-7258-befd-30c6e8712ba4': {
|
|
55
|
-
light: `${
|
|
56
|
-
dark: `${
|
|
55
|
+
light: `${DAM_CDN_LINK}/AT12OVMT.png`,
|
|
56
|
+
dark: `${DAM_CDN_LINK}/AT12OVJ9.png`
|
|
57
57
|
},
|
|
58
58
|
// Launch checklist
|
|
59
59
|
'019e5cd9-5ca1-7258-befd-3ce1c551015e': {
|
|
60
|
-
light: `${
|
|
61
|
-
dark: `${
|
|
60
|
+
light: `${DAM_CDN_LINK}/AT12OVKW.png`,
|
|
61
|
+
dark: `${DAM_CDN_LINK}/AT12OVHN.png`
|
|
62
62
|
},
|
|
63
63
|
// Meeting agenda
|
|
64
64
|
'019e5cd9-5ca1-7258-befd-47559a8d7cfc': {
|
|
65
|
-
light: `${
|
|
66
|
-
dark: `${
|
|
65
|
+
light: `${DAM_CDN_LINK}/AT12OVMU.png`,
|
|
66
|
+
dark: `${DAM_CDN_LINK}/AT12OVJD.png`
|
|
67
67
|
},
|
|
68
68
|
// Project status snapshot
|
|
69
69
|
'019e5cd9-5ca1-7258-befd-2943939d1b79': {
|
|
70
|
-
light: `${
|
|
71
|
-
dark: `${
|
|
70
|
+
light: `${DAM_CDN_LINK}/AT12OVMO.png`,
|
|
71
|
+
dark: `${DAM_CDN_LINK}/AT12OVJU.png`
|
|
72
72
|
},
|
|
73
73
|
// Pros and cons
|
|
74
74
|
'019e5cd9-5ca1-7258-befd-6db9658d75f4': {
|
|
75
|
-
light: `${
|
|
76
|
-
dark: `${
|
|
75
|
+
light: `${DAM_CDN_LINK}/AT12OVN5.png`,
|
|
76
|
+
dark: `${DAM_CDN_LINK}/AT12OVHY.png`
|
|
77
77
|
},
|
|
78
78
|
// Quick project update
|
|
79
79
|
'019e5cd9-5ca1-7258-befd-820ce1acd7a0': {
|
|
80
|
-
light: `${
|
|
81
|
-
dark: `${
|
|
80
|
+
light: `${DAM_CDN_LINK}/AT12OVNA.png`,
|
|
81
|
+
dark: `${DAM_CDN_LINK}/AT12OVI5.png`
|
|
82
82
|
},
|
|
83
83
|
// Risks and assumptions
|
|
84
84
|
'019e5cd9-5ca1-7258-befd-2da95ce98772': {
|
|
85
|
-
light: `${
|
|
86
|
-
dark: `${
|
|
85
|
+
light: `${DAM_CDN_LINK}/AT12OVMQ.png`,
|
|
86
|
+
dark: `${DAM_CDN_LINK}/AT12OVJ7.png`
|
|
87
87
|
},
|
|
88
88
|
// Roles and responsibilities matrix
|
|
89
89
|
'019e5cd9-5ca1-7258-befd-37cd3a06776d': {
|
|
90
|
-
light: `${
|
|
91
|
-
dark: `${
|
|
90
|
+
light: `${DAM_CDN_LINK}/AT12OVM8.png`,
|
|
91
|
+
dark: `${DAM_CDN_LINK}/AT12OVHG.png`
|
|
92
92
|
},
|
|
93
93
|
// Run sheet
|
|
94
94
|
'019e5cd9-5ca1-7258-befd-4a9979f87235': {
|
|
95
|
-
light: `${
|
|
96
|
-
dark: `${
|
|
95
|
+
light: `${DAM_CDN_LINK}/AT12OVMZ.png`,
|
|
96
|
+
dark: `${DAM_CDN_LINK}/AT12OVJB.png`
|
|
97
97
|
},
|
|
98
98
|
// Started → Now
|
|
99
99
|
'019e5cd9-5ca1-7258-befd-74fb1585da6f': {
|
|
100
|
-
light: `${
|
|
101
|
-
dark: `${
|
|
100
|
+
light: `${DAM_CDN_LINK}/AT12OVN8.png`,
|
|
101
|
+
dark: `${DAM_CDN_LINK}/AT12OVJQ.png`
|
|
102
102
|
},
|
|
103
103
|
// Weekly calendar
|
|
104
104
|
'019e5cd9-5ca1-7258-befd-580c2c95a0a0': {
|
|
105
|
-
light: `${
|
|
106
|
-
dark: `${
|
|
105
|
+
light: `${DAM_CDN_LINK}/AT12OVN2.png`,
|
|
106
|
+
dark: `${DAM_CDN_LINK}/AT12OVIJ.png`
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
export const getSnippetPreviewImageUrls = snippetKey => Object.prototype.hasOwnProperty.call(snippetPreviewImageUrlsByKey, snippetKey) ? snippetPreviewImageUrlsByKey[snippetKey] : undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
/** Keep the list viewport in sync with measured rows, including short search results. */
|
|
3
|
+
export function useMenuListHeight(cache, rowCount, rowKeySignature) {
|
|
4
|
+
const [height, setHeight] = useState(() => Array.from({
|
|
5
|
+
length: rowCount
|
|
6
|
+
}, (_, index) => cache.rowHeight({
|
|
7
|
+
index
|
|
8
|
+
})).reduce((sum, value) => sum + value, 0));
|
|
9
|
+
const frame = useRef();
|
|
10
|
+
const updateHeight = useCallback(() => {
|
|
11
|
+
if (frame.current !== undefined) {
|
|
12
|
+
cancelAnimationFrame(frame.current);
|
|
13
|
+
}
|
|
14
|
+
// CellMeasurer updates its cache during commit. Read it after all rows have measured.
|
|
15
|
+
frame.current = requestAnimationFrame(() => {
|
|
16
|
+
frame.current = undefined;
|
|
17
|
+
const total = Array.from({
|
|
18
|
+
length: rowCount
|
|
19
|
+
}, (_, index) => cache.rowHeight({
|
|
20
|
+
index
|
|
21
|
+
})).reduce((sum, height) => sum + height, 0);
|
|
22
|
+
setHeight(total);
|
|
23
|
+
});
|
|
24
|
+
}, [cache, rowCount]);
|
|
25
|
+
useLayoutEffect(() => {
|
|
26
|
+
updateHeight();
|
|
27
|
+
return () => {
|
|
28
|
+
if (frame.current !== undefined) {
|
|
29
|
+
cancelAnimationFrame(frame.current);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, [rowKeySignature, updateHeight]);
|
|
33
|
+
return {
|
|
34
|
+
height,
|
|
35
|
+
updateHeight
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useLayoutEffect, useState } from 'react';
|
|
2
|
+
import { bind } from 'bind-event-listener';
|
|
3
|
+
import rafSchedule from 'raf-schd';
|
|
4
|
+
import { findOverflowScrollParent } from '../ui/Popup/utils';
|
|
5
|
+
/** Constrain menu height to the available space; Popup chooses placement. */
|
|
6
|
+
export function useMenuPopupSizing({
|
|
7
|
+
target,
|
|
8
|
+
boundariesElement,
|
|
9
|
+
scrollableElement,
|
|
10
|
+
maxHeight,
|
|
11
|
+
offset,
|
|
12
|
+
isOpen = true
|
|
13
|
+
}) {
|
|
14
|
+
const [height, setHeight] = useState(maxHeight);
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
const view = target === null || target === void 0 ? void 0 : target.ownerDocument.defaultView;
|
|
17
|
+
if (!target || !view || !isOpen) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const boundary = boundariesElement || target.ownerDocument.body;
|
|
21
|
+
const scrollParent = scrollableElement || findOverflowScrollParent(target);
|
|
22
|
+
const update = () => {
|
|
23
|
+
const rect = target.getBoundingClientRect();
|
|
24
|
+
const bounds = boundary.getBoundingClientRect();
|
|
25
|
+
const above = Math.max(0, rect.top - (bounds.top - boundary.scrollTop) - offset);
|
|
26
|
+
const below = Math.max(0, bounds.bottom - rect.bottom - offset);
|
|
27
|
+
const space = below >= maxHeight ? below : Math.max(above, below);
|
|
28
|
+
// Popup rounds its position up to a CSS pixel. Reserve that pixel at the edge.
|
|
29
|
+
const available = Math.max(0, Math.floor(space) - 1);
|
|
30
|
+
setHeight(Math.min(maxHeight, available));
|
|
31
|
+
};
|
|
32
|
+
const schedule = rafSchedule(update);
|
|
33
|
+
update();
|
|
34
|
+
const unbindResize = bind(view, {
|
|
35
|
+
type: 'resize',
|
|
36
|
+
listener: schedule
|
|
37
|
+
});
|
|
38
|
+
const unbindScroll = scrollParent ? bind(scrollParent, {
|
|
39
|
+
type: 'scroll',
|
|
40
|
+
listener: schedule
|
|
41
|
+
}) : undefined;
|
|
42
|
+
return () => {
|
|
43
|
+
unbindResize();
|
|
44
|
+
unbindScroll === null || unbindScroll === void 0 ? void 0 : unbindScroll();
|
|
45
|
+
schedule.cancel();
|
|
46
|
+
};
|
|
47
|
+
}, [target, boundariesElement, scrollableElement, maxHeight, offset, isOpen]);
|
|
48
|
+
return height;
|
|
49
|
+
}
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "125.
|
|
17
|
+
const packageVersion = "125.4.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -47,6 +47,7 @@ export default function MentionWithProfileCard({
|
|
|
47
47
|
}) {
|
|
48
48
|
const {
|
|
49
49
|
cloudId,
|
|
50
|
+
renderAgentMentionCard,
|
|
50
51
|
renderUserMentionCard,
|
|
51
52
|
resourceClient
|
|
52
53
|
} = profilecardProvider;
|
|
@@ -70,6 +71,13 @@ export default function MentionWithProfileCard({
|
|
|
70
71
|
|
|
71
72
|
// Agent mentions (userType 'APP') open the Rovo agent profile card on click.
|
|
72
73
|
if (userType === 'APP' && cloudId && isExperimentEnabled('rovo_chat_mention_agents')) {
|
|
74
|
+
if (renderAgentMentionCard) {
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderAgentMentionCard({
|
|
76
|
+
accountId: id,
|
|
77
|
+
children: mention,
|
|
78
|
+
cloudId
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
73
81
|
return /*#__PURE__*/React.createElement(AgentProfileCardTrigger, {
|
|
74
82
|
agentId: id,
|
|
75
83
|
agentIdType: isExperimentEnabled('platform_editor_comment_mention_card_fixes') ? 'identity' : undefined,
|
|
@@ -11,6 +11,9 @@ import { ELEMENT_BROWSER_ID } from '../../element-browser';
|
|
|
11
11
|
import { fullPageMessages } from '../../messages';
|
|
12
12
|
import { mediaInsertMessages } from '../../messages/media-insert';
|
|
13
13
|
import { EDIT_AREA_ID } from '../../ui';
|
|
14
|
+
|
|
15
|
+
// oxlint-disable-next-line eslint/no-redeclare
|
|
16
|
+
|
|
14
17
|
/*
|
|
15
18
|
** The context is used to handle the keydown events of submenus.
|
|
16
19
|
** Because the keyboard navigation is explicitly managed for main toolbar items
|
|
@@ -39,6 +39,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
39
39
|
ACTION["DEACTIVATED"] = "deactivated";
|
|
40
40
|
ACTION["DECREMENTED"] = "decremented";
|
|
41
41
|
ACTION["DELETED"] = "deleted";
|
|
42
|
+
ACTION["DISCARD_ALL"] = "discardAll";
|
|
42
43
|
ACTION["DISCARDED_INVALID_STEPS_FROM_TRANSACTION"] = "discardedInvalidStepsFromTransaction";
|
|
43
44
|
ACTION["DISCARDED"] = "discarded";
|
|
44
45
|
/** used in @atlassian/editor-referentiality */
|
|
@@ -62,6 +63,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
62
63
|
ACTION["ENTERED"] = "entered";
|
|
63
64
|
ACTION["ERROR"] = "error";
|
|
64
65
|
ACTION["ERRORED"] = "errored";
|
|
66
|
+
ACTION["EMPTY_STATE_EXPOSED"] = "emptyStateExposed";
|
|
65
67
|
ACTION["EXPERIENCE_MEASURED"] = "experienceMeasured";
|
|
66
68
|
ACTION["EXPERIENCE_SAMPLED"] = "experienceSampled";
|
|
67
69
|
ACTION["EXPOSED"] = "exposed";
|
|
@@ -118,6 +120,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
118
120
|
ACTION["REFERENCE_SYNCED_BLOCK_UPDATE"] = "referenceSyncedBlockUpdate";
|
|
119
121
|
ACTION["REFERENCE_SYNCED_BLOCK_UNSYNC"] = "referenceSyncedBlockUnsync";
|
|
120
122
|
ACTION["REFERENCE_SYNCED_BLOCK_COPY"] = "referenceSyncedBlockCopy";
|
|
123
|
+
ACTION["RIGHT_RAIL_CLOSED"] = "rightRailClosed";
|
|
121
124
|
ACTION["RIGHT_RAIL_VIEWED"] = "rightRailViewed";
|
|
122
125
|
ACTION["REPLACED_ALL"] = "replacedAll";
|
|
123
126
|
ACTION["REPLACED_ONE"] = "replacedOne";
|