Given the current capabilities of the browser, you can intercept the copy event, get the selection without style and put it on the clipboard.
I tested this code with Chrome / Safari / Firefox. Believe me, this should work in MS browsers too.
document.addEventListener('copy', function(e) { const text_only = document.getSelection().toString(); const clipdata = e.clipboardData || window.clipboardData; clipdata.setData('text/plain', text_only); clipdata.setData('text/html', text_only); e.preventDefault(); });
Laizer
source share