CarlosNZ/json-edit-react

Feature request -- trigger for JSON editor

tony-gutierrez opened this issue · 5 comments

A common use case is probably to initially paste in a chunk of json, and then edit it in the editor.

There is an edit button next to root that goes to a nice textarea for pasting in JSON. I would like to be able to trigger that view externally with my own button.

Currently I workaround by using tabs, one with the editor and one with my own textarea.

Good suggestion, thanks. It would have to be a single trigger for only the outermost/root JSON editor, right?

Would need to do something like this:

https://www.geeksforgeeks.org/how-to-call-function-inside-child-component-from-parent-component-using-useref-hook/

Just putting that here as a note to self.

There's been another request for an external trigger for something else (can't remember what right now), so I'll probably do this with a range of internal functions that can be triggered via a single prop.

Hi @tony-gutierrez -- I've implemented this functionality in the latest beta if you'd like to try it out: https://www.npmjs.com/package/json-edit-react/v/1.25.0-beta1

See the documentation for "External control".

Let me know if you have any feedback before I make an official release (non-beta).

Done in #182 and released in v1.25.0