When using this code to copy a htmlLink to the clipboard:
htmlLink = "<a href='#'>link</a>";
var copyDiv = document.createElement('div');
copyDiv.contentEditable = true;
document.body.appendChild(copyDiv);
copyDiv.innerHTML = htmlLink;
copyDiv.unselectable = "off";
copyDiv.focus();
document.execCommand('SelectAll');
document.execCommand("Copy", false, null);
document.body.removeChild(copyDiv);
After pasting into a tinyMCE text editor, unwanted styles are applied:
<a style="box-sizing: border-box; color: #1bc5bd; text-decoration-line: none; background-color: #f3f6f9; transition: color 0.15s ease 0s, background-color 0.15s ease 0s, border-color 0.15s ease 0s, box-shadow 0.15s ease 0s, -webkit-box-shadow 0.15s ease 0s; font-family: iransans, tahoma; font-size: 13px; outline: 0px !important;" href="#">link</a>
These styles are coming from public website css classes that I do not want.
How can I remove these unwanted styles?