Skip to content

Commit d7d18aa

Browse files
authored
Clean up video styling (microsoft#160461)
1 parent 151ba12 commit d7d18aa

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

extensions/image-preview/media/videoPreview.css

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,21 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
html, body {
6+
html {
77
width: 100%;
88
height: 100%;
99
text-align: center;
1010
}
1111

1212
body {
1313
padding: 5px 10px;
14-
box-sizing: border-box;
15-
-webkit-user-select: none;
16-
user-select: none;
17-
}
18-
19-
.video-container {
20-
height: 100%;
21-
display: flex;
22-
justify-content: center;
23-
align-items: center;
24-
}
25-
26-
.container.loading,
27-
.container.error {
14+
width: calc(100% - 20px);
15+
height: calc(100% - 10px);
2816
display: flex;
2917
justify-content: center;
3018
align-items: center;
19+
-webkit-user-select: none;
20+
user-select: none;
3121
}
3222

3323
.loading-indicator {

extensions/image-preview/media/videoPreview.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
let hasLoadedMedia = false;
2727

2828
// Elements
29-
const container = document.createElement('div');
30-
container.className = 'video-container';
31-
document.body.appendChild(container);
32-
3329
const video = document.createElement('video');
3430
if (settings.src !== null) {
3531
video.src = settings.src;
@@ -44,7 +40,7 @@
4440

4541
document.body.classList.remove('loading');
4642
document.body.classList.add('ready');
47-
container.append(video);
43+
document.body.append(video);
4844
}
4945

5046
video.addEventListener('error', e => {

extensions/image-preview/src/videoPreview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class VideoPreview extends MediaPreview {
7979
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data: ${cspSource}; media-src ${cspSource}; script-src 'nonce-${nonce}'; style-src ${cspSource} 'nonce-${nonce}';">
8080
<meta id="settings" data-settings="${escapeAttribute(JSON.stringify(settings))}">
8181
</head>
82-
<body class="container loading">
82+
<body class="loading">
8383
<div class="loading-indicator"></div>
8484
<div class="loading-error">
8585
<p>${localize('preview.videoLoadError', "An error occurred while loading the video file.")}</p>

0 commit comments

Comments
 (0)