Skip to content

Commit

Permalink
Prevent insertion of URLs in descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-Crow committed Jul 1, 2024
1 parent e67e203 commit a032d0a
Show file tree
Hide file tree
Showing 6 changed files with 25,816 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ runserver:

.PHONY: test
test:
$(EXEC_CMD) poetry run python manage.py test --buffer
$(EXEC_CMD) poetry run python manage.py test --buffer --parallel
18,461 changes: 18,461 additions & 0 deletions blog/migrations/0020_alter_blogentrypage_body_alter_blogindexpage_body_and_more.py

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion content_manager/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
HORIZONTAL_CARD_IMAGE_RATIOS,
LEVEL_CHOICES,
LIMITED_RICHTEXTFIELD_FEATURES,
LIMITED_RICHTEXTFIELD_FEATURES_WITHOUT_LINKS,
LINK_ICON_CHOICES,
LINK_SIZE_CHOICES,
MEDIA_WIDTH_CHOICES,
Expand Down Expand Up @@ -361,7 +362,9 @@ class TileBlock(blocks.StructBlock):
default="h3",
help_text=_("Adapt to the page layout. Defaults to heading 3."),
)
description = blocks.RichTextBlock(label=_("Content"), features=LIMITED_RICHTEXTFIELD_FEATURES, required=False)
description = blocks.RichTextBlock(
label=_("Content"), features=LIMITED_RICHTEXTFIELD_FEATURES_WITHOUT_LINKS, required=False
)
image = ImageChooserBlock(label=_("Image"), help_text=_("Prefer SVG files."), required=False)
link = LinkWithoutLabelBlock(
label=_("Link"),
Expand Down
8 changes: 8 additions & 0 deletions content_manager/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
"strikethrough",
]

LIMITED_RICHTEXTFIELD_FEATURES_WITHOUT_LINKS = [
"bold",
"italic",
"superscript",
"subscript",
"strikethrough",
]

LINK_SIZE_CHOICES = [
("fr-link--sm", _("Small")),
("", _("Medium")),
Expand Down
Loading

0 comments on commit a032d0a

Please sign in to comment.