Skip to content
Permalink
Browse files

Fixes Javascript crash when plain text is pasted as html (e. g. a pho…

…ne number without html tags) into rich text field. Follow up for #2645.
  • Loading branch information
Mantas Masalskis authored and zammad-sync committed Nov 27, 2019
1 parent a9dd937 commit f41aa097ce9f2bcf8b0bac271cbdc0539e597a42
Showing with 5 additions and 1 deletion.
  1. +5 −1 app/assets/javascripts/app/lib/base/jquery.contenteditable.js
@@ -290,7 +290,11 @@
// E.g. Excel provides images of the spreadsheet along with HTML.
// While some browsers make images available in clipboard as HTML,
// 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){
return item.kind == 'file' && (item.type == 'image/png' || item.type == 'image/jpeg')
})[0]

0 comments on commit f41aa09

Please sign in to comment.
You can’t perform that action at this time.