josdejong / jsoneditor

A web-based tool to view, edit, format, and validate JSON
http://jsoneditoronline.org
Apache License 2.0
11.23k stars 2.02k forks source link

Selecting tree as normal text and scrolling horizontally with middle mouse instead of selecting nodes with it. #1591

Closed AbdulTheActivePiecer closed 3 weeks ago

AbdulTheActivePiecer commented 1 month ago

Hi there, I have a JsonEditor instance with "tree" mode and is read only.

Is there a way to make selection work like it was in "preview" mode before, where you could select the content as text?

Another thing related to selection, clicking middle mouse and going horizontally or vertically also selects nodes, is there a way to stop that?

Cheers, awesome project.

josdejong commented 3 weeks ago

Thanks for your suggestions/questions

About selecting when read-only in "tree" mode: in tree mode, for example the commas and double quotes are not rendered, so you cannot select a useful section of the JSON like in preview mode. Do you mean like you would like to "magically" select a valid JSON section instead? This will be tricky to implement in jsoneditor, though it is implemented in the successor of this library: svelte-jsoneditor.

About clicking the middle-mouse: I think we could implement a fix for that, yes. Help would be welcome.

AbdulTheActivePiecer commented 3 weeks ago

Hi there @josdejong, so the middle mouse issue needs to be fixed on both here and https://github.com/josdejong/svelte-jsoneditor/, would you like me to open a ticket there as well for that and change the title of this issue to only include the middle mouse issue and not the text selection in tree ?

josdejong commented 3 weeks ago

svelte-jsoneditor indeed has the same behavior. Yes please open an issue there too fix the middle-mouse button behavior, thanks!

josdejong commented 3 weeks ago

Fixed now in v10.0.4 via 9029fb91baf8fb0284e1f5cbdf3715e32c42e85b.

I've also implemented a fix for svelte-jsoneditor via https://github.com/josdejong/svelte-jsoneditor/commit/d0e7f4cce8046c1c0101127556378aa6da770122, so no need to open a separate issue in that project.