@atlaskit/media-viewer 52.4.4 → 52.4.6
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 +15 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/viewers/doc-next/doc-viewer.compiled.css +5 -1
- package/dist/cjs/viewers/doc-next/doc-viewer.js +29 -9
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/viewers/doc-next/doc-viewer.compiled.css +5 -1
- package/dist/es2019/viewers/doc-next/doc-viewer.js +27 -6
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/viewers/doc-next/doc-viewer.compiled.css +5 -1
- package/dist/esm/viewers/doc-next/doc-viewer.js +26 -6
- package/dist/types/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.d.ts +1 -1
- package/dist/types/viewers/codeViewer/codeViewerRenderer.d.ts +2 -2
- package/dist/types/viewers/doc-next/index.d.ts +1 -1
- package/dist/types-ts4.5/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.d.ts +1 -1
- package/dist/types-ts4.5/viewers/codeViewer/codeViewerRenderer.d.ts +2 -2
- package/dist/types-ts4.5/viewers/doc-next/index.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/media-viewer
|
|
2
2
|
|
|
3
|
+
## 52.4.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#183808](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183808)
|
|
8
|
+
[`4436100210ca9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4436100210ca9) -
|
|
9
|
+
Added spinner to document viewer
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 52.4.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 52.4.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ exports.packageVersion = exports.packageName = void 0;
|
|
|
10
10
|
var _analytics = require("@atlaskit/media-common/analytics");
|
|
11
11
|
var componentName = exports.component = exports.componentName = 'mediaViewer';
|
|
12
12
|
var packageName = exports.packageName = "@atlaskit/media-viewer";
|
|
13
|
-
var packageVersion = exports.packageVersion = "52.4.
|
|
13
|
+
var packageVersion = exports.packageVersion = "52.4.5";
|
|
14
14
|
function getFileAttributes(fileState) {
|
|
15
15
|
if (!fileState) {
|
|
16
16
|
return {
|
|
@@ -12,7 +12,7 @@ var _mediaCommon = require("@atlaskit/media-common");
|
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
14
14
|
var packageName = "@atlaskit/media-viewer";
|
|
15
|
-
var packageVersion = "52.4.
|
|
15
|
+
var packageVersion = "52.4.5";
|
|
16
16
|
var ufoExperience;
|
|
17
17
|
var getExperience = function getExperience() {
|
|
18
18
|
if (!ufoExperience) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
._18m91wug{overflow-y:auto}
|
|
2
|
+
._1bah1h6o{justify-content:center}
|
|
2
3
|
._1bsbauwl{width:100vw}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
3
5
|
._1reo1wug{overflow-x:auto}
|
|
4
|
-
.
|
|
6
|
+
._4cvr1h6o{align-items:center}
|
|
7
|
+
._4t3i1kxc{height:100vh}
|
|
8
|
+
._kqswstnw{position:absolute}
|
|
@@ -8,13 +8,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
});
|
|
9
9
|
exports.default = exports.DocViewer = void 0;
|
|
10
10
|
require("./doc-viewer.compiled.css");
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var React = _react;
|
|
13
11
|
var _runtime = require("@compiled/react/runtime");
|
|
14
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
15
13
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
18
17
|
var _mediaClient = require("@atlaskit/media-client");
|
|
19
18
|
var _mediaDocumentViewer = require("@atlaskit/media-document-viewer");
|
|
20
19
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
@@ -22,6 +21,7 @@ var _errors = require("../../errors");
|
|
|
22
21
|
var _zoomControls = require("../../zoomControls");
|
|
23
22
|
var _zoomLevel = require("../../domain/zoomLevel");
|
|
24
23
|
var _passwordInput = require("./passwordInput");
|
|
24
|
+
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
25
25
|
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); }
|
|
26
26
|
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; }
|
|
27
27
|
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; }
|
|
@@ -29,7 +29,8 @@ var initialState = {
|
|
|
29
29
|
isMissingPassword: false,
|
|
30
30
|
hasPasswordError: false,
|
|
31
31
|
password: '',
|
|
32
|
-
zoomLevel: new _zoomLevel.ZoomLevel(1.75)
|
|
32
|
+
zoomLevel: new _zoomLevel.ZoomLevel(1.75),
|
|
33
|
+
isLoading: true
|
|
33
34
|
};
|
|
34
35
|
var reducer = function reducer(state, action) {
|
|
35
36
|
switch (action.type) {
|
|
@@ -54,11 +55,16 @@ var reducer = function reducer(state, action) {
|
|
|
54
55
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
55
56
|
isMissingPassword: true
|
|
56
57
|
});
|
|
58
|
+
case 'loading_completed':
|
|
59
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
60
|
+
isLoading: false
|
|
61
|
+
});
|
|
57
62
|
default:
|
|
58
63
|
return state;
|
|
59
64
|
}
|
|
60
65
|
};
|
|
61
66
|
var documentViewerStyles = null;
|
|
67
|
+
var spinnerStyles = null;
|
|
62
68
|
var DocViewer = exports.DocViewer = function DocViewer(_ref) {
|
|
63
69
|
var mediaClient = _ref.mediaClient,
|
|
64
70
|
fileState = _ref.fileState,
|
|
@@ -175,6 +181,12 @@ var DocViewer = exports.DocViewer = function DocViewer(_ref) {
|
|
|
175
181
|
return _ref4.apply(this, arguments);
|
|
176
182
|
};
|
|
177
183
|
}());
|
|
184
|
+
var onSuccessHandler = (0, _mediaCommon.useStaticCallback)(function () {
|
|
185
|
+
dispatch({
|
|
186
|
+
type: 'loading_completed'
|
|
187
|
+
});
|
|
188
|
+
onSuccess === null || onSuccess === void 0 || onSuccess();
|
|
189
|
+
});
|
|
178
190
|
var onZoomChange = (0, _mediaCommon.useStaticCallback)(function (newZoomLevel) {
|
|
179
191
|
dispatch({
|
|
180
192
|
type: 'set_zoom_level',
|
|
@@ -182,22 +194,30 @@ var DocViewer = exports.DocViewer = function DocViewer(_ref) {
|
|
|
182
194
|
});
|
|
183
195
|
});
|
|
184
196
|
if (state.isMissingPassword) {
|
|
185
|
-
return /*#__PURE__*/
|
|
197
|
+
return /*#__PURE__*/_react.default.createElement(_passwordInput.PasswordInput, {
|
|
186
198
|
onSubmit: onPasswordSubmit,
|
|
187
199
|
hasPasswordError: state.hasPasswordError
|
|
188
200
|
});
|
|
189
201
|
}
|
|
190
|
-
return /*#__PURE__*/
|
|
202
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, state.isLoading && /*#__PURE__*/_react.default.createElement("div", {
|
|
203
|
+
className: (0, _runtime.ax)(["_kqswstnw _1e0c1txw _1bah1h6o _4cvr1h6o"])
|
|
204
|
+
}, /*#__PURE__*/_react.default.createElement(_spinner.default, {
|
|
205
|
+
size: "large",
|
|
206
|
+
appearance: "invert"
|
|
207
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
208
|
+
style: {
|
|
209
|
+
opacity: state.isLoading ? 0 : 1
|
|
210
|
+
},
|
|
191
211
|
id: _mediaDocumentViewer.DOCUMENT_SCROLL_ROOT_ID,
|
|
192
212
|
className: (0, _runtime.ax)(["_1reo1wug _18m91wug _4t3i1kxc _1bsbauwl"])
|
|
193
|
-
}, /*#__PURE__*/
|
|
213
|
+
}, /*#__PURE__*/_react.default.createElement(_mediaDocumentViewer.DocumentViewer, {
|
|
194
214
|
getContent: getContent,
|
|
195
215
|
getPageImageUrl: getPageImageUrl,
|
|
196
216
|
zoom: state.zoomLevel.value,
|
|
197
|
-
onSuccess:
|
|
198
|
-
}), /*#__PURE__*/
|
|
217
|
+
onSuccess: onSuccessHandler
|
|
218
|
+
}), /*#__PURE__*/_react.default.createElement(_zoomControls.ZoomControls, {
|
|
199
219
|
onChange: onZoomChange,
|
|
200
220
|
zoomLevel: state.zoomLevel
|
|
201
|
-
}));
|
|
221
|
+
})));
|
|
202
222
|
};
|
|
203
223
|
var _default = exports.default = DocViewer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ANALYTICS_MEDIA_CHANNEL, sanitiseAnalyticsPayload } from '@atlaskit/media-common/analytics';
|
|
2
2
|
const componentName = 'mediaViewer';
|
|
3
3
|
const packageName = "@atlaskit/media-viewer";
|
|
4
|
-
const packageVersion = "52.4.
|
|
4
|
+
const packageVersion = "52.4.5";
|
|
5
5
|
export { packageName, packageVersion, componentName, componentName as component };
|
|
6
6
|
export function getFileAttributes(fileState) {
|
|
7
7
|
if (!fileState) {
|
|
@@ -2,7 +2,7 @@ import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atl
|
|
|
2
2
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
3
3
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
4
4
|
const packageName = "@atlaskit/media-viewer";
|
|
5
|
-
const packageVersion = "52.4.
|
|
5
|
+
const packageVersion = "52.4.5";
|
|
6
6
|
let ufoExperience;
|
|
7
7
|
const getExperience = () => {
|
|
8
8
|
if (!ufoExperience) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
._18m91wug{overflow-y:auto}
|
|
2
|
+
._1bah1h6o{justify-content:center}
|
|
2
3
|
._1bsbauwl{width:100vw}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
3
5
|
._1reo1wug{overflow-x:auto}
|
|
4
|
-
.
|
|
6
|
+
._4cvr1h6o{align-items:center}
|
|
7
|
+
._4t3i1kxc{height:100vh}
|
|
8
|
+
._kqswstnw{position:absolute}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* doc-viewer.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
2
|
import "./doc-viewer.compiled.css";
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useReducer } from 'react';
|
|
4
|
+
import React, { useReducer } from 'react';
|
|
6
5
|
import { isCommonMediaClientError } from '@atlaskit/media-client';
|
|
7
6
|
import { DOCUMENT_SCROLL_ROOT_ID, DocumentViewer } from '@atlaskit/media-document-viewer';
|
|
8
7
|
import { useStaticCallback } from '@atlaskit/media-common';
|
|
@@ -10,11 +9,13 @@ import { MediaViewerError } from '../../errors';
|
|
|
10
9
|
import { ZoomControls } from '../../zoomControls';
|
|
11
10
|
import { ZoomLevel } from '../../domain/zoomLevel';
|
|
12
11
|
import { PasswordInput } from './passwordInput';
|
|
12
|
+
import Spinner from '@atlaskit/spinner';
|
|
13
13
|
const initialState = {
|
|
14
14
|
isMissingPassword: false,
|
|
15
15
|
hasPasswordError: false,
|
|
16
16
|
password: '',
|
|
17
|
-
zoomLevel: new ZoomLevel(1.75)
|
|
17
|
+
zoomLevel: new ZoomLevel(1.75),
|
|
18
|
+
isLoading: true
|
|
18
19
|
};
|
|
19
20
|
const reducer = (state, action) => {
|
|
20
21
|
switch (action.type) {
|
|
@@ -44,11 +45,17 @@ const reducer = (state, action) => {
|
|
|
44
45
|
...state,
|
|
45
46
|
isMissingPassword: true
|
|
46
47
|
};
|
|
48
|
+
case 'loading_completed':
|
|
49
|
+
return {
|
|
50
|
+
...state,
|
|
51
|
+
isLoading: false
|
|
52
|
+
};
|
|
47
53
|
default:
|
|
48
54
|
return state;
|
|
49
55
|
}
|
|
50
56
|
};
|
|
51
57
|
const documentViewerStyles = null;
|
|
58
|
+
const spinnerStyles = null;
|
|
52
59
|
export const DocViewer = ({
|
|
53
60
|
mediaClient,
|
|
54
61
|
fileState,
|
|
@@ -112,6 +119,12 @@ export const DocViewer = ({
|
|
|
112
119
|
}, traceContext);
|
|
113
120
|
return URL.createObjectURL(src);
|
|
114
121
|
});
|
|
122
|
+
const onSuccessHandler = useStaticCallback(() => {
|
|
123
|
+
dispatch({
|
|
124
|
+
type: 'loading_completed'
|
|
125
|
+
});
|
|
126
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
127
|
+
});
|
|
115
128
|
const onZoomChange = useStaticCallback(newZoomLevel => {
|
|
116
129
|
dispatch({
|
|
117
130
|
type: 'set_zoom_level',
|
|
@@ -124,17 +137,25 @@ export const DocViewer = ({
|
|
|
124
137
|
hasPasswordError: state.hasPasswordError
|
|
125
138
|
});
|
|
126
139
|
}
|
|
127
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
140
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, state.isLoading && /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
className: ax(["_kqswstnw _1e0c1txw _1bah1h6o _4cvr1h6o"])
|
|
142
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
143
|
+
size: "large",
|
|
144
|
+
appearance: "invert"
|
|
145
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
style: {
|
|
147
|
+
opacity: state.isLoading ? 0 : 1
|
|
148
|
+
},
|
|
128
149
|
id: DOCUMENT_SCROLL_ROOT_ID,
|
|
129
150
|
className: ax(["_1reo1wug _18m91wug _4t3i1kxc _1bsbauwl"])
|
|
130
151
|
}, /*#__PURE__*/React.createElement(DocumentViewer, {
|
|
131
152
|
getContent: getContent,
|
|
132
153
|
getPageImageUrl: getPageImageUrl,
|
|
133
154
|
zoom: state.zoomLevel.value,
|
|
134
|
-
onSuccess:
|
|
155
|
+
onSuccess: onSuccessHandler
|
|
135
156
|
}), /*#__PURE__*/React.createElement(ZoomControls, {
|
|
136
157
|
onChange: onZoomChange,
|
|
137
158
|
zoomLevel: state.zoomLevel
|
|
138
|
-
}));
|
|
159
|
+
})));
|
|
139
160
|
};
|
|
140
161
|
export default DocViewer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ANALYTICS_MEDIA_CHANNEL, sanitiseAnalyticsPayload } from '@atlaskit/media-common/analytics';
|
|
2
2
|
var componentName = 'mediaViewer';
|
|
3
3
|
var packageName = "@atlaskit/media-viewer";
|
|
4
|
-
var packageVersion = "52.4.
|
|
4
|
+
var packageVersion = "52.4.5";
|
|
5
5
|
export { packageName, packageVersion, componentName, componentName as component };
|
|
6
6
|
export function getFileAttributes(fileState) {
|
|
7
7
|
if (!fileState) {
|
|
@@ -5,7 +5,7 @@ import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atl
|
|
|
5
5
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
6
6
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
7
7
|
var packageName = "@atlaskit/media-viewer";
|
|
8
|
-
var packageVersion = "52.4.
|
|
8
|
+
var packageVersion = "52.4.5";
|
|
9
9
|
var ufoExperience;
|
|
10
10
|
var getExperience = function getExperience() {
|
|
11
11
|
if (!ufoExperience) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
._18m91wug{overflow-y:auto}
|
|
2
|
+
._1bah1h6o{justify-content:center}
|
|
2
3
|
._1bsbauwl{width:100vw}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
3
5
|
._1reo1wug{overflow-x:auto}
|
|
4
|
-
.
|
|
6
|
+
._4cvr1h6o{align-items:center}
|
|
7
|
+
._4t3i1kxc{height:100vh}
|
|
8
|
+
._kqswstnw{position:absolute}
|
|
@@ -3,12 +3,11 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import "./doc-viewer.compiled.css";
|
|
6
|
-
import * as React from 'react';
|
|
7
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
8
|
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; }
|
|
10
9
|
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) { _defineProperty(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; }
|
|
11
|
-
import { useReducer } from 'react';
|
|
10
|
+
import React, { useReducer } from 'react';
|
|
12
11
|
import { isCommonMediaClientError } from '@atlaskit/media-client';
|
|
13
12
|
import { DOCUMENT_SCROLL_ROOT_ID, DocumentViewer } from '@atlaskit/media-document-viewer';
|
|
14
13
|
import { useStaticCallback } from '@atlaskit/media-common';
|
|
@@ -16,11 +15,13 @@ import { MediaViewerError } from '../../errors';
|
|
|
16
15
|
import { ZoomControls } from '../../zoomControls';
|
|
17
16
|
import { ZoomLevel } from '../../domain/zoomLevel';
|
|
18
17
|
import { PasswordInput } from './passwordInput';
|
|
18
|
+
import Spinner from '@atlaskit/spinner';
|
|
19
19
|
var initialState = {
|
|
20
20
|
isMissingPassword: false,
|
|
21
21
|
hasPasswordError: false,
|
|
22
22
|
password: '',
|
|
23
|
-
zoomLevel: new ZoomLevel(1.75)
|
|
23
|
+
zoomLevel: new ZoomLevel(1.75),
|
|
24
|
+
isLoading: true
|
|
24
25
|
};
|
|
25
26
|
var reducer = function reducer(state, action) {
|
|
26
27
|
switch (action.type) {
|
|
@@ -45,11 +46,16 @@ var reducer = function reducer(state, action) {
|
|
|
45
46
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
46
47
|
isMissingPassword: true
|
|
47
48
|
});
|
|
49
|
+
case 'loading_completed':
|
|
50
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
51
|
+
isLoading: false
|
|
52
|
+
});
|
|
48
53
|
default:
|
|
49
54
|
return state;
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
57
|
var documentViewerStyles = null;
|
|
58
|
+
var spinnerStyles = null;
|
|
53
59
|
export var DocViewer = function DocViewer(_ref) {
|
|
54
60
|
var mediaClient = _ref.mediaClient,
|
|
55
61
|
fileState = _ref.fileState,
|
|
@@ -166,6 +172,12 @@ export var DocViewer = function DocViewer(_ref) {
|
|
|
166
172
|
return _ref4.apply(this, arguments);
|
|
167
173
|
};
|
|
168
174
|
}());
|
|
175
|
+
var onSuccessHandler = useStaticCallback(function () {
|
|
176
|
+
dispatch({
|
|
177
|
+
type: 'loading_completed'
|
|
178
|
+
});
|
|
179
|
+
onSuccess === null || onSuccess === void 0 || onSuccess();
|
|
180
|
+
});
|
|
169
181
|
var onZoomChange = useStaticCallback(function (newZoomLevel) {
|
|
170
182
|
dispatch({
|
|
171
183
|
type: 'set_zoom_level',
|
|
@@ -178,17 +190,25 @@ export var DocViewer = function DocViewer(_ref) {
|
|
|
178
190
|
hasPasswordError: state.hasPasswordError
|
|
179
191
|
});
|
|
180
192
|
}
|
|
181
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, state.isLoading && /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
className: ax(["_kqswstnw _1e0c1txw _1bah1h6o _4cvr1h6o"])
|
|
195
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
196
|
+
size: "large",
|
|
197
|
+
appearance: "invert"
|
|
198
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
style: {
|
|
200
|
+
opacity: state.isLoading ? 0 : 1
|
|
201
|
+
},
|
|
182
202
|
id: DOCUMENT_SCROLL_ROOT_ID,
|
|
183
203
|
className: ax(["_1reo1wug _18m91wug _4t3i1kxc _1bsbauwl"])
|
|
184
204
|
}, /*#__PURE__*/React.createElement(DocumentViewer, {
|
|
185
205
|
getContent: getContent,
|
|
186
206
|
getPageImageUrl: getPageImageUrl,
|
|
187
207
|
zoom: state.zoomLevel.value,
|
|
188
|
-
onSuccess:
|
|
208
|
+
onSuccess: onSuccessHandler
|
|
189
209
|
}), /*#__PURE__*/React.createElement(ZoomControls, {
|
|
190
210
|
onChange: onZoomChange,
|
|
191
211
|
zoomLevel: state.zoomLevel
|
|
192
|
-
}));
|
|
212
|
+
})));
|
|
193
213
|
};
|
|
194
214
|
export default DocViewer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ErrorFileState, type FileState } from '@atlaskit/media-client';
|
|
3
|
-
import { MediaViewerError } from '../../../errors';
|
|
3
|
+
import { type MediaViewerError } from '../../../errors';
|
|
4
4
|
export type Props = {
|
|
5
5
|
item: Exclude<FileState, ErrorFileState>;
|
|
6
6
|
src: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
2
|
import { type ErrorFileState, type FileState } from '@atlaskit/media-client';
|
|
3
|
-
import { Outcome } from '../../domain';
|
|
3
|
+
import { type Outcome } from '../../domain';
|
|
4
4
|
import type { SupportedLanguages } from '@atlaskit/code/types';
|
|
5
|
-
import { MediaViewerError } from '../../errors';
|
|
5
|
+
import { type MediaViewerError } from '../../errors';
|
|
6
6
|
export declare const CodeViewWrapper: (props: {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
'data-testid': string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type MediaClient, type FileState } from '@atlaskit/media-client';
|
|
3
3
|
import { Outcome } from '../../domain';
|
|
4
|
-
import { MediaViewerError } from '../../errors';
|
|
4
|
+
import { type MediaViewerError } from '../../errors';
|
|
5
5
|
import { BaseViewer } from '../base-viewer';
|
|
6
6
|
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
7
7
|
import { ZoomLevel } from '../../domain/zoomLevel';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ErrorFileState, type FileState } from '@atlaskit/media-client';
|
|
3
|
-
import { MediaViewerError } from '../../../errors';
|
|
3
|
+
import { type MediaViewerError } from '../../../errors';
|
|
4
4
|
export type Props = {
|
|
5
5
|
item: Exclude<FileState, ErrorFileState>;
|
|
6
6
|
src: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
2
|
import { type ErrorFileState, type FileState } from '@atlaskit/media-client';
|
|
3
|
-
import { Outcome } from '../../domain';
|
|
3
|
+
import { type Outcome } from '../../domain';
|
|
4
4
|
import type { SupportedLanguages } from '@atlaskit/code/types';
|
|
5
|
-
import { MediaViewerError } from '../../errors';
|
|
5
|
+
import { type MediaViewerError } from '../../errors';
|
|
6
6
|
export declare const CodeViewWrapper: (props: {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
'data-testid': string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type MediaClient, type FileState } from '@atlaskit/media-client';
|
|
3
3
|
import { Outcome } from '../../domain';
|
|
4
|
-
import { MediaViewerError } from '../../errors';
|
|
4
|
+
import { type MediaViewerError } from '../../errors';
|
|
5
5
|
import { BaseViewer } from '../base-viewer';
|
|
6
6
|
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
7
7
|
import { ZoomLevel } from '../../domain/zoomLevel';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-viewer",
|
|
3
|
-
"version": "52.4.
|
|
3
|
+
"version": "52.4.6",
|
|
4
4
|
"description": "MediaViewer is Atlassian's powerful solution for viewing files on the web. It's both powerful and extendable yet easy-to-integrate",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/css": "^0.12.0",
|
|
42
42
|
"@atlaskit/form": "^12.0.0",
|
|
43
43
|
"@atlaskit/heading": "^5.2.0",
|
|
44
|
-
"@atlaskit/icon": "^27.
|
|
44
|
+
"@atlaskit/icon": "^27.3.0",
|
|
45
45
|
"@atlaskit/icon-file-type": "^7.0.0",
|
|
46
46
|
"@atlaskit/icon-lab": "^5.1.0",
|
|
47
47
|
"@atlaskit/media-client": "^35.0.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/side-navigation": "^11.0.0",
|
|
57
57
|
"@atlaskit/spinner": "^18.0.0",
|
|
58
58
|
"@atlaskit/textfield": "^8.0.0",
|
|
59
|
-
"@atlaskit/theme": "^
|
|
59
|
+
"@atlaskit/theme": "^19.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^5.4.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.3.0",
|
|
62
62
|
"@atlaskit/ufo": "^0.4.0",
|