Browser Undo Breaks With Custom Event Handler

Discussion in 'JavaScript' started by Heretic86, Aug 6, 2021.

  1. #1
    Vanilla Javascript...

    Hopefully pretty easy. I have a Text Area that I use a custom Event Handler in to modify the pasted content.

    function doPasteThang(e){
    e.preventDefault();

    //... some code here

    myTextArea.value = modifedString;
    }

    So that all works. However, once something has been pasted, I can no longer use a Browsers CTRL + Z to Undo the last thing entered. I am missing something, and not really sure what I am missing. Like a mutation? new CustomEvent?

    Can anyone suggest what I am missing?
     
    Heretic86, Aug 6, 2021 IP