Enhancement: Ensure added HTML is converted back to its original format when identifying signature.

This commit is contained in:
Rolf Schmidt 2020-02-11 16:15:05 +01:00 committed by Thorsten Eckel
parent f4084fb011
commit 2236cd0367
2 changed files with 7 additions and 1 deletions

View file

@ -681,7 +681,8 @@ class App.Utils
$('<div/>').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 $('<div>').text(text).html()
if text.trim().length
contentNodes.push index
else if node.nodeType == Node.ELEMENT_NODE

View file

@ -3367,3 +3367,8 @@ test('App.Utils.clipboardHtmlInsertPreperation()', function() {
equal(App.Utils.clipboardHtmlInsertPreperation('<div><b>test</b><br> 123</div>', { mode: 'textonly', multiline: true }), 'test<br> 123')
});
test('App.Utils.signatureIdentifyByHtmlHelper()', function() {
result = App.Utils.signatureIdentifyByHtmlHelper("&lt;script&gt;alert('fish2');&lt;/script&gt;<blockquote></blockquote>")
equal(result, "&lt;script&gt;alert('fish2');&lt;/script&gt;<span class=\"js-signatureMarker\"></span><blockquote></blockquote>", 'signatureIdentifyByHtmlHelper does not reactivate alert')
});