Enhancement: Ensure added HTML is converted back to its original format when identifying signature.
This commit is contained in:
parent
f4084fb011
commit
2236cd0367
2 changed files with 7 additions and 1 deletions
|
@ -681,7 +681,8 @@ class App.Utils
|
||||||
$('<div/>').html(message).contents().each (index, node) ->
|
$('<div/>').html(message).contents().each (index, node) ->
|
||||||
text = $(node).text()
|
text = $(node).text()
|
||||||
if node.nodeType == Node.TEXT_NODE
|
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
|
if text.trim().length
|
||||||
contentNodes.push index
|
contentNodes.push index
|
||||||
else if node.nodeType == Node.ELEMENT_NODE
|
else if node.nodeType == Node.ELEMENT_NODE
|
||||||
|
|
|
@ -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')
|
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("<script>alert('fish2');</script><blockquote></blockquote>")
|
||||||
|
|
||||||
|
equal(result, "<script>alert('fish2');</script><span class=\"js-signatureMarker\"></span><blockquote></blockquote>", 'signatureIdentifyByHtmlHelper does not reactivate alert')
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue