From fe2c6575864f26fb82a0349b8605711e514eb219 Mon Sep 17 00:00:00 2001 From: SysAdmin Agent Date: Sat, 21 Mar 2026 21:55:17 +0000 Subject: [PATCH] Fix Vorlagen editor: drop Summernote, use code editor for all templates (STI-82) Summernote WYSIWYG was mangling Django template syntax ({{ }}, {% %}) on save, causing content to revert to corrupted state. Switched all template types to the plain code editor textarea which preserves content exactly as-is. Also removed jQuery/Summernote JS dependencies from the editor page, and fixed getEditorContent reference in preview code. Co-Authored-By: Claude Opus 4.6 --- app/stiftung/views/vorlagen.py | 7 +- app/templates/stiftung/vorlage_editor.html | 131 ++++----------------- 2 files changed, 27 insertions(+), 111 deletions(-) diff --git a/app/stiftung/views/vorlagen.py b/app/stiftung/views/vorlagen.py index cdcb0ad..0f8feec 100644 --- a/app/stiftung/views/vorlagen.py +++ b/app/stiftung/views/vorlagen.py @@ -57,10 +57,9 @@ def vorlage_editor(request, pk): html_json = json.dumps(vorlage.html_inhalt) html_json = html_json.replace("<", "\\u003c").replace(">", "\\u003e") - # Serienbrief templates are full HTML documents with Django template tags - # ({% for %}, {% if %}) — Summernote WYSIWYG mangles these. - # Use a plain code editor textarea instead. - use_code_editor = vorlage.kategorie == "serienbrief" + # All templates contain Django template tags ({{ }}, {% %}) that + # Summernote WYSIWYG mangles on save. Use plain code editor for all. + use_code_editor = True return render(request, "stiftung/vorlage_editor.html", { "vorlage": vorlage, diff --git a/app/templates/stiftung/vorlage_editor.html b/app/templates/stiftung/vorlage_editor.html index 4fb858d..f13ea58 100644 --- a/app/templates/stiftung/vorlage_editor.html +++ b/app/templates/stiftung/vorlage_editor.html @@ -1,11 +1,7 @@ {% extends 'base.html' %} -{% load static %} - {% block title %}{{ vorlage.bezeichnung }} – Vorlage bearbeiten{% endblock %} {% block extra_css %} - -