I want to paste text selected from a certain document(pdf, docx, html), into a div of contenteditable type.
Now I want to remove all the formatting of the clipboard text before it is rendered. So, the final content pasted should be a plain text.
An analogue of this scenario can be pasting content into Windows Notepad.
How could this be done using AngularJs. Or there exist any other javascript library to acomplish this.
Update: I can use the following code to get the clipboard as a text.
editor.addEventListener("paste", function(e) {
// cancel paste
e.preventDefault();
// get text representation of clipboard
var text = e.clipboardData.getData("text/plain");
// insert text manually
document.execCommand("insertHTML", false, text);
});
But i dont know how and where to add this code in AngularJs.