Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide array index #490

Closed
mysticek opened this issue Jul 25, 2024 · 7 comments
Closed

Hide array index #490

mysticek opened this issue Jul 25, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@mysticek
Copy link

Hello, is there a way, how to hide array index numbers? Just show array items without 1, 2, 3... indexesM

@pionxzh
Copy link
Collaborator

pionxzh commented Jul 25, 2024

There is a KeyRenderer config. But returning empty or null in that function would still show the colon which makes it look weird.
image

Things we can do to achieve what you want:

  1. If the key is empty, hide the colon.
  2. Wait for proposal: passing parent to the onAdd fn #469

@pionxzh pionxzh added the enhancement New feature or request label Jul 25, 2024
@pionxzh
Copy link
Collaborator

pionxzh commented Jul 25, 2024

Another solution would be adding data-type to the dom so that you can do it in pure css.

@mysticek
Copy link
Author

mysticek commented Jul 30, 2024

Thank you.

Second question - is possible to show commas after values? (::after selector is not solution, because you cant copy it)

@pionxzh

@pionxzh
Copy link
Collaborator

pionxzh commented Jul 30, 2024

Comma... I think this one can be added to the package. Can you submit another request for it?

@pionxzh
Copy link
Collaborator

pionxzh commented Aug 13, 2024

#496 has added support for hiding arbitrary index/key. I will prepare a demo after it gets released.

@pionxzh
Copy link
Collaborator

pionxzh commented Aug 26, 2024

released 3.5.0 with this feature. Let me prepare the demo this week.

@pionxzh
Copy link
Collaborator

pionxzh commented Aug 27, 2024

Open in StackBlitz

image

Please check the demo with

  1. hiding array index
  2. show comma

Btw, you can also select and copy valid JSON without hiding the array index. Try it out!

@pionxzh pionxzh closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants