I want to figure out how many characters are deleted by the user in a contenteditable div. I have a component that is rendered like this.
render(): JSX.Element | null {
return (
<div className="input-box">
<div
contentEditable={true}
id={this.props.textId}
/>
</div>
);
}
onContentChange
is added as an eventListener
inside componentDidMount()
.
I'm trying to print the event inside onContentChange
, but I am not able to distinguish when the user has deleted one character or more, how can I find this out using the event or any other method?