From dc7c57575a2ec63b02397e4946232b6837292f6a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 12 May 2016 11:24:52 +0200 Subject: [PATCH] Allow h1-h6 and hr for past in. --- app/assets/javascripts/app/lib/app_post/utils.coffee | 4 ++-- public/assets/tests/html_utils.js | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index bc57cf1b1..aa8847abc 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -174,7 +174,7 @@ class App.Utils replacementTag = 'div'; # Replace all x tags with the type of replacementTag - html.find('h1, h2, h3, h4, h5, h6, textarea').each( -> + html.find('textarea').each( -> outer = @outerHTML; # Replace opening tag @@ -189,7 +189,7 @@ class App.Utils ) # remove tags & content - html.find('font, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset').remove() + html.find('font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset').remove() html diff --git a/public/assets/tests/html_utils.js b/public/assets/tests/html_utils.js index 48b709b69..5424d7666 100644 --- a/public/assets/tests/html_utils.js +++ b/public/assets/tests/html_utils.js @@ -428,8 +428,7 @@ test("htmlCleanup", function() { equal(result.html(), should, source) source = "

some link to somewhere

" - //should = "
some link to somewhere
" - should = "
some link to somewhere
" + should = "

some link to somewhere

" result = App.Utils.htmlCleanup($(source)) equal(result.html(), should, source) @@ -446,9 +445,7 @@ test("htmlCleanup", function() { equal(result.html(), should, source) source = "

some h1 for somewhere


" - //should = "
some h1 for somewhere

" - should = "
some h1 for somewhere

" - //should = '
some h1 for somewhere
' + should = "

some h1 for somewhere


" result = App.Utils.htmlCleanup($(source)) equal(result.html(), should, source)