Skip to content
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

Option to add custom event listeners to the CodeFlask textarea #123

Open
acarl005 opened this issue Jun 18, 2020 · 1 comment
Open

Option to add custom event listeners to the CodeFlask textarea #123

acarl005 opened this issue Jun 18, 2020 · 1 comment

Comments

@acarl005
Copy link

acarl005 commented Jun 18, 2020

Hello, I really like this library for it's small size. I was hoping to be able to add hotkeys to my editor, e.g. ctrl+enter to "execute" code. I tried to implement this by adding a "keydown" listener on the textarea generated by codeflask, but I was unable to prevent a newline from being inserted to the code due to the default behavior of the enter key. I tried, e.preventDefault(), but that was insufficient. Apparently I need to stop the "keydown" listener that codeflask added in order to prevent that. This is possible using e.stopImmediatePropagation(), but only if I call that method from an event handler that triggers before the other one. Since event handlers are triggered in the order they are added, this is impractical for the user. It would be nice if the CodeFlask constructor provided a way for users to add custom event handlers before the ones added by the library. I propose an implementation in my pull request #122 which allowed me to implement my hotkey. Please let me know if this is a welcome feature. I'm happy to help design this.

@acarl005
Copy link
Author

acarl005 commented Mar 6, 2022

I forked it, added the option, and published under my namespace for now. Let me know if you want to merge.

https://github.com/acarl005/CodeFlask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant