How do I clear the label and style of text pasted into an contenteditable element?

when you copy text from somewhere else, you copy it along with the style. how do you clear the original label and style?

May.18,2022

compatible with ie11,edge,chrome,firefox,safari:

var element = document.createElement('div');
    element.contentEditable = true;
    element.addEventListener("paste", function (e){
        e.stopPropagation();
        e.preventDefault();
        var text = '', event = (e.originalEvent || e);
        if (event.clipboardData && event.clipboardData.getData) {
            text = event.clipboardData.getData('text/plain');
        } else if (window.clipboardData && window.clipboardData.getData) {
            text = window.clipboardData.getData('Text');
        }
        if (document.queryCommandSupported('insertText')) {
            document.execCommand('insertText', false, text);
        } else {
            document.execCommand('paste', false, text);
        }
    });

function textFormat (e) {
e.preventDefault()
var text
var clp = (e.originalEvent || e).clipboardData
if (clp === undefined || clp === null) {
  text = window.clipboardData.getData('text') || ''
  if (text !== '') {
    if (window.getSelection) {
      var newNode = document.createElement('span')
      newNode.innerHTML = text
      window.getSelection().getRangeAt(0).insertNode(newNode)
    } else {
      document.selection.createRange().pasteHTML(text)
    }
  }
} else {
  text = clp.getData('text/plain') || ''
  if (text !== '') {
    document.execCommand('insertText', false, text)
  }
}

}

  :
  document.getElementById('editArea').addEventListener('paste', function (e) {
    textFormat (e)
  })
  

reference: https://stackoverflow.com/que...
example: (may not open)
http://jsfiddle.net/ch6yn/

here is an example I wrote myself:


</div>
Menu