Merge pull request #874 from basecamp/flavorjones/fix-lightbox-attributes-2

Fix my fix to Action Text sanitizer config
This commit is contained in:
Mike Dalessio
2025-08-08 15:19:36 -04:00
committed by GitHub
+4 -3
View File
@@ -1,7 +1,8 @@
Rails.application.config.after_initialize do
Rails::HTML5::SafeListSanitizer.allowed_tags.merge(%w[ s table tr td th thead tbody details summary video source])
Rails::HTML5::SafeListSanitizer.allowed_tags.merge(%w[ s table tr td th thead tbody details summary video source ])
Rails::HTML5::SafeListSanitizer.allowed_attributes.merge(%w[ data-turbo-frame controls type width data-action data-lightbox-target data-lightbox-url-value ])
ActionText::ContentHelper.allowed_tags = Rails::HTML5::SafeListSanitizer.allowed_tags
ActionText::ContentHelper.allowed_attributes = Rails::HTML5::SafeListSanitizer.allowed_attributes
# ugh, see https://github.com/rails/rails/issues/54478 which I need to fix upstream --mike
ActionText::ContentHelper.allowed_tags = Rails::HTML5::SafeListSanitizer.allowed_tags + [ ActionText::Attachment.tag_name, "figure", "figcaption" ]
ActionText::ContentHelper.allowed_attributes = Rails::HTML5::SafeListSanitizer.allowed_attributes + ActionText::Attachment::ATTRIBUTES
end