-
Notifications
You must be signed in to change notification settings - Fork 393
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
fix(codemirror): use correct method to indent the code on tab key press #527
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 72d4a6a:
|
Size changessandpack-react
Details
sandpack-client
Details
|
@@ -197,11 +197,27 @@ export const CodeMirror = React.forwardRef<CodeMirrorRef, CodeMirrorProps>( | |||
const customCommandsKeymap: KeyBinding[] = [ | |||
{ | |||
key: "Tab", | |||
run: insertTab, | |||
run: (view): boolean => { | |||
indentMore(view); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As indentMore
returns true, this was preventing running the next command. So, here I'm grabbing the custom keybinding and running before returning it.
I'm not fully confident, but it seems to work
@danilowoz Woohoo! Thanks for looking into this 😄 Really appreciate it! |
Hey @joshwcomeau, this PR addresses your bug report about the ability to override the
extensionsKeymap
. Turns out, it was a mistake on our side and we were literally inserting atab
instead of regularly indenting the line. So, this should fix your original problem and make the CodeEditor behavior more consistent.Closes #522