@atlaskit/media-card 78.16.0 → 78.17.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 +21 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/cardAnalytics.js +1 -10
- package/dist/cjs/card/cardView.js +5 -5
- package/dist/cjs/card/externalImageCard.js +14 -36
- package/dist/cjs/card/fileCard.js +5 -24
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +17 -9
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionIconButton.js +1 -3
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsView.js +1 -5
- package/dist/cjs/card/ui/actionsBar/cardActions/styles.js +2 -15
- package/dist/cjs/card/ui/actionsBar/styles.js +5 -3
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineCard.js +12 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -10
- package/dist/cjs/utils/analytics/index.js +0 -6
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/cardAnalytics.js +1 -10
- package/dist/es2019/card/cardView.js +4 -5
- package/dist/es2019/card/externalImageCard.js +1 -20
- package/dist/es2019/card/fileCard.js +6 -25
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/actionsBar/actionsBarWrapper.js +17 -9
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionIconButton.js +1 -3
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsView.js +2 -6
- package/dist/es2019/card/ui/actionsBar/cardActions/styles.js +0 -18
- package/dist/es2019/card/ui/actionsBar/styles.js +5 -3
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineCard.js +13 -0
- package/dist/es2019/utils/analytics/analytics.js +0 -7
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/cardAnalytics.js +1 -10
- package/dist/esm/card/cardView.js +5 -5
- package/dist/esm/card/externalImageCard.js +15 -37
- package/dist/esm/card/fileCard.js +6 -25
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/actionsBar/actionsBarWrapper.js +17 -9
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionIconButton.js +1 -3
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionsView.js +2 -6
- package/dist/esm/card/ui/actionsBar/cardActions/styles.js +1 -14
- package/dist/esm/card/ui/actionsBar/styles.js +5 -3
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineCard.js +12 -0
- package/dist/esm/utils/analytics/analytics.js +0 -9
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/cardAnalytics.d.ts +0 -1
- package/dist/types/card/cardView.d.ts +1 -1
- package/dist/types/card/ui/actionsBar/cardActions/styles.d.ts +0 -1
- package/dist/types/utils/analytics/analytics.d.ts +0 -1
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/card/cardAnalytics.d.ts +0 -1
- package/dist/types-ts4.5/card/cardView.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/styles.d.ts +0 -1
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -1
- package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
- package/package.json +7 -6
- package/dist/cjs/utils/preventClickThrough.js +0 -30
- package/dist/es2019/utils/preventClickThrough.js +0 -21
- package/dist/esm/utils/preventClickThrough.js +0 -22
- package/dist/types/utils/preventClickThrough.d.ts +0 -8
- package/dist/types-ts4.5/utils/preventClickThrough.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 78.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#98696](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98696)
|
|
8
|
+
[`396ff0958321d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/396ff0958321d) -
|
|
9
|
+
Adding the ability to register copy intents to enable cross site / product copy and paste for
|
|
10
|
+
media by forwarding the ref from useCopyIntent / useFilePreview
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 78.16.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#181001](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/181001)
|
|
21
|
+
[`6108eab3b6a57`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6108eab3b6a57) -
|
|
22
|
+
Fixed positioning when Action Bar items add a tooltip
|
|
23
|
+
|
|
3
24
|
## 78.16.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -21,7 +21,7 @@ var _excluded = ["identifier"];
|
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
23
|
var packageName = "@atlaskit/media-card";
|
|
24
|
-
var packageVersion = "78.
|
|
24
|
+
var packageVersion = "78.17.0";
|
|
25
25
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
26
26
|
var identifier = _ref.identifier,
|
|
27
27
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.fireScreenEvent = exports.fireOperationalEvent = exports.fireNonCriticalErrorEvent = exports.fireDownloadSucceededEvent = exports.fireDownloadFailedEvent =
|
|
6
|
+
exports.fireScreenEvent = exports.fireOperationalEvent = exports.fireNonCriticalErrorEvent = exports.fireDownloadSucceededEvent = exports.fireDownloadFailedEvent = void 0;
|
|
7
7
|
var _analytics = require("../utils/analytics");
|
|
8
8
|
var _errors = require("../errors");
|
|
9
9
|
var fireOperationalEvent = exports.fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes, ssrReliability) {
|
|
@@ -25,15 +25,6 @@ var fireOperationalEvent = exports.fireOperationalEvent = function fireOperation
|
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
var fireCopiedEvent = exports.fireCopiedEvent = function fireCopiedEvent(createAnalyticsEvent, fileId, cardRef) {
|
|
29
|
-
if (typeof window.getSelection === 'function') {
|
|
30
|
-
var _selection$containsNo;
|
|
31
|
-
var selection = window.getSelection();
|
|
32
|
-
if (selection !== null && selection !== void 0 && (_selection$containsNo = selection.containsNode) !== null && _selection$containsNo !== void 0 && _selection$containsNo.call(selection, cardRef, true)) {
|
|
33
|
-
(0, _analytics.fireMediaCardEvent)((0, _analytics.getCopiedFilePayload)(fileId), createAnalyticsEvent);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
28
|
var fireScreenEvent = exports.fireScreenEvent = function fireScreenEvent(createAnalyticsEvent, fileAttributes) {
|
|
38
29
|
(0, _analytics.fireMediaCardEvent)((0, _analytics.getRenderPreviewableCardPayload)(fileAttributes), createAnalyticsEvent);
|
|
39
30
|
};
|
|
@@ -14,6 +14,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
14
14
|
var _mimeTypeIcon = require("@atlaskit/media-ui/mime-type-icon");
|
|
15
15
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
16
16
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
17
|
+
var _useCallbackRef = require("use-callback-ref");
|
|
17
18
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
18
19
|
var _analytics = require("../utils/analytics");
|
|
19
20
|
var _imageRenderer = require("./ui/imageRenderer/imageRenderer");
|
|
@@ -42,7 +43,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
42
43
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
43
44
|
var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
44
45
|
var identifier = _ref.identifier,
|
|
45
|
-
innerRef = _ref.innerRef,
|
|
46
|
+
_ref$innerRef = _ref.innerRef,
|
|
47
|
+
innerRef = _ref$innerRef === void 0 ? null : _ref$innerRef,
|
|
46
48
|
onImageLoad = _ref.onImageLoad,
|
|
47
49
|
onImageError = _ref.onImageError,
|
|
48
50
|
dimensions = _ref.dimensions,
|
|
@@ -85,9 +87,6 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
85
87
|
var divRef = (0, _react2.useRef)(null);
|
|
86
88
|
var prevCardPreviewRef = (0, _react2.useRef)();
|
|
87
89
|
var breakpoint = (0, _useBreakpoint.useBreakpoint)(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
88
|
-
(0, _react2.useEffect)(function () {
|
|
89
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
90
|
-
}, [innerRef]);
|
|
91
90
|
(0, _react2.useEffect)(function () {
|
|
92
91
|
// We should only switch didImageRender to false when cardPreview goes undefined, not when it is changed. as this method could be triggered after onImageLoad callback, falling on a race condition
|
|
93
92
|
if (prevCardPreviewRef.current && !cardPreview) {
|
|
@@ -123,6 +122,7 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
123
122
|
}
|
|
124
123
|
return true;
|
|
125
124
|
};
|
|
125
|
+
var mergedRef = (0, _useCallbackRef.useMergeRefs)([divRef, innerRef]);
|
|
126
126
|
var getRenderConfigByStatus = function getRenderConfigByStatus() {
|
|
127
127
|
var _ref3 = metadata || {},
|
|
128
128
|
name = _ref3.name,
|
|
@@ -320,7 +320,7 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
320
320
|
dimensions: dimensions,
|
|
321
321
|
onClick: onClick,
|
|
322
322
|
onMouseEnter: onMouseEnter,
|
|
323
|
-
innerRef:
|
|
323
|
+
innerRef: mergedRef,
|
|
324
324
|
breakpoint: breakpoint,
|
|
325
325
|
mediaCardCursor: mediaCardCursor,
|
|
326
326
|
disableOverlay: !!disableOverlay,
|
|
@@ -15,7 +15,6 @@ var _mediaViewer = require("@atlaskit/media-viewer");
|
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
17
17
|
var _errors = require("../errors");
|
|
18
|
-
var _document = _interopRequireDefault(require("../utils/document"));
|
|
19
18
|
var _generateUniqueId = require("../utils/generateUniqueId");
|
|
20
19
|
var _getMediaCardCursor = require("../utils/getMediaCardCursor");
|
|
21
20
|
var _ufoExperiences = require("../utils/ufoExperiences");
|
|
@@ -70,10 +69,6 @@ var ExternalImageCard = exports.ExternalImageCard = function ExternalImageCard(_
|
|
|
70
69
|
traceId: (0, _mediaCommon.getRandomHex)(8)
|
|
71
70
|
};
|
|
72
71
|
}, []);
|
|
73
|
-
var _useState = (0, _react.useState)(null),
|
|
74
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
75
|
-
cardElement = _useState2[0],
|
|
76
|
-
setCardElement = _useState2[1];
|
|
77
72
|
var fileStateFlagsRef = (0, _react.useRef)({
|
|
78
73
|
wasStatusUploading: false,
|
|
79
74
|
wasStatusProcessing: false
|
|
@@ -81,10 +76,10 @@ var ExternalImageCard = exports.ExternalImageCard = function ExternalImageCard(_
|
|
|
81
76
|
var startUfoExperienceRef = (0, _useCurrentValueRef.useCurrentValueRef)(function () {
|
|
82
77
|
(0, _ufoExperiences.startUfoExperience)(internalOccurrenceKey);
|
|
83
78
|
});
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
status =
|
|
87
|
-
setStatus =
|
|
79
|
+
var _useState = (0, _react.useState)('loading-preview'),
|
|
80
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
81
|
+
status = _useState2[0],
|
|
82
|
+
setStatus = _useState2[1];
|
|
88
83
|
var cardPreview = (0, _react.useMemo)(function () {
|
|
89
84
|
return {
|
|
90
85
|
dataURI: identifier.dataURI,
|
|
@@ -111,18 +106,18 @@ var ExternalImageCard = exports.ExternalImageCard = function ExternalImageCard(_
|
|
|
111
106
|
status: 'unknown'
|
|
112
107
|
}
|
|
113
108
|
};
|
|
114
|
-
var
|
|
109
|
+
var _useState3 = (0, _react.useState)(false),
|
|
110
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
111
|
+
previewDidRender = _useState4[0],
|
|
112
|
+
setPreviewDidRender = _useState4[1];
|
|
113
|
+
var _useState5 = (0, _react.useState)(),
|
|
115
114
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var _useState7 = (0, _react.useState)(),
|
|
115
|
+
error = _useState6[0],
|
|
116
|
+
setError = _useState6[1];
|
|
117
|
+
var _useState7 = (0, _react.useState)(null),
|
|
119
118
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var _useState9 = (0, _react.useState)(null),
|
|
123
|
-
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
124
|
-
mediaViewerSelectedItem = _useState10[0],
|
|
125
|
-
setMediaViewerSelectedItem = _useState10[1];
|
|
119
|
+
mediaViewerSelectedItem = _useState8[0],
|
|
120
|
+
setMediaViewerSelectedItem = _useState8[1];
|
|
126
121
|
|
|
127
122
|
//----------------------------------------------------------------//
|
|
128
123
|
//---------------------- Analytics ------------------------------//
|
|
@@ -159,22 +154,6 @@ var ExternalImageCard = exports.ExternalImageCard = function ExternalImageCard(_
|
|
|
159
154
|
(0, _react.useEffect)(function () {
|
|
160
155
|
startUfoExperienceRef.current();
|
|
161
156
|
}, [startUfoExperienceRef]);
|
|
162
|
-
(0, _react.useEffect)(function () {
|
|
163
|
-
var _getDocument;
|
|
164
|
-
var fireCopiedCardEvent = function fireCopiedCardEvent() {
|
|
165
|
-
cardElement && createAnalyticsEvent && (0, _cardAnalytics.fireCopiedEvent)(createAnalyticsEvent, metadata.id, cardElement);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// we add a listener for each of the cards on the page
|
|
169
|
-
// and then check if the triggered listener is from the card
|
|
170
|
-
// that contains a div in current window.getSelection()
|
|
171
|
-
// won't work in IE11
|
|
172
|
-
(_getDocument = (0, _document.default)()) === null || _getDocument === void 0 || _getDocument.addEventListener('copy', fireCopiedCardEvent);
|
|
173
|
-
return function () {
|
|
174
|
-
var _getDocument2;
|
|
175
|
-
(_getDocument2 = (0, _document.default)()) === null || _getDocument2 === void 0 || _getDocument2.removeEventListener('copy', fireCopiedCardEvent);
|
|
176
|
-
};
|
|
177
|
-
}, [cardElement, createAnalyticsEvent, metadata.id]);
|
|
178
157
|
var prevStatus = (0, _usePrevious.usePrevious)(status);
|
|
179
158
|
(0, _react.useEffect)(function () {
|
|
180
159
|
if (prevStatus !== undefined && status !== prevStatus) {
|
|
@@ -270,7 +249,6 @@ var ExternalImageCard = exports.ExternalImageCard = function ExternalImageCard(_
|
|
|
270
249
|
viewingLevel: 'minimal'
|
|
271
250
|
}, payloadPart));
|
|
272
251
|
},
|
|
273
|
-
innerRef: setCardElement,
|
|
274
252
|
testId: testId,
|
|
275
253
|
titleBoxBgColor: titleBoxBgColor,
|
|
276
254
|
titleBoxIcon: titleBoxIcon,
|
|
@@ -18,9 +18,9 @@ var _mediaCommon = require("@atlaskit/media-common");
|
|
|
18
18
|
var _mediaViewer = require("@atlaskit/media-viewer");
|
|
19
19
|
var _react = _interopRequireWildcard(require("react"));
|
|
20
20
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
21
|
+
var _useCallbackRef = require("use-callback-ref");
|
|
21
22
|
var _errors = require("../errors");
|
|
22
23
|
var _types = require("../types");
|
|
23
|
-
var _document = _interopRequireDefault(require("../utils/document"));
|
|
24
24
|
var _generateUniqueId = require("../utils/generateUniqueId");
|
|
25
25
|
var _getDataURIDimension = require("../utils/getDataURIDimension");
|
|
26
26
|
var _getMediaCardCursor = require("../utils/getMediaCardCursor");
|
|
@@ -197,7 +197,8 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
197
197
|
ssrReliability = _useFilePreview.ssrReliability,
|
|
198
198
|
onImageErrorBase = _useFilePreview.onImageError,
|
|
199
199
|
onImageLoadBase = _useFilePreview.onImageLoad,
|
|
200
|
-
getSsrScriptProps = _useFilePreview.getSsrScriptProps
|
|
200
|
+
getSsrScriptProps = _useFilePreview.getSsrScriptProps,
|
|
201
|
+
copyNodeRef = _useFilePreview.copyNodeRef;
|
|
201
202
|
var _useState13 = (0, _react.useState)(),
|
|
202
203
|
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
203
204
|
error = _useState14[0],
|
|
@@ -394,27 +395,6 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
394
395
|
}
|
|
395
396
|
};
|
|
396
397
|
|
|
397
|
-
//----------------------------------------------------------------//
|
|
398
|
-
//------------------------ handle fireCopiedEvent --------------//
|
|
399
|
-
//----------------------------------------------------------------//
|
|
400
|
-
|
|
401
|
-
(0, _react.useEffect)(function () {
|
|
402
|
-
var _getDocument;
|
|
403
|
-
var fireCopiedCardEvent = function fireCopiedCardEvent() {
|
|
404
|
-
cardElement && createAnalyticsEvent && (0, _cardAnalytics.fireCopiedEvent)(createAnalyticsEvent, metadata.id, cardElement);
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
// we add a listener for each of the cards on the page
|
|
408
|
-
// and then check if the triggered listener is from the card
|
|
409
|
-
// that contains a div in current window.getSelection()
|
|
410
|
-
// won't work in IE11
|
|
411
|
-
(_getDocument = (0, _document.default)()) === null || _getDocument === void 0 || _getDocument.addEventListener('copy', fireCopiedCardEvent);
|
|
412
|
-
return function () {
|
|
413
|
-
var _getDocument2;
|
|
414
|
-
(_getDocument2 = (0, _document.default)()) === null || _getDocument2 === void 0 || _getDocument2.removeEventListener('copy', fireCopiedCardEvent);
|
|
415
|
-
};
|
|
416
|
-
}, [cardElement, createAnalyticsEvent, metadata.id]);
|
|
417
|
-
|
|
418
398
|
//----------------------------------------------------------------//
|
|
419
399
|
//----------------- update status flags --------------------------//
|
|
420
400
|
//----------------------------------------------------------------//
|
|
@@ -535,6 +515,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
535
515
|
}
|
|
536
516
|
}
|
|
537
517
|
});
|
|
518
|
+
var mergedRef = (0, _useCallbackRef.useMergeRefs)([setCardElement, copyNodeRef]);
|
|
538
519
|
(0, _react.useEffect)(function () {
|
|
539
520
|
updateFileStateRef.current();
|
|
540
521
|
}, [fileState, preview, previewStatus, updateFileStateRef, previewDidRender, finalStatus]);
|
|
@@ -598,7 +579,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
598
579
|
viewingLevel: 'minimal'
|
|
599
580
|
}, payloadPart));
|
|
600
581
|
} : undefined,
|
|
601
|
-
innerRef:
|
|
582
|
+
innerRef: mergedRef,
|
|
602
583
|
testId: testId,
|
|
603
584
|
titleBoxBgColor: titleBoxBgColor,
|
|
604
585
|
titleBoxIcon: titleBoxIcon,
|
|
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
87
87
|
}(_react.default.Component);
|
|
88
88
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
89
89
|
var packageName = "@atlaskit/media-card";
|
|
90
|
-
var packageVersion = "78.
|
|
90
|
+
var packageVersion = "78.17.0";
|
|
91
91
|
|
|
92
92
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
93
93
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -13,13 +13,21 @@ var _styles = require("./styles");
|
|
|
13
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
14
|
|
|
15
15
|
var ActionsBarWrapper = exports.ActionsBarWrapper = function ActionsBarWrapper(props) {
|
|
16
|
-
return (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
return (
|
|
17
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
18
|
+
(0, _react.jsx)("div", {
|
|
19
|
+
id: "actionsBarWrapper",
|
|
20
|
+
"data-testId": "actionsBarWrapper"
|
|
21
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
22
|
+
,
|
|
23
|
+
css: (0, _styles.wrapperStyles)(props.isFixed)
|
|
24
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
25
|
+
,
|
|
26
|
+
className: _styles.actionsBarClassName,
|
|
27
|
+
onClick: function onClick(event) {
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
}
|
|
31
|
+
}, props.children)
|
|
32
|
+
);
|
|
25
33
|
};
|
|
@@ -53,9 +53,7 @@ var CardActionIconButton = exports.CardActionIconButton = function CardActionIco
|
|
|
53
53
|
variant: variant,
|
|
54
54
|
disabled: isDisabled
|
|
55
55
|
}, icon);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return useTooltip ? /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
56
|
+
return tooltip ? /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
59
57
|
content: tooltip,
|
|
60
58
|
position: "bottom",
|
|
61
59
|
tag: "span"
|
|
@@ -13,9 +13,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
13
13
|
var _react = require("@emotion/react");
|
|
14
14
|
var _react2 = require("react");
|
|
15
15
|
var _cardActionIconButton = require("./cardActionIconButton");
|
|
16
|
-
var _styles = require("./styles");
|
|
17
16
|
var _cardActionsDropdownMenu = require("./cardActionsDropdownMenu");
|
|
18
|
-
var _preventClickThrough = require("../../../../utils/preventClickThrough");
|
|
19
17
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
20
18
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
21
19
|
* @jsxRuntime classic
|
|
@@ -36,9 +34,7 @@ var CardActionsView = exports.CardActionsView = /*#__PURE__*/function (_Componen
|
|
|
36
34
|
}
|
|
37
35
|
var primaryAction = actions.find(actionWithIcon);
|
|
38
36
|
var otherActions = actions.filter(actionNotEqualTo(primaryAction));
|
|
39
|
-
return (0, _react.jsx)(
|
|
40
|
-
css: _styles.wrapperStyles
|
|
41
|
-
}, primaryAction ? this.renderActionIconButton(primaryAction, true) : null, this.renderOtherActionButtons(otherActions)));
|
|
37
|
+
return (0, _react.jsx)(_react2.Fragment, null, primaryAction ? this.renderActionIconButton(primaryAction, true) : null, this.renderOtherActionButtons(otherActions));
|
|
42
38
|
}
|
|
43
39
|
}, {
|
|
44
40
|
key: "renderActionIconButton",
|
|
@@ -3,32 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.cardActionButtonStyles = exports.CardActionIconButtonVariant = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
10
10
|
var _styles = require("../../styles");
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
14
|
-
var wrapperStyles = exports.wrapperStyles = (0, _react.css)({
|
|
15
|
-
boxSizing: 'border-box',
|
|
16
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
17
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
18
|
-
'*': {
|
|
19
|
-
boxSizing: 'border-box'
|
|
20
|
-
},
|
|
21
|
-
display: 'flex',
|
|
22
|
-
position: 'relative',
|
|
23
|
-
lineHeight: 0
|
|
24
|
-
});
|
|
25
12
|
var CardActionIconButtonVariant = exports.CardActionIconButtonVariant = /*#__PURE__*/function (CardActionIconButtonVariant) {
|
|
26
13
|
CardActionIconButtonVariant["default"] = "default";
|
|
27
14
|
CardActionIconButtonVariant["filled"] = "filled";
|
|
28
15
|
return CardActionIconButtonVariant;
|
|
29
16
|
}({});
|
|
30
17
|
var getVariantStyles = function getVariantStyles(variant) {
|
|
31
|
-
return variant === 'filled' ? "\n background-color: ".concat("var(--ds-surface-overlay, ".concat((0, _styles.rgba)(_colors.N0, 0.8), ")"), ";\n
|
|
18
|
+
return variant === 'filled' ? "\n background-color: ".concat("var(--ds-surface-overlay, ".concat((0, _styles.rgba)(_colors.N0, 0.8), ")"), ";\n\n &:hover {\n background-color: ", "var(--ds-surface-overlay-hovered, ".concat((0, _styles.rgba)(_colors.N0, 0.6), ")"), "\n }\n ") : "\n &:hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, rgba(9, 30, 66, 0.06))", ";\n }\n ");
|
|
32
19
|
};
|
|
33
20
|
var cardActionButtonStyles = exports.cardActionButtonStyles = function cardActionButtonStyles(_ref) {
|
|
34
21
|
var variant = _ref.variant;
|
|
@@ -15,11 +15,13 @@ var wrapperStyles = exports.wrapperStyles = function wrapperStyles(isFixed) {
|
|
|
15
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
16
16
|
(0, _react.css)(isFixed ? fixedActionBarStyles : 'opacity: 0;', (0, _styles.transition)(), {
|
|
17
17
|
position: 'absolute',
|
|
18
|
-
top:
|
|
19
|
-
right: "var(--ds-space-100, 8px)",
|
|
18
|
+
top: 0,
|
|
20
19
|
display: 'flex',
|
|
21
20
|
flexFlow: 'row nowrap',
|
|
22
|
-
|
|
21
|
+
justifyContent: 'right',
|
|
22
|
+
width: '100%',
|
|
23
|
+
padding: "var(--ds-space-100, 8px)",
|
|
24
|
+
gap: "var(--ds-space-100, 8px)"
|
|
23
25
|
})
|
|
24
26
|
);
|
|
25
27
|
};
|
|
@@ -117,7 +117,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
117
117
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
118
118
|
var analyticsContext = {
|
|
119
119
|
packageVersion: "@atlaskit/media-card",
|
|
120
|
-
packageName: "78.
|
|
120
|
+
packageName: "78.17.0",
|
|
121
121
|
componentName: 'mediaInlineCard',
|
|
122
122
|
component: 'mediaInlineCard'
|
|
123
123
|
};
|
|
@@ -20,6 +20,7 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
20
20
|
var _errors = require("../errors");
|
|
21
21
|
var _analytics = require("../utils/analytics");
|
|
22
22
|
var _mediaInlineCardAnalytics = require("./mediaInlineCardAnalytics");
|
|
23
|
+
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
23
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
26
|
// UI component which renders an inline link in the appropiate state based on a media file
|
|
@@ -67,6 +68,10 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
67
68
|
setIsSucceededEventSent(true);
|
|
68
69
|
(0, _analytics.fireMediaCardEvent)(payload, createAnalyticsEvent);
|
|
69
70
|
};
|
|
71
|
+
var _useCopyIntent = (0, _mediaClientReact.useCopyIntent)(identifier.id, {
|
|
72
|
+
collectionName: identifier.collectionName
|
|
73
|
+
}),
|
|
74
|
+
copyNodeRef = _useCopyIntent.copyNodeRef;
|
|
70
75
|
var onMediaInlineCardClick = function onMediaInlineCardClick(event) {
|
|
71
76
|
if (onClick) {
|
|
72
77
|
var inlineCardEvent = {
|
|
@@ -124,6 +129,7 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
124
129
|
var errorReason = (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading' ? 'upload' : 'metadata-fetch';
|
|
125
130
|
!isFailedEventSent && fireFailedOperationalEvent(new _errors.MediaCardError(errorReason, subscribeError));
|
|
126
131
|
return /*#__PURE__*/_react.default.createElement(_mediaUi.MediaInlineCardErroredView, {
|
|
132
|
+
innerRef: copyNodeRef,
|
|
127
133
|
message: (intl || defaultIntl).formatMessage(errorMessage),
|
|
128
134
|
isSelected: isSelected
|
|
129
135
|
});
|
|
@@ -132,6 +138,7 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
132
138
|
var error = new _errors.MediaCardError('error-file-state', new Error(fileState.message));
|
|
133
139
|
!isFailedEventSent && fireFailedOperationalEvent(error);
|
|
134
140
|
return /*#__PURE__*/_react.default.createElement(_mediaUi.MediaInlineCardErroredView, {
|
|
141
|
+
innerRef: copyNodeRef,
|
|
135
142
|
message: (intl || defaultIntl).formatMessage(_mediaUi.messages.couldnt_load_file),
|
|
136
143
|
isSelected: isSelected
|
|
137
144
|
});
|
|
@@ -142,18 +149,21 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
142
149
|
var _error = new _errors.MediaCardError('metadata-fetch', new _mediaClient.FileFetcherError('emptyFileName', fileState.id));
|
|
143
150
|
!isFailedEventSent && fireFailedOperationalEvent(_error);
|
|
144
151
|
return /*#__PURE__*/_react.default.createElement(_mediaUi.MediaInlineCardErroredView, {
|
|
152
|
+
innerRef: copyNodeRef,
|
|
145
153
|
message: (intl || defaultIntl).formatMessage(_mediaUi.messages.couldnt_load_file),
|
|
146
154
|
isSelected: isSelected
|
|
147
155
|
});
|
|
148
156
|
}
|
|
149
157
|
if ((fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading') {
|
|
150
158
|
return /*#__PURE__*/_react.default.createElement(_mediaUi.MediaInlineCardLoadingView, {
|
|
159
|
+
innerRef: copyNodeRef,
|
|
151
160
|
message: fileState.name,
|
|
152
161
|
isSelected: isSelected
|
|
153
162
|
});
|
|
154
163
|
}
|
|
155
164
|
if (!fileState) {
|
|
156
165
|
return /*#__PURE__*/_react.default.createElement(_mediaUi.MediaInlineCardLoadingView, {
|
|
166
|
+
innerRef: copyNodeRef,
|
|
157
167
|
message: (intl || defaultIntl).formatMessage(_mediaUi.messages.loading_file),
|
|
158
168
|
isSelected: isSelected
|
|
159
169
|
});
|
|
@@ -192,6 +202,7 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
192
202
|
content: formattedDate,
|
|
193
203
|
tag: "span"
|
|
194
204
|
}, /*#__PURE__*/_react.default.createElement(_mediaUi.MediaInlineCardLoadedView, {
|
|
205
|
+
innerRef: copyNodeRef,
|
|
195
206
|
icon: linkIcon,
|
|
196
207
|
title: name,
|
|
197
208
|
onClick: onMediaInlineCardClick,
|
|
@@ -199,6 +210,7 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
199
210
|
})), mediaViewer));
|
|
200
211
|
} else {
|
|
201
212
|
return renderContent( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_mediaUi.MediaInlineCardLoadedView, {
|
|
213
|
+
innerRef: copyNodeRef,
|
|
202
214
|
icon: linkIcon,
|
|
203
215
|
title: name,
|
|
204
216
|
onClick: onMediaInlineCardClick,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.extractErrorInfo = exports.createAndFireMediaCardEvent = void 0;
|
|
8
8
|
exports.fireMediaCardEvent = fireMediaCardEvent;
|
|
9
|
-
exports.getRenderSucceededEventPayload = exports.getRenderPreviewableCardPayload = exports.getRenderFailedFileStatusPayload = exports.getRenderFailedExternalUriPayload = exports.getRenderErrorRequestMetadata = exports.getRenderErrorFailReason = exports.getRenderErrorEventPayload = exports.getRenderErrorErrorReason = exports.getRenderErrorErrorDetail = exports.getRemoteSuccessEventPayload = exports.getFileAttributes = exports.getErrorTraceContext = exports.getErrorEventPayload = exports.getDownloadSucceededEventPayload = exports.getDownloadFailedEventPayload = exports.
|
|
9
|
+
exports.getRenderSucceededEventPayload = exports.getRenderPreviewableCardPayload = exports.getRenderFailedFileStatusPayload = exports.getRenderFailedExternalUriPayload = exports.getRenderErrorRequestMetadata = exports.getRenderErrorFailReason = exports.getRenderErrorEventPayload = exports.getRenderErrorErrorReason = exports.getRenderErrorErrorDetail = exports.getRemoteSuccessEventPayload = exports.getFileAttributes = exports.getErrorTraceContext = exports.getErrorEventPayload = exports.getDownloadSucceededEventPayload = exports.getDownloadFailedEventPayload = exports.getCacheHitEventPayload = void 0;
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _mediaClient = require("@atlaskit/media-client");
|
|
12
12
|
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
@@ -216,15 +216,6 @@ var getRenderFailedFileStatusPayload = exports.getRenderFailedFileStatusPayload
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
};
|
|
219
|
-
var getCopiedFilePayload = exports.getCopiedFilePayload = function getCopiedFilePayload(fileId) {
|
|
220
|
-
return {
|
|
221
|
-
eventType: 'ui',
|
|
222
|
-
action: 'copied',
|
|
223
|
-
actionSubject: 'file',
|
|
224
|
-
actionSubjectId: fileId,
|
|
225
|
-
attributes: {}
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
219
|
function fireMediaCardEvent(payload, createAnalyticsEvent) {
|
|
229
220
|
if (createAnalyticsEvent) {
|
|
230
221
|
var event = createAnalyticsEvent((0, _analytics.sanitiseAnalyticsPayload)(payload));
|
|
@@ -27,12 +27,6 @@ Object.defineProperty(exports, "getCacheHitEventPayload", {
|
|
|
27
27
|
return _analytics.getCacheHitEventPayload;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "getCopiedFilePayload", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _analytics.getCopiedFilePayload;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
30
|
Object.defineProperty(exports, "getDownloadFailedEventPayload", {
|
|
37
31
|
enumerable: true,
|
|
38
32
|
get: function get() {
|
|
@@ -15,7 +15,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
17
|
var packageName = "@atlaskit/media-card";
|
|
18
|
-
var packageVersion = "78.
|
|
18
|
+
var packageVersion = "78.17.0";
|
|
19
19
|
var concurrentExperience;
|
|
20
20
|
var getExperience = function getExperience(id) {
|
|
21
21
|
if (!concurrentExperience) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "78.
|
|
12
|
+
const packageVersion = "78.17.0";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fireMediaCardEvent, getRenderSucceededEventPayload, getRenderErrorEventPayload, getRenderFailedFileStatusPayload,
|
|
1
|
+
import { fireMediaCardEvent, getRenderSucceededEventPayload, getRenderErrorEventPayload, getRenderFailedFileStatusPayload, getRenderPreviewableCardPayload, getErrorEventPayload, getDownloadSucceededEventPayload, getDownloadFailedEventPayload } from '../utils/analytics';
|
|
2
2
|
import { MediaCardError } from '../errors';
|
|
3
3
|
export const fireOperationalEvent = (createAnalyticsEvent, status, fileAttributes, performanceAttributes, ssrReliability, error = new MediaCardError('missing-error-data'), traceContext, metadataTraceContext) => {
|
|
4
4
|
const fireEvent = payload => fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
@@ -14,15 +14,6 @@ export const fireOperationalEvent = (createAnalyticsEvent, status, fileAttribute
|
|
|
14
14
|
break;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
export const fireCopiedEvent = (createAnalyticsEvent, fileId, cardRef) => {
|
|
18
|
-
if (typeof window.getSelection === 'function') {
|
|
19
|
-
var _selection$containsNo;
|
|
20
|
-
const selection = window.getSelection();
|
|
21
|
-
if (selection !== null && selection !== void 0 && (_selection$containsNo = selection.containsNode) !== null && _selection$containsNo !== void 0 && _selection$containsNo.call(selection, cardRef, true)) {
|
|
22
|
-
fireMediaCardEvent(getCopiedFilePayload(fileId), createAnalyticsEvent);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
17
|
export const fireScreenEvent = (createAnalyticsEvent, fileAttributes) => {
|
|
27
18
|
fireMediaCardEvent(getRenderPreviewableCardPayload(fileAttributes), createAnalyticsEvent);
|
|
28
19
|
};
|
|
@@ -9,6 +9,7 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
9
9
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
10
10
|
import SpinnerIcon from '@atlaskit/spinner';
|
|
11
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
|
+
import { useMergeRefs } from 'use-callback-ref';
|
|
12
13
|
import { messages } from '@atlaskit/media-ui';
|
|
13
14
|
import { createAndFireMediaCardEvent } from '../utils/analytics';
|
|
14
15
|
import { ImageRenderer } from './ui/imageRenderer/imageRenderer';
|
|
@@ -30,7 +31,7 @@ import { useCurrentValueRef } from '../utils/useCurrentValueRef';
|
|
|
30
31
|
import { SvgView } from './svgView';
|
|
31
32
|
export const CardViewBase = ({
|
|
32
33
|
identifier,
|
|
33
|
-
innerRef,
|
|
34
|
+
innerRef = null,
|
|
34
35
|
onImageLoad,
|
|
35
36
|
onImageError,
|
|
36
37
|
dimensions,
|
|
@@ -67,9 +68,6 @@ export const CardViewBase = ({
|
|
|
67
68
|
const divRef = useRef(null);
|
|
68
69
|
const prevCardPreviewRef = useRef();
|
|
69
70
|
const breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
72
|
-
}, [innerRef]);
|
|
73
71
|
useEffect(() => {
|
|
74
72
|
// We should only switch didImageRender to false when cardPreview goes undefined, not when it is changed. as this method could be triggered after onImageLoad callback, falling on a race condition
|
|
75
73
|
if (prevCardPreviewRef.current && !cardPreview) {
|
|
@@ -106,6 +104,7 @@ export const CardViewBase = ({
|
|
|
106
104
|
}
|
|
107
105
|
return true;
|
|
108
106
|
};
|
|
107
|
+
const mergedRef = useMergeRefs([divRef, innerRef]);
|
|
109
108
|
const getRenderConfigByStatus = () => {
|
|
110
109
|
const {
|
|
111
110
|
name,
|
|
@@ -311,7 +310,7 @@ export const CardViewBase = ({
|
|
|
311
310
|
dimensions: dimensions,
|
|
312
311
|
onClick: onClick,
|
|
313
312
|
onMouseEnter: onMouseEnter,
|
|
314
|
-
innerRef:
|
|
313
|
+
innerRef: mergedRef,
|
|
315
314
|
breakpoint: breakpoint,
|
|
316
315
|
mediaCardCursor: mediaCardCursor,
|
|
317
316
|
disableOverlay: !!disableOverlay,
|