Permalink
Browse files

Added configurable whitelist tags to WYMeditor which fixes #1202

  • Loading branch information...
parndt committed Jan 30, 2012
1 parent ab34249 commit f44241e8c81f4b82bd66ad433fb20fcef499abcf
@@ -215,7 +215,7 @@ $.extend(WYMeditor, {
"section", "article", "aside", "details", "header", "footer",
"nav", "dialog", "figure", "figcaption", "address", "hgroup",
"mark", "time", "canvas", "audio", "video", "source", "output",
"progress", "ruby", "rt", "rp", "summary", "command"),
"progress", "ruby", "rt", "rp", "summary", "command"<%= ", #{Refinery::Core.wymeditor_whitelist_tags.keys.map{|k| %Q{"#{k}"}}.join(', ')}" if Refinery::Core.wymeditor_whitelist_tags.any? %>),
KEY : {
BACKSPACE: 8,
@@ -2161,7 +2161,7 @@ WYMeditor.XhtmlValidator = {
{
"core":
{
"except":[
"except":<%= [
"base",
"head",
"html",
@@ -2170,7 +2170,7 @@ WYMeditor.XhtmlValidator = {
"script",
"style",
"title"
],
].reject{|a| Refinery::Core.wymeditor_whitelist_tags.keys.map(&:to_s).include?(a)}.inspect %>,
"attributes":[
"class",
"id",
@@ -2184,14 +2184,14 @@ WYMeditor.XhtmlValidator = {
},
"language":
{
"except":[
"except":<%= [
"base",
"br",
"hr",
"iframe",
"param",
"script"
],
].reject{|a| Refinery::Core.wymeditor_whitelist_tags.keys.map(&:to_s).include?(a)}.inspect %>,
"attributes":
{
"dir":[
@@ -2245,7 +2245,7 @@ WYMeditor.XhtmlValidator = {
},
"keyboard":
{
"except":[
"except":<%= [
"base",
"bdo",
"br",
@@ -2259,7 +2259,7 @@ WYMeditor.XhtmlValidator = {
"script",
"style",
"title"
],
].reject{|a| Refinery::Core.wymeditor_whitelist_tags.keys.map(&:to_s).include?(a)}.inspect %>,
"attributes":[
"onkeydown",
"onkeypress",
@@ -2268,7 +2268,7 @@ WYMeditor.XhtmlValidator = {
},
"mouse":
{
"except":[
"except":<%= [
"base",
"bdo",
"br",
@@ -2279,7 +2279,7 @@ WYMeditor.XhtmlValidator = {
"script",
"style",
"title"
],
].reject{|a| Refinery::Core.wymeditor_whitelist_tags.keys.map(&:to_s).include?(a)}.inspect %>,
"attributes":[
"onclick",
"ondblclick",
@@ -2800,7 +2800,8 @@ WYMeditor.XhtmlValidator = {
"62":"rt",
"63":"rp",
"64":"summary",
"65":"command"
"65":"command"<% Refinery::Core.wymeditor_whitelist_tags.each do |key, value| %>,
<%= key.inspect %>:<%= value.to_json %><% end %>
},
// Temporary skipped attributes
@@ -3873,7 +3874,7 @@ WYMeditor.XhtmlSaxListener = function()
"section", "article", "aside", "details", "header", "footer",
"nav", "dialog", "figure", "figcaption", "address", "hgroup",
"mark", "time", "canvas", "audio", "video", "source", "output",
"progress", "ruby", "rt", "rp", "summary", "command"];
"progress", "ruby", "rt", "rp", "summary", "command"<%= ", #{Refinery::Core.wymeditor_whitelist_tags.keys.map{|k| %Q{"#{k}"}}.join(', ')}" if Refinery::Core.wymeditor_whitelist_tags.any? %>];
// Defines self-closing tags.
@@ -33,4 +33,7 @@ Refinery::Core.configure do |config|
# Show/hide browser update message in the backend
# config.show_internet_explorer_upgrade_message = <%= Refinery::Core.show_internet_explorer_upgrade_message.inspect %>
# Add extra tags to the wymeditor whitelist e.g. = {'tag' => {'attributes': '1': 'href'}} or just {'tag' => {}}
# config.wymeditor_whitelist_tags = <%= Refinery::Core.wymeditor_whitelist_tags.inspect %>
end
@@ -5,7 +5,7 @@ module Core
config_accessor :rescue_not_found, :s3_backend, :base_cache_key, :site_name,
:google_analytics_page_code, :authenticity_token_on_frontend,
:menu_hide_children, :dragonfly_secret, :ie6_upgrade_message_enabled,
:show_internet_explorer_upgrade_message
:show_internet_explorer_upgrade_message, :wymeditor_whitelist_tags
self.rescue_not_found = false
self.s3_backend = false
@@ -17,5 +17,6 @@ module Core
self.dragonfly_secret = Array.new(24) { rand(256) }.pack('C*').unpack('H*').first
self.ie6_upgrade_message_enabled = true
self.show_internet_explorer_upgrade_message = false
self.wymeditor_whitelist_tags = {}
end
end

0 comments on commit f44241e

Please sign in to comment.