@atlaskit/media-viewer 54.11.22 → 54.11.24
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 +31 -0
- package/dist/cjs/DownloadButton.js +14 -5
- package/dist/cjs/DownloadItem.js +3 -1
- package/dist/cjs/ErrorViewDownloadButton.js +3 -0
- package/dist/cjs/ToolbarDownloadButton.js +3 -0
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/errorMessage.compiled.css +1 -0
- package/dist/cjs/errorMessage.js +11 -7
- package/dist/cjs/errorMessageWithAnalytics.js +2 -1
- package/dist/cjs/insetViewerContext.js +15 -15
- package/dist/cjs/loading.js +7 -2
- package/dist/cjs/styleWrappers.compiled.css +5 -1
- package/dist/cjs/styleWrappers.js +48 -15
- package/dist/cjs/viewers/archiveSidebar/archive-viewer-base.js +1 -1
- package/dist/cjs/viewers/audio.js +68 -27
- package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
- package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +37 -9
- package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/theme.js +68 -53
- package/dist/cjs/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
- package/dist/cjs/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
- package/dist/cjs/viewers/codeViewer/CodeViewerFooter.js +41 -0
- package/dist/cjs/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
- package/dist/cjs/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
- package/dist/cjs/viewers/codeViewer/codeViewerRenderer-compiled.js +8 -1
- package/dist/cjs/viewers/doc/DocViewer.js +7 -2
- package/dist/cjs/viewers/doc/passwordInput.compiled.css +3 -1
- package/dist/cjs/viewers/doc/passwordInput.js +12 -4
- package/dist/cjs/viewers/video.js +6 -6
- package/dist/es2019/DownloadButton.js +12 -4
- package/dist/es2019/DownloadItem.js +3 -1
- package/dist/es2019/ErrorViewDownloadButton.js +3 -0
- package/dist/es2019/ToolbarDownloadButton.js +3 -0
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/errorMessage.compiled.css +1 -0
- package/dist/es2019/errorMessage.js +9 -5
- package/dist/es2019/errorMessageWithAnalytics.js +2 -1
- package/dist/es2019/insetViewerContext.js +11 -11
- package/dist/es2019/loading.js +7 -2
- package/dist/es2019/styleWrappers.compiled.css +4 -0
- package/dist/es2019/styleWrappers.js +59 -26
- package/dist/es2019/viewers/archiveSidebar/archive-viewer-base.js +2 -2
- package/dist/es2019/viewers/audio.js +52 -17
- package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
- package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +29 -9
- package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/theme.js +21 -5
- package/dist/es2019/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
- package/dist/es2019/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
- package/dist/es2019/viewers/codeViewer/CodeViewerFooter.js +33 -0
- package/dist/es2019/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
- package/dist/es2019/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
- package/dist/es2019/viewers/codeViewer/codeViewerRenderer-compiled.js +5 -1
- package/dist/es2019/viewers/doc/DocViewer.js +7 -2
- package/dist/es2019/viewers/doc/passwordInput.compiled.css +3 -1
- package/dist/es2019/viewers/doc/passwordInput.js +12 -4
- package/dist/es2019/viewers/video.js +7 -7
- package/dist/esm/DownloadButton.js +14 -5
- package/dist/esm/DownloadItem.js +3 -1
- package/dist/esm/ErrorViewDownloadButton.js +3 -0
- package/dist/esm/ToolbarDownloadButton.js +3 -0
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/errorMessage.compiled.css +1 -0
- package/dist/esm/errorMessage.js +11 -7
- package/dist/esm/errorMessageWithAnalytics.js +2 -1
- package/dist/esm/insetViewerContext.js +14 -14
- package/dist/esm/loading.js +7 -2
- package/dist/esm/styleWrappers.compiled.css +5 -1
- package/dist/esm/styleWrappers.js +48 -15
- package/dist/esm/viewers/archiveSidebar/archive-viewer-base.js +2 -2
- package/dist/esm/viewers/audio.js +69 -28
- package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
- package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +38 -11
- package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/theme.js +67 -52
- package/dist/esm/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
- package/dist/esm/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
- package/dist/esm/viewers/codeViewer/CodeViewerFooter.js +32 -0
- package/dist/esm/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
- package/dist/esm/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
- package/dist/esm/viewers/codeViewer/codeViewerRenderer-compiled.js +8 -1
- package/dist/esm/viewers/doc/DocViewer.js +7 -2
- package/dist/esm/viewers/doc/passwordInput.compiled.css +3 -1
- package/dist/esm/viewers/doc/passwordInput.js +12 -4
- package/dist/esm/viewers/video.js +7 -7
- package/dist/types/DownloadButton.d.ts +1 -1
- package/dist/types/DownloadButtonProps.d.ts +1 -0
- package/dist/types/DownloadItem.d.ts +1 -1
- package/dist/types/DownloadItemProps.d.ts +1 -0
- package/dist/types/errorMessage.d.ts +6 -1
- package/dist/types/insetViewerContext.d.ts +3 -3
- package/dist/types/styleWrappers.d.ts +2 -2
- package/dist/types/viewers/audio.d.ts +2 -16
- package/dist/types/viewers/codeViewer/CodeRendererAdvanced/theme.d.ts +1 -0
- package/dist/types/viewers/codeViewer/CodeViewerFooter.d.ts +7 -0
- package/dist/types/viewers/codeViewer/CodeViewerHeaderBar.d.ts +1 -1
- package/package.json +6 -5
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import AudioIcon from '@atlaskit/icon/core/audio';
|
|
4
|
+
import IconTile from '@atlaskit/icon/icon-tile';
|
|
4
5
|
import { globalMediaEventEmitter } from '@atlaskit/media-client/global-media-event-emitter';
|
|
5
6
|
import { CustomMediaPlayer } from '@atlaskit/media-ui/customMediaPlayer';
|
|
7
|
+
import { InsetViewerProvider } from '@atlaskit/media-ui/insetViewerProvider';
|
|
6
8
|
import { Outcome } from '../domain/outcome';
|
|
9
|
+
import { withInsetViewerFooter } from '../insetViewerContext';
|
|
7
10
|
import { MediaViewerError } from '../MediaViewerError';
|
|
8
|
-
import { AudioPlayer, AudioCover, Audio, DefaultCoverWrapper, CustomAudioPlayerWrapper } from '../styleWrappers';
|
|
11
|
+
import { AudioPlayer, AudioCover, Audio, DefaultCoverWrapper, CustomAudioPlayerWrapper, CustomMediaPlayerWrapper } from '../styleWrappers';
|
|
9
12
|
import { getObjectUrlFromFileState } from '../utils/getObjectUrlFromFileState';
|
|
10
13
|
import { isIE } from '../utils/isIE';
|
|
11
14
|
import { BaseViewer } from './base-viewer';
|
|
@@ -16,7 +19,7 @@ const defaultCover = /*#__PURE__*/React.createElement(DefaultCoverWrapper, null,
|
|
|
16
19
|
const getCoverUrl = (item, mediaClient, collectionName) => mediaClient.getImageUrl(item.id, {
|
|
17
20
|
collection: collectionName
|
|
18
21
|
});
|
|
19
|
-
|
|
22
|
+
class _AudioViewer extends BaseViewer {
|
|
20
23
|
constructor(...args) {
|
|
21
24
|
super(...args);
|
|
22
25
|
_defineProperty(this, "renderCover", () => {
|
|
@@ -31,6 +34,13 @@ export class AudioViewer extends BaseViewer {
|
|
|
31
34
|
src: coverUrl,
|
|
32
35
|
alt: item.name
|
|
33
36
|
});
|
|
37
|
+
} else if (this.props.isInsetViewer) {
|
|
38
|
+
return /*#__PURE__*/React.createElement(DefaultCoverWrapper, null, /*#__PURE__*/React.createElement(IconTile, {
|
|
39
|
+
icon: AudioIcon,
|
|
40
|
+
label: "cover",
|
|
41
|
+
appearance: "gray",
|
|
42
|
+
size: "xlarge"
|
|
43
|
+
}));
|
|
34
44
|
} else {
|
|
35
45
|
return defaultCover;
|
|
36
46
|
}
|
|
@@ -82,6 +92,20 @@ export class AudioViewer extends BaseViewer {
|
|
|
82
92
|
} catch (e) {}
|
|
83
93
|
});
|
|
84
94
|
}
|
|
95
|
+
componentDidMount() {
|
|
96
|
+
super.componentDidMount();
|
|
97
|
+
if (this.props.isInsetViewer) {
|
|
98
|
+
var _this$props$setHasPla, _this$props;
|
|
99
|
+
(_this$props$setHasPla = (_this$props = this.props).setHasPlayerControls) === null || _this$props$setHasPla === void 0 ? void 0 : _this$props$setHasPla.call(_this$props, true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
componentWillUnmount() {
|
|
103
|
+
if (this.props.isInsetViewer) {
|
|
104
|
+
var _this$props$setHasPla2, _this$props2;
|
|
105
|
+
(_this$props$setHasPla2 = (_this$props2 = this.props).setHasPlayerControls) === null || _this$props$setHasPla2 === void 0 ? void 0 : _this$props$setHasPla2.call(_this$props2, false);
|
|
106
|
+
}
|
|
107
|
+
super.componentWillUnmount();
|
|
108
|
+
}
|
|
85
109
|
get initialState() {
|
|
86
110
|
return {
|
|
87
111
|
content: Outcome.pending()
|
|
@@ -92,23 +116,33 @@ export class AudioViewer extends BaseViewer {
|
|
|
92
116
|
item,
|
|
93
117
|
showControls,
|
|
94
118
|
previewCount,
|
|
95
|
-
onCanPlay
|
|
119
|
+
onCanPlay,
|
|
120
|
+
isInsetViewer,
|
|
121
|
+
mediaFooterControls
|
|
96
122
|
} = this.props;
|
|
97
123
|
const useCustomAudioPlayer = !isIE();
|
|
98
124
|
const isAutoPlay = previewCount === 0;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
125
|
+
if (useCustomAudioPlayer) {
|
|
126
|
+
const player = /*#__PURE__*/React.createElement(AudioPlayer, {
|
|
127
|
+
"data-testid": "media-viewer-audio-content"
|
|
128
|
+
}, this.renderCover(), /*#__PURE__*/React.createElement(CustomAudioPlayerWrapper, null, /*#__PURE__*/React.createElement(InsetViewerProvider, {
|
|
129
|
+
isInsetViewer: isInsetViewer
|
|
130
|
+
}, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
131
|
+
type: "audio",
|
|
132
|
+
isAutoPlay: isAutoPlay,
|
|
133
|
+
src: src,
|
|
134
|
+
fileId: item.id,
|
|
135
|
+
isShortcutEnabled: true,
|
|
136
|
+
showControls: showControls,
|
|
137
|
+
onCanPlay: onCanPlay,
|
|
138
|
+
onFirstPlay: this.onFirstPlay,
|
|
139
|
+
onError: this.onError,
|
|
140
|
+
controlsPortalElement: mediaFooterControls
|
|
141
|
+
}))));
|
|
142
|
+
// Same stage wrapper as the video, so audio fills the stage the same way.
|
|
143
|
+
return isInsetViewer ? /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, null, player) : player;
|
|
144
|
+
}
|
|
145
|
+
return /*#__PURE__*/React.createElement(AudioPlayer, null, this.renderCover(), /*#__PURE__*/React.createElement(CustomAudioPlayerWrapper, null, /*#__PURE__*/React.createElement(Audio, {
|
|
112
146
|
autoPlay: isAutoPlay,
|
|
113
147
|
controls: true,
|
|
114
148
|
ref: this.saveAudioElement,
|
|
@@ -157,4 +191,5 @@ export class AudioViewer extends BaseViewer {
|
|
|
157
191
|
}
|
|
158
192
|
URL.revokeObjectURL(content.data);
|
|
159
193
|
}
|
|
160
|
-
}
|
|
194
|
+
}
|
|
195
|
+
export const AudioViewer = withInsetViewerFooter(_AudioViewer);
|
package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
._154iidpf{top:0}
|
|
1
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}._154iidpf{top:0}
|
|
2
|
+
._18m915vq{overflow-y:hidden}
|
|
2
3
|
._18m91wug{overflow-y:auto}
|
|
4
|
+
._1ltv1tcg{left:24px}
|
|
3
5
|
._1ltvidpf{left:0}
|
|
6
|
+
._1reo15vq{overflow-x:hidden}
|
|
4
7
|
._1reo1wug{overflow-x:auto}
|
|
8
|
+
._1xi21tcg{right:24px}
|
|
5
9
|
._1xi2idpf{right:0}
|
|
10
|
+
._4t3i1osq{height:100%}
|
|
6
11
|
._4t3i8ved{height:75px}
|
|
7
12
|
._94n5idpf{bottom:0}
|
|
8
13
|
._bfhk1nox{background-color:#1d2125}
|
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
/* CodeRendererAdvanced.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
2
|
import "./CodeRendererAdvanced.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import React, { useRef, useState } from 'react';
|
|
5
5
|
import { syntaxHighlighting } from '@codemirror/language';
|
|
6
6
|
import { languages } from '@codemirror/language-data';
|
|
7
7
|
import { Compartment, EditorState } from '@codemirror/state';
|
|
8
8
|
import { EditorView, lineNumbers, gutters } from '@codemirror/view';
|
|
9
|
-
import {
|
|
9
|
+
import { useIsInsetViewer, useMediaFooterControls } from '../../../insetViewerContext';
|
|
10
|
+
import { INSET_VIEWER_GUTTER_PX } from '../../../styleWrappers';
|
|
11
|
+
import { CodeViewerFooter } from '../CodeViewerFooter';
|
|
12
|
+
import { cmTheme, highlightStyle, insetViewerCmTheme } from './theme';
|
|
10
13
|
const codeViewWrapperStyles = null;
|
|
14
|
+
const insetViewerCodeViewWrapperStyles = null;
|
|
15
|
+
|
|
16
|
+
// Gives the editor a definite height to fill, so its own scroller scrolls.
|
|
17
|
+
const insetViewerEditorHostStyles = null;
|
|
11
18
|
const codeViewerHeaderBarStyles = null;
|
|
12
19
|
export const CodeRendererAdvanced = props => {
|
|
20
|
+
var _props$item$name$spli;
|
|
21
|
+
const isInsetViewer = useIsInsetViewer();
|
|
22
|
+
const footerElement = useMediaFooterControls();
|
|
23
|
+
// CodeMirror already splits the document into lines, so the footer gets the count for free.
|
|
24
|
+
const [lineCount, setLineCount] = useState();
|
|
25
|
+
const extension = (_props$item$name$spli = props.item.name.split('.').pop()) !== null && _props$item$name$spli !== void 0 ? _props$item$name$spli : '';
|
|
26
|
+
const language = languages.find(lang => lang.extensions.includes(extension));
|
|
13
27
|
const nodeRef = useRef(elem => {
|
|
14
|
-
var _props$
|
|
28
|
+
var _props$onSuccess;
|
|
15
29
|
if (!elem) {
|
|
16
30
|
return;
|
|
17
31
|
}
|
|
18
|
-
const extension = (_props$item$name$spli = props.item.name.split('.').pop()) !== null && _props$item$name$spli !== void 0 ? _props$item$name$spli : '';
|
|
19
32
|
const languageCompartment = new Compartment();
|
|
20
33
|
const view = new EditorView({
|
|
21
34
|
doc: props.src,
|
|
22
35
|
parent: elem,
|
|
23
|
-
extensions: [lineNumbers(), gutters(), EditorState.readOnly.of(true), EditorView.editable.of(false), EditorView.lineWrapping, cmTheme, syntaxHighlighting(highlightStyle), languageCompartment.of([])]
|
|
36
|
+
extensions: [lineNumbers(), gutters(), EditorState.readOnly.of(true), EditorView.editable.of(false), EditorView.lineWrapping, isInsetViewer ? insetViewerCmTheme : cmTheme, syntaxHighlighting(highlightStyle), languageCompartment.of([])]
|
|
24
37
|
});
|
|
38
|
+
if (isInsetViewer) {
|
|
39
|
+
setLineCount(view.state.doc.lines);
|
|
40
|
+
}
|
|
25
41
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props);
|
|
26
|
-
const language = languages.find(lang => lang.extensions.includes(extension));
|
|
27
42
|
language === null || language === void 0 ? void 0 : language.load().then(val => {
|
|
28
43
|
view.dispatch({
|
|
29
44
|
effects: languageCompartment.reconfigure(val)
|
|
@@ -35,10 +50,15 @@ export const CodeRendererAdvanced = props => {
|
|
|
35
50
|
});
|
|
36
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
37
52
|
"data-testid": props.testId,
|
|
38
|
-
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon"])
|
|
39
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon", isInsetViewer && "_2rko1mok _1reo15vq _18m915vq _1ltv1tcg _1xi21tcg"])
|
|
54
|
+
}, !isInsetViewer && /*#__PURE__*/React.createElement("div", {
|
|
40
55
|
className: ax(["_4t3i8ved _bfhk1nox"])
|
|
41
56
|
}), /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
ref: nodeRef.current
|
|
57
|
+
ref: nodeRef.current,
|
|
58
|
+
className: ax([isInsetViewer && "_4t3i1osq"])
|
|
59
|
+
}), isInsetViewer && /*#__PURE__*/React.createElement(CodeViewerFooter, {
|
|
60
|
+
lineCount: lineCount,
|
|
61
|
+
languageName: language === null || language === void 0 ? void 0 : language.name,
|
|
62
|
+
footerElement: footerElement
|
|
43
63
|
}));
|
|
44
64
|
};
|
|
@@ -7,15 +7,21 @@ import { tags } from '@lezer/highlight';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const LINE_HEIGHT = '1.5rem';
|
|
10
|
-
|
|
10
|
+
const createCmTheme = isInsetViewer => CodeMirror.theme({
|
|
11
11
|
'&': {
|
|
12
12
|
backgroundColor: "var(--ds-background-neutral, #0515240F)",
|
|
13
13
|
padding: '0',
|
|
14
|
-
marginTop: "var(--ds-space-100, 8px)",
|
|
15
|
-
marginBottom: "var(--ds-space-100, 8px)",
|
|
14
|
+
marginTop: isInsetViewer ? "var(--ds-space-0, 0px)" : "var(--ds-space-100, 8px)",
|
|
15
|
+
marginBottom: isInsetViewer ? "var(--ds-space-0, 0px)" : "var(--ds-space-100, 8px)",
|
|
16
16
|
['fontSize']: '0.875rem',
|
|
17
17
|
// Custom syntax styling to match existing styling
|
|
18
|
-
['lineHeight']: LINE_HEIGHT
|
|
18
|
+
['lineHeight']: LINE_HEIGHT,
|
|
19
|
+
// The editor scrolls and is rounded itself, so its scrollbar sits inside the rounded corners.
|
|
20
|
+
...(isInsetViewer ? {
|
|
21
|
+
height: '100%',
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
borderRadius: "var(--ds-radius-large, 8px)"
|
|
24
|
+
} : {})
|
|
19
25
|
},
|
|
20
26
|
'&.cm-focused': {
|
|
21
27
|
outline: 'none'
|
|
@@ -53,7 +59,13 @@ export const cmTheme = CodeMirror.theme({
|
|
|
53
59
|
backgroundColor: "var(--ds-background-neutral, #0515240F)",
|
|
54
60
|
border: 'none',
|
|
55
61
|
padding: "var(--ds-space-100, 8px)",
|
|
56
|
-
color: "var(--ds-text-subtlest, #6B6E76)"
|
|
62
|
+
color: "var(--ds-text-subtlest, #6B6E76)",
|
|
63
|
+
// CodeMirror sizes the gutter to the visible height, so once the editor scrolls it
|
|
64
|
+
// would stop short of the bottom. Let it grow with the content instead.
|
|
65
|
+
...(isInsetViewer ? {
|
|
66
|
+
height: 'auto',
|
|
67
|
+
minHeight: '100%'
|
|
68
|
+
} : {})
|
|
57
69
|
},
|
|
58
70
|
'.cm-lineNumbers .cm-gutterElement': {
|
|
59
71
|
paddingLeft: "var(--ds-space-0, 0px)",
|
|
@@ -68,6 +80,10 @@ export const cmTheme = CodeMirror.theme({
|
|
|
68
80
|
minHeight: LINE_HEIGHT
|
|
69
81
|
}
|
|
70
82
|
});
|
|
83
|
+
export const cmTheme = createCmTheme(false);
|
|
84
|
+
|
|
85
|
+
// The inset viewer's wrapper already frames the editor, so it has no margin, and the editor does the scrolling.
|
|
86
|
+
export const insetViewerCmTheme = createCmTheme(true);
|
|
71
87
|
function overflowShadow({
|
|
72
88
|
leftCoverWidth,
|
|
73
89
|
rightCoverWidth
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { SUPPORTED_LANGUAGES } from '@atlaskit/code/constants';
|
|
3
|
+
import { useIsInsetViewer, useMediaFooterControls } from '../../insetViewerContext';
|
|
4
|
+
import { CodeViewerFooter } from './CodeViewerFooter';
|
|
2
5
|
import { CodeViewRenderer as CompiledCodeViewRenderer } from './CodeViewRenderer';
|
|
3
|
-
export const CodeViewRenderer = props =>
|
|
6
|
+
export const CodeViewRenderer = props => {
|
|
7
|
+
var _SUPPORTED_LANGUAGES$;
|
|
8
|
+
const isInsetViewer = useIsInsetViewer();
|
|
9
|
+
const footerElement = useMediaFooterControls();
|
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CompiledCodeViewRenderer, props), isInsetViewer && /*#__PURE__*/React.createElement(CodeViewerFooter
|
|
11
|
+
// Plain text has no name, so the footer shows its translated "Plain text" label instead of
|
|
12
|
+
// the code package's untranslated "PlainText".
|
|
13
|
+
, {
|
|
14
|
+
languageName: props.language === 'text' ? undefined : (_SUPPORTED_LANGUAGES$ = SUPPORTED_LANGUAGES.find(candidate => candidate.alias.includes(props.language))) === null || _SUPPORTED_LANGUAGES$ === void 0 ? void 0 : _SUPPORTED_LANGUAGES$.name,
|
|
15
|
+
footerElement: footerElement
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._19bvu2gc{padding-left:var(--ds-space-100,8px)}
|
|
2
|
+
._1bah1yb4{justify-content:space-between}
|
|
3
|
+
._1bsb1osq{width:100%}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
5
|
+
._4cvr1h6o{align-items:center}
|
|
6
|
+
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
7
|
+
._ca0qv77o{padding-top:var(--ds-space-025,2px)}
|
|
8
|
+
._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
|
|
9
|
+
._syazi7uo{color:var(--ds-text,#292a2e)}
|
|
10
|
+
._u5f3u2gc{padding-right:var(--ds-space-100,8px)}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* CodeViewerFooter.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./CodeViewerFooter.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
7
|
+
import { FormattedMessage } from 'react-intl';
|
|
8
|
+
import { messages } from '@atlaskit/media-ui/messages';
|
|
9
|
+
const styles = {
|
|
10
|
+
root: "_1e0c1txw _4cvr1h6o _1bah1yb4 _1bsb1osq _syazi7uo",
|
|
11
|
+
language: "_2rko12b0 _ca0qv77o _u5f3u2gc _n3tdv77o _19bvu2gc _bfhki8nm"
|
|
12
|
+
};
|
|
13
|
+
// The line count on the left, if there is one, and the language on the right, in the inset media footer.
|
|
14
|
+
export const CodeViewerFooter = ({
|
|
15
|
+
lineCount,
|
|
16
|
+
languageName,
|
|
17
|
+
footerElement
|
|
18
|
+
}) => {
|
|
19
|
+
if (!footerElement) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
"data-testid": "media-viewer-code-footer",
|
|
24
|
+
className: ax([styles.root])
|
|
25
|
+
}, /*#__PURE__*/React.createElement("span", null, lineCount !== undefined && /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.line_count, {
|
|
26
|
+
values: {
|
|
27
|
+
count: lineCount
|
|
28
|
+
}
|
|
29
|
+
}))), /*#__PURE__*/React.createElement("span", {
|
|
30
|
+
"data-testid": "media-viewer-code-footer-language",
|
|
31
|
+
className: ax([styles.language])
|
|
32
|
+
}, languageName !== null && languageName !== void 0 ? languageName : /*#__PURE__*/React.createElement(FormattedMessage, messages.plain_text))), footerElement);
|
|
33
|
+
};
|
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
import "./CodeViewerHeaderBar.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useIsInsetViewer } from '../../insetViewerContext';
|
|
6
7
|
const codeViewerHeaderBarStyles = null;
|
|
7
8
|
export const CodeViewerHeaderBar = () => {
|
|
9
|
+
const isInsetViewer = useIsInsetViewer();
|
|
10
|
+
// The inset viewer has its own header row, so there is nothing to clear.
|
|
11
|
+
if (isInsetViewer) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
8
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
9
15
|
className: ax(["_4t3i8ved _bfhk1nox"])
|
|
10
16
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
._154iidpf{top:0}
|
|
1
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}._154iidpf{top:0}
|
|
2
2
|
._18m91wug{overflow-y:auto}
|
|
3
|
+
._1ltv1tcg{left:24px}
|
|
3
4
|
._1ltvidpf{left:0}
|
|
4
5
|
._1reo1wug{overflow-x:auto}
|
|
6
|
+
._1xi21tcg{right:24px}
|
|
5
7
|
._1xi2idpf{right:0}
|
|
6
8
|
._94n5idpf{bottom:0}
|
|
7
9
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
@@ -3,7 +3,10 @@ import "./codeViewerRenderer-compiled.compiled.css";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { forwardRef } from 'react';
|
|
6
|
+
import { useIsInsetViewer } from '../../insetViewerContext';
|
|
7
|
+
import { INSET_VIEWER_GUTTER_PX } from '../../styleWrappers';
|
|
6
8
|
const codeViewWrapperStyles = null;
|
|
9
|
+
const insetViewerCodeViewWrapperStyles = null;
|
|
7
10
|
|
|
8
11
|
// Based on some basic benchmarking with @atlaskit/code it was found that ~10,000 lines took around ~5secs to render, which locks the main thread.
|
|
9
12
|
// Therefore we set a hard limit on the amount of lines which we apply formatting to,
|
|
@@ -17,9 +20,10 @@ export const CodeViewWrapper = /*#__PURE__*/forwardRef(({
|
|
|
17
20
|
children,
|
|
18
21
|
'data-testid': testId
|
|
19
22
|
}, ref) => {
|
|
23
|
+
const isInsetViewer = useIsInsetViewer();
|
|
20
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
25
|
"data-testid": testId,
|
|
22
26
|
ref: ref,
|
|
23
|
-
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon"])
|
|
27
|
+
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon", isInsetViewer && "_2rko1mok _1ltv1tcg _1xi21tcg"])
|
|
24
28
|
}, children);
|
|
25
29
|
});
|
|
@@ -10,6 +10,7 @@ import { DOCUMENT_SCROLL_ROOT_ID } from '@atlaskit/media-document-viewer/get-doc
|
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
11
|
import Spinner from '@atlaskit/spinner/spinner';
|
|
12
12
|
import { ZoomLevel } from '../../domain/zoomLevel';
|
|
13
|
+
import { useIsInsetViewer } from '../../insetViewerContext';
|
|
13
14
|
import { MediaViewerError } from '../../MediaViewerError';
|
|
14
15
|
import { ZoomControls } from '../../zoomControls';
|
|
15
16
|
import { PasswordInput } from './passwordInput';
|
|
@@ -69,6 +70,7 @@ export const DocViewer = ({
|
|
|
69
70
|
}) => {
|
|
70
71
|
var _fileState$mimeType;
|
|
71
72
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
73
|
+
const isInsetViewer = useIsInsetViewer();
|
|
72
74
|
|
|
73
75
|
// Compute enableLazyPageRendering based on Excel file detection and feature gate
|
|
74
76
|
// Excel files are found to have 60K pages, because excel can have thousand of empty rows, JST-1296681
|
|
@@ -149,8 +151,11 @@ export const DocViewer = ({
|
|
|
149
151
|
return /*#__PURE__*/React.createElement(React.Fragment, null, state.isLoading && /*#__PURE__*/React.createElement("div", {
|
|
150
152
|
className: ax(["_kqswstnw _1e0c1txw _1bah1h6o _4cvr1h6o"])
|
|
151
153
|
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
152
|
-
size: "large"
|
|
153
|
-
|
|
154
|
+
size: "large"
|
|
155
|
+
// The overlay viewer is always dark, so it inverts the spinner. The inset viewer follows the
|
|
156
|
+
// theme, so it uses the spinner's own subtle icon colour.
|
|
157
|
+
,
|
|
158
|
+
appearance: isInsetViewer ? 'inherit' : 'invert'
|
|
154
159
|
})), /*#__PURE__*/React.createElement("div", {
|
|
155
160
|
style: {
|
|
156
161
|
opacity: state.isLoading ? 0 : 1
|
|
@@ -7,5 +7,7 @@
|
|
|
7
7
|
._19pkidpf{margin-top:0}
|
|
8
8
|
._1e0c1txw{display:flex}
|
|
9
9
|
._1jyy9txx._1jyy9txx h1{color:#b6c2cf}
|
|
10
|
+
._1jyyazsu._1jyyazsu h1{color:var(--ds-text-subtle,#505258)}
|
|
10
11
|
._4cvr1h6o{align-items:center}
|
|
11
|
-
._syaz1366{color:#fd9891}
|
|
12
|
+
._syaz1366{color:#fd9891}
|
|
13
|
+
._syaz1tmw{color:var(--ds-text-danger,#ae2e24)}
|
|
@@ -22,10 +22,16 @@ import { Text } from '@atlaskit/primitives/text';
|
|
|
22
22
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
23
23
|
import { xcss } from '@atlaskit/primitives/xcss/xcss';
|
|
24
24
|
import TextField from '@atlaskit/textfield/text-field';
|
|
25
|
+
import { useIsInsetViewer } from '../../insetViewerContext';
|
|
25
26
|
const COLOR_SHADE = '#b6c2cf';
|
|
26
27
|
const ERROR_COLOR = '#FD9891';
|
|
27
28
|
const headingStyle = null;
|
|
29
|
+
const insetViewerHeadingStyle = null;
|
|
28
30
|
const errorMessageWrapperStyle = null;
|
|
31
|
+
const errorMessageColorStyle = null;
|
|
32
|
+
|
|
33
|
+
// The message itself takes its color from the Text color prop, so this is just for the icon.
|
|
34
|
+
const insetViewerErrorMessageColorStyle = null;
|
|
29
35
|
const errorMessageStyle = null;
|
|
30
36
|
const headerStyles = xcss({
|
|
31
37
|
textAlign: 'center',
|
|
@@ -49,6 +55,7 @@ export const PasswordInput = ({
|
|
|
49
55
|
const onRenderRef = useRef(onRender);
|
|
50
56
|
const [formError, setFormError] = useState(hasPasswordError);
|
|
51
57
|
const intl = useIntl();
|
|
58
|
+
const isInsetViewer = useIsInsetViewer();
|
|
52
59
|
useEffect(() => {
|
|
53
60
|
var _onRenderRef$current;
|
|
54
61
|
(_onRenderRef$current = onRenderRef.current) === null || _onRenderRef$current === void 0 ? void 0 : _onRenderRef$current.call(onRenderRef);
|
|
@@ -69,11 +76,11 @@ export const PasswordInput = ({
|
|
|
69
76
|
justifyContent: "center"
|
|
70
77
|
}, /*#__PURE__*/React.createElement(LockIcon, {
|
|
71
78
|
label: "",
|
|
72
|
-
color: COLOR_SHADE
|
|
79
|
+
color: isInsetViewer ? "var(--ds-icon-subtle, #505258)" : COLOR_SHADE
|
|
73
80
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
74
81
|
xcss: headerStyles
|
|
75
82
|
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
className: ax(["_151kfhey _18ewwu06 _1jyy9txx"])
|
|
83
|
+
className: ax(["_151kfhey _18ewwu06 _1jyy9txx", isInsetViewer && "_1jyyazsu"])
|
|
77
84
|
}, /*#__PURE__*/React.createElement(Heading, {
|
|
78
85
|
as: "h1",
|
|
79
86
|
size: "medium"
|
|
@@ -97,7 +104,7 @@ export const PasswordInput = ({
|
|
|
97
104
|
}
|
|
98
105
|
})), formError && /*#__PURE__*/React.createElement("div", {
|
|
99
106
|
id: `${fieldProps.id}-error`,
|
|
100
|
-
className: ax(["_11c8wadc _19pk1b66 _1e0c1txw _4cvr1h6o _syaz1366 _125x1366"])
|
|
107
|
+
className: ax(["_11c8wadc _19pk1b66 _1e0c1txw _4cvr1h6o", isInsetViewer ? "_syaz1tmw" : "_syaz1366 _125x1366"])
|
|
101
108
|
}, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
102
109
|
color: "currentColor",
|
|
103
110
|
label: "",
|
|
@@ -106,7 +113,8 @@ export const PasswordInput = ({
|
|
|
106
113
|
id: `${fieldProps.id}-errorMessage`,
|
|
107
114
|
className: ax(["_19pkidpf _18u01b66"])
|
|
108
115
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
109
|
-
as: "p"
|
|
116
|
+
as: "p",
|
|
117
|
+
color: isInsetViewer ? 'color.text.danger' : undefined
|
|
110
118
|
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.incorrect_password)))))), /*#__PURE__*/React.createElement(Box, {
|
|
111
119
|
xcss: footerStyles
|
|
112
120
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -13,7 +13,7 @@ import { buildVideoErrorDiagnostics } from '../buildVideoErrorDiagnostics';
|
|
|
13
13
|
import { Outcome } from '../domain/outcome';
|
|
14
14
|
import { withInsetViewerFooter } from '../insetViewerContext';
|
|
15
15
|
import { MediaViewerError } from '../MediaViewerError';
|
|
16
|
-
import { Video,
|
|
16
|
+
import { Video, CustomMediaPlayerWrapper, FittedVideoFrame } from '../styleWrappers';
|
|
17
17
|
import { insetFittedViewport } from '../utils/fit-viewport';
|
|
18
18
|
import { getObjectUrlFromFileState } from '../utils/getObjectUrlFromFileState';
|
|
19
19
|
import { isIE } from '../utils/isIE';
|
|
@@ -111,14 +111,14 @@ class _VideoViewer extends BaseViewer {
|
|
|
111
111
|
componentDidMount() {
|
|
112
112
|
super.componentDidMount();
|
|
113
113
|
if (this.props.isInsetViewer) {
|
|
114
|
-
var _this$props$
|
|
115
|
-
(_this$props$
|
|
114
|
+
var _this$props$setHasPla, _this$props;
|
|
115
|
+
(_this$props$setHasPla = (_this$props = this.props).setHasPlayerControls) === null || _this$props$setHasPla === void 0 ? void 0 : _this$props$setHasPla.call(_this$props, true);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
componentWillUnmount() {
|
|
119
119
|
if (this.props.isInsetViewer) {
|
|
120
|
-
var _this$props$
|
|
121
|
-
(_this$props$
|
|
120
|
+
var _this$props$setHasPla2, _this$props2;
|
|
121
|
+
(_this$props$setHasPla2 = (_this$props2 = this.props).setHasPlayerControls) === null || _this$props$setHasPla2 === void 0 ? void 0 : _this$props$setHasPla2.call(_this$props2, false);
|
|
122
122
|
}
|
|
123
123
|
super.componentWillUnmount();
|
|
124
124
|
}
|
|
@@ -147,7 +147,7 @@ class _VideoViewer extends BaseViewer {
|
|
|
147
147
|
src: content
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
return /*#__PURE__*/React.createElement(
|
|
150
|
+
return /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, null, /*#__PURE__*/React.createElement(FittedVideoFrame, {
|
|
151
151
|
ref: this.setInsetVideoFrame
|
|
152
152
|
}, /*#__PURE__*/React.createElement(Video, {
|
|
153
153
|
autoPlay: isAutoPlay,
|
|
@@ -196,7 +196,7 @@ class _VideoViewer extends BaseViewer {
|
|
|
196
196
|
const player = /*#__PURE__*/React.createElement(InsetViewerProvider, {
|
|
197
197
|
isInsetViewer: isInsetViewer
|
|
198
198
|
}, playerElement);
|
|
199
|
-
return /*#__PURE__*/React.createElement(
|
|
199
|
+
return /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, {
|
|
200
200
|
"data-testid": "media-viewer-video-content"
|
|
201
201
|
}, isInsetViewer ? /*#__PURE__*/React.createElement(FittedVideoFrame, {
|
|
202
202
|
ref: this.setInsetVideoFrame
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticspayload", "onClick", "tooltip"];
|
|
3
|
+
var _excluded = ["analyticspayload", "onClick", "tooltip", "variant"];
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
7
|
+
import Button from '@atlaskit/button/default/button';
|
|
7
8
|
import DownloadIcon from '@atlaskit/icon/core/download';
|
|
8
9
|
import MediaButton from '@atlaskit/media-ui/MediaButton';
|
|
9
10
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
10
11
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
11
12
|
import { fireAnalytics } from './analytics/fireAnalytics';
|
|
12
|
-
import { useIsInsetViewer } from './insetViewerContext';
|
|
13
13
|
import { noop } from './noop';
|
|
14
14
|
import { ViewerIconButton } from './viewer-icon-button';
|
|
15
15
|
export function DownloadButton(_ref) {
|
|
@@ -17,23 +17,32 @@ export function DownloadButton(_ref) {
|
|
|
17
17
|
_ref$onClick = _ref.onClick,
|
|
18
18
|
providedOnClick = _ref$onClick === void 0 ? noop : _ref$onClick,
|
|
19
19
|
tooltip = _ref.tooltip,
|
|
20
|
+
_ref$variant = _ref.variant,
|
|
21
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
20
22
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
23
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
22
24
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
23
25
|
var _useIntl = useIntl(),
|
|
24
26
|
formatMessage = _useIntl.formatMessage;
|
|
25
|
-
var isInsetViewer = useIsInsetViewer();
|
|
26
27
|
var onClick = useCallback(function (event, analyticsEvent) {
|
|
27
28
|
fireAnalytics(analyticspayload, createAnalyticsEvent);
|
|
28
29
|
providedOnClick(event, analyticsEvent);
|
|
29
30
|
}, [analyticspayload, providedOnClick, createAnalyticsEvent]);
|
|
30
|
-
var downloadButton =
|
|
31
|
+
var downloadButton = variant === 'insetIcon' ? /*#__PURE__*/React.createElement(ViewerIconButton, {
|
|
31
32
|
testId: rest.testId,
|
|
32
33
|
isDisabled: rest.isDisabled,
|
|
33
34
|
icon: DownloadIcon,
|
|
34
35
|
label: formatMessage(messages.download),
|
|
35
36
|
onClick: onClick
|
|
36
|
-
}) :
|
|
37
|
+
}) : variant === 'insetText' ?
|
|
38
|
+
/*#__PURE__*/
|
|
39
|
+
// The themed button used elsewhere in the inset viewer for non-icons
|
|
40
|
+
React.createElement(Button, {
|
|
41
|
+
appearance: "primary",
|
|
42
|
+
testId: rest.testId,
|
|
43
|
+
isDisabled: rest.isDisabled,
|
|
44
|
+
onClick: onClick
|
|
45
|
+
}, rest.children) : /*#__PURE__*/React.createElement(MediaButton, _extends({}, rest, {
|
|
37
46
|
onClick: onClick
|
|
38
47
|
}));
|
|
39
48
|
return tooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
package/dist/esm/DownloadItem.js
CHANGED
|
@@ -15,6 +15,7 @@ export var DownloadItem = function DownloadItem(_ref) {
|
|
|
15
15
|
analyticspayload = _ref.analyticspayload,
|
|
16
16
|
traceContext = _ref.traceContext,
|
|
17
17
|
iconBefore = _ref.iconBefore,
|
|
18
|
+
variant = _ref.variant,
|
|
18
19
|
children = _ref.children,
|
|
19
20
|
fallbackMediaName = _ref.fallbackMediaName;
|
|
20
21
|
var _useState = useState(false),
|
|
@@ -52,6 +53,7 @@ export var DownloadItem = function DownloadItem(_ref) {
|
|
|
52
53
|
itemDownloader();
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
|
-
iconBefore: iconBefore
|
|
56
|
+
iconBefore: iconBefore,
|
|
57
|
+
variant: variant
|
|
56
58
|
}, children));
|
|
57
59
|
};
|
|
@@ -3,6 +3,7 @@ import { FormattedMessage } from 'react-intl';
|
|
|
3
3
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
4
4
|
import { createFailedPreviewDownloadButtonClickedEvent } from './analytics/events/ui/failedPreviewDownloadButtonClicked';
|
|
5
5
|
import { DownloadItem } from './DownloadItem';
|
|
6
|
+
import { useIsInsetViewer } from './insetViewerContext';
|
|
6
7
|
import { DownloadButtonWrapper } from './styleWrappers';
|
|
7
8
|
export var ErrorViewDownloadButton = function ErrorViewDownloadButton(_ref) {
|
|
8
9
|
var fileState = _ref.fileState,
|
|
@@ -10,12 +11,14 @@ export var ErrorViewDownloadButton = function ErrorViewDownloadButton(_ref) {
|
|
|
10
11
|
error = _ref.error,
|
|
11
12
|
traceContext = _ref.traceContext,
|
|
12
13
|
collectionName = _ref.collectionName;
|
|
14
|
+
var isInsetViewer = useIsInsetViewer();
|
|
13
15
|
var downloadEvent = createFailedPreviewDownloadButtonClickedEvent(fileState, error);
|
|
14
16
|
var testId = 'media-viewer-error-download-button';
|
|
15
17
|
return /*#__PURE__*/React.createElement(DownloadButtonWrapper, null, /*#__PURE__*/React.createElement(DownloadItem, {
|
|
16
18
|
testId: testId,
|
|
17
19
|
analyticspayload: downloadEvent,
|
|
18
20
|
appearance: "primary",
|
|
21
|
+
variant: isInsetViewer ? 'insetText' : 'default',
|
|
19
22
|
fileState: fileState,
|
|
20
23
|
mediaClient: mediaClient,
|
|
21
24
|
collectionName: collectionName,
|
|
@@ -3,12 +3,14 @@ import { isExternalImageIdentifier } from '@atlaskit/media-client/is-external-im
|
|
|
3
3
|
import { createDownloadButtonClickedEvent } from './analytics/events/ui/downloadButtonClicked';
|
|
4
4
|
import { downloadIcon } from './downloadIcon';
|
|
5
5
|
import { DownloadItem } from './DownloadItem';
|
|
6
|
+
import { useIsInsetViewer } from './insetViewerContext';
|
|
6
7
|
export var ToolbarDownloadButton = function ToolbarDownloadButton(_ref) {
|
|
7
8
|
var state = _ref.state,
|
|
8
9
|
mediaClient = _ref.mediaClient,
|
|
9
10
|
identifier = _ref.identifier,
|
|
10
11
|
traceContext = _ref.traceContext,
|
|
11
12
|
fallbackMediaName = _ref.fallbackMediaName;
|
|
13
|
+
var isInsetViewer = useIsInsetViewer();
|
|
12
14
|
// TODO [MS-1731]: make it work for external files as well
|
|
13
15
|
if (isExternalImageIdentifier(identifier)) {
|
|
14
16
|
return null;
|
|
@@ -23,6 +25,7 @@ export var ToolbarDownloadButton = function ToolbarDownloadButton(_ref) {
|
|
|
23
25
|
collectionName: identifier.collectionName,
|
|
24
26
|
traceContext: traceContext,
|
|
25
27
|
iconBefore: downloadIcon,
|
|
28
|
+
variant: isInsetViewer ? 'insetIcon' : 'default',
|
|
26
29
|
fallbackMediaName: fallbackMediaName
|
|
27
30
|
});
|
|
28
31
|
};
|
|
@@ -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.23";
|
|
11
11
|
var ufoExperience;
|
|
12
12
|
var getExperience = function getExperience() {
|
|
13
13
|
if (!ufoExperience) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|