-
Notifications
You must be signed in to change notification settings - Fork 117
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
Feature-Request: onSelect #163
Comments
as a small addon to that: this feature is used already internally for the breadcrumb navigation (just not exposed). |
Yes, good idea! Thanks for your suggestion Sebastian. Two thoughts in this regard:
|
The pull request #229 add updateSelection to JSONEditor addresses the feature to change the selection. Regards Christof |
Thanks @sagIoTPower. I would like to first think through #163 (comment) before merging your PR, we may want to go a different direction to cater for the three different modes. Do you have thoughts on a good approach to that? |
Before thinking about a concept for a harmonised approach, I have some observations/ questions:
Is my understanding correct? |
Thanks for your input @sagIoTPower. Unified solution: from an end-user point of view it would be ideal to not have to worry different modes, and just having "the" content and "the" selection. However, I think a unified selection is not practically possible because the There are indeed more methods that are not supported for all modes, like Selection APII think we can go two ways: either create different methods for the different modes, like interface Selection {
type: SelectionType, // text or tree, and possibly in the future we need a table specific model
selection: TreeSelection
}
new JSONEditor({
target: ...,
props: {
// initial state
mode,
content,
selection,
// listener for selection changes
onSelect: (selection) => {
// ...
}
}
})
// a method to change the selection
editor.setSelection(selection) Refactoring the Selection modelI think we should also refactor the current data model for API for the full StateOn more thought: instead of separate properties, listeners and methods for EDIT: also, the expanded state would be useful to control. |
Having spent a while reading the jsoneditor docs and trying to use them with svelte-jsoneditor by accident, I've realised that the onEvent event handler no longer exists - I was hoping to add a context-sensitive help (pulled from jsonschema) alongside my editor as users click through the document... is this intended to replace that? |
@howardjones can you please open a new issue to discuss this? I want to keep this issue focused about |
So onSelect is not an event fired when a new field is focused? |
The I would like to elaborate but let's please discuss it in a separate issue. |
FYI: I'm working on refactoring the |
A new property |
@josdejong, thank you for implementing this feature. 👏
and it works for my scenario. |
Thanks, good to hear 👌 |
add a
onSelect(path: Path, value: any): void
similar toonClassName(path: Path, value: any): string | undefined
.Usecase: I have two editors open and when I select one element in the one editor I want to evaluate the path and value and use it to jump to another element in the second editor.
The text was updated successfully, but these errors were encountered: