You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 usinge.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 theCodeFlask
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.The text was updated successfully, but these errors were encountered: