New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About recording key down event. #582
Comments
@Rexime https://uiwjs.github.io/react-codemirror/#/extensions/events import CodeMirror from '@uiw/react-codemirror';
import { events } from '@uiw/codemirror-extensions-events';
function App() {
const [scrollTop, setScrollTop] = useState(0);
const eventExt = events.scroll({
scroll: (evn) => {
setScrollTop(evn.target.scrollTop);
},
});
const eventExt2 = events.content({
focus: (evn) => {
console.log('focus');
},
blur: (evn) => {
console.log('blur');
},
});
return <CodeMirror value="console.log('hello world!');" height="200px" extensions={[eventExt, eventExt2]} />;
}
export default App; |
Thanks a lot!! |
@jaywcjlove I wanted to save every key code event, but I did not know how to do it. The example you provided was not for that purpose. Is there any example of that? Thank you so much! |
@Rexime I'm not sure what you need react-codemirror/core/src/index.tsx Lines 57 to 58 in 24285de
|
@jaywcjlove I need to collect this kind of info https://www.toptal.com/developers/keycode. Like everytime I press a key, it will be recorded. I'm not sure if it's possible for the codemirror. |
const eventExt2 = events.content({
keydown: (evn) => {
console.log('keydown');
},
}); |
@jaywcjlove Thank you soooo much!!!! You really made my day! |
Is there any way to record every key-down event when using the editor in my webapp?
The text was updated successfully, but these errors were encountered: