TexteaInc / json-viewer

not only a JSON viewer
https://viewer.textea.io
MIT License
457 stars 36 forks source link

Submit input value on Enter key #396

Closed kozlovskisarmands closed 1 month ago

kozlovskisarmands commented 1 year ago

Hello! Would it be possible to add functionality that Enter key on input press submits the values instead of putting in a new line? And also outside click out of Input field, would close the editing process. Thanks in advance :)

pionxzh commented 1 year ago

You are right. The current new line behavior is quite weird. And I think we can have an option to enable the clicking out.

pionxzh commented 1 year ago

I have added support for Enter and Esc keyboard control. I still need to think about the clicking-out behavior. Either leave it to the user-land or provide a config to enable it.

pionxzh commented 1 month ago

I think this one can be achieved by extending the built-in editor. There is an abortEditing function in props that can be called to exit the editing state. Closing. 🙏