customize the collapsed render text for a node
Awesome component, thank you!
Wondering if there is any way to modify what gets rendered for collapsed nodes. For arrays it shows 'n items' and for objects it shows 'n props'.
Eg for objects I would want something like prop of "renderCollapsedDesc" which could be Func[node], so could render for example {Object, key=${node.name}} to give more information on the node when in collapsed mode.
I didn't see this as configurable so wanted to check. If it's not supported, would you be able to point me to where that formatting is done in the code so I could take a stab at it?
Thanks for your suggestion. The displayed text is hard coded right now, the code is here for objects:
https://github.com/josdejong/svelte-jsoneditor/blob/baf8ebe791c3042dc2f38d6f0a0ada9a00ae52fd/src/lib/components/modes/treemode/JSONNode.svelte#L755-L758
And here for arrays:
https://github.com/josdejong/svelte-jsoneditor/blob/baf8ebe791c3042dc2f38d6f0a0ada9a00ae52fd/src/lib/components/modes/treemode/JSONNode.svelte#L629-L642
I'm open to implementing a configuration option to customize the text with a callback function. Maybe people would like to be able to fully hide the text, that could also be an option.
Thanks, I'll take a look!
An easy way to hide and/or change the view of properties/items of an object is exactly my current task... Would be really nice config feature in my opinion.
Moving this idea to the Discussions > Ideas section since we are not actively working on it. Help implementing this would be welcome.