I have added a custom event listener to copy/cut of text from an element (say elementId). Now when I copy from elementId and paste on word the functionality works fine. But when I copy from the elementId and paste on notepad, the paste doesn't work. By doesn't work I mean nothing is pasted at all.
document.getElementById(config.editorEl).addEventListener('copy', function(event) {
const range = window.getSelection().getRangeAt(0);
const content = range.cloneContents();
const div = document.createElement('div');
div.appendChild(content);
$(div)
.find('.remove_this_class')
.contents()
.unwrap();
event.clipboardData.setData('text/html', div.innerHTML);
event.preventDefault();
});
Summary: The custom copy/cut handler doesn't work properly.