Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
774defd1
Commit
774defd1
authored
Aug 03, 2024
by
Timothy J. Baek
Browse files
fix: image preview element styling issue
parent
6657f286
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
src/lib/components/common/ImagePreview.svelte
src/lib/components/common/ImagePreview.svelte
+12
-9
No files found.
src/lib/components/common/ImagePreview.svelte
View file @
774defd1
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
let mounted = false;
let mounted = false;
let previewElement = null;
const downloadImage = (url, filename) => {
const downloadImage = (url, filename) => {
fetch(url)
fetch(url)
.then((response) => response.blob())
.then((response) => response.blob())
...
@@ -34,22 +36,23 @@
...
@@ -34,22 +36,23 @@
mounted = true;
mounted = true;
});
});
$: if (
mounted
) {
$: if (
show && previewElement
) {
if (show) {
document.body.appendChild(previewElement);
window.addEventListener('keydown', handleKeyDown);
window.addEventListener('keydown', handleKeyDown);
document.body.style.overflow = 'hidden';
document.body.style.overflow = 'hidden';
} else {
} else
if (previewElement)
{
window.removeEventListener('keydown', handleKeyDown);
window.removeEventListener('keydown', handleKeyDown);
document.body.removeChild(previewElement);
document.body.style.overflow = 'unset';
document.body.style.overflow = 'unset';
}
}
}
</script>
</script>
{#if show}
{#if show}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
<div
class="fixed top-0 right-0 left-0 bottom-0 bg-black text-white w-full min-h-screen h-screen flex justify-center z-50 overflow-hidden overscroll-contain"
bind:this={previewElement}
class="modal fixed top-0 right-0 left-0 bottom-0 bg-black text-white w-full min-h-screen h-screen flex justify-center z-[9999] overflow-hidden overscroll-contain"
>
>
<div class=" absolute left-0 w-full flex justify-between">
<div class=" absolute left-0 w-full flex justify-between">
<div>
<div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment