diff --git a/app-admin/src/lib/admin/BlockList.svelte b/app-admin/src/lib/admin/BlockList.svelte
index 761a929..3054347 100644
--- a/app-admin/src/lib/admin/BlockList.svelte
+++ b/app-admin/src/lib/admin/BlockList.svelte
@@ -1,64 +1,115 @@
-
-
-
- {#each blocks as block, i (block.id)}
-
onSelect(block.id)}
- ondragstart={() => (dragIndex = i)}
- ondragover={(e) => e.preventDefault()}
- ondrop={() => { if (dragIndex !== null && dragIndex !== i) onMove(dragIndex, i); dragIndex = null; }}
- >
-
-
☰
-
{labels[block.type] ?? block.type}
-
-
-
- {/each}
-
+
+
+
+ {#each blocks as block, i (block.id)}
+ - {
+ dragIndex = i;
+ // Firefox won't start a drag without data.
+ e.dataTransfer?.setData('text/plain', block.id);
+ if (e.dataTransfer) e.dataTransfer.effectAllowed = 'move';
+ }}
+ ondragover={(e) => {
+ e.preventDefault();
+ dropIndex = i;
+ }}
+ ondragleave={() => dropIndex === i && (dropIndex = null)}
+ ondrop={(e) => {
+ e.preventDefault();
+ drop(i);
+ }}
+ ondragend={() => {
+ dragIndex = null;
+ dropIndex = null;
+ }}
+ >
+ ⠿
+
+
+
+ {:else}
+ - No blocks yet — use “Add block”.
+ {/each}
+
diff --git a/app-admin/src/lib/admin/unsaved.svelte.ts b/app-admin/src/lib/admin/unsaved.svelte.ts
new file mode 100644
index 0000000..6841fbd
--- /dev/null
+++ b/app-admin/src/lib/admin/unsaved.svelte.ts
@@ -0,0 +1,15 @@
+import { beforeNavigate } from '$app/navigation';
+
+/**
+ * Warn before leaving a page with unsaved edits. Call during component init.
+ * Form submissions are allowed through (they are the save).
+ */
+export function warnOnUnsavedChanges(isDirty: () => boolean) {
+ beforeNavigate(({ cancel, type }) => {
+ if (!isDirty() || type === 'form') return;
+ // Closing the tab/reloading: browsers only allow their own prompt,
+ // which `cancel()` triggers. confirm() is ignored there.
+ if (type === 'leave') return cancel();
+ if (!confirm('You have unsaved changes. Leave anyway?')) cancel();
+ });
+}
diff --git a/app-admin/src/routes/emails/[key]/+page.svelte b/app-admin/src/routes/emails/[key]/+page.svelte
index b429335..2cad426 100644
--- a/app-admin/src/routes/emails/[key]/+page.svelte
+++ b/app-admin/src/routes/emails/[key]/+page.svelte
@@ -1,9 +1,9 @@
-
-Edit {page.title} | CMS
-
-
-
-{#if showPreview}
-
-
-
-
-
-
-
-
-
-{/if}
+
+
+Edit {title || 'page'} | CMS
+
+ showPreview && e.key === 'Escape' && (showPreview = false)} />
+
+
+
+{#if showPreview}
+
+
+
+
+
+
+
+
Unsaved draft preview
+
+
+
+
+
+{/if}