@atlaskit/media-viewer 54.11.22 → 54.11.23
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 +25 -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 +3 -3
package/dist/esm/errorMessage.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/* errorMessage.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import "./errorMessage.compiled.css";
|
|
9
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
10
|
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; }
|
|
8
11
|
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; }
|
|
9
12
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -21,6 +24,9 @@ import { errorLoadingFile } from './error-images';
|
|
|
21
24
|
import { getErrorMessageFromError } from './getErrorMessageFromError';
|
|
22
25
|
import { getPrimaryErrorReason } from './getPrimaryErrorReason';
|
|
23
26
|
import { ErrorMessageWrapper, ErrorImage } from './styleWrappers';
|
|
27
|
+
var styles = {
|
|
28
|
+
insetViewerLine: "_syazazsu"
|
|
29
|
+
};
|
|
24
30
|
var errorLoadingFileImage = function errorLoadingFileImage(formatMessage) {
|
|
25
31
|
return /*#__PURE__*/React.createElement(ErrorImage, {
|
|
26
32
|
src: errorLoadingFile,
|
|
@@ -103,17 +109,15 @@ export var ErrorMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
103
109
|
}, {
|
|
104
110
|
key: "render",
|
|
105
111
|
value: function render() {
|
|
112
|
+
var _this = this;
|
|
106
113
|
var errorInfo = this.getErrorInfo();
|
|
107
114
|
return /*#__PURE__*/React.createElement(ErrorMessageWrapper, {
|
|
108
115
|
"data-testid": "media-viewer-error"
|
|
109
116
|
}, /*#__PURE__*/React.createElement("div", null, errorInfo.icon, errorInfo.messages.map(function (formatMessage, i) {
|
|
110
|
-
return (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
key: "p".concat(i)
|
|
115
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, formatMessage))
|
|
116
|
-
);
|
|
117
|
+
return /*#__PURE__*/React.createElement("p", {
|
|
118
|
+
key: "p".concat(i),
|
|
119
|
+
className: ax([_this.props.isInsetViewer && styles.insetViewerLine])
|
|
120
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, formatMessage));
|
|
117
121
|
})), this.props.children);
|
|
118
122
|
}
|
|
119
123
|
}], [{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { injectIntl } from 'react-intl';
|
|
2
2
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
3
3
|
import { ErrorMessage } from './errorMessage';
|
|
4
|
+
import { withInsetViewer } from './insetViewerContext';
|
|
4
5
|
|
|
5
6
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
6
|
-
var ErroMsg = withAnalyticsEvents()(injectIntl(ErrorMessage));
|
|
7
|
+
var ErroMsg = withAnalyticsEvents()(withInsetViewer(injectIntl(ErrorMessage)));
|
|
7
8
|
export default ErroMsg;
|
|
@@ -8,8 +8,8 @@ var MediaFooterControlsContext = /*#__PURE__*/createContext(null);
|
|
|
8
8
|
var SetMediaFooterControlsContext = /*#__PURE__*/createContext(function () {});
|
|
9
9
|
|
|
10
10
|
// Whether a viewer has registered video controls in the footer, which gives the footer extra room.
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var HasMediaFooterPlayerControlsContext = /*#__PURE__*/createContext(false);
|
|
12
|
+
var SetHasMediaFooterPlayerControlsContext = /*#__PURE__*/createContext(function () {});
|
|
13
13
|
export var InsetViewerProvider = function InsetViewerProvider(_ref) {
|
|
14
14
|
var _ref$isInsetViewer = _ref.isInsetViewer,
|
|
15
15
|
isInsetViewer = _ref$isInsetViewer === void 0 ? false : _ref$isInsetViewer,
|
|
@@ -20,18 +20,18 @@ export var InsetViewerProvider = function InsetViewerProvider(_ref) {
|
|
|
20
20
|
setMediaFooterControls = _useState2[1];
|
|
21
21
|
var _useState3 = useState(false),
|
|
22
22
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
hasPlayerControls = _useState4[0],
|
|
24
|
+
setHasPlayerControls = _useState4[1];
|
|
25
25
|
return /*#__PURE__*/React.createElement(InsetViewerContext.Provider, {
|
|
26
26
|
value: isInsetViewer
|
|
27
27
|
}, /*#__PURE__*/React.createElement(SetMediaFooterControlsContext.Provider, {
|
|
28
28
|
value: setMediaFooterControls
|
|
29
29
|
}, /*#__PURE__*/React.createElement(MediaFooterControlsContext.Provider, {
|
|
30
30
|
value: mediaFooterControls
|
|
31
|
-
}, /*#__PURE__*/React.createElement(
|
|
32
|
-
value:
|
|
33
|
-
}, /*#__PURE__*/React.createElement(
|
|
34
|
-
value:
|
|
31
|
+
}, /*#__PURE__*/React.createElement(SetHasMediaFooterPlayerControlsContext.Provider, {
|
|
32
|
+
value: setHasPlayerControls
|
|
33
|
+
}, /*#__PURE__*/React.createElement(HasMediaFooterPlayerControlsContext.Provider, {
|
|
34
|
+
value: hasPlayerControls
|
|
35
35
|
}, children)))));
|
|
36
36
|
};
|
|
37
37
|
export var useIsInsetViewer = function useIsInsetViewer() {
|
|
@@ -43,11 +43,11 @@ export var useMediaFooterControls = function useMediaFooterControls() {
|
|
|
43
43
|
export var useSetMediaFooterControls = function useSetMediaFooterControls() {
|
|
44
44
|
return useContext(SetMediaFooterControlsContext);
|
|
45
45
|
};
|
|
46
|
-
export var
|
|
47
|
-
return useContext(
|
|
46
|
+
export var useHasMediaFooterPlayerControls = function useHasMediaFooterPlayerControls() {
|
|
47
|
+
return useContext(HasMediaFooterPlayerControlsContext);
|
|
48
48
|
};
|
|
49
|
-
export var
|
|
50
|
-
return useContext(
|
|
49
|
+
export var useSetHasMediaFooterPlayerControls = function useSetHasMediaFooterPlayerControls() {
|
|
50
|
+
return useContext(SetHasMediaFooterPlayerControlsContext);
|
|
51
51
|
};
|
|
52
52
|
export var withInsetViewer = function withInsetViewer(WrappedComponent) {
|
|
53
53
|
var WithInsetViewer = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -64,12 +64,12 @@ export var withInsetViewerFooter = function withInsetViewerFooter(WrappedCompone
|
|
|
64
64
|
var WithInsetViewerFooter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
65
65
|
var isInsetViewer = useIsInsetViewer();
|
|
66
66
|
var mediaFooterControls = useMediaFooterControls();
|
|
67
|
-
var
|
|
67
|
+
var setHasPlayerControls = useSetHasMediaFooterPlayerControls();
|
|
68
68
|
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
|
|
69
69
|
ref: ref,
|
|
70
70
|
isInsetViewer: isInsetViewer,
|
|
71
71
|
mediaFooterControls: mediaFooterControls,
|
|
72
|
-
|
|
72
|
+
setHasPlayerControls: setHasPlayerControls
|
|
73
73
|
}));
|
|
74
74
|
});
|
|
75
75
|
WithInsetViewerFooter.displayName = "WithInsetViewerFooter(".concat(WrappedComponent.displayName || WrappedComponent.name || 'Component', ")");
|
package/dist/esm/loading.js
CHANGED
|
@@ -3,12 +3,17 @@ import React from 'react';
|
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
5
5
|
import AkSpinner from '@atlaskit/spinner/spinner';
|
|
6
|
+
import { useIsInsetViewer } from './insetViewerContext';
|
|
6
7
|
export var Spinner = function Spinner(_ref) {
|
|
7
8
|
_objectDestructuringEmpty(_ref);
|
|
8
9
|
var intl = useIntl();
|
|
10
|
+
var isInsetViewer = useIsInsetViewer();
|
|
9
11
|
return /*#__PURE__*/React.createElement(AkSpinner, {
|
|
10
|
-
label: intl.formatMessage(messages.loading_file)
|
|
11
|
-
|
|
12
|
+
label: intl.formatMessage(messages.loading_file)
|
|
13
|
+
// The overlay viewer is always dark, so it inverts the spinner. The inset viewer follows the
|
|
14
|
+
// theme, so it uses the spinner's own subtle icon colour.
|
|
15
|
+
,
|
|
16
|
+
appearance: isInsetViewer ? 'inherit' : 'invert',
|
|
12
17
|
size: "large"
|
|
13
18
|
});
|
|
14
19
|
};
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
._yyhycs5v{grid-column:2}
|
|
11
11
|
._yyhykb7n{grid-column:1}._11pt15ty svg{filter:drop-shadow(0 1px 1px rgb(9 30 66/25%)) drop-shadow(0 0 1px rgb(9 30 66/31%))}
|
|
12
12
|
._152tidpf{inset-block-start:0}
|
|
13
|
+
._154i1dlc{top:var(--_7soeen)}
|
|
13
14
|
._154i1ejb{top:var(--ds-space-300,24px)}
|
|
14
15
|
._154i1ssb{top:50%}
|
|
15
16
|
._154i1wug{top:auto}
|
|
16
17
|
._154iidpf{top:0}
|
|
18
|
+
._154iyct9{top:var(--_3tx9jb)}
|
|
17
19
|
._16jlidpf{flex-grow:0}
|
|
18
20
|
._16jlkb7n{flex-grow:1}
|
|
19
21
|
._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
._1bsb1osq{width:100%}
|
|
41
43
|
._1bsb1tcg{width:24px}
|
|
42
44
|
._1bsbauwl{width:100vw}
|
|
45
|
+
._1bsbs947{width:var(--_llywoj)}
|
|
43
46
|
._1bsbyazj{width:calc(100% - 26pc)}
|
|
44
47
|
._1bsbze3t{width:var(--ds-space-0,0)}
|
|
45
48
|
._1bto1l2s{text-overflow:ellipsis}
|
|
@@ -95,13 +98,13 @@
|
|
|
95
98
|
._4cvr1fhb{align-items:stretch}
|
|
96
99
|
._4cvr1h6o{align-items:center}
|
|
97
100
|
._4cvresu3{align-items:flex-end}
|
|
98
|
-
._4t3i11a6{height:var(--_1goz90u)}
|
|
99
101
|
._4t3i1kdj{height:25pc}
|
|
100
102
|
._4t3i1kxc{height:100vh}
|
|
101
103
|
._4t3i1osq{height:100%}
|
|
102
104
|
._4t3i1uc6{height:98px}
|
|
103
105
|
._4t3ixncg{height:var(--ds-space-800,4pc)}
|
|
104
106
|
._4t3ixy5q{height:var(--ds-space-400,2pc)}
|
|
107
|
+
._4t3iz5ib{height:calc(var(--ds-space-800, 4pc) + var(--ds-space-050, 4px))}
|
|
105
108
|
._4t3izwfg{height:2pc}
|
|
106
109
|
._5ral1f51{object-fit:contain}
|
|
107
110
|
._5ralzm06{object-fit:scale-down}
|
|
@@ -117,6 +120,7 @@
|
|
|
117
120
|
._bfhk1i5c{background-color:var(--ds-blanket,#050c1f75)}
|
|
118
121
|
._bfhk1j28{background-color:transparent}
|
|
119
122
|
._bfhk1tzm{background-color:#22272b}
|
|
123
|
+
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
120
124
|
._bfhkr3uz{background-color:#000}
|
|
121
125
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
122
126
|
._c71l1osq{max-height:100%}
|
|
@@ -20,13 +20,15 @@ import SlideIn from '@atlaskit/motion/slide-in';
|
|
|
20
20
|
import { Box } from '@atlaskit/primitives/box';
|
|
21
21
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
22
22
|
import { xcss } from '@atlaskit/primitives/xcss/xcss';
|
|
23
|
-
import {
|
|
23
|
+
import { useHasMediaFooterPlayerControls, useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
|
|
24
24
|
var INSET_HEADER_HEIGHT = "var(--ds-space-800, 64px)";
|
|
25
25
|
// The horizontal gutter of the inset header, footer and fitted media, shared so they can't drift.
|
|
26
26
|
// It is `space.300` at the default root font size, hard-coded because the fit maths needs a number
|
|
27
27
|
// and resolving the token would mean reading the DOM on every resize.
|
|
28
28
|
export var INSET_VIEWER_GUTTER_PX = 24;
|
|
29
29
|
var INSET_SIDEBAR_WIDTH = '400px';
|
|
30
|
+
// The media footer is the header's height, and taller when it holds player controls.
|
|
31
|
+
var INSET_PLAYER_FOOTER_HEIGHT = "calc(".concat(INSET_HEADER_HEIGHT, " + ", "var(--ds-space-050, 4px)", ")");
|
|
30
32
|
var insetSidebarWidthTransitionStyles = null;
|
|
31
33
|
var insetSidebarSlotStyles = null;
|
|
32
34
|
var insetSidebarSlotOpenStyles = null;
|
|
@@ -49,7 +51,7 @@ var insetViewerSidebarHeaderContentStyles = null;
|
|
|
49
51
|
var insetViewerSidebarHeaderTitleStyles = null;
|
|
50
52
|
var insetViewerMediaStageStyles = null;
|
|
51
53
|
var insetViewerMediaFooterBarStyles = null;
|
|
52
|
-
var
|
|
54
|
+
var insetViewerPlayerMediaFooterBarStyles = null;
|
|
53
55
|
var listWrapperStyles = null;
|
|
54
56
|
var insetViewerListWrapperStyles = null;
|
|
55
57
|
var itemStageStyles = null;
|
|
@@ -74,7 +76,11 @@ var pdfWrapperStyles = null;
|
|
|
74
76
|
var arrowStyles = null;
|
|
75
77
|
var arrowWrapperStyles = null;
|
|
76
78
|
var insetViewerArrowStyles = null;
|
|
79
|
+
|
|
80
|
+
// The arrows' container is the stage above the footer, so half the footer is added to centre them on
|
|
81
|
+
// the whole media column, wherever the footer's height changes.
|
|
77
82
|
var insetViewerArrowWrapperStyles = null;
|
|
83
|
+
var insetViewerPlayerArrowWrapperStyles = null;
|
|
78
84
|
var insetViewerLeftWrapperStyles = null;
|
|
79
85
|
var insetViewerRightWrapperStyles = null;
|
|
80
86
|
var arrowsWrapperStyles = null;
|
|
@@ -107,13 +113,23 @@ var metadataIconWrapperStyles = xcss({
|
|
|
107
113
|
var rightHeaderStyles = null;
|
|
108
114
|
var insetViewerRightHeaderStyles = null;
|
|
109
115
|
var customAudioPlayerWrapperStyles = null;
|
|
116
|
+
|
|
117
|
+
// The controls are in the footer, so the player's play/pause blanket covers the whole stage.
|
|
118
|
+
var insetViewerCustomAudioPlayerWrapperStyles = null;
|
|
110
119
|
var audioPlayerStyles = null;
|
|
120
|
+
var insetViewerAudioPlayerStyles = null;
|
|
121
|
+
var insetViewerAudioCoverStyles = null;
|
|
111
122
|
var audioStyles = null;
|
|
112
123
|
var audioCoverStyles = null;
|
|
113
124
|
var defaultCoverWrapperStyles = null;
|
|
125
|
+
var defaultCoverScaleStyles = null;
|
|
114
126
|
var downloadButtonWrapperStyles = null;
|
|
127
|
+
|
|
128
|
+
// The media button's text is fixed dark on its light blue, so it stays dark on hover. The inset
|
|
129
|
+
// viewer's themed button sets its own hover colors.
|
|
130
|
+
var downloadButtonWrapperHoverStyles = null;
|
|
115
131
|
var customVideoPlayerWrapperStyles = null;
|
|
116
|
-
var
|
|
132
|
+
var insetViewerCustomMediaPlayerWrapperStyles = null;
|
|
117
133
|
var insetViewerFittedVideoFrameStyles = null;
|
|
118
134
|
var sidebarWrapperStyles = null;
|
|
119
135
|
var insetViewerSidebarWrapperStyles = null;
|
|
@@ -219,14 +235,13 @@ export var MediaStage = function MediaStage(_ref9) {
|
|
|
219
235
|
};
|
|
220
236
|
export var MediaFooterBar = function MediaFooterBar() {
|
|
221
237
|
var setMediaFooterControls = useSetMediaFooterControls();
|
|
222
|
-
var
|
|
238
|
+
var hasPlayerControls = useHasMediaFooterPlayerControls();
|
|
223
239
|
return /*#__PURE__*/React.createElement("div", {
|
|
224
240
|
ref: setMediaFooterControls,
|
|
225
241
|
"data-testid": "media-viewer-media-footer",
|
|
226
|
-
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f315ne _n3tdpxbi _19bv15ne _kqswh2mm _lcxv1rj4",
|
|
242
|
+
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f315ne _n3tdpxbi _19bv15ne _kqswh2mm _lcxv1rj4", hasPlayerControls && "_4t3iz5ib _ca0qv47k"]),
|
|
227
243
|
style: {
|
|
228
|
-
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px"))
|
|
229
|
-
"--_1goz90u": ix("calc(".concat(INSET_HEADER_HEIGHT, " + ", "var(--ds-space-050, 4px)", ")"))
|
|
244
|
+
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px"))
|
|
230
245
|
}
|
|
231
246
|
});
|
|
232
247
|
};
|
|
@@ -363,15 +378,25 @@ export var LeftWrapper = function LeftWrapper(_ref23) {
|
|
|
363
378
|
var children = _ref23.children,
|
|
364
379
|
isArchiveSideBarVisible = _ref23.isArchiveSideBarVisible;
|
|
365
380
|
var isInsetViewer = useIsInsetViewer();
|
|
381
|
+
var hasPlayerControls = useHasMediaFooterPlayerControls();
|
|
366
382
|
return /*#__PURE__*/React.createElement("div", {
|
|
367
|
-
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1ltv1ejb"])
|
|
383
|
+
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv", isInsetViewer && "_154iyct9 _ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && hasPlayerControls && "_154i1dlc", isInsetViewer && "_1ltv1ejb"]),
|
|
384
|
+
style: {
|
|
385
|
+
"--_3tx9jb": ix("calc(50% + ".concat(INSET_HEADER_HEIGHT, " / 2)")),
|
|
386
|
+
"--_7soeen": ix("calc(50% + ".concat(INSET_PLAYER_FOOTER_HEIGHT, " / 2)"))
|
|
387
|
+
}
|
|
368
388
|
}, children);
|
|
369
389
|
};
|
|
370
390
|
export var RightWrapper = function RightWrapper(_ref24) {
|
|
371
391
|
var children = _ref24.children;
|
|
372
392
|
var isInsetViewer = useIsInsetViewer();
|
|
393
|
+
var hasPlayerControls = useHasMediaFooterPlayerControls();
|
|
373
394
|
return /*#__PURE__*/React.createElement("div", {
|
|
374
|
-
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1xi21ejb"])
|
|
395
|
+
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf", isInsetViewer && "_154iyct9 _ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && hasPlayerControls && "_154i1dlc", isInsetViewer && "_1xi21ejb"]),
|
|
396
|
+
style: {
|
|
397
|
+
"--_3tx9jb": ix("calc(50% + ".concat(INSET_HEADER_HEIGHT, " / 2)")),
|
|
398
|
+
"--_7soeen": ix("calc(50% + ".concat(INSET_PLAYER_FOOTER_HEIGHT, " / 2)"))
|
|
399
|
+
}
|
|
375
400
|
}, children);
|
|
376
401
|
};
|
|
377
402
|
|
|
@@ -505,16 +530,21 @@ export var RightHeader = function RightHeader(_ref34) {
|
|
|
505
530
|
};
|
|
506
531
|
export var CustomAudioPlayerWrapper = function CustomAudioPlayerWrapper(_ref35) {
|
|
507
532
|
var children = _ref35.children;
|
|
533
|
+
var isInsetViewer = useIsInsetViewer();
|
|
508
534
|
return /*#__PURE__*/React.createElement("div", {
|
|
509
|
-
className: ax(["_kqswstnw _94n5idpf _1ltvidpf _1bsb1osq"])
|
|
535
|
+
className: ax(["_kqswstnw _94n5idpf _1ltvidpf _1bsb1osq", isInsetViewer && "_154iidpf _4t3i1osq"])
|
|
510
536
|
}, children);
|
|
511
537
|
};
|
|
512
538
|
export var AudioPlayer = function AudioPlayer(_ref36) {
|
|
513
539
|
var datatestId = _ref36['data-testid'],
|
|
514
540
|
children = _ref36.children;
|
|
541
|
+
var isInsetViewer = useIsInsetViewer();
|
|
515
542
|
return /*#__PURE__*/React.createElement("div", {
|
|
516
543
|
"data-testid": datatestId,
|
|
517
|
-
className: ax(["_2rkofajl _1reo15vq _18m915vq _bfhk1tzm _4cvr1h6o _1bah1h6o _1bsb1kdj _4t3i1kdj _1e0c1txw _2lx21bp4 _kqswh2mm"])
|
|
544
|
+
className: ax(["_2rkofajl _1reo15vq _18m915vq _bfhk1tzm _4cvr1h6o _1bah1h6o _1bsb1kdj _4t3i1kdj _1e0c1txw _2lx21bp4 _kqswh2mm", isInsetViewer && "_2rko1mok _bfhki8nm _1bsbs947 _4t3i1osq"]),
|
|
545
|
+
style: {
|
|
546
|
+
"--_llywoj": ix("calc(100% - ".concat(INSET_VIEWER_GUTTER_PX * 2, "px)"))
|
|
547
|
+
}
|
|
518
548
|
}, children);
|
|
519
549
|
};
|
|
520
550
|
AudioPlayer.displayName = 'AudioPlayer';
|
|
@@ -535,25 +565,28 @@ export var Audio = /*#__PURE__*/forwardRef(function (_ref37, ref) {
|
|
|
535
565
|
export var AudioCover = function AudioCover(_ref38) {
|
|
536
566
|
var src = _ref38.src,
|
|
537
567
|
alt = _ref38.alt;
|
|
568
|
+
var isInsetViewer = useIsInsetViewer();
|
|
538
569
|
return /*#__PURE__*/React.createElement("img", {
|
|
539
570
|
alt: alt,
|
|
540
571
|
src: src,
|
|
541
|
-
className: ax(["_1bsb1osq _4t3i1osq _5ralzm06 _bfhkr3uz"])
|
|
572
|
+
className: ax(["_1bsb1osq _4t3i1osq _5ralzm06 _bfhkr3uz", isInsetViewer && "_bfhki8nm"])
|
|
542
573
|
});
|
|
543
574
|
};
|
|
544
575
|
export var DefaultCoverWrapper = function DefaultCoverWrapper(_ref39) {
|
|
545
576
|
var children = _ref39.children;
|
|
577
|
+
var isInsetViewer = useIsInsetViewer();
|
|
546
578
|
return /*#__PURE__*/React.createElement("div", {
|
|
547
|
-
className: ax(["_1bsb1osq _4t3i1osq _1e0c1txw _4cvr1h6o _1bah1h6o _syazi7uo _umc418ws"])
|
|
579
|
+
className: ax(["_1bsb1osq _4t3i1osq _1e0c1txw _4cvr1h6o _1bah1h6o _syazi7uo", !isInsetViewer && "_umc418ws"])
|
|
548
580
|
}, children);
|
|
549
581
|
};
|
|
550
582
|
export var DownloadButtonWrapper = function DownloadButtonWrapper(_ref40) {
|
|
551
583
|
var children = _ref40.children;
|
|
584
|
+
var isInsetViewer = useIsInsetViewer();
|
|
552
585
|
return /*#__PURE__*/React.createElement("div", {
|
|
553
|
-
className: ax(["_19pk1ejb _y3gn1h6o _1sfy1fjg _4pkp1fjg"])
|
|
586
|
+
className: ax(["_19pk1ejb _y3gn1h6o", !isInsetViewer && "_1sfy1fjg _4pkp1fjg"])
|
|
554
587
|
}, children);
|
|
555
588
|
};
|
|
556
|
-
export var
|
|
589
|
+
export var CustomMediaPlayerWrapper = /*#__PURE__*/forwardRef(function (_ref41, ref) {
|
|
557
590
|
var datatestId = _ref41['data-testid'],
|
|
558
591
|
children = _ref41.children;
|
|
559
592
|
var isInsetViewer = useIsInsetViewer();
|
|
@@ -32,7 +32,7 @@ import ErrorMessage from '../../errorMessageWithAnalytics';
|
|
|
32
32
|
import { isMediaViewerError } from '../../isMediaViewerError';
|
|
33
33
|
import { MAX_FILE_SIZE_SUPPORTED_BY_CODEVIEWER } from '../../item-viewer';
|
|
34
34
|
import { Spinner } from '../../loading';
|
|
35
|
-
import {
|
|
35
|
+
import { CustomMediaPlayerWrapper, AudioPlayer, CustomAudioPlayerWrapper, DefaultCoverWrapper, ListWrapper } from '../../styleWrappers';
|
|
36
36
|
import { getMediaTypeFromFilename } from '../../utils/getMediaTypeFromFilename';
|
|
37
37
|
import { getMimeTypeFromFilename } from '../../utils/getMimeTypeFromFilename';
|
|
38
38
|
import { rejectAfter } from '../../utils/rejectAfter';
|
|
@@ -334,7 +334,7 @@ export var ArchiveViewerBase = /*#__PURE__*/function (_BaseViewer) {
|
|
|
334
334
|
onError: this.onViewerError('archiveviewer-imageviewer-onerror', selectedArchiveEntry)
|
|
335
335
|
}));
|
|
336
336
|
case 'video':
|
|
337
|
-
return /*#__PURE__*/React.createElement(ArchiveItemViewerWrapper, null, /*#__PURE__*/React.createElement(
|
|
337
|
+
return /*#__PURE__*/React.createElement(ArchiveItemViewerWrapper, null, /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, {
|
|
338
338
|
"data-testid": "media-viewer-video-content"
|
|
339
339
|
}, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
340
340
|
type: "video",
|
|
@@ -3,18 +3,23 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _get from "@babel/runtime/helpers/get";
|
|
6
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import AudioIcon from '@atlaskit/icon/core/audio';
|
|
15
|
+
import IconTile from '@atlaskit/icon/icon-tile';
|
|
13
16
|
import { globalMediaEventEmitter } from '@atlaskit/media-client/global-media-event-emitter';
|
|
14
17
|
import { CustomMediaPlayer } from '@atlaskit/media-ui/customMediaPlayer';
|
|
18
|
+
import { InsetViewerProvider } from '@atlaskit/media-ui/insetViewerProvider';
|
|
15
19
|
import { Outcome } from '../domain/outcome';
|
|
20
|
+
import { withInsetViewerFooter } from '../insetViewerContext';
|
|
16
21
|
import { MediaViewerError } from '../MediaViewerError';
|
|
17
|
-
import { AudioPlayer, AudioCover, Audio, DefaultCoverWrapper, CustomAudioPlayerWrapper } from '../styleWrappers';
|
|
22
|
+
import { AudioPlayer, AudioCover, Audio, DefaultCoverWrapper, CustomAudioPlayerWrapper, CustomMediaPlayerWrapper } from '../styleWrappers';
|
|
18
23
|
import { getObjectUrlFromFileState } from '../utils/getObjectUrlFromFileState';
|
|
19
24
|
import { isIE } from '../utils/isIE';
|
|
20
25
|
import { BaseViewer } from './base-viewer';
|
|
@@ -27,14 +32,14 @@ var getCoverUrl = function getCoverUrl(item, mediaClient, collectionName) {
|
|
|
27
32
|
collection: collectionName
|
|
28
33
|
});
|
|
29
34
|
};
|
|
30
|
-
|
|
31
|
-
function
|
|
35
|
+
var _AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
36
|
+
function _AudioViewer() {
|
|
32
37
|
var _this;
|
|
33
|
-
_classCallCheck(this,
|
|
38
|
+
_classCallCheck(this, _AudioViewer);
|
|
34
39
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
40
|
args[_key] = arguments[_key];
|
|
36
41
|
}
|
|
37
|
-
_this = _callSuper(this,
|
|
42
|
+
_this = _callSuper(this, _AudioViewer, [].concat(args));
|
|
38
43
|
_defineProperty(_this, "renderCover", function () {
|
|
39
44
|
var item = _this.props.item;
|
|
40
45
|
var coverUrl = _this.state.coverUrl;
|
|
@@ -43,6 +48,13 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
43
48
|
src: coverUrl,
|
|
44
49
|
alt: item.name
|
|
45
50
|
});
|
|
51
|
+
} else if (_this.props.isInsetViewer) {
|
|
52
|
+
return /*#__PURE__*/React.createElement(DefaultCoverWrapper, null, /*#__PURE__*/React.createElement(IconTile, {
|
|
53
|
+
icon: AudioIcon,
|
|
54
|
+
label: "cover",
|
|
55
|
+
appearance: "gray",
|
|
56
|
+
size: "xlarge"
|
|
57
|
+
}));
|
|
46
58
|
} else {
|
|
47
59
|
return defaultCover;
|
|
48
60
|
}
|
|
@@ -122,8 +134,26 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
122
134
|
})));
|
|
123
135
|
return _this;
|
|
124
136
|
}
|
|
125
|
-
_inherits(
|
|
126
|
-
return _createClass(
|
|
137
|
+
_inherits(_AudioViewer, _BaseViewer);
|
|
138
|
+
return _createClass(_AudioViewer, [{
|
|
139
|
+
key: "componentDidMount",
|
|
140
|
+
value: function componentDidMount() {
|
|
141
|
+
_superPropGet(_AudioViewer, "componentDidMount", this, 3)([]);
|
|
142
|
+
if (this.props.isInsetViewer) {
|
|
143
|
+
var _this$props$setHasPla, _this$props2;
|
|
144
|
+
(_this$props$setHasPla = (_this$props2 = this.props).setHasPlayerControls) === null || _this$props$setHasPla === void 0 || _this$props$setHasPla.call(_this$props2, true);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "componentWillUnmount",
|
|
149
|
+
value: function componentWillUnmount() {
|
|
150
|
+
if (this.props.isInsetViewer) {
|
|
151
|
+
var _this$props$setHasPla2, _this$props3;
|
|
152
|
+
(_this$props$setHasPla2 = (_this$props3 = this.props).setHasPlayerControls) === null || _this$props$setHasPla2 === void 0 || _this$props$setHasPla2.call(_this$props3, false);
|
|
153
|
+
}
|
|
154
|
+
_superPropGet(_AudioViewer, "componentWillUnmount", this, 3)([]);
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
127
157
|
key: "initialState",
|
|
128
158
|
get: function get() {
|
|
129
159
|
return {
|
|
@@ -133,26 +163,36 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
133
163
|
}, {
|
|
134
164
|
key: "renderSuccessful",
|
|
135
165
|
value: function renderSuccessful(src) {
|
|
136
|
-
var _this$
|
|
137
|
-
item = _this$
|
|
138
|
-
showControls = _this$
|
|
139
|
-
previewCount = _this$
|
|
140
|
-
onCanPlay = _this$
|
|
166
|
+
var _this$props4 = this.props,
|
|
167
|
+
item = _this$props4.item,
|
|
168
|
+
showControls = _this$props4.showControls,
|
|
169
|
+
previewCount = _this$props4.previewCount,
|
|
170
|
+
onCanPlay = _this$props4.onCanPlay,
|
|
171
|
+
isInsetViewer = _this$props4.isInsetViewer,
|
|
172
|
+
mediaFooterControls = _this$props4.mediaFooterControls;
|
|
141
173
|
var useCustomAudioPlayer = !isIE();
|
|
142
174
|
var isAutoPlay = previewCount === 0;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
175
|
+
if (useCustomAudioPlayer) {
|
|
176
|
+
var player = /*#__PURE__*/React.createElement(AudioPlayer, {
|
|
177
|
+
"data-testid": "media-viewer-audio-content"
|
|
178
|
+
}, this.renderCover(), /*#__PURE__*/React.createElement(CustomAudioPlayerWrapper, null, /*#__PURE__*/React.createElement(InsetViewerProvider, {
|
|
179
|
+
isInsetViewer: isInsetViewer
|
|
180
|
+
}, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
181
|
+
type: "audio",
|
|
182
|
+
isAutoPlay: isAutoPlay,
|
|
183
|
+
src: src,
|
|
184
|
+
fileId: item.id,
|
|
185
|
+
isShortcutEnabled: true,
|
|
186
|
+
showControls: showControls,
|
|
187
|
+
onCanPlay: onCanPlay,
|
|
188
|
+
onFirstPlay: this.onFirstPlay,
|
|
189
|
+
onError: this.onError,
|
|
190
|
+
controlsPortalElement: mediaFooterControls
|
|
191
|
+
}))));
|
|
192
|
+
// Same stage wrapper as the video, so audio fills the stage the same way.
|
|
193
|
+
return isInsetViewer ? /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, null, player) : player;
|
|
194
|
+
}
|
|
195
|
+
return /*#__PURE__*/React.createElement(AudioPlayer, null, this.renderCover(), /*#__PURE__*/React.createElement(CustomAudioPlayerWrapper, null, /*#__PURE__*/React.createElement(Audio, {
|
|
156
196
|
autoPlay: isAutoPlay,
|
|
157
197
|
controls: true,
|
|
158
198
|
ref: this.saveAudioElement,
|
|
@@ -164,11 +204,11 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
164
204
|
key: "init",
|
|
165
205
|
value: function () {
|
|
166
206
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
167
|
-
var _this$
|
|
207
|
+
var _this$props5, mediaClient, item, collectionName, audioUrl, _t2;
|
|
168
208
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
169
209
|
while (1) switch (_context3.prev = _context3.next) {
|
|
170
210
|
case 0:
|
|
171
|
-
_this$
|
|
211
|
+
_this$props5 = this.props, mediaClient = _this$props5.mediaClient, item = _this$props5.item, collectionName = _this$props5.collectionName;
|
|
172
212
|
_context3.prev = 1;
|
|
173
213
|
if (!(item.status === 'processed')) {
|
|
174
214
|
_context3.next = 4;
|
|
@@ -233,4 +273,5 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
233
273
|
URL.revokeObjectURL(content.data);
|
|
234
274
|
}
|
|
235
275
|
}]);
|
|
236
|
-
}(BaseViewer);
|
|
276
|
+
}(BaseViewer);
|
|
277
|
+
export var AudioViewer = withInsetViewerFooter(_AudioViewer);
|
|
@@ -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
|
+
._1ltv15ne{left:var(--_1spe40c)}
|
|
3
5
|
._1ltvidpf{left:0}
|
|
6
|
+
._1reo15vq{overflow-x:hidden}
|
|
4
7
|
._1reo1wug{overflow-x:auto}
|
|
8
|
+
._1xi215ne{right:var(--_1spe40c)}
|
|
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,31 +1,50 @@
|
|
|
1
1
|
/* CodeRendererAdvanced.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import "./CodeRendererAdvanced.compiled.css";
|
|
3
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useRef } from 'react';
|
|
5
|
+
import React, { useRef, useState } from 'react';
|
|
5
6
|
import { syntaxHighlighting } from '@codemirror/language';
|
|
6
7
|
import { languages } from '@codemirror/language-data';
|
|
7
8
|
import { Compartment, EditorState } from '@codemirror/state';
|
|
8
9
|
import { EditorView, lineNumbers, gutters } from '@codemirror/view';
|
|
9
|
-
import {
|
|
10
|
+
import { useIsInsetViewer, useMediaFooterControls } from '../../../insetViewerContext';
|
|
11
|
+
import { INSET_VIEWER_GUTTER_PX } from '../../../styleWrappers';
|
|
12
|
+
import { CodeViewerFooter } from '../CodeViewerFooter';
|
|
13
|
+
import { cmTheme, highlightStyle, insetViewerCmTheme } from './theme';
|
|
10
14
|
var codeViewWrapperStyles = null;
|
|
15
|
+
var insetViewerCodeViewWrapperStyles = null;
|
|
16
|
+
|
|
17
|
+
// Gives the editor a definite height to fill, so its own scroller scrolls.
|
|
18
|
+
var insetViewerEditorHostStyles = null;
|
|
11
19
|
var codeViewerHeaderBarStyles = null;
|
|
12
20
|
export var CodeRendererAdvanced = function CodeRendererAdvanced(props) {
|
|
21
|
+
var _props$item$name$spli;
|
|
22
|
+
var isInsetViewer = useIsInsetViewer();
|
|
23
|
+
var footerElement = useMediaFooterControls();
|
|
24
|
+
// CodeMirror already splits the document into lines, so the footer gets the count for free.
|
|
25
|
+
var _useState = useState(),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
lineCount = _useState2[0],
|
|
28
|
+
setLineCount = _useState2[1];
|
|
29
|
+
var extension = (_props$item$name$spli = props.item.name.split('.').pop()) !== null && _props$item$name$spli !== void 0 ? _props$item$name$spli : '';
|
|
30
|
+
var language = languages.find(function (lang) {
|
|
31
|
+
return lang.extensions.includes(extension);
|
|
32
|
+
});
|
|
13
33
|
var nodeRef = useRef(function (elem) {
|
|
14
|
-
var _props$
|
|
34
|
+
var _props$onSuccess;
|
|
15
35
|
if (!elem) {
|
|
16
36
|
return;
|
|
17
37
|
}
|
|
18
|
-
var extension = (_props$item$name$spli = props.item.name.split('.').pop()) !== null && _props$item$name$spli !== void 0 ? _props$item$name$spli : '';
|
|
19
38
|
var languageCompartment = new Compartment();
|
|
20
39
|
var view = new EditorView({
|
|
21
40
|
doc: props.src,
|
|
22
41
|
parent: elem,
|
|
23
|
-
extensions: [lineNumbers(), gutters(), EditorState.readOnly.of(true), EditorView.editable.of(false), EditorView.lineWrapping, cmTheme, syntaxHighlighting(highlightStyle), languageCompartment.of([])]
|
|
42
|
+
extensions: [lineNumbers(), gutters(), EditorState.readOnly.of(true), EditorView.editable.of(false), EditorView.lineWrapping, isInsetViewer ? insetViewerCmTheme : cmTheme, syntaxHighlighting(highlightStyle), languageCompartment.of([])]
|
|
24
43
|
});
|
|
44
|
+
if (isInsetViewer) {
|
|
45
|
+
setLineCount(view.state.doc.lines);
|
|
46
|
+
}
|
|
25
47
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 || _props$onSuccess.call(props);
|
|
26
|
-
var language = languages.find(function (lang) {
|
|
27
|
-
return lang.extensions.includes(extension);
|
|
28
|
-
});
|
|
29
48
|
language === null || language === void 0 || language.load().then(function (val) {
|
|
30
49
|
view.dispatch({
|
|
31
50
|
effects: languageCompartment.reconfigure(val)
|
|
@@ -37,10 +56,18 @@ export var CodeRendererAdvanced = function CodeRendererAdvanced(props) {
|
|
|
37
56
|
});
|
|
38
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
58
|
"data-testid": props.testId,
|
|
40
|
-
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon"])
|
|
41
|
-
|
|
59
|
+
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon", isInsetViewer && "_2rko1mok _1reo15vq _18m915vq _1ltv15ne _1xi215ne"]),
|
|
60
|
+
style: {
|
|
61
|
+
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px"))
|
|
62
|
+
}
|
|
63
|
+
}, !isInsetViewer && /*#__PURE__*/React.createElement("div", {
|
|
42
64
|
className: ax(["_4t3i8ved _bfhk1nox"])
|
|
43
65
|
}), /*#__PURE__*/React.createElement("div", {
|
|
44
|
-
ref: nodeRef.current
|
|
66
|
+
ref: nodeRef.current,
|
|
67
|
+
className: ax([isInsetViewer && "_4t3i1osq"])
|
|
68
|
+
}), isInsetViewer && /*#__PURE__*/React.createElement(CodeViewerFooter, {
|
|
69
|
+
lineCount: lineCount,
|
|
70
|
+
languageName: language === null || language === void 0 ? void 0 : language.name,
|
|
71
|
+
footerElement: footerElement
|
|
45
72
|
}));
|
|
46
73
|
};
|