josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
818 stars 108 forks source link

Disable line wrapping or only show the first x characters of a long text #310

Closed bookzhan closed 6 months ago

bookzhan commented 9 months ago

If line breaks are used to display the content, it would be inconvenient to view the structure of the JSON.

image
josdejong commented 9 months ago

Thanks for your suggestion. I can think of two solutions:

  1. Introduce an option "lineWrap" that you can turn on/off yourself.
  2. Only show the first say 100 characters, followed by a button [...] which, when clicked, will show the remaining characters. This is how browser consoles do it, and I think that is a much nicer solution since you don't have to toggle options upfront. We could apply this to the tree and table mode too.

Anyone interested in thinking this through and implement a solution? Help would be welcome.

josdejong commented 6 months ago

Moving this idea to the Discussions > Ideas section since we are not actively working on it. Help implementing this would be very welcome.