I want to prevent pictures from being pasted into a content editable <div>
. I have already tried the following but it doesn't filter out pictures, it only removes the styling of words.
div.addEventListener("paste", e => {
e.preventDefault();
let text = (e.originalEvent || e).clipboardData.getData('text/plain');
document.execCommand("insertHTML", false, text);
});
How can i prevent it from happening without using the HTML textarea element? Thanks in advance