[FIX] web_editor: fallback to plain text when pasting

Depending of the location where the "Copying" happened, only text/plain
content could be available from the clipboard component.

So if no text/html was retrieved, we should fall back to plain text
pasting.

closes #9787
opw-657137
This commit is contained in:
Nicolas Lempereur
2015-11-30 10:35:35 +01:00
parent f77e44f2dd
commit 919678bed3
@@ -2320,6 +2320,12 @@ function summernote_paste (event) {
var html = clipboardData.getData("text/html");
var $node = $('<div/>').html(html);
// if copying source did not provide html, default to plain text
if(!html) {
$node.text(clipboardData.getData("text/plain")).html(function(_, html){
return html.replace(/\r?\n/g,'<br>');
});
}
/*
remove undesirable tag