On copy paste and key press formatting issue in editable content

186 Views Asked by At

i have any issue when i copy some rich text from like web page or word file to editable content in my site <p contenteditable> edit-table content </p> than copy text font property auto set here like text color , style etc

so i use below code for set original formatting

 var c1 =  $(document).on('paste', '[contenteditable]', function (e) {
      if(c1){
        e.preventDefault();
        var text = e.originalEvent.clipboardData.getData("text/plain");
        document.execCommand("insertHTML", false, text);
        return false;
      }
}); 

and its working when paste , but if i remove text and type on content than pasted text property set here like their color , css , font-bold etc , not to set plain/text, so how to set rich text to plain/text in type on editable content ?

0

There are 0 best solutions below