Closed kozlovskisarmands closed 3 days ago
Let me rephrase what I understand:
json-viewer
, and it will accept and update the content?ctrl+A
Hello @pionxzh!
Thanks for the detailed explanation. I believe that the implementation of this request might be more suitable to be put on userland. json-viewer
shouldn't listen to these global actions as a "component".
Here are a couple of suggestions:
paste
events. This field would take the pasted content, figure out what it is, and update the data. It's worth looking into whether there's a simpler way to do this, this is what I have tried before.Ctrl + A
event and highlight the text. Even if the text gets selected correctly, the copied content might not look right as JSON because of how the elements are shown.I wanted to make a quick demo for you, but Next.js just stopped working on StackBlitz 😞. I'll try to fix it this week.
Thanks for answer! First method actually seems doable, I'll try. What about JSON Viewer supporting onPaste prop itself?
That would be kind of weird. You can always update the input value out of the component. paste
is something that happened out of the JSON viewer, so it makes no sense to have an onPaste
callback.
Is it possible to use usual text editor functionality, like: copy, paste, select all etc.? (Ctrl+C/V/A) Idea would be to copy whole object to clipboard and then just with Ctrl+V to paste it inside the JSON Viewer, is it possible and/or will it be supported in future?