I need to catch historyUndo and historyRedo from InputEvent. The problem is, my contentEditable div is giving me FormEvent not InputEvent.
const inputChanged = (e: InputEvent) => {
//Error here because e is FormEvent type not InputEvent
if(e.inputType === 'historyUndo' || e.inputType === 'historyRedo')
{
....
}
}
return <div contentEditable={true} onInput={(e) => inputChanged(e)}>
....
</div>
How can I catch InputEvent on div contentEditable?
What you want to do is access the
nativeEventproperty of the event. Something similar to this.