From 07d60ebdc25fdf964773ce9f481be83aa3db6621 Mon Sep 17 00:00:00 2001 From: benweet Date: Wed, 28 May 2014 09:03:40 +0100 Subject: [PATCH] Added sanitizer extension --- public/res/extensions/htmlSanitizer.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/res/extensions/htmlSanitizer.js b/public/res/extensions/htmlSanitizer.js index e34b4afa..e10c8277 100644 --- a/public/res/extensions/htmlSanitizer.js +++ b/public/res/extensions/htmlSanitizer.js @@ -16,13 +16,9 @@ define([ converter.hooks.chain("postConversion", function(html) { buf = []; html.split('
').forEach(function(sectionHtml) { - try { - htmlParser(sectionHtml, htmlSanitizeWriter(buf, function(uri, isImage) { - return !/^unsafe/.test(sanitizeUri(uri, isImage)); - })); - } - catch(e) { - } + htmlParser(sectionHtml, htmlSanitizeWriter(buf, function(uri, isImage) { + return !/^unsafe/.test(sanitizeUri(uri, isImage)); + })); buf.push('
'); }); return buf.slice(0, -1).join(''); @@ -98,6 +94,9 @@ define([ // Special Elements (can contain anything) var specialElements = makeMap("script,style"); + // benweet: Add iframe + blockElements.iframe = true; + var validElements = _.extend({}, voidElements, blockElements, @@ -113,8 +112,9 @@ define([ 'scope,scrolling,shape,size,span,start,summary,target,title,type,' + 'valign,value,vspace,width')); - // benweet: Add id + // benweet: Add id and allowfullscreen (YouTube iframe) validAttrs.id = true; + validAttrs.allowfullscreen = true; /* * HTML Parser By Misko Hevery (misko@hevery.com)