@atlaskit/media-file-preview 0.8.0 → 0.8.2
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
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/media-file-preview
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#132917](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132917)
|
|
8
|
+
[`c940f8ae45182`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c940f8ae45182) -
|
|
9
|
+
Removed the additional `ssr` parameter to the image endpoint
|
|
10
|
+
|
|
11
|
+
## 0.8.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#132551](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132551)
|
|
16
|
+
[`19eb1d802c7f9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/19eb1d802c7f9) -
|
|
17
|
+
Fixed the dual fetching of image when medaiBlobUrlAttributes change
|
|
18
|
+
|
|
3
19
|
## 0.8.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -76,8 +76,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
76
76
|
});
|
|
77
77
|
if ((0, _platformFeatureFlags.fg)('platform.media-card-performance-observer_lgc7b')) {
|
|
78
78
|
imageURLParams = _objectSpread(_objectSpread({}, imageURLParams), {}, {
|
|
79
|
-
source: source
|
|
80
|
-
ssr: ssr
|
|
79
|
+
source: source
|
|
81
80
|
});
|
|
82
81
|
}
|
|
83
82
|
var previewInitializer = function previewInitializer() {
|
|
@@ -200,6 +199,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
200
199
|
// Cache, Local & Remote Preview
|
|
201
200
|
//----------------------------------------------------------------
|
|
202
201
|
|
|
202
|
+
var mediaBlobUrlAttrsRef = (0, _helpers.useCurrentValueRef)(mediaBlobUrlAttrs);
|
|
203
203
|
(0, _react.useEffect)(function () {
|
|
204
204
|
var cachedPreview = _getPreview.mediaFilePreviewCache.get(identifier.id, resizeMode);
|
|
205
205
|
|
|
@@ -213,7 +213,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
213
213
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
214
214
|
// Then, local Preview NOT available
|
|
215
215
|
|
|
216
|
-
(0, _getPreview.getAndCacheLocalPreview)(identifier.id, localBinary, requestDimensions || {}, resizeMode,
|
|
216
|
+
(0, _getPreview.getAndCacheLocalPreview)(identifier.id, localBinary, requestDimensions || {}, resizeMode, mediaBlobUrlAttrsRef.current).then(setPreview).catch(function (e) {
|
|
217
217
|
setIsBannedLocalPreview(true);
|
|
218
218
|
// CXP-2723 TODO: We might have to wrap this error in MediaCardError
|
|
219
219
|
setNonCriticalError(e);
|
|
@@ -234,7 +234,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
-
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview,
|
|
237
|
+
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview, mediaBlobUrlAttrsRef, preview, requestDimensions, skipRemote, isBackendPreviewReady, localBinary, mediaType, mimeType, upfrontPreviewStatus]);
|
|
238
238
|
|
|
239
239
|
//----------------------------------------------------------------
|
|
240
240
|
// RETURN
|
|
@@ -49,8 +49,7 @@ export const useFilePreview = ({
|
|
|
49
49
|
if (fg('platform.media-card-performance-observer_lgc7b')) {
|
|
50
50
|
imageURLParams = {
|
|
51
51
|
...imageURLParams,
|
|
52
|
-
source
|
|
53
|
-
ssr
|
|
52
|
+
source
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
55
|
const previewInitializer = () => {
|
|
@@ -175,6 +174,7 @@ export const useFilePreview = ({
|
|
|
175
174
|
// Cache, Local & Remote Preview
|
|
176
175
|
//----------------------------------------------------------------
|
|
177
176
|
|
|
177
|
+
const mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrs);
|
|
178
178
|
useEffect(() => {
|
|
179
179
|
const cachedPreview = mediaFilePreviewCache.get(identifier.id, resizeMode);
|
|
180
180
|
|
|
@@ -188,7 +188,7 @@ export const useFilePreview = ({
|
|
|
188
188
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
189
189
|
// Then, local Preview NOT available
|
|
190
190
|
|
|
191
|
-
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode,
|
|
191
|
+
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode, mediaBlobUrlAttrsRef.current).then(setPreview).catch(e => {
|
|
192
192
|
setIsBannedLocalPreview(true);
|
|
193
193
|
// CXP-2723 TODO: We might have to wrap this error in MediaCardError
|
|
194
194
|
setNonCriticalError(e);
|
|
@@ -209,7 +209,7 @@ export const useFilePreview = ({
|
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview,
|
|
212
|
+
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview, mediaBlobUrlAttrsRef, preview, requestDimensions, skipRemote, isBackendPreviewReady, localBinary, mediaType, mimeType, upfrontPreviewStatus]);
|
|
213
213
|
|
|
214
214
|
//----------------------------------------------------------------
|
|
215
215
|
// RETURN
|
|
@@ -69,8 +69,7 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
69
69
|
});
|
|
70
70
|
if (fg('platform.media-card-performance-observer_lgc7b')) {
|
|
71
71
|
imageURLParams = _objectSpread(_objectSpread({}, imageURLParams), {}, {
|
|
72
|
-
source: source
|
|
73
|
-
ssr: ssr
|
|
72
|
+
source: source
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
75
|
var previewInitializer = function previewInitializer() {
|
|
@@ -193,6 +192,7 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
193
192
|
// Cache, Local & Remote Preview
|
|
194
193
|
//----------------------------------------------------------------
|
|
195
194
|
|
|
195
|
+
var mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrs);
|
|
196
196
|
useEffect(function () {
|
|
197
197
|
var cachedPreview = mediaFilePreviewCache.get(identifier.id, resizeMode);
|
|
198
198
|
|
|
@@ -206,7 +206,7 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
206
206
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
207
207
|
// Then, local Preview NOT available
|
|
208
208
|
|
|
209
|
-
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode,
|
|
209
|
+
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode, mediaBlobUrlAttrsRef.current).then(setPreview).catch(function (e) {
|
|
210
210
|
setIsBannedLocalPreview(true);
|
|
211
211
|
// CXP-2723 TODO: We might have to wrap this error in MediaCardError
|
|
212
212
|
setNonCriticalError(e);
|
|
@@ -227,7 +227,7 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview,
|
|
230
|
+
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview, mediaBlobUrlAttrsRef, preview, requestDimensions, skipRemote, isBackendPreviewReady, localBinary, mediaType, mimeType, upfrontPreviewStatus]);
|
|
231
231
|
|
|
232
232
|
//----------------------------------------------------------------
|
|
233
233
|
// RETURN
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-file-preview",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "A React Hook to fetch and render file previews. It's overloaded with fancy features like SSR, lazy loading, memory cache and local preview.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@af/integration-testing": "*",
|
|
54
54
|
"@af/visual-regression": "*",
|
|
55
55
|
"@atlaskit/media-state": "^1.1.0",
|
|
56
|
-
"@atlaskit/media-test-data": "^2.
|
|
56
|
+
"@atlaskit/media-test-data": "^2.6.0",
|
|
57
57
|
"@atlaskit/section-message": "^6.6.0",
|
|
58
58
|
"@atlaskit/ssr": "*",
|
|
59
59
|
"@atlaskit/visual-regression": "*",
|