Skip to content

Commit

Permalink
MDL-57374 editor: Pasting plain text in Atto removes all styles/classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dasistwas committed Jan 12, 2017
1 parent 5e1014a commit 7c51958
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 18 deletions.
Expand Up @@ -1395,9 +1395,9 @@ EditorClean.prototype = {
isHTML = (types.indexOf('text/html') > -1);
}

var content;
if (isHTML) {
// Get the clipboard content.
var content;
try {
content = event.clipboardData.getData('text/html');
} catch (error) {
Expand Down Expand Up @@ -1427,10 +1427,16 @@ EditorClean.prototype = {
this.updateOriginal();
return false;
} else {
// Due to poor cross browser clipboard compatibility, the failure to find html doesn't mean it isn't there.
// Wait for the clipboard event to finish then fallback clean the entire editor.
this.fallbackPasteCleanupDelayed();
return true;
try {
// Plaintext clipboard content can only be retrieved this way.
content = event.clipboardData.getData('text');
} catch (error) {
// Something went wrong. Fallback.
// Due to poor cross browser clipboard compatibility, the failure to find html doesn't mean it isn't there.
// Wait for the clipboard event to finish then fallback clean the entire editor.
this.fallbackPasteCleanupDelayed();
return true;
}
}
} else {
// If we reached a here, this probably means the browser has limited (or no) clipboard support.
Expand Down

0 comments on commit 7c51958

Please sign in to comment.