tulios / json-viewer

It is a Chrome extension for printing JSON and JSONP.
https://chrome.google.com/webstore/detail/json-viewer/gbmdgpbipfallnflgajpaliibnhdgobh
MIT License
3.29k stars 672 forks source link

fix: handle chrome's pretty print button #341

Closed bukowskiadam closed 9 months ago

bukowskiadam commented 9 months ago

Trying to fix #340

I tested it locally, and it works.

A way to build that worked for me:

  1. use node v10 - fnm use 10 or nvm use 10
  2. npm i and ignore node-gyp errors
  3. npm run release (builds minified files) and load unpacked like stated in the readme file
bukowskiadam commented 9 months ago

Now I see that the second version of the code breaks some pages. It removed the first div from any page opened 😂

RandTrawick commented 9 months ago

@bukowskiadam, I tested your update and it works perfectly for me in Chrome Version 117.0.5938.62 (Official Build) (arm64).

It definitely would be good to update the sass version at some point to get rid of that crusty old node-gyp dependency that caused so many years of pain.

tulios commented 9 months ago

Thanks for the PR. Im planning to address the issue this weekend

chinhoe commented 9 months ago

@bukowskiadam would it be possible to retrieve the 'pre' node using a for loop? just in case there are more elements in the future.

bukowskiadam commented 9 months ago

@chinhoe I think there is more to improve in the code. Now, with my fixed code, I get two scrollbars like this 👇🏻

image

Looping over elements might break some pages as I did blindly removing the first element if it's not a PRE. Every direct child (body > pre) would be then a victim.

emrearslan commented 9 months ago

we understand again in these few days that the plugin is very useful 😄 when will the pr be merged?

bukowskiadam commented 9 months ago

True story, closing. I confirm that the newest stable chrome is back to normal because they got rid of the checkbox. Thank you all for the attention!

chulapitta commented 7 months ago

I think the Pretty Print checkbox is back in the latest Chrome update?