diff --git a/app/src/lib/admin/editors/ImageUploader.svelte b/app/src/lib/admin/editors/ImageUploader.svelte
index ed062c8..42da314 100644
--- a/app/src/lib/admin/editors/ImageUploader.svelte
+++ b/app/src/lib/admin/editors/ImageUploader.svelte
@@ -1,39 +1,105 @@
-
- {#if url}
-

+
+
+
fileInput?.click()}
+ onkeydown={(e) => e.key === 'Enter' && fileInput?.click()}
+ >
+ {#if uploading}
+
+
Uploading…
+ {:else if localUrl}
+
+

+
+
+ {:else}
+
+
Upload image
+
PNG, JPG, WebP
+ {/if}
+
+
+ {#if error}
+
{error}
{/if}
-
-
-
- {#if uploading}
{/if}
+
+
+
+
+
diff --git a/app/src/lib/admin/editors/RichTextEditor.svelte b/app/src/lib/admin/editors/RichTextEditor.svelte
index c00f38c..569fa04 100644
--- a/app/src/lib/admin/editors/RichTextEditor.svelte
+++ b/app/src/lib/admin/editors/RichTextEditor.svelte
@@ -39,6 +39,14 @@
if (url) exec('createLink', url);
}
+ function clearFormatting() {
+ if (!browser) return;
+ editorEl?.focus();
+ document.execCommand('formatBlock', false, '
');
+ document.execCommand('removeFormat');
+ emit();
+ }
+
function handleInput() {
emit();
}
@@ -53,6 +61,7 @@
+
({}));
+ throw new Error(err?.message || `Upload failed (${res.status})`);
+ }
+ return res.json();
}
diff --git a/app/src/routes/admin/+layout.svelte b/app/src/routes/admin/+layout.svelte
index 2c68e7a..b6ccf6f 100644
--- a/app/src/routes/admin/+layout.svelte
+++ b/app/src/routes/admin/+layout.svelte
@@ -10,7 +10,7 @@
diff --git a/app/src/routes/admin/api/upload/+server.ts b/app/src/routes/admin/api/upload/+server.ts
new file mode 100644
index 0000000..681ee47
--- /dev/null
+++ b/app/src/routes/admin/api/upload/+server.ts
@@ -0,0 +1,27 @@
+import { env } from '$env/dynamic/public';
+import { error, json } from '@sveltejs/kit';
+import type { RequestHandler } from './$types';
+
+export const POST: RequestHandler = async ({ request, locals }) => {
+ const formData = await request.formData();
+ const file = formData.get('file') as File | null;
+ const alt = formData.get('alt') as string | null;
+
+ if (!file) {
+ throw error(400, 'No file provided');
+ }
+
+ const uploadForm = new FormData();
+ uploadForm.append('file', file);
+ if (alt) uploadForm.append('alt', alt);
+
+ try {
+ const record = await locals.pb.collection('media').create(uploadForm);
+ const publicUrl = env.PUBLIC_POCKETBASE_URL || 'http://localhost:8090';
+ const url = `${publicUrl}/api/files/${record.collectionId}/${record.id}/${record.file}`;
+ return json({ record, url });
+ } catch (e) {
+ console.error('Media upload error:', e);
+ throw error(500, 'Upload failed');
+ }
+};
diff --git a/app/src/routes/admin/globals/+page.svelte b/app/src/routes/admin/globals/+page.svelte
index db47d54..6390685 100644
--- a/app/src/routes/admin/globals/+page.svelte
+++ b/app/src/routes/admin/globals/+page.svelte
@@ -42,7 +42,10 @@
Footer
{#each ['businessName', 'tagline', 'address', 'phone', 'email', 'copyrightText'] as field}
-
+
{/each}
Social links
{#each footer.socialLinks || [] as link, i}
diff --git a/docker-compose.yml b/docker-compose.yml
index 0eb7614..c6a3ed7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,7 +6,7 @@ services:
ports:
- "8090:80"
volumes:
- - ./pocketbase/pb_data:/pb/pb_data
+ - pocketbase:/pb/pb_data
app:
build:
@@ -22,3 +22,7 @@ services:
ORIGIN: http://localhost:3000
ports:
- "3000:3000"
+
+volumes:
+ pocketbase:
+
\ No newline at end of file