mui-toolpad
mui-toolpad copied to clipboard
Deploy with keyboard enter
- Closes https://github.com/mui/mui-toolpad/issues/1164
https://user-images.githubusercontent.com/437214/196986160-a863dc7b-3e63-4ccf-8ee3-2a431cb88574.mov
@oliviertassinari in your proposed implementation you have added condition to not trigger event when shift is down, I'm not sure why exactly that is needed though. Please lemme know if that must be added for some reason
IMO there is only one drawback with my implementation - if we really want to allow deploying on mac only with cmd + enter then I should do some OS sniffing as right now we can deploy with both cmd + enter and ctrl + enter
Your Render PR Server URL is https://toolpad-pr-1188.onrender.com.
Follow its progress at https://dashboard.render.com/web/srv-cd8m86ha6gdttutvskeg.
you have added condition to not trigger event when shift is down, I'm not sure why exactly that is needed though
@bytasv I have copied the logic from the data grid. I don't know why it's here. No objections to remove it.
I'm not sure why exactly that is needed though
So that when someone somewhere sometime in the future defines the Cmd+Shift+Enter shortcut, this one doesn't accidentally fire?
@Janpot I copied it from here precisely: https://github.com/mui/mui-x/pull/5744/files#diff-f5bd889280d2db3f858e79916957e7f360ba3392b12b0c2902f9b5b4b9a84d3bR62 you can see the logic in action in this demo: https://mui.com/x/react-data-grid/recipes-editing/#multiline-editing. I had a look at the rest of the codebase, they usually don't ignore the shift key.
@cherniavskii What was the intent with the Shift key, e.g. https://github.com/mui/mui-x/pull/5744#discussion_r944358320?
So that when someone somewhere sometime in the future defines the Cmd+Shift+Enter shortcut, this one doesn't accidentally fire?
In that case we should guard that no other key is pressed, because there could also be other shortcuts in the future, that we might not be aware of right now, cmd+option+enter, cmd+tab+enter, etc.. (whatever they would do)
@Janpot please take a look. I moved key handler to the form itself, as well as tweaked DialogForm component so we could get this functionality everywhere where DialogForm is used.
@oliviertassinari
What was the intent with the Shift key, e.g. https://github.com/mui/mui-x/pull/5744#discussion_r944358320?
The intention was to for Enter and Shift + Enter to add new line and only exit editing on Escape or Ctrl + Enter
I have just used the feature to deploy, nice :)