Admin: one image picker everywhere, with paste, drag-and-drop and a library #12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "unified-image-picker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Every image field in the admin now uses the same component, and images can be pasted or dragged in.
Why
Image fields looked and behaved differently. Blocks, emails and the logo had one uploader (a box plus URL and alt fields). Services & products had its own small thumbnail with an "Upload image" button. Neither accepted a pasted image, and the box said "drop zone" but did nothing with a dropped file.
What changed
ImageUploader.svelteis nowImagePicker.svelteand is used everywhere:media), newest first, searchable by alt text or file name, 24 at a time (MediaLibrary.svelte, new adminGET /api/media); a hand-written alt text is kept, otherwise the image's own alt text is usedpasted-20261026133019.png)mediacollection rejects are refused up front with a plain message. That means a type other than JPG/PNG/WebP/GIF/SVG, or a file over 20 MB.object-contain), so logos and portrait photos aren't cropped.childrensnippet)bind:uploading).uploadMedia(file, alt?)takes an optional alt text.Tested
imagefield gets the media id and is cleared by Remove.txtfile is refused with the messagesvelte-check(admin): 0 errors, 15 warnings (main: 17–18).imagefield gets the picked media id, the outer dialog stays open).🤖 Generated with Claude Code
https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
Admin: one image picker everywhere, with paste and drag-and-dropto Admin: one image picker everywhere, with paste, drag-and-drop and a library