uploading || fileInput?.click()} ondragenter={(e) => { e.preventDefault(); dragging = true; }} ondragover={(e) => e.preventDefault()} ondragleave={(e) => { if (!e.currentTarget.contains(e.relatedTarget as Node | null)) dragging = false; }} ondrop={onDrop} > {#if uploading}
Uploading…
{:else if url && !dragging}
Click, drop or paste to replace
{:else}
{dragging ? 'Drop to upload' : 'Click, drop or paste an image'}
JPG, PNG, WebP, GIF, SVG
{/if}
{#if url && !uploading}
{/if}
{#if withUrl || altHint}
{#if altHint}
Alt text
onChange({ url, alt: e.currentTarget.value })} />
{/if} {#if withUrl}
Image URL
onChange({ url: e.currentTarget.value, alt, id: '' })} />
{/if}
{:else}
Click the box to choose a file, drag an image onto it, or click it and press Ctrl+V to paste.
{@render children?.()}
{/if}
(libraryOpen = true)}>Pick from library
{#if canReadClipboard}
Paste
{/if}
{#if error}
{error}
{/if}