Commit db9433b60090d388cd45e629de38ec08a1768a76
Committed by
Joenio Costa
1 parent
c384c3e8
Exists in
master
and in
29 other branches
Allowing videos from tv softwarelivre on tinymce
(ActionItem1533)
Showing
3 changed files
with
10 additions
and
3 deletions
Show diff stats
app/views/shared/tiny_mce.rhtml
@@ -22,7 +22,7 @@ tinyMCE.init({ | @@ -22,7 +22,7 @@ tinyMCE.init({ | ||
22 | paste_insert_word_content_callback : "convertWord", | 22 | paste_insert_word_content_callback : "convertWord", |
23 | paste_use_dialog: false, | 23 | paste_use_dialog: false, |
24 | apply_source_formatting : true, | 24 | apply_source_formatting : true, |
25 | - extended_valid_elements : "applet[style|archive|codebase|code|height|width],comment,iframe[src|style|allowtransparency|frameborder]", | 25 | + extended_valid_elements : "applet[style|archive|codebase|code|height|width],comment,iframe[src|style|allowtransparency|frameborder|width|height]", |
26 | content_css: '/stylesheets/tinymce.css', | 26 | content_css: '/stylesheets/tinymce.css', |
27 | language: <%= tinymce_language.inspect %>, | 27 | language: <%= tinymce_language.inspect %>, |
28 | entity_encoding: 'raw' | 28 | entity_encoding: 'raw' |
test/unit/tiny_mce_article_test.rb
@@ -59,11 +59,16 @@ class TinyMceArticleTest < Test::Unit::TestCase | @@ -59,11 +59,16 @@ class TinyMceArticleTest < Test::Unit::TestCase | ||
59 | assert_equal "<iframe src=\"http://itheora.org\"></iframe>", article.body | 59 | assert_equal "<iframe src=\"http://itheora.org\"></iframe>", article.body |
60 | end | 60 | end |
61 | 61 | ||
62 | - should 'remove iframe if it is not from itheora' do | 62 | + should 'remove iframe if it is not from itheora or softwarelivre' do |
63 | article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='anything'></iframe>") | 63 | article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='anything'></iframe>") |
64 | assert_equal "", article.body | 64 | assert_equal "", article.body |
65 | end | 65 | end |
66 | 66 | ||
67 | + should 'allow iframe if it is from stream.softwarelivre.org' do | ||
68 | + article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://stream.softwarelivre.org'></iframe>") | ||
69 | + assert_equal "<iframe src=\"http://stream.softwarelivre.org\"></iframe>", article.body | ||
70 | + end | ||
71 | + | ||
67 | #TinymMCE convert config={"key":(.*)} in config={"key":(.*)} | 72 | #TinymMCE convert config={"key":(.*)} in config={"key":(.*)} |
68 | should 'not replace " with &quot; when adding an Archive.org video' do | 73 | should 'not replace " with &quot; when adding an Archive.org video' do |
69 | article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => "<embed flashvars='config={"key":"\#$b6eb72a0f2f1e29f3d4"}'> </embed>") | 74 | article = TinyMceArticle.create!(:profile => profile, :name => 'article', :abstract => 'abstract', :body => "<embed flashvars='config={"key":"\#$b6eb72a0f2f1e29f3d4"}'> </embed>") |
vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb
@@ -12,7 +12,9 @@ HTML::WhiteListSanitizer.module_eval do | @@ -12,7 +12,9 @@ HTML::WhiteListSanitizer.module_eval do | ||
12 | final_text = final_text.gsub(/<!--.*\[if IE\]-->(.*)<!--\[endif\]-->/, '<!–-[if IE]>\1<![endif]-–>') #FIX for itheora comments | 12 | final_text = final_text.gsub(/<!--.*\[if IE\]-->(.*)<!--\[endif\]-->/, '<!–-[if IE]>\1<![endif]-–>') #FIX for itheora comments |
13 | 13 | ||
14 | if final_text =~ /iframe/ | 14 | if final_text =~ /iframe/ |
15 | - unless final_text =~ /<iframe(.*)src=(.*)itheora.org(.*)<\/iframe>/ | 15 | + itheora_video = /<iframe(.*)src=(.*)itheora.org(.*)<\/iframe>/ |
16 | + sl_video = /<iframe(.*)src=\"http:\/\/stream.softwarelivre.org(.*)<\/iframe>/ | ||
17 | + unless (final_text =~ itheora_video || final_text =~ sl_video) | ||
16 | final_text = final_text.gsub(/<iframe(.*)<\/iframe>/, '') | 18 | final_text = final_text.gsub(/<iframe(.*)<\/iframe>/, '') |
17 | end | 19 | end |
18 | end | 20 | end |