Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up video styling #160461

Merged
merged 1 commit into from Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 5 additions & 15 deletions extensions/image-preview/media/videoPreview.css
Expand Up @@ -3,31 +3,21 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

html, body {
html {
width: 100%;
height: 100%;
text-align: center;
}

body {
padding: 5px 10px;
box-sizing: border-box;
-webkit-user-select: none;
user-select: none;
}

.video-container {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}

.container.loading,
.container.error {
width: calc(100% - 20px);
height: calc(100% - 10px);
display: flex;
justify-content: center;
align-items: center;
-webkit-user-select: none;
user-select: none;
}

.loading-indicator {
Expand Down
6 changes: 1 addition & 5 deletions extensions/image-preview/media/videoPreview.js
Expand Up @@ -26,10 +26,6 @@
let hasLoadedMedia = false;

// Elements
const container = document.createElement('div');
container.className = 'video-container';
document.body.appendChild(container);

const video = document.createElement('video');
if (settings.src !== null) {
video.src = settings.src;
Expand All @@ -44,7 +40,7 @@

document.body.classList.remove('loading');
document.body.classList.add('ready');
container.append(video);
document.body.append(video);
}

video.addEventListener('error', e => {
Expand Down
2 changes: 1 addition & 1 deletion extensions/image-preview/src/videoPreview.ts
Expand Up @@ -79,7 +79,7 @@ class VideoPreview extends MediaPreview {
<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}';">
<meta id="settings" data-settings="${escapeAttribute(JSON.stringify(settings))}">
</head>
<body class="container loading">
<body class="loading">
<div class="loading-indicator"></div>
<div class="loading-error">
<p>${localize('preview.videoLoadError', "An error occurred while loading the video file.")}</p>
Expand Down