Admin: one image picker everywhere, with paste and drag-and-drop
ImageUploader becomes ImagePicker and replaces the separate image field on Services & products, so every image (blocks, card images, block backgrounds, emails, the logo, services) is picked the same way. Besides choosing a file it takes an image dragged onto the box or pasted (Ctrl+V while the picker has focus, or the Paste button where the browser allows reading the clipboard). Pasted images get a dated file name and no alt text made from "image.png"; files the media collection won't take are refused with a message before uploading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
4b50067a4a
commit
93d4863cfc
8 changed files with 200 additions and 156 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import { browser } from '$app/environment';
|
||||
import { enhance } from '$app/forms';
|
||||
import { fly, slide } from 'svelte/transition';
|
||||
import ImageUploader from '$lib/admin/editors/ImageUploader.svelte';
|
||||
import ImagePicker from '$lib/admin/editors/ImagePicker.svelte';
|
||||
import { PRIVACY_PAGE_SLUG } from '$lib/admin/privacyTemplate';
|
||||
import { shopLinks } from '$lib/types';
|
||||
import type { SubmitFunction } from '@sveltejs/kit';
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
<input type="hidden" name="data" value={JSON.stringify(header)} />
|
||||
<h2 class="mb-4 text-2xl font-bold">Header</h2>
|
||||
<h3 class="mb-2 font-bold">Logo</h3>
|
||||
<ImageUploader url={header.logo?.url} alt={header.logo?.alt} onChange={(image) => (header.logo = image)} />
|
||||
<ImagePicker url={header.logo?.url} alt={header.logo?.alt} altHint="Usually the business name" onChange={(image) => (header.logo = { url: image.url, alt: image.alt })} />
|
||||
<h3 class="mt-6 mb-2 font-bold">Home page</h3>
|
||||
<select class="select w-full" aria-label="Home page" bind:value={header.homePage}>
|
||||
<option value="">— Select a page —</option>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue