Files
openfoodnetwork/app/services/content_scrubber.rb
Jean-Baptiste Bellet 6d68460950 Factorize sanitizer options between edition and displaying
by using the same `app/services/content_scrubber.rb`
2023-01-26 18:21:27 +01:00

17 lines
372 B
Ruby

# frozen_string_literal: true
class ContentScrubber < Rails::Html::PermitScrubber
ALLOWED_TAGS = ["p", "b", "strong", "em", "i", "a", "u", "img"].freeze
ALLOWED_ATTRIBUTES = ["href", "target", "src", "alt"].freeze
def initialize
super
self.tags = ALLOWED_TAGS
self.attributes = ALLOWED_ATTRIBUTES
end
def skip_node?(node)
node.text?
end
end