mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2026-07-06 15:35:50 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user