Giter Site home page Giter Site logo

virtual-json-viewer's Issues

Suggestion: detect when dark mode changes on the desktop

Hi Paolo,

I discovered this project in your response to my comment about JSON viewers yesterday, great job with this extension!

I've been using it for a little while today and noticed that while you already detect when the theme is changed in the options, the same doesn't happen when the system itself (the desktop really) switches modes. So changing the mode in the options applies the chosen theme immediately, but if you have "system" selected and the desktop itself switches, the theme doesn't change until the tab is reloaded.

Steps to reproduce:

  1. Start with the OS desktop in "light mode"
  2. In the options, select theme: "System theme"
  3. Open a JSON file, it's light-themed as expected
  4. Switch the desktop to "dark mode"
  5. The JSON render only becomes dark if the tab is reloaded (this happens from dark to light as well, of course)

It seems like just adding a watcher function with setInterval to detect this would likely be enough, although I can't say I'm qualified enough to make recommendations on Chrome extensions :-)

This is clearly a pretty minor issue, but I figured that since you had already gone through the effort of applying the theme immediately using a storage event listener when the options are changed, you might want to have each page do the same when the desktop switches modes too.

Feature Request: Mouseless work by keyboard shortcuts

Could you please define default keyboard shortcuts at least for

  1. Expand All
  2. Collapse All
  3. Navigate To Next Array Element
  4. Navigate To Previous Array Element
  5. Expand/Collapse Current Element
  6. Jump To JQ Filter TextBox
  7. Scroll Up
  8. Scroll Down
  9. Switch To Raw View
  10. Switch To Tree View
  11. Case Sensitive On/Off
  12. Hide/Unhide mismatch

Feature Request: Expose default expanded/collapsed in settings

Great experience with the extension so far, coming from plain JSONVue.

I'd love to be able to set expanded/collapsed as a default in settings.

Usually I like to get an overview real quick and this would save me a click or ctrl+e a bunch of times.

Set default application state in settings

It would be nice to set some default application state in extensions settings so that they are applied when opening a new page, e.g. viewer mode (tree/raw) or search visibility (all/subtree/matches).

This is quite a challenge because extensions settings are loaded in async and are not available on first render when the application state is set in session storage. Need to convince React that it can be done.

MacOS keyboard hotkeys for text selection doesn't work in plugin's Tree mode

Hi,
Could you please make it possible to use MacOS keyboard hotkeys for text selection, such as:

Select text to beginning of a line – Shift+Command+Left Arrow
Select text to end of a line – Shift+Command+Right Arrow
Select text to beginning of current word – Shift+Option+Right Arrow
Select text to end of current word – Shift+Option+Right Arrow
Select text to beginning of all text – Shift+Command+Up Arrow
Select text to end of all text – Shift+Command+Down Arrow

( or introduce some new hotkeys for text selection, for example like https://www.jetbrains.com/go/guide/tips/expanding-shrinking-selection/ ) in virtual-json-viewer plugin's in Tree mode?

Because it's currently hard to copy text in that mode, for example UUIDs

Unexpected non-whitespace character after JSON at position 7509

I get a "Unexpected non-whitespace character after JSON at position 7509" when trying to use jq filtering. If I use jq from the cmd line the filtering works fine.

Is there a way to get more debug info about the JSON in question?

The JSON does contain UTF like "GÖTEBORG" and "Højrup"

JQ is disabled on strict CSP

Description

When I load a json from a remote host served with strict Content Security Policy (CSP) rules, the JQ filter bar is not showing.
Example: https://api.github.com/users/paolosimone/repos

Details

This happens because JQ filtering relies on WebAssembly, but WASM execution is enabled only if CSP allows the execution of unsafe code ('script-src': 'unsafe-eval')... even if the wasm file is the one bundled with the extension package!

Error: Wasm code generation disallowed by embedder

References:

Why not Sandbox?

The recommended approach is to run wasm code in a sandbox and send/receive data through message passing. This solution introduces an additional overhead due to serialization/deserialization of the message content (in our case, the JSON itself).

How much overhead? Will it continue to work smoothly with ~10MB json?

Don't know, I guess we could give it a try (at least as a fallback strategy) before jumping to conclusion.

But I want to use the interactive JQ feature now

I feel you. In the meantime you could download the json (floppy disk icon) and load the file in the browser.

[BUG] Huge errors cover the search bar

Buggy behavior

When an error is too big it (sometimes) ends up hiding the full search bar. (see attached screenshot)

Expected behavior

It doesn't happen (they are output below the bar).

Screenshot

1669283063

Workaround

Reload the window.

jq doesn't work

 curl https://wttr.in/Detroit\?format\=j1 | jq '.weather|.[].date'                                  [2022-05-19 23:58:52]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48898  100 48898    0     0   112k      0 --:--:-- --:--:-- --:--:--  115k
"2022-05-19"
"2022-05-20"
"2022-05-21"

works as expected but Virtual Json Viewer plugin throws Unexpected string in JSON at position 13 error for the same expression:
.weather|.[].date

See also https://jqplay.org/s/DHmRZozMOj9
Could you please fix it and make my life easier?

Enable the plugin on json content, regardless of content type

Request from @RVFET (original comment here)

Would be great if the extension could fallback to trying to parse the response into json even when content type does not match any json format, just as a last chance, it'd be a great addition. I'm aware that it'd create some performance bottlenecks since it'd need to check every page you visit but it could be an option that we can toggle, or perhaps manual wildcard/regex based custom website matching could help a ton, too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.