diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index 956889672..fd9b23bef 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -681,7 +681,8 @@ class App.Utils $('
').html(message).contents().each (index, node) -> text = $(node).text() if node.nodeType == Node.TEXT_NODE - res.push text + # convert text back to HTML as it was before + res.push $('
').text(text).html() if text.trim().length contentNodes.push index else if node.nodeType == Node.ELEMENT_NODE diff --git a/public/assets/tests/html_utils.js b/public/assets/tests/html_utils.js index 37234a117..d208dd8cc 100644 --- a/public/assets/tests/html_utils.js +++ b/public/assets/tests/html_utils.js @@ -3367,3 +3367,8 @@ test('App.Utils.clipboardHtmlInsertPreperation()', function() { equal(App.Utils.clipboardHtmlInsertPreperation('
test
123
', { mode: 'textonly', multiline: true }), 'test
123') }); +test('App.Utils.signatureIdentifyByHtmlHelper()', function() { + result = App.Utils.signatureIdentifyByHtmlHelper("<script>alert('fish2');</script>
") + + equal(result, "<script>alert('fish2');</script>
", 'signatureIdentifyByHtmlHelper does not reactivate alert') +});