Fixes Javascript crash when plain text is pasted as html (e. g. a phone number without html tags) into rich text field. Follow up for #2645.
This commit is contained in:
parent
a9dd937968
commit
f41aa097ce
1 changed files with 5 additions and 1 deletions
|
@ -290,7 +290,11 @@
|
||||||
// E.g. Excel provides images of the spreadsheet along with HTML.
|
// E.g. Excel provides images of the spreadsheet along with HTML.
|
||||||
// While some browsers make images available in clipboard as HTML,
|
// While some browsers make images available in clipboard as HTML,
|
||||||
// sometimes wrapped in multiple nodes.
|
// sometimes wrapped in multiple nodes.
|
||||||
if($(clipboardData.getData('text/html')).text().trim().length == 0) {
|
|
||||||
|
var rawHTML = clipboardData.getData('text/html')
|
||||||
|
var parsedHTML = jQuery(jQuery.parseHTML(rawHTML))
|
||||||
|
|
||||||
|
if(parsedHTML.text().trim().length == 0) {
|
||||||
item = jQuery.grep(clipboardData.items, function(item){
|
item = jQuery.grep(clipboardData.items, function(item){
|
||||||
return item.kind == 'file' && (item.type == 'image/png' || item.type == 'image/jpeg')
|
return item.kind == 'file' && (item.type == 'image/png' || item.type == 'image/jpeg')
|
||||||
})[0]
|
})[0]
|
||||||
|
|
Loading…
Reference in a new issue