From f7fe8595a10f4afa07f1ec6ee6759b7088cd7251 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 6 Feb 2026 12:57:51 +0100 Subject: [PATCH] Add WYSIWYG text editor for Satzung content management This commit introduces a new WYSIWYG text editor for editing the Satzung text directly within the CMS. It includes functionality for saving the edited content and displays a success or error message based on the save operation's outcome. Additionally, the layout has been updated to improve the presentation of the PDF upload section and current PDF information. --- pages/cms/satzung.vue | 108 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 105 insertions(+), 3 deletions(-) diff --git a/pages/cms/satzung.vue b/pages/cms/satzung.vue index 4fc403b..1caf010 100644 --- a/pages/cms/satzung.vue +++ b/pages/cms/satzung.vue @@ -7,6 +7,7 @@ +

PDF-Upload @@ -68,14 +69,15 @@

+

- Aktuelle Satzung + Aktuelle Satzung (PDF)

-
+

PDF-Datei verfügbar @@ -94,6 +96,52 @@

+ +
+
+

+ Textfassung für die Website +

+ +
+

+ Diese HTML-Fassung wird auf der Seite „Verein → Satzung“ angezeigt. Die PDF-Version bleibt die rechtlich verbindliche Fassung. +

+ + +
+
import { ref, onMounted } from 'vue' +import RichTextEditor from '~/components/RichTextEditor.vue' definePageMeta({ middleware: 'auth', @@ -121,6 +170,8 @@ const currentPdfUrl = ref('') const lastUpdated = ref('') const message = ref('') const messageType = ref('') +const satzungContent = ref('') +const savingText = ref(false) async function loadCurrentSatzung() { try { @@ -131,6 +182,11 @@ async function loadCurrentSatzung() { // Einfache Zeitstempel-Simulation lastUpdated.value = new Date().toLocaleDateString('de-DE') } + if (satzung?.content) { + satzungContent.value = satzung.content + } else { + satzungContent.value = '' + } } catch (e) { console.error('Fehler beim Laden der aktuellen Satzung:', e) } @@ -187,5 +243,51 @@ async function uploadPdf() { } } +async function saveText() { + savingText.value = true + message.value = '' + try { + const current = await $fetch('/api/config') + const currentSeiten = current.seiten || {} + const currentSatzung = currentSeiten.satzung || {} + + const updated = { + ...current, + seiten: { + ...currentSeiten, + satzung: { + ...currentSatzung, + content: satzungContent.value || '' + } + } + } + + await $fetch('/api/config', { + method: 'PUT', + body: updated + }) + + message.value = 'Satzungstext erfolgreich gespeichert' + messageType.value = 'success' + + try { + window.showSuccessModal && window.showSuccessModal('Erfolg', 'Satzungstext erfolgreich gespeichert.') + } catch { + // Modal optional + } + } catch (error) { + const errMsg = error?.data?.message || 'Fehler beim Speichern des Satzungstextes' + message.value = errMsg + messageType.value = 'error' + try { + window.showErrorModal && window.showErrorModal('Fehler', errMsg) + } catch { + // optional + } + } finally { + savingText.value = false + } +} + onMounted(loadCurrentSatzung)