I am trying to sanitize a paste in a contentEditable div. That is, the code should look something like this:
$('#content').bind('paste',function(e) {
Ideally, I could analyze the embedded text and reformat it in a way that is suitable for the site, but I do not know how to do it.
Alternatively, it would be convenient for me to embed text as plain text (as opposed to HTML), but I don't know how to do this.
Iβm a little less pleased with the decision to have a window with a text field, asking the user to insert it in this text area and then place the text in the content at the previous cursor position. I know how to do this, but I want to avoid this.
And itβs completely inconvenient for me to simply prevent the user from inserting with e.preventDefault() .
Thanks in advance.
source share