@atlaskit/media-viewer 54.11.11 → 54.11.13
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 +26 -0
- package/dist/cjs/analytics/fireAnalytics.js +4 -3
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/inset-sidebar-header.js +0 -1
- package/dist/cjs/list.js +2 -2
- package/dist/cjs/styleWrappers.compiled.css +2 -0
- package/dist/cjs/styleWrappers.js +32 -17
- package/dist/cjs/utils/fit-viewport.js +91 -4
- package/dist/cjs/utils/getMediaTypeFromFilename.js +2 -2
- package/dist/cjs/viewers/archiveSidebar/archive-sidebar-folder-entry.js +4 -4
- package/dist/cjs/viewers/audio.js +2 -2
- package/dist/cjs/viewers/base-viewer.js +2 -2
- package/dist/cjs/viewers/codeViewer/index.js +2 -1
- package/dist/cjs/viewers/doc/DocViewer.js +8 -8
- package/dist/cjs/viewers/image/index.js +2 -2
- package/dist/cjs/viewers/image/interactive-img-component.js +80 -10
- package/dist/cjs/viewers/image/interactive-img.js +2 -2
- package/dist/cjs/viewers/svg/ImageWrapper-compiled.compiled.css +4 -0
- package/dist/cjs/viewers/svg/ImageWrapper-compiled.js +4 -1
- package/dist/cjs/viewers/svg/index.js +110 -19
- package/dist/cjs/viewers/video.js +5 -3
- package/dist/es2019/analytics/fireAnalytics.js +2 -1
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/buildVideoErrorDiagnostics.js +0 -1
- package/dist/es2019/inset-sidebar-header.js +0 -1
- package/dist/es2019/list.js +1 -1
- package/dist/es2019/styleWrappers.compiled.css +2 -0
- package/dist/es2019/styleWrappers.js +25 -16
- package/dist/es2019/utils/fit-viewport.js +86 -4
- package/dist/es2019/utils/getMediaTypeFromFilename.js +1 -1
- package/dist/es2019/viewers/archiveSidebar/archive-sidebar-folder-entry.js +2 -2
- package/dist/es2019/viewers/audio.js +1 -1
- package/dist/es2019/viewers/base-viewer.js +1 -1
- package/dist/es2019/viewers/codeViewer/index.js +2 -1
- package/dist/es2019/viewers/doc/DocViewer.js +2 -2
- package/dist/es2019/viewers/image/index.js +1 -1
- package/dist/es2019/viewers/image/interactive-img-component.js +84 -10
- package/dist/es2019/viewers/image/interactive-img.js +1 -1
- package/dist/es2019/viewers/svg/ImageWrapper-compiled.compiled.css +4 -0
- package/dist/es2019/viewers/svg/ImageWrapper-compiled.js +4 -1
- package/dist/es2019/viewers/svg/index.js +104 -17
- package/dist/es2019/viewers/video.js +3 -1
- package/dist/esm/analytics/fireAnalytics.js +2 -1
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/buildVideoErrorDiagnostics.js +0 -1
- package/dist/esm/inset-sidebar-header.js +0 -1
- package/dist/esm/list.js +1 -1
- package/dist/esm/styleWrappers.compiled.css +2 -0
- package/dist/esm/styleWrappers.js +31 -16
- package/dist/esm/utils/fit-viewport.js +90 -4
- package/dist/esm/utils/getMediaTypeFromFilename.js +1 -1
- package/dist/esm/viewers/archiveSidebar/archive-sidebar-folder-entry.js +2 -2
- package/dist/esm/viewers/audio.js +1 -1
- package/dist/esm/viewers/base-viewer.js +1 -1
- package/dist/esm/viewers/codeViewer/index.js +2 -1
- package/dist/esm/viewers/doc/DocViewer.js +2 -2
- package/dist/esm/viewers/image/index.js +1 -1
- package/dist/esm/viewers/image/interactive-img-component.js +80 -10
- package/dist/esm/viewers/image/interactive-img.js +1 -1
- package/dist/esm/viewers/svg/ImageWrapper-compiled.compiled.css +4 -0
- package/dist/esm/viewers/svg/ImageWrapper-compiled.js +4 -1
- package/dist/esm/viewers/svg/index.js +109 -18
- package/dist/esm/viewers/video.js +3 -1
- package/dist/types/DownloadItemProps.d.ts +3 -2
- package/dist/types/ErrorViewDownloadButton.d.ts +3 -2
- package/dist/types/ToolbarDownloadButton.d.ts +4 -2
- package/dist/types/analytics/events/operational/_mediaFile.d.ts +1 -1
- package/dist/types/analytics/events/operational/commenced.d.ts +1 -1
- package/dist/types/analytics/events/operational/createDownloadFailedEventPayload.d.ts +2 -2
- package/dist/types/analytics/events/operational/createDownloadSucceededEventPayload.d.ts +2 -2
- package/dist/types/analytics/events/operational/download.d.ts +1 -1
- package/dist/types/analytics/events/operational/loadFailed.d.ts +2 -2
- package/dist/types/analytics/events/operational/loadSucceeded.d.ts +1 -1
- package/dist/types/analytics/events/operational/previewTooLarge.d.ts +2 -2
- package/dist/types/analytics/events/operational/previewUnsupported.d.ts +2 -2
- package/dist/types/analytics/events/operational/zipEntryLoadFailed.d.ts +1 -1
- package/dist/types/analytics/events/operational/zipEntryLoadSucceeded.d.ts +2 -2
- package/dist/types/analytics/events/screen/modal.d.ts +1 -1
- package/dist/types/analytics/events/screen/passwordPdf.d.ts +1 -1
- package/dist/types/analytics/events/screen/pdfPasswordInput.d.ts +1 -1
- package/dist/types/analytics/events/ui/_clickedButton.d.ts +1 -1
- package/dist/types/analytics/events/ui/closed.d.ts +1 -1
- package/dist/types/analytics/events/ui/createNavigatedEvent.d.ts +1 -1
- package/dist/types/analytics/events/ui/downloadButtonClicked.d.ts +3 -2
- package/dist/types/analytics/events/ui/failedPreviewDownloadButtonClicked.d.ts +3 -2
- package/dist/types/analytics/events/ui/navigated.d.ts +1 -1
- package/dist/types/analytics/getFileAttributes.d.ts +2 -2
- package/dist/types/analytics/index.d.ts +2 -2
- package/dist/types/analytics/ufoExperiences.d.ts +2 -2
- package/dist/types/buildImgErrorDiagnostics.d.ts +1 -1
- package/dist/types/buildVideoErrorDiagnostics.d.ts +1 -1
- package/dist/types/components/types.d.ts +3 -2
- package/dist/types/errorMessage.d.ts +2 -2
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/getRequestMetadata.d.ts +1 -1
- package/dist/types/header.d.ts +3 -2
- package/dist/types/isFileStateItem.d.ts +1 -1
- package/dist/types/item-viewer.d.ts +4 -2
- package/dist/types/list.d.ts +2 -2
- package/dist/types/media-viewer.d.ts +2 -2
- package/dist/types/navigation.d.ts +1 -1
- package/dist/types/styleWrappers.d.ts +5 -6
- package/dist/types/utils/fit-viewport.d.ts +31 -0
- package/dist/types/utils/getIdentifierCollection.d.ts +1 -1
- package/dist/types/utils/getMediaTypeFromFilename.d.ts +1 -1
- package/dist/types/utils/getObjectUrlFromFileState.d.ts +1 -1
- package/dist/types/utils/getSelectedIndex.d.ts +1 -1
- package/dist/types/utils/isSameIdentifier.d.ts +1 -1
- package/dist/types/viewerOptions.d.ts +1 -1
- package/dist/types/viewers/archiveSidebar/archive-sidebar-folder-entry.d.ts +1 -1
- package/dist/types/viewers/archiveSidebar/archive-sidebar-renderer.d.ts +2 -1
- package/dist/types/viewers/archiveSidebar/archive-sidebar.d.ts +1 -1
- package/dist/types/viewers/archiveSidebar/get-archive-entries-from-file-state.d.ts +2 -1
- package/dist/types/viewers/archiveSidebar/types.d.ts +3 -2
- package/dist/types/viewers/audio.d.ts +3 -2
- package/dist/types/viewers/base-viewer.d.ts +3 -2
- package/dist/types/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.d.ts +1 -1
- package/dist/types/viewers/codeViewer/codeViewerRenderer-compiled.d.ts +1 -1
- package/dist/types/viewers/codeViewer/codeViewerRenderer.d.ts +1 -1
- package/dist/types/viewers/codeViewer/index.d.ts +3 -2
- package/dist/types/viewers/customViewer/customViewer.d.ts +3 -1
- package/dist/types/viewers/doc/DocViewer.d.ts +3 -2
- package/dist/types/viewers/doc/index.d.ts +3 -2
- package/dist/types/viewers/image/index.d.ts +3 -2
- package/dist/types/viewers/image/interactive-img-component.d.ts +9 -0
- package/dist/types/viewers/svg/index.d.ts +2 -2
- package/dist/types/viewers/video.d.ts +4 -2
- package/example-helpers/MainWrapper.tsx +1 -1
- package/example-helpers/NativeMediaPreview.tsx +3 -1
- package/example-helpers/index.ts +2 -2
- package/example-helpers/svg/delayApiResponses.ts +2 -2
- package/example-helpers/svg/uploader.ts +2 -2
- package/example-helpers/svg/useSelectOptions.ts +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useCallback, useLayoutEffect } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
4
|
-
import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
|
|
4
|
+
import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common/constants';
|
|
5
5
|
import MediaSvg from '@atlaskit/media-svg/media-svg';
|
|
6
6
|
import { Camera } from '@atlaskit/media-ui/camera/camera';
|
|
7
7
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
@@ -11,6 +11,7 @@ import { ZoomLevel } from '../../domain/zoomLevel';
|
|
|
11
11
|
import { useIsInsetViewer } from '../../insetViewerContext';
|
|
12
12
|
import { MediaViewerError } from '../../MediaViewerError';
|
|
13
13
|
import { BaselineExtend } from '../../styleWrappers';
|
|
14
|
+
import { refitViewport, insetFittedViewport, isUserScroll, readWrapperScroll, readWrapperSize, readViewportCenterOnMedia } from '../../utils/fit-viewport';
|
|
14
15
|
import { ZoomControls } from '../../zoomControls';
|
|
15
16
|
import { clientRectangle } from './clientRectangle';
|
|
16
17
|
import { getErrorReason } from './errors';
|
|
@@ -29,19 +30,46 @@ const SvgViewerBase = ({
|
|
|
29
30
|
const [cursorPos, setCursorPos] = useState(new Vector2(0, 0));
|
|
30
31
|
const [camera, setCamera] = useState();
|
|
31
32
|
const wrapperRef = useRef(null);
|
|
33
|
+
const imageRef = useRef(null);
|
|
34
|
+
const savedViewportCenterRef = useRef(undefined);
|
|
35
|
+
// The wrapper scroll position the saved center was read at or restored to.
|
|
36
|
+
const savedViewportCenterScrollRef = useRef(undefined);
|
|
37
|
+
// The wrapper size the last load or resize was handled at.
|
|
38
|
+
const fittedWrapperSizeRef = useRef(undefined);
|
|
32
39
|
const [wrapperScroll, setWrapperScroll] = useState();
|
|
33
40
|
const intl = useIntl();
|
|
34
41
|
const isInsetViewer = useIsInsetViewer();
|
|
42
|
+
const captureViewportCenterOnMedia = (wrapper, image) => {
|
|
43
|
+
savedViewportCenterRef.current = readViewportCenterOnMedia(wrapper, image);
|
|
44
|
+
savedViewportCenterScrollRef.current = readWrapperScroll(wrapper);
|
|
45
|
+
};
|
|
35
46
|
const onResize = useCallback(() => {
|
|
36
47
|
if (!wrapperRef.current || !camera) {
|
|
37
48
|
return;
|
|
38
49
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
if (!isInsetViewer) {
|
|
51
|
+
const newViewport = clientRectangle(wrapperRef.current);
|
|
52
|
+
const newCamera = camera.resizedViewport(newViewport);
|
|
53
|
+
const newZoomLevel = zoomLevelAfterResize(newCamera, camera, zoomLevel);
|
|
54
|
+
setCamera(newCamera);
|
|
55
|
+
setZoomLevel(newZoomLevel);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
fittedWrapperSizeRef.current = readWrapperSize(wrapperRef.current);
|
|
59
|
+
const refit = refitViewport({
|
|
60
|
+
wrapper: wrapperRef.current,
|
|
61
|
+
media: imageRef.current,
|
|
62
|
+
camera,
|
|
63
|
+
zoomLevel,
|
|
64
|
+
savedViewportCenter: savedViewportCenterRef.current
|
|
65
|
+
});
|
|
66
|
+
if (!refit) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
savedViewportCenterScrollRef.current = readWrapperScroll(wrapperRef.current);
|
|
70
|
+
setCamera(refit.camera);
|
|
71
|
+
setZoomLevel(refit.zoomLevel);
|
|
72
|
+
}, [isInsetViewer, camera, zoomLevel]);
|
|
45
73
|
const panImage = useCallback(ev => {
|
|
46
74
|
if (isDragging && wrapperRef.current) {
|
|
47
75
|
const newCursorPos = new Vector2(ev.screenX, ev.screenY);
|
|
@@ -49,28 +77,68 @@ const SvgViewerBase = ({
|
|
|
49
77
|
setCursorPos(newCursorPos);
|
|
50
78
|
wrapperRef.current.scrollLeft += delta.x;
|
|
51
79
|
wrapperRef.current.scrollTop += delta.y;
|
|
80
|
+
if (isInsetViewer && imageRef.current) {
|
|
81
|
+
captureViewportCenterOnMedia(wrapperRef.current, imageRef.current);
|
|
82
|
+
}
|
|
52
83
|
}
|
|
53
|
-
}, [cursorPos, isDragging]);
|
|
84
|
+
}, [cursorPos, isDragging, isInsetViewer]);
|
|
54
85
|
const stopDragging = useCallback(ev => {
|
|
55
86
|
ev.preventDefault();
|
|
56
87
|
setIsDragging(false);
|
|
57
88
|
}, []);
|
|
58
89
|
useEffect(() => {
|
|
59
|
-
|
|
90
|
+
const shouldListenForWindowResize = !isInsetViewer || typeof ResizeObserver === 'undefined';
|
|
91
|
+
if (shouldListenForWindowResize) {
|
|
92
|
+
window.addEventListener('resize', onResize);
|
|
93
|
+
}
|
|
60
94
|
document.addEventListener('mousemove', panImage);
|
|
61
95
|
document.addEventListener('mouseup', stopDragging);
|
|
62
96
|
return () => {
|
|
63
|
-
|
|
97
|
+
if (shouldListenForWindowResize) {
|
|
98
|
+
window.removeEventListener('resize', onResize);
|
|
99
|
+
}
|
|
64
100
|
document.removeEventListener('mousemove', panImage);
|
|
65
101
|
document.removeEventListener('mouseup', stopDragging);
|
|
66
102
|
};
|
|
67
|
-
}, [onResize, panImage, stopDragging]);
|
|
103
|
+
}, [isInsetViewer, onResize, panImage, stopDragging]);
|
|
104
|
+
|
|
105
|
+
// The observer calls the latest `onResize` through a ref, so it isn't recreated every time the
|
|
106
|
+
// media is zoomed.
|
|
107
|
+
const onResizeRef = useRef(onResize);
|
|
108
|
+
useLayoutEffect(() => {
|
|
109
|
+
onResizeRef.current = onResize;
|
|
110
|
+
}, [onResize]);
|
|
111
|
+
|
|
112
|
+
// Inset only: observes the wrapper's size, and saves the center after the user scrolls it natively
|
|
113
|
+
// (wheel, trackpad, scrollbar, keyboard or touch), which doesn't go through the zoom or drag handlers.
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
const wrapper = wrapperRef.current;
|
|
116
|
+
if (!wrapper || !isInsetViewer) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const onWrapperScroll = () => {
|
|
120
|
+
if (!imageRef.current || !isUserScroll(wrapper, fittedWrapperSizeRef.current, savedViewportCenterScrollRef.current)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
captureViewportCenterOnMedia(wrapper, imageRef.current);
|
|
124
|
+
};
|
|
125
|
+
wrapper.addEventListener('scroll', onWrapperScroll);
|
|
126
|
+
const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(() => onResizeRef.current());
|
|
127
|
+
observer === null || observer === void 0 ? void 0 : observer.observe(wrapper);
|
|
128
|
+
return () => {
|
|
129
|
+
wrapper.removeEventListener('scroll', onWrapperScroll);
|
|
130
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
131
|
+
};
|
|
132
|
+
}, [isInsetViewer]);
|
|
68
133
|
const onSvgLoad = ev => {
|
|
69
134
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
|
70
135
|
if (!wrapperRef.current) {
|
|
71
136
|
return;
|
|
72
137
|
}
|
|
73
|
-
const viewport = clientRectangle(wrapperRef.current);
|
|
138
|
+
const viewport = isInsetViewer ? insetFittedViewport(wrapperRef.current) : clientRectangle(wrapperRef.current);
|
|
139
|
+
if (isInsetViewer) {
|
|
140
|
+
fittedWrapperSizeRef.current = readWrapperSize(wrapperRef.current);
|
|
141
|
+
}
|
|
74
142
|
const originalImgRect = naturalSizeRectangle(ev.currentTarget);
|
|
75
143
|
const newCamera = new Camera(viewport, originalImgRect);
|
|
76
144
|
const newZoomLevel = new ZoomLevel(newCamera.scaleDownToFit);
|
|
@@ -121,6 +189,14 @@ const SvgViewerBase = ({
|
|
|
121
189
|
scrollTop: y
|
|
122
190
|
});
|
|
123
191
|
};
|
|
192
|
+
|
|
193
|
+
// Fits to the camera's current viewport. A zoom level's initial value is the fit from when it was
|
|
194
|
+
// created, which is stale once the wrapper has resized while the media was zoomed.
|
|
195
|
+
const onResetZoom = () => {
|
|
196
|
+
if (camera) {
|
|
197
|
+
onZoomChange(new ZoomLevel(camera.scaleDownToFit));
|
|
198
|
+
}
|
|
199
|
+
};
|
|
124
200
|
useLayoutEffect(() => {
|
|
125
201
|
// Must scroll after the new zoom (onZoomChange) and before the repaint
|
|
126
202
|
const {
|
|
@@ -135,7 +211,10 @@ const SvgViewerBase = ({
|
|
|
135
211
|
} = wrapperScroll;
|
|
136
212
|
wrapper.scrollLeft = scrollLeft;
|
|
137
213
|
wrapper.scrollTop = scrollTop;
|
|
138
|
-
|
|
214
|
+
if (isInsetViewer && imageRef.current) {
|
|
215
|
+
captureViewportCenterOnMedia(wrapper, imageRef.current);
|
|
216
|
+
}
|
|
217
|
+
}, [isInsetViewer, wrapperScroll]);
|
|
139
218
|
|
|
140
219
|
// We use style attr instead of SC prop for perf reasons
|
|
141
220
|
// When image loads it does two things at the same time 1) it renders itself in the browser 2) triggers onLoad
|
|
@@ -151,14 +230,21 @@ const SvgViewerBase = ({
|
|
|
151
230
|
cursor: canDrag && isDragging ? 'grabbing' : canDrag ? 'grab' : 'initial',
|
|
152
231
|
display: 'inline-block',
|
|
153
232
|
verticalAlign: 'middle',
|
|
154
|
-
position: 'relative'
|
|
233
|
+
position: 'relative',
|
|
234
|
+
...(isInsetViewer && {
|
|
235
|
+
borderRadius: "var(--ds-radius-large, 8px)",
|
|
236
|
+
overflow: 'hidden'
|
|
237
|
+
})
|
|
155
238
|
};
|
|
156
239
|
const imgDimensions = camera === null || camera === void 0 ? void 0 : camera.scaledImg(zoomLevel.value);
|
|
157
240
|
return /*#__PURE__*/React.createElement(ImageWrapper, {
|
|
158
241
|
onClick: onSvgClicked,
|
|
159
|
-
ref: wrapperRef
|
|
160
|
-
|
|
242
|
+
ref: wrapperRef
|
|
243
|
+
// Prevents scrollbars while loading or fitted.
|
|
244
|
+
,
|
|
245
|
+
isHidden: isHidden || !!(isInsetViewer && camera && zoomLevel.value === camera.scaleDownToFit)
|
|
161
246
|
}, /*#__PURE__*/React.createElement(MediaSvg, {
|
|
247
|
+
ref: imageRef,
|
|
162
248
|
testId: 'media-viewer-svg',
|
|
163
249
|
alt: intl.formatMessage(messages.svg_base_alt),
|
|
164
250
|
identifier: identifier,
|
|
@@ -171,7 +257,8 @@ const SvgViewerBase = ({
|
|
|
171
257
|
onError: onSvgError
|
|
172
258
|
}), /*#__PURE__*/React.createElement(BaselineExtend, null), /*#__PURE__*/React.createElement(ZoomControls, {
|
|
173
259
|
zoomLevel: zoomLevel,
|
|
174
|
-
onChange: onZoomChange
|
|
260
|
+
onChange: onZoomChange,
|
|
261
|
+
onResetZoom: isInsetViewer ? onResetZoom : undefined
|
|
175
262
|
}));
|
|
176
263
|
};
|
|
177
264
|
export const SvgViewer = withAnalyticsEvents({
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
4
|
+
import { getArtifactUrl } from '@atlaskit/media-client/artifacts';
|
|
5
|
+
import { globalMediaEventEmitter } from '@atlaskit/media-client/global-media-event-emitter';
|
|
4
6
|
import { Camera } from '@atlaskit/media-ui/camera/camera';
|
|
5
7
|
import { CustomMediaPlayer } from '@atlaskit/media-ui/customMediaPlayer';
|
|
6
8
|
import { InsetViewerProvider } from '@atlaskit/media-ui/insetViewerProvider';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ANALYTICS_MEDIA_CHANNEL
|
|
1
|
+
import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common/constants';
|
|
2
|
+
import { sanitiseAnalyticsPayload } from '@atlaskit/media-common/sanitisePayload';
|
|
2
3
|
export function fireAnalytics(payload, createAnalyticsEvent) {
|
|
3
4
|
if (createAnalyticsEvent) {
|
|
4
5
|
var ev = createAnalyticsEvent(sanitiseAnalyticsPayload(payload));
|
|
@@ -7,7 +7,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
7
7
|
import { UFOExperience } from '@atlaskit/ufo/experience';
|
|
8
8
|
import { ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo/experience-types';
|
|
9
9
|
var packageName = "@atlaskit/media-viewer";
|
|
10
|
-
var packageVersion = "54.11.
|
|
10
|
+
var packageVersion = "54.11.12";
|
|
11
11
|
var ufoExperience;
|
|
12
12
|
var getExperience = function getExperience() {
|
|
13
13
|
if (!ufoExperience) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { isErrorFileState } from '@atlaskit/media-client';
|
|
3
3
|
import { isVideoMimeTypeSupportedByBrowser } from '@atlaskit/media-common/isMimeTypeSupportedByBrowser';
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Human-readable names for the four standard `MediaError.code` values, so the
|
|
7
6
|
* downstream analytics `error`/`errorDetail` report a meaningful cause instead of
|
|
@@ -87,7 +87,6 @@ export var InsetSidebarHeader = function InsetSidebarHeader(_ref3) {
|
|
|
87
87
|
testId: "media-viewer-sidebar-button",
|
|
88
88
|
onClick: onHideSidebar,
|
|
89
89
|
buttonRef: hideSidebarButtonRef,
|
|
90
|
-
isSelected: true,
|
|
91
90
|
icon: PanelRightIcon,
|
|
92
91
|
label: label || formatMessage(messages.hide_sidebar)
|
|
93
92
|
}), /*#__PURE__*/React.createElement(ViewerIconButton, {
|
package/dist/esm/list.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useState, useRef } from 'react';
|
|
3
|
-
import { getRandomTelemetryId } from '@atlaskit/media-common';
|
|
3
|
+
import { getRandomTelemetryId } from '@atlaskit/media-common/helpers';
|
|
4
4
|
import { hideControlsClassName } from '@atlaskit/media-ui/classNames';
|
|
5
5
|
import Header from './headerWithIntl';
|
|
6
6
|
import { useIsInsetViewer } from './insetViewerContext';
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
._18m91wug{overflow-y:auto}
|
|
23
23
|
._18m9ewfl{overflow-y:visible}
|
|
24
24
|
._18u01wug{margin-left:auto}
|
|
25
|
+
._19bv15ne{padding-left:var(--_1spe40c)}
|
|
25
26
|
._19bv1ejb{padding-left:var(--ds-space-300,24px)}
|
|
26
27
|
._19bv1mjv{padding-left:300px}
|
|
27
28
|
._19bvidpf{padding-left:0}
|
|
@@ -155,6 +156,7 @@
|
|
|
155
156
|
._t6vde4h9{border-left-width:var(--ds-border-width,1px)}
|
|
156
157
|
._t9ec1i34{transform:translateY(-50%)}
|
|
157
158
|
._tzy41w01{opacity:.85}
|
|
159
|
+
._u5f315ne{padding-right:var(--_1spe40c)}
|
|
158
160
|
._u5f31ejb{padding-right:var(--ds-space-300,24px)}
|
|
159
161
|
._u5f3idpf{padding-right:0}
|
|
160
162
|
._u5f3v47k{padding-right:var(--ds-space-250,20px)}
|
|
@@ -14,15 +14,17 @@ import { forwardRef, useMemo } from 'react';
|
|
|
14
14
|
import { TouchScrollable } from 'react-scrolllock';
|
|
15
15
|
import { useMergeRefs } from 'use-callback-ref';
|
|
16
16
|
import Heading from '@atlaskit/heading/heading';
|
|
17
|
-
import Motion from '@atlaskit/motion/entering/motion';
|
|
18
17
|
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
18
|
+
import SlideIn from '@atlaskit/motion/slide-in';
|
|
19
19
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
20
20
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
21
21
|
import { useHasMediaFooterVideoControls, useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
|
|
22
22
|
var INSET_HEADER_HEIGHT = "var(--ds-space-800, 64px)";
|
|
23
|
+
// The horizontal gutter of the inset header, footer and fitted media, shared so they can't drift.
|
|
24
|
+
// It is `space.300` at the default root font size, hard-coded because the fit maths needs a number
|
|
25
|
+
// and resolving the token would mean reading the DOM on every resize.
|
|
26
|
+
export var INSET_VIEWER_GUTTER_PX = 24;
|
|
23
27
|
var INSET_SIDEBAR_WIDTH = '400px';
|
|
24
|
-
|
|
25
|
-
// Uses the same timing as the content's `motion.panel.enter`/`exit` slide, so they move together.
|
|
26
28
|
var insetSidebarWidthTransitionStyles = null;
|
|
27
29
|
var insetSidebarSlotStyles = null;
|
|
28
30
|
var insetSidebarSlotOpenStyles = null;
|
|
@@ -82,8 +84,11 @@ var insetViewerHeaderStyles = null;
|
|
|
82
84
|
var headerStyleWithSideBar = null;
|
|
83
85
|
var leftHeaderStyles = null;
|
|
84
86
|
var imageWrapperStyles = null;
|
|
87
|
+
var insetViewerImageWrapperStyles = null;
|
|
88
|
+
var preventScrollbarsStyles = null;
|
|
85
89
|
var baselineExtendStyles = null;
|
|
86
90
|
var imgStyles = null;
|
|
91
|
+
var insetViewerImgStyles = null;
|
|
87
92
|
var pixelatedImgStyles = null;
|
|
88
93
|
var medatadataTextWrapperStyles = null;
|
|
89
94
|
var metadataWrapperStyles = null;
|
|
@@ -153,7 +158,7 @@ export var InsetViewerLayout = function InsetViewerLayout(_ref4) {
|
|
|
153
158
|
}, children);
|
|
154
159
|
};
|
|
155
160
|
// The sidebar's header row and body open and close as one element, so they share one width
|
|
156
|
-
// animation and one
|
|
161
|
+
// animation and one slide.
|
|
157
162
|
export var SidebarColumn = function SidebarColumn(_ref5) {
|
|
158
163
|
var children = _ref5.children,
|
|
159
164
|
isOpen = _ref5.isOpen;
|
|
@@ -161,12 +166,13 @@ export var SidebarColumn = function SidebarColumn(_ref5) {
|
|
|
161
166
|
"aria-hidden": !isOpen,
|
|
162
167
|
"data-testid": "media-viewer-sidebar-column",
|
|
163
168
|
className: ax(["_1reo15vq _18m915vq _1e0c1txw _1bahesu3 _1bsbze3t _1ul9idpf _vchhusvi", "_yyhycs5v _1ii7kb7n _1tkeidpf _4t3i1osq", "_k8m01ea5 _6fl4v1ec _156y147i", isOpen && "_1bsb1kdj _1oec1mzy", !isOpen && "_lcxvglyw _1oeci9qs"])
|
|
164
|
-
}, /*#__PURE__*/React.createElement(ExitingPersistence, null, isOpen ? /*#__PURE__*/React.createElement(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
}, /*#__PURE__*/React.createElement(ExitingPersistence, null, isOpen ? /*#__PURE__*/React.createElement(SlideIn, {
|
|
170
|
+
enterFrom: "right"
|
|
171
|
+
}, function (slideInProps) {
|
|
172
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, slideInProps, {
|
|
173
|
+
className: ax(["_1bsb1kdj _1ul91kdj _4t3i1osq _1tkeidpf _1e0c1txw _2lx21bp4 _vchhusvi"])
|
|
174
|
+
}), children);
|
|
175
|
+
}) : null));
|
|
170
176
|
};
|
|
171
177
|
export var InsetSidebarHeaderRow = function InsetSidebarHeaderRow(_ref6) {
|
|
172
178
|
var children = _ref6.children,
|
|
@@ -190,7 +196,10 @@ export var HeaderWrapper = function HeaderWrapper(_ref7) {
|
|
|
190
196
|
var isInsetViewer = useIsInsetViewer();
|
|
191
197
|
return /*#__PURE__*/React.createElement("div", {
|
|
192
198
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
193
|
-
className: ax([!isInsetViewer && "_11q75a80 _kqswstnw _154iidpf _1ltvidpf _1bsb1osq _4t3i1uc6 _tzy41w01 _ouxlidpf _syaz1poe _k48p1wq8 _ca0q1ejb _n3td1ejb _19bv1ejb _u5f31ejb _vchhusvi _lcxvglyw _1pby3tda", !isInsetViewer && isArchiveSideBarVisible && "_ouxl1klg", isInsetViewer && "_kqswh2mm _1bsb1osq _4t3ixncg _1o9zidpf _syazi7uo _lcxvglyw _1pbykb7n _1e0c1txw _4cvr1h6o _ca0qpxbi
|
|
199
|
+
className: ax([!isInsetViewer && "_11q75a80 _kqswstnw _154iidpf _1ltvidpf _1bsb1osq _4t3i1uc6 _tzy41w01 _ouxlidpf _syaz1poe _k48p1wq8 _ca0q1ejb _n3td1ejb _19bv1ejb _u5f31ejb _vchhusvi _lcxvglyw _1pby3tda", !isInsetViewer && isArchiveSideBarVisible && "_ouxl1klg", isInsetViewer && "_kqswh2mm _1bsb1osq _4t3ixncg _1o9zidpf _syazi7uo _lcxvglyw _1pbykb7n _1e0c1txw _4cvr1h6o _ca0qpxbi _u5f315ne _n3tdpxbi _19bv15ne _vchhusvi", className]),
|
|
200
|
+
style: {
|
|
201
|
+
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px"))
|
|
202
|
+
}
|
|
194
203
|
}, children);
|
|
195
204
|
};
|
|
196
205
|
HeaderWrapper.displayName = 'HeaderWrapper';
|
|
@@ -212,8 +221,9 @@ export var MediaFooterBar = function MediaFooterBar() {
|
|
|
212
221
|
return /*#__PURE__*/React.createElement("div", {
|
|
213
222
|
ref: setMediaFooterControls,
|
|
214
223
|
"data-testid": "media-viewer-media-footer",
|
|
215
|
-
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi
|
|
224
|
+
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f315ne _n3tdpxbi _19bv15ne _kqswh2mm _lcxv1rj4", hasVideoControls && "_4t3i11a6 _ca0qv47k"]),
|
|
216
225
|
style: {
|
|
226
|
+
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px")),
|
|
217
227
|
"--_1goz90u": ix("calc(".concat(INSET_HEADER_HEIGHT, " + ", "var(--ds-space-050, 4px)", ")"))
|
|
218
228
|
}
|
|
219
229
|
});
|
|
@@ -384,9 +394,11 @@ export var LeftHeader = function LeftHeader(_ref26) {
|
|
|
384
394
|
export var ImageWrapper = /*#__PURE__*/forwardRef(function (_ref27, ref) {
|
|
385
395
|
var children = _ref27.children,
|
|
386
396
|
datatestId = _ref27['data-testid'],
|
|
397
|
+
preventScrollbars = _ref27.preventScrollbars,
|
|
387
398
|
onClick = _ref27.onClick,
|
|
388
399
|
style = _ref27.style,
|
|
389
400
|
className = _ref27.className;
|
|
401
|
+
var isInsetViewer = useIsInsetViewer();
|
|
390
402
|
return /*#__PURE__*/React.createElement("div", {
|
|
391
403
|
role: "none",
|
|
392
404
|
"data-testid": datatestId,
|
|
@@ -396,7 +408,7 @@ export var ImageWrapper = /*#__PURE__*/forwardRef(function (_ref27, ref) {
|
|
|
396
408
|
style: style
|
|
397
409
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
398
410
|
,
|
|
399
|
-
className: ax(["_1reo1wug _18m91wug _1bsbauwl _4t3i1kxc _y3gn1h6o _s7n4nkob _o5721q9c", className])
|
|
411
|
+
className: ax(["_1reo1wug _18m91wug _1bsbauwl _4t3i1kxc _y3gn1h6o _s7n4nkob _o5721q9c", isInsetViewer && "_1bsb1osq _4t3i1osq _p12f1osq _c71l1osq", preventScrollbars && "_1reo15vq _18m915vq", className])
|
|
400
412
|
}, children);
|
|
401
413
|
});
|
|
402
414
|
export var BaselineExtend = function BaselineExtend() {
|
|
@@ -404,7 +416,7 @@ export var BaselineExtend = function BaselineExtend() {
|
|
|
404
416
|
className: ax(["_4t3i1osq _1e0c1o8l _s7n4nkob"])
|
|
405
417
|
});
|
|
406
418
|
};
|
|
407
|
-
export var Img = function
|
|
419
|
+
export var Img = /*#__PURE__*/forwardRef(function (_ref28, ref) {
|
|
408
420
|
var canDrag = _ref28.canDrag,
|
|
409
421
|
isDragging = _ref28.isDragging,
|
|
410
422
|
shouldPixelate = _ref28.shouldPixelate,
|
|
@@ -416,6 +428,7 @@ export var Img = function Img(_ref28) {
|
|
|
416
428
|
alt = _ref28.alt,
|
|
417
429
|
className = _ref28.className,
|
|
418
430
|
rest = _objectWithoutProperties(_ref28, _excluded);
|
|
431
|
+
var isInsetViewer = useIsInsetViewer();
|
|
419
432
|
var cursor = useMemo(function () {
|
|
420
433
|
if (canDrag && isDragging) {
|
|
421
434
|
return 'grabbing';
|
|
@@ -426,8 +439,10 @@ export var Img = function Img(_ref28) {
|
|
|
426
439
|
}
|
|
427
440
|
}, [canDrag, isDragging]);
|
|
428
441
|
return /*#__PURE__*/React.createElement("img", _extends({}, rest, {
|
|
442
|
+
ref: ref
|
|
429
443
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
430
|
-
|
|
444
|
+
,
|
|
445
|
+
className: ax(["_1e0c1o8l _s7n4nkob _kqswh2mm", shouldPixelate && "_1kemd8h4", isInsetViewer && "_2rko1mok _1reo15vq _18m915vq", className]),
|
|
431
446
|
alt: alt,
|
|
432
447
|
"data-testid": datatestId,
|
|
433
448
|
src: src
|
|
@@ -439,7 +454,7 @@ export var Img = function Img(_ref28) {
|
|
|
439
454
|
onLoad: onLoad,
|
|
440
455
|
onError: onError
|
|
441
456
|
}));
|
|
442
|
-
};
|
|
457
|
+
});
|
|
443
458
|
export var MedatadataTextWrapper = function MedatadataTextWrapper(_ref29) {
|
|
444
459
|
var children = _ref29.children;
|
|
445
460
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,9 +1,95 @@
|
|
|
1
1
|
import { Rectangle } from '@atlaskit/media-ui/rectangle';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var INSET_VIEWER_FIT_GUTTER_PX = 24;
|
|
2
|
+
import { INSET_VIEWER_GUTTER_PX } from '../styleWrappers';
|
|
3
|
+
import { zoomLevelAfterResize } from '../viewers/image/zoom-level-after-resize';
|
|
5
4
|
export var insetFittedViewport = function insetFittedViewport(el) {
|
|
6
5
|
var clientWidth = el.clientWidth,
|
|
7
6
|
clientHeight = el.clientHeight;
|
|
8
|
-
return new Rectangle(Math.max(0, clientWidth -
|
|
7
|
+
return new Rectangle(Math.max(0, clientWidth - INSET_VIEWER_GUTTER_PX * 2), clientHeight);
|
|
8
|
+
};
|
|
9
|
+
export var readViewportCenterOnMedia = function readViewportCenterOnMedia(wrapper, media) {
|
|
10
|
+
var mediaRect = media.getBoundingClientRect();
|
|
11
|
+
if (mediaRect.width <= 0 || mediaRect.height <= 0) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
var viewportCenter = viewportClientCenter(wrapper);
|
|
15
|
+
return {
|
|
16
|
+
x: (viewportCenter.x - mediaRect.left) / mediaRect.width,
|
|
17
|
+
y: (viewportCenter.y - mediaRect.top) / mediaRect.height
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export var readWrapperSize = function readWrapperSize(wrapper) {
|
|
21
|
+
return {
|
|
22
|
+
width: wrapper.clientWidth,
|
|
23
|
+
height: wrapper.clientHeight
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export var readWrapperScroll = function readWrapperScroll(wrapper) {
|
|
27
|
+
return {
|
|
28
|
+
scrollLeft: wrapper.scrollLeft,
|
|
29
|
+
scrollTop: wrapper.scrollTop
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Scroll events don't say what scrolled the wrapper, so a scroll is the user's only when neither the
|
|
34
|
+
// browser nor the viewer did it. The browser moves the scroll position when the wrapper resizes, so
|
|
35
|
+
// the wrapper must still be the size the viewer last handled. The viewer's own scroll writes (zoom,
|
|
36
|
+
// drag and the center restore) land on the position its saved center belongs to, so the scroll
|
|
37
|
+
// must be somewhere else.
|
|
38
|
+
export var isUserScroll = function isUserScroll(wrapper, fittedSize, savedViewportCenterScroll) {
|
|
39
|
+
return !!fittedSize && wrapper.clientWidth === fittedSize.width && wrapper.clientHeight === fittedSize.height && !(savedViewportCenterScroll && wrapper.scrollLeft === savedViewportCenterScroll.scrollLeft && wrapper.scrollTop === savedViewportCenterScroll.scrollTop);
|
|
40
|
+
};
|
|
41
|
+
export var restoreViewportCenterOnMedia = function restoreViewportCenterOnMedia(wrapper, media, center) {
|
|
42
|
+
var mediaRect = media.getBoundingClientRect();
|
|
43
|
+
if (mediaRect.width <= 0 || mediaRect.height <= 0) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
var viewportCenter = viewportClientCenter(wrapper);
|
|
47
|
+
wrapper.scrollLeft = Math.round(wrapper.scrollLeft + (mediaRect.left + center.x * mediaRect.width - viewportCenter.x));
|
|
48
|
+
wrapper.scrollTop = Math.round(wrapper.scrollTop + (mediaRect.top + center.y * mediaRect.height - viewportCenter.y));
|
|
49
|
+
};
|
|
50
|
+
export var refitViewport = function refitViewport(_ref) {
|
|
51
|
+
var wrapper = _ref.wrapper,
|
|
52
|
+
media = _ref.media,
|
|
53
|
+
camera = _ref.camera,
|
|
54
|
+
zoomLevel = _ref.zoomLevel,
|
|
55
|
+
savedViewportCenter = _ref.savedViewportCenter;
|
|
56
|
+
var refit = calculateViewportRefit(camera, zoomLevel, insetFittedViewport(wrapper));
|
|
57
|
+
if (!refit) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Size the media for the new fit now. Waiting for the next render leaves it a frame behind the
|
|
62
|
+
// wrapper, and the center below is read from the media's layout.
|
|
63
|
+
if (media) {
|
|
64
|
+
var _refit$camera$scaledI = refit.camera.scaledImg(refit.zoomLevel.value),
|
|
65
|
+
width = _refit$camera$scaledI.width,
|
|
66
|
+
height = _refit$camera$scaledI.height;
|
|
67
|
+
media.style.width = "".concat(width, "px");
|
|
68
|
+
media.style.height = "".concat(height, "px");
|
|
69
|
+
}
|
|
70
|
+
var isZoomed = Number.isFinite(zoomLevel.value) && Number.isFinite(camera.scaleDownToFit) && zoomLevel.value !== camera.scaleDownToFit;
|
|
71
|
+
if (isZoomed && savedViewportCenter && media) {
|
|
72
|
+
restoreViewportCenterOnMedia(wrapper, media, savedViewportCenter);
|
|
73
|
+
}
|
|
74
|
+
return refit;
|
|
75
|
+
};
|
|
76
|
+
var viewportClientCenter = function viewportClientCenter(wrapper) {
|
|
77
|
+
var rect = wrapper.getBoundingClientRect();
|
|
78
|
+
return {
|
|
79
|
+
x: rect.left + wrapper.clientLeft + wrapper.clientWidth / 2,
|
|
80
|
+
y: rect.top + wrapper.clientTop + wrapper.clientHeight / 2
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var calculateViewportRefit = function calculateViewportRefit(camera, zoomLevel, nextViewport) {
|
|
84
|
+
if (nextViewport.width <= 0 || nextViewport.height <= 0) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
if (nextViewport.width === camera.viewport.width && nextViewport.height === camera.viewport.height) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
var resizedCamera = camera.resizedViewport(nextViewport);
|
|
91
|
+
return {
|
|
92
|
+
camera: resizedCamera,
|
|
93
|
+
zoomLevel: zoomLevelAfterResize(resizedCamera, camera, zoomLevel)
|
|
94
|
+
};
|
|
9
95
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getMediaTypeFromMimeType } from '@atlaskit/media-common';
|
|
1
|
+
import { getMediaTypeFromMimeType } from '@atlaskit/media-common/mediaTypeUtils';
|
|
2
2
|
import { getMimeTypeFromFilename } from './getMimeTypeFromFilename';
|
|
3
3
|
export var getMediaTypeFromFilename = function getMediaTypeFromFilename(filename) {
|
|
4
4
|
var mimeType = getMimeTypeFromFilename(filename);
|
|
@@ -11,8 +11,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { injectIntl } from 'react-intl';
|
|
13
13
|
import Folder24Icon from '@atlaskit/icon-file-type/glyph/folder/24';
|
|
14
|
-
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
15
|
-
import { downloadUrl } from '@atlaskit/media-common';
|
|
14
|
+
import { globalMediaEventEmitter } from '@atlaskit/media-client/global-media-event-emitter';
|
|
15
|
+
import { downloadUrl } from '@atlaskit/media-common/downloadUrl';
|
|
16
16
|
import { MediaTypeIcon } from '@atlaskit/media-ui/media-type-icon';
|
|
17
17
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -10,7 +10,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import AudioIcon from '@atlaskit/icon/core/audio';
|
|
13
|
-
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
13
|
+
import { globalMediaEventEmitter } from '@atlaskit/media-client/global-media-event-emitter';
|
|
14
14
|
import { CustomMediaPlayer } from '@atlaskit/media-ui/customMediaPlayer';
|
|
15
15
|
import { Outcome } from '../domain/outcome';
|
|
16
16
|
import { MediaViewerError } from '../MediaViewerError';
|
|
@@ -11,7 +11,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
11
11
|
import React, { Fragment } from 'react';
|
|
12
12
|
import deepEqual from 'deep-equal';
|
|
13
13
|
import { FormattedMessage } from 'react-intl';
|
|
14
|
-
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
14
|
+
import { globalMediaEventEmitter } from '@atlaskit/media-client/global-media-event-emitter';
|
|
15
15
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
16
16
|
import ErrorMessage from '../errorMessageWithAnalytics';
|
|
17
17
|
import { ErrorViewDownloadButton } from '../ErrorViewDownloadButton';
|
|
@@ -8,7 +8,8 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import { isErrorFileState
|
|
11
|
+
import { isErrorFileState } from '@atlaskit/media-client';
|
|
12
|
+
import { request } from '@atlaskit/media-client/request';
|
|
12
13
|
import { getExtension } from '@atlaskit/media-ui/getExtension';
|
|
13
14
|
import { getLanguageType } from '@atlaskit/media-ui/getLanguageType';
|
|
14
15
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -9,8 +9,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
9
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; }
|
|
10
10
|
import React, { useReducer } from 'react';
|
|
11
11
|
import { isCommonMediaClientError } from '@atlaskit/media-client';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { isExcelFile } from '@atlaskit/media-common/isExcelFile';
|
|
13
|
+
import { useStaticCallback } from '@atlaskit/media-common/useStaticCallback';
|
|
14
14
|
import { DocumentViewer } from '@atlaskit/media-document-viewer/document-viewer';
|
|
15
15
|
import { DOCUMENT_SCROLL_ROOT_ID } from '@atlaskit/media-document-viewer/get-document-root';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -10,7 +10,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { isImageRepresentationReady, isErrorFileState, addFileAttrsToUrl } from '@atlaskit/media-client';
|
|
13
|
-
import { isImageMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
13
|
+
import { isImageMimeTypeSupportedByBrowser } from '@atlaskit/media-common/isMimeTypeSupportedByBrowser';
|
|
14
14
|
import { getOrientation } from '@atlaskit/media-ui/imageMetaData/getOrientation';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
16
|
import { buildImgErrorDiagnostics } from '../../buildImgErrorDiagnostics';
|