From db9433b60090d388cd45e629de38ec08a1768a76 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Fri, 14 May 2010 10:43:54 -0300 Subject: [PATCH] Allowing videos from tv softwarelivre on tinymce --- app/views/shared/tiny_mce.rhtml | 2 +- test/unit/tiny_mce_article_test.rb | 7 ++++++- vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/shared/tiny_mce.rhtml b/app/views/shared/tiny_mce.rhtml index a60f7cc..c5d1d4b 100644 --- a/app/views/shared/tiny_mce.rhtml +++ b/app/views/shared/tiny_mce.rhtml @@ -22,7 +22,7 @@ tinyMCE.init({ paste_insert_word_content_callback : "convertWord", paste_use_dialog: false, apply_source_formatting : true, - extended_valid_elements : "applet[style|archive|codebase|code|height|width],comment,iframe[src|style|allowtransparency|frameborder]", + extended_valid_elements : "applet[style|archive|codebase|code|height|width],comment,iframe[src|style|allowtransparency|frameborder|width|height]", content_css: '/stylesheets/tinymce.css', language: <%= tinymce_language.inspect %>, entity_encoding: 'raw' diff --git a/test/unit/tiny_mce_article_test.rb b/test/unit/tiny_mce_article_test.rb index ec97428..1996ccf 100644 --- a/test/unit/tiny_mce_article_test.rb +++ b/test/unit/tiny_mce_article_test.rb @@ -59,11 +59,16 @@ class TinyMceArticleTest < Test::Unit::TestCase assert_equal "", article.body end - should 'remove iframe if it is not from itheora' do + should 'remove iframe if it is not from itheora or softwarelivre' do article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => "") assert_equal "", article.body end + should 'allow iframe if it is from stream.softwarelivre.org' do + article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => "") + assert_equal "", article.body + end + #TinymMCE convert config={"key":(.*)} in config={"key":(.*)} should 'not replace " with &quot; when adding an Archive.org video' do article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => " ") diff --git a/vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb b/vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb index e43d19e..073bf5a 100644 --- a/vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb +++ b/vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb @@ -12,7 +12,9 @@ HTML::WhiteListSanitizer.module_eval do final_text = final_text.gsub(/(.*)/, '\1') #FIX for itheora comments if final_text =~ /iframe/ - unless final_text =~ // + itheora_video = // + sl_video = // + unless (final_text =~ itheora_video || final_text =~ sl_video) final_text = final_text.gsub(//, '') end end -- libgit2 0.21.2