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 type { EmailBlock, EmailBlockType } from '$lib/types';
|
||||
import { emailBlockLabels } from '$lib/admin/emailBlockDefaults';
|
||||
import RichTextEditor from './RichTextEditor.svelte';
|
||||
import ImageUploader from './ImageUploader.svelte';
|
||||
import ImagePicker from './ImagePicker.svelte';
|
||||
import SegmentedControl from './SegmentedControl.svelte';
|
||||
import ColorField from './ColorField.svelte';
|
||||
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
<p class="mt-2 text-sm text-base-content/60">Use placeholders like <code>{'{{customer_first_name}}'}</code> — see the list above.</p>
|
||||
{:else if block.type === 'image'}
|
||||
<div class="space-y-4">
|
||||
<ImageUploader url={block.data.url} alt={block.data.alt} onChange={(image) => updateData(image)} />
|
||||
<ImagePicker url={block.data.url} alt={block.data.alt} onChange={(image) => updateData({ url: image.url, alt: image.alt })} />
|
||||
<SegmentedControl label="Width" options={[100, 75, 50, 25]} value={Number(block.data.width) || 100} onChange={(v) => updateData({ width: v })} formatLabel={(v) => `${v}%`} />
|
||||
<SegmentedControl label="Alignment" options={['left', 'center', 'right']} value={block.data.alignment || 'center'} onChange={(v) => updateData({ alignment: v })} />
|
||||
<label class="fieldset">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue