triggerdotdev / jsonhero-web

JSON Hero is an open-source, beautiful JSON explorer for the web that lets you browse, search and navigate your JSON files at speed. 🚀. Built with 💜 by the Trigger.dev team.
https://jsonhero.io
Apache License 2.0
9.01k stars 482 forks source link

feat: add collapse all tree nodes functionality #159

Closed SSHari closed 1 year ago

SSHari commented 1 year ago

PR to add a collapse all keyboard shortcut to the tree view. I know the associated issue mentions using the following shortcut keys:

The issue is that on a Mac, in a browser, the Command + Option + Left Arrow shortcut combination switches browser tabs. I think trying to overload that and prevent the browser's default behavior may be a little bit odd. Since that's the case, I opted to make the shortcut Option + Left Arrow on Mac and Alt + Left Arrow on Windows.

If we prefer a different shortcut combination then it should be easy enough to change. One other thing is that whatever we land on, we should consider adding a section to the footer with the shortcut combination and an explanation for what it does:

image

I was originally planning to head down this path and add the section, but without confirmation on the shortcut keys and without a valid SVG for the combination, it just didn't make sense at this point.

Bounty: /claim #149

ericallam commented 1 year ago

This looks great! Will test and merge it in shortly 👍