@atlaskit/media-file-preview 0.11.4 → 0.11.5
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 +8 -0
- package/dist/cjs/globalScope/printScript.js +1 -2
- package/dist/cjs/useMediaImage.js +2 -1
- package/dist/es2019/globalScope/printScript.js +2 -5
- package/dist/es2019/useMediaImage.js +2 -1
- package/dist/esm/globalScope/printScript.js +1 -2
- package/dist/esm/useMediaImage.js +2 -1
- package/dist/types/useMediaImage.d.ts +1 -0
- package/dist/types-ts4.5/useMediaImage.d.ts +1 -0
- package/package.json +6 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-file-preview
|
|
2
2
|
|
|
3
|
+
## 0.11.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#186676](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/186676)
|
|
8
|
+
[`0fa7265b4e380`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0fa7265b4e380) -
|
|
9
|
+
Cleanup remove media script after SSR feature gate
|
|
10
|
+
|
|
3
11
|
## 0.11.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.printScript = exports.printFunctionCall = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var printParam = function printParam(param) {
|
|
11
10
|
if (typeof param === 'string') {
|
|
12
11
|
return "'".concat(param, "'");
|
|
@@ -33,5 +32,5 @@ var printFunctionCall = exports.printFunctionCall = function printFunctionCall(f
|
|
|
33
32
|
// mismatch issues after SSR. We don't want to render different
|
|
34
33
|
// HTML on the client and server https://react.dev/reference/react-dom/client/hydrateRoot
|
|
35
34
|
var printScript = exports.printScript = function printScript(statements) {
|
|
36
|
-
return
|
|
35
|
+
return "(function(){\n \t\t\t ".concat(statements.join(';'), "\n \t\t\tdocument.currentScript.remove();\n\t\t})();\n\t\t");
|
|
37
36
|
};
|
|
@@ -50,11 +50,12 @@ var useMediaImage = exports.useMediaImage = function useMediaImage(_ref) {
|
|
|
50
50
|
src: preview === null || preview === void 0 ? void 0 : preview.dataURI,
|
|
51
51
|
onLoad: onLoad,
|
|
52
52
|
onError: onError,
|
|
53
|
+
alt: (mediaBlobUrlAttrs === null || mediaBlobUrlAttrs === void 0 ? void 0 : mediaBlobUrlAttrs.alt) || '',
|
|
53
54
|
'data-test-file-id': identifier.id,
|
|
54
55
|
'data-test-collection': identifier.collectionName,
|
|
55
56
|
'data-test-preview-source': preview === null || preview === void 0 ? void 0 : preview.source
|
|
56
57
|
};
|
|
57
|
-
}, [identifier.collectionName, identifier.id, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
|
|
58
|
+
}, [identifier.collectionName, identifier.id, mediaBlobUrlAttrs === null || mediaBlobUrlAttrs === void 0 ? void 0 : mediaBlobUrlAttrs.alt, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
|
|
58
59
|
return {
|
|
59
60
|
status: status,
|
|
60
61
|
error: error,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
const printParam = param => {
|
|
3
2
|
if (typeof param === 'string') {
|
|
4
3
|
return `'${param}'`;
|
|
@@ -15,10 +14,8 @@ export const printFunctionCall = (fn, ...args) => `(${fn.toString()})(${printPar
|
|
|
15
14
|
// Removing the script tag after execution to prevent hydration
|
|
16
15
|
// mismatch issues after SSR. We don't want to render different
|
|
17
16
|
// HTML on the client and server https://react.dev/reference/react-dom/client/hydrateRoot
|
|
18
|
-
export const printScript = statements =>
|
|
17
|
+
export const printScript = statements => `(function(){
|
|
19
18
|
${statements.join(';')}
|
|
20
19
|
document.currentScript.remove();
|
|
21
20
|
})();
|
|
22
|
-
|
|
23
|
-
${statements.join(';')}
|
|
24
|
-
})();`;
|
|
21
|
+
`;
|
|
@@ -45,10 +45,11 @@ export const useMediaImage = ({
|
|
|
45
45
|
src: preview === null || preview === void 0 ? void 0 : preview.dataURI,
|
|
46
46
|
onLoad,
|
|
47
47
|
onError,
|
|
48
|
+
alt: (mediaBlobUrlAttrs === null || mediaBlobUrlAttrs === void 0 ? void 0 : mediaBlobUrlAttrs.alt) || '',
|
|
48
49
|
'data-test-file-id': identifier.id,
|
|
49
50
|
'data-test-collection': identifier.collectionName,
|
|
50
51
|
'data-test-preview-source': preview === null || preview === void 0 ? void 0 : preview.source
|
|
51
|
-
}), [identifier.collectionName, identifier.id, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
|
|
52
|
+
}), [identifier.collectionName, identifier.id, mediaBlobUrlAttrs === null || mediaBlobUrlAttrs === void 0 ? void 0 : mediaBlobUrlAttrs.alt, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
|
|
52
53
|
return {
|
|
53
54
|
status,
|
|
54
55
|
error,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
var printParam = function printParam(param) {
|
|
4
3
|
if (typeof param === 'string') {
|
|
5
4
|
return "'".concat(param, "'");
|
|
@@ -26,5 +25,5 @@ export var printFunctionCall = function printFunctionCall(fn) {
|
|
|
26
25
|
// mismatch issues after SSR. We don't want to render different
|
|
27
26
|
// HTML on the client and server https://react.dev/reference/react-dom/client/hydrateRoot
|
|
28
27
|
export var printScript = function printScript(statements) {
|
|
29
|
-
return
|
|
28
|
+
return "(function(){\n \t\t\t ".concat(statements.join(';'), "\n \t\t\tdocument.currentScript.remove();\n\t\t})();\n\t\t");
|
|
30
29
|
};
|
|
@@ -44,11 +44,12 @@ export var useMediaImage = function useMediaImage(_ref) {
|
|
|
44
44
|
src: preview === null || preview === void 0 ? void 0 : preview.dataURI,
|
|
45
45
|
onLoad: onLoad,
|
|
46
46
|
onError: onError,
|
|
47
|
+
alt: (mediaBlobUrlAttrs === null || mediaBlobUrlAttrs === void 0 ? void 0 : mediaBlobUrlAttrs.alt) || '',
|
|
47
48
|
'data-test-file-id': identifier.id,
|
|
48
49
|
'data-test-collection': identifier.collectionName,
|
|
49
50
|
'data-test-preview-source': preview === null || preview === void 0 ? void 0 : preview.source
|
|
50
51
|
};
|
|
51
|
-
}, [identifier.collectionName, identifier.id, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
|
|
52
|
+
}, [identifier.collectionName, identifier.id, mediaBlobUrlAttrs === null || mediaBlobUrlAttrs === void 0 ? void 0 : mediaBlobUrlAttrs.alt, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
|
|
52
53
|
return {
|
|
53
54
|
status: status,
|
|
54
55
|
error: error,
|
|
@@ -35,6 +35,7 @@ export declare const useMediaImage: ({ identifier, resizeMode, dimensions, ssr,
|
|
|
35
35
|
src: string | undefined;
|
|
36
36
|
onLoad: () => void;
|
|
37
37
|
onError: () => void;
|
|
38
|
+
alt: string;
|
|
38
39
|
'data-test-file-id': string;
|
|
39
40
|
'data-test-collection': string | undefined;
|
|
40
41
|
'data-test-preview-source': import("./types").MediaFilePreviewSource | undefined;
|
|
@@ -35,6 +35,7 @@ export declare const useMediaImage: ({ identifier, resizeMode, dimensions, ssr,
|
|
|
35
35
|
src: string | undefined;
|
|
36
36
|
onLoad: () => void;
|
|
37
37
|
onError: () => void;
|
|
38
|
+
alt: string;
|
|
38
39
|
'data-test-file-id': string;
|
|
39
40
|
'data-test-collection': string | undefined;
|
|
40
41
|
'data-test-preview-source': import("./types").MediaFilePreviewSource | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-file-preview",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
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",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/media-client": "^35.
|
|
36
|
+
"@atlaskit/media-client": "^35.1.0",
|
|
37
37
|
"@atlaskit/media-client-react": "^4.1.0",
|
|
38
38
|
"@atlaskit/media-common": "^12.3.0",
|
|
39
|
-
"@atlaskit/media-ui": "^28.
|
|
39
|
+
"@atlaskit/media-ui": "^28.6.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"eventemitter2": "^4.1.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@af/integration-testing": "workspace:^",
|
|
51
51
|
"@af/visual-regression": "workspace:^",
|
|
52
|
-
"@atlaskit/media-state": "^1.
|
|
53
|
-
"@atlaskit/media-test-data": "^3.
|
|
52
|
+
"@atlaskit/media-state": "^1.8.0",
|
|
53
|
+
"@atlaskit/media-test-data": "^3.2.0",
|
|
54
54
|
"@atlaskit/section-message": "^8.2.0",
|
|
55
55
|
"@atlaskit/ssr": "workspace:^",
|
|
56
56
|
"@atlaskit/visual-regression": "workspace:^",
|
|
@@ -95,9 +95,5 @@
|
|
|
95
95
|
]
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
"platform-feature-flags": {
|
|
99
|
-
"platform_remove_media_script_after_execution": {
|
|
100
|
-
"type": "boolean"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
98
|
+
"platform-feature-flags": {}
|
|
103
99
|
}
|