VulcanJS / Vulcan

πŸŒ‹ A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.89k forks source link

Shortcut to submit a form (new NovaForm event handler) #1471

Closed xavxyz closed 8 years ago

xavxyz commented 8 years ago

This is a starter issue, highly inspired by the great job of the folks at Hoodie. πŸ‘

πŸŽƒπŸ™€πŸ‘•πŸ”­πŸ˜» Hacktoberfest: Trick or Treat!

If you haven’t yet, sign up for Hacktoberfest to earn an exclusive T-Shirt.

We are sure you can learn a neat trick or two in the process on how to hack & customize Telescope Nova! πŸ”­

πŸ€” What you will need to know

Meteor, React.

🎯 The Goal

What about being able to submit a post or a comment after typing with a standard shortcut: Ctrl + Enter (or Cmd + Enter on Mac) ? πŸ‘Š

Forms in Nova work thanks to NovaForm (in nova:forms package), which uses Formsy under the hood.

To enable this feature (proposed in #850), we would need an event handler on NovaForm component that calls its method submitForm if the right keys are pressed.

No changes are needed on submitForm: it uses directly the data of Formsy, that can be retrieved with this.refs.form.getModel() (see Formsy API docs).

Useful link : React Events

πŸ“‹ Step by Step

Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub.


Ping us here, in the Telescope Slack room or on Twitter if you have any questions πŸ˜‰

aszx87410 commented 8 years ago

Hi, I want to work on this issue, can I?

aszx87410 commented 8 years ago

Already finished. Please let me know if there is any problem, thanks.

xavxyz commented 8 years ago

Awesome, thanks a lot! Merged πŸ”˜πŸ‘Š