'onKeyDown and ref is not supported in HighlightWithinTextarea from package react-highlight-within-textarea

I am trying to build a react web app in my use case includes: Detect the key pressed by the user in the HighlightWithinTextarea component from react-highlight-within-textarea package.

but the component is not supporting onKeyDown and ref.

Can someone suggest a way to implement onKeyDown and ref in HighlightWithinTextarea package url: react-highlight-within-textarea

My sample code:

import { HighlightWithinTextarea } from "react-highlight-within-textarea";
.....
const inputAreaRef = useRef(null);
......

<HighlightWithinTextarea
value={userInput}
type="text"
id="inputArea"
tabIndex="0"
highlight={highlight}
onChange={onChange2}
ref={inputAreaRef}
contentEditable="true"
onKeyDown={() => alert("key pressed")}
className="input"
/>
......


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source