feat: add image paste support

Add image paste functionality allowing users to paste images directly
from the clipboard as files. Uses the standard DataTransfer API
(clipboardData.items) for cross-browser compatibility.

On the download page, images are now displayed as previews in addition
to the download option.

Also fix Rust 2024 never-type-fallback compatibility by adding turbofish
type annotations to redis crate calls.
This commit is contained in:
Stefan Meinecke
2026-05-12 14:59:30 +02:00
parent d40bbd25ea
commit 3e3d528d5a
4 changed files with 297 additions and 12 deletions
@@ -80,6 +80,15 @@
</button>
<small> {file.type} {prettyBytes(file.size)}</small>
</div>
{#if file.type.startsWith('image/')}
{#key file.name}
<img
src={URL.createObjectURL(new File([file.contents], file.name, { type: file.type }))}
alt={file.name}
class="preview"
/>
{/key}
{/if}
{/each}
<Button onclick={download}>{$t('show.download_all')}</Button>
{/if}
@@ -130,4 +139,13 @@
margin-bottom: 0.5rem;
word-wrap: break-word;
}
.preview {
display: block;
max-width: 100%;
max-height: 60vh;
margin-bottom: 0.5rem;
border-radius: 0.25rem;
border: 2px solid var(--ui-bg-1);
}
</style>