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

Expose currently expanded paths #417

Open
sallaben opened this issue Mar 17, 2024 · 3 comments
Open

Expose currently expanded paths #417

sallaben opened this issue Mar 17, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@sallaben
Copy link

Hi! Is it possible to get a list of the currently expanded paths from the editor instance in any way?

@josdejong
Copy link
Owner

The predecessor, jsoneditor has a callback onExpand that is invoked when a path is expanded/collapsed. We can look into implementing something like that.

More broadly thinking: it would be neat to implement an API where you can fully control the expanded state, similarly to how you can pass content and selection, with 2-way binding in Svelte, and extra getter/setter methods for the vanilla editor. This may require refactoring the data models of the expanded state, not sure, but we'll have to think that through before making it public.

@josdejong josdejong added the enhancement New feature or request label Mar 20, 2024
@nbabaka2023
Copy link

That would be great! I used a predecessor but found this project more powerful for my needs!

@sallaben
Copy link
Author

The predecessor, jsoneditor has a callback onExpand that is invoked when a path is expanded/collapsed. We can look into implementing something like that.

More broadly thinking: it would be neat to implement an API where you can fully control the expanded state, similarly to how you can pass content and selection, with 2-way binding in Svelte, and extra getter/setter methods for the vanilla editor. This may require refactoring the data models of the expanded state, not sure, but we'll have to think that through before making it public.

Thanks for the reply! That is my intended usage too - I'd like to be able to store the entire editor state (content, selection, expanded, and any other pieces) in localstorage so that the editor loads the same way it was previously set to, persisting across page refresh.

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

3 participants