uiwjs / react-textarea-code-editor

A simple code editor with syntax highlighting.
https://uiwjs.github.io/react-textarea-code-editor/
MIT License
480 stars 22 forks source link

Allow to prevent shortcuts processing in onKeyDown by returning false #87

Closed Badestrand closed 2 years ago

Badestrand commented 2 years ago

Hi!

I need the functionality to "submit" the code when the user presses cmd+enter on Mac or ctrl+enter on Windows. I could "submit" in the onKeyDown but the combination would insert the enter plus indention.

Now the user can return false from onKeyDown to prevent the shortcut processing.

Sorry if the format of this pull request is wrong, it's one of my first ever :)

netlify[bot] commented 2 years ago

❌ Deploy Preview for vibrant-wilson-a6f337 failed.

🔨 Explore the source changes: be999d693d33b0c09037c76e119b90f29beeea0f

🔍 Inspect the deploy log: https://app.netlify.com/sites/vibrant-wilson-a6f337/deploys/61f100c0c3d600000764a057

Badestrand commented 2 years ago

Oh I see the onKeyDown type needs to be changed as well.