diff --git a/src/open_inwoner/components/templates/components/Header/WarningHeader.html b/src/open_inwoner/components/templates/components/Header/WarningHeader.html index 135f1969cb..00229747e9 100644 --- a/src/open_inwoner/components/templates/components/Header/WarningHeader.html +++ b/src/open_inwoner/components/templates/components/Header/WarningHeader.html @@ -10,6 +10,6 @@
{% icon icon="error_outlined" outlined=True %} - {{ warning_banner_text }} + {{ warning_banner_text|safe }}
diff --git a/src/open_inwoner/conf/base.py b/src/open_inwoner/conf/base.py index 0e4dc6db2f..5a6ecf50fc 100644 --- a/src/open_inwoner/conf/base.py +++ b/src/open_inwoner/conf/base.py @@ -901,6 +901,9 @@ MAIL_EDITOR_BASE_HOST = BASE_URL CKEDITOR_CONFIGS = { + "default": { + "allowedContent": True, + }, "mail_editor": { "allowedContent": True, "contentsCss": [ @@ -908,7 +911,7 @@ ], # Enter the css file used to style the email. "height": 600, # This is optional "entities": False, # This is added because CKEDITOR escapes the ' when you do an if statement - } + }, } # diff --git a/src/open_inwoner/configurations/migrations/0067_alter_siteconfiguration_warning_banner_text.py b/src/open_inwoner/configurations/migrations/0067_alter_siteconfiguration_warning_banner_text.py new file mode 100644 index 0000000000..8c57e9223b --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0067_alter_siteconfiguration_warning_banner_text.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2.11 on 2024-05-15 14:44 + +from django.db import migrations + +import ckeditor.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("configurations", "0066_merge_20240405_1100"), + ] + + operations = [ + migrations.AlterField( + model_name="siteconfiguration", + name="warning_banner_text", + field=ckeditor.fields.RichTextField( + blank=True, + help_text="Text will be displayed on the warning banner", + verbose_name="Warning banner text", + ), + ), + ] diff --git a/src/open_inwoner/configurations/models.py b/src/open_inwoner/configurations/models.py index d10605fbd8..8b021a166f 100644 --- a/src/open_inwoner/configurations/models.py +++ b/src/open_inwoner/configurations/models.py @@ -8,6 +8,7 @@ from django.dispatch import receiver from django.utils.translation import gettext_lazy as _ +import ckeditor.fields as ckeditor_fields from colorfield.fields import ColorField from django_jsonform.models.fields import ArrayField from filer.fields.image import FilerImageField @@ -68,7 +69,7 @@ class SiteConfiguration(SingletonModel): default=False, help_text=_("Whether the warning banner should be displayed"), ) - warning_banner_text = models.TextField( + warning_banner_text = ckeditor_fields.RichTextField( verbose_name=_("Warning banner text"), blank=True, help_text=_("Text will be displayed on the warning banner"), diff --git a/src/open_inwoner/scss/components/WarningHeader/WarningHeader.scss b/src/open_inwoner/scss/components/WarningHeader/WarningHeader.scss index 1983bbdf59..febbc64e48 100644 --- a/src/open_inwoner/scss/components/WarningHeader/WarningHeader.scss +++ b/src/open_inwoner/scss/components/WarningHeader/WarningHeader.scss @@ -24,4 +24,10 @@ max-width: var(--spacing-giant); } } + + // override paragraph styling from CKEditor + p { + margin: 0; + padding: 0; + } }