Merge pull request #2876 from javierm/ckeditor4_update

Ckeditor4 update
This commit is contained in:
Raimond Garcia
2018-09-17 23:02:50 +02:00
committed by GitHub
16 changed files with 126 additions and 27 deletions

View File

@@ -0,0 +1,9 @@
class AdminWYSIWYGSanitizer < WYSIWYGSanitizer
def allowed_tags
super + %w[img]
end
def allowed_attributes
super + %w[alt src style]
end
end

View File

@@ -1,10 +1,14 @@
class WYSIWYGSanitizer
def allowed_tags
%w[p ul ol li strong em u s a h2 h3]
end
ALLOWED_TAGS = %w(p ul ol li strong em u s)
ALLOWED_ATTRIBUTES = []
def allowed_attributes
%w[href]
end
def sanitize(html)
ActionController::Base.helpers.sanitize(html, tags: ALLOWED_TAGS, attributes: ALLOWED_ATTRIBUTES)
ActionController::Base.helpers.sanitize(html, tags: allowed_tags, attributes: allowed_attributes)
end
end