[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user