Files
openfoodnetwork/app/services/trix_scrubber.rb
Jean-Baptiste Bellet 6b29f7e3c5 Sanitize content with a new TrixScrubber
specifically made for trix editor with its allowed tags
2023-05-26 15:19:27 +02:00

14 lines
393 B
Ruby

# frozen_string_literal: true
class TrixScrubber < Rails::Html::PermitScrubber
ALLOWED_TAGS = ["p", "b", "strong", "em", "i", "a", "u", "br", "del", "h1", "blockquote", "pre",
"ul", "ol", "li"].freeze
ALLOWED_ATTRIBUTES = ["href", "target", "src", "alt"].freeze
def initialize
super
self.tags = ALLOWED_TAGS
self.attributes = ALLOWED_ATTRIBUTES
end
end