Closed Pareder closed 2 years ago
In onKeyDown handler by default there is a check for event.code property (https://github.com/uiwjs/react-textarea-code-editor/blob/main/src/shortcuts.ts#L7), but this property was added to event only in React v17 (https://blog.saeloun.com/2021/04/23/react-keyboard-event-code.html). Before that we can get it via event.nativeEvent.code accessor. In peerDependencies you have "react": ">=16.9.0" (https://github.com/uiwjs/react-textarea-code-editor/blob/main/package.json#L66), so maybe it is better to extend check in shortcuts method? Something like that:
onKeyDown
event.code
event.nativeEvent.code
peerDependencies
"react": ">=16.9.0"
shortcuts
const code = event.code || event.nativeEvent.code;
Great job, thank you!
@Pareder Upgrade v2.0.3
v2.0.3
In
onKeyDown
handler by default there is a check forevent.code
property (https://github.com/uiwjs/react-textarea-code-editor/blob/main/src/shortcuts.ts#L7), but this property was added to event only in React v17 (https://blog.saeloun.com/2021/04/23/react-keyboard-event-code.html). Before that we can get it viaevent.nativeEvent.code
accessor. InpeerDependencies
you have"react": ">=16.9.0"
(https://github.com/uiwjs/react-textarea-code-editor/blob/main/package.json#L66), so maybe it is better to extend check inshortcuts
method? Something like that: