josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
897 stars 108 forks source link

Set selection and listen to selection changes? #172

Closed sagIoTPower closed 1 year ago

sagIoTPower commented 1 year ago

Hi,

I would like to use the svelte-jsoneditor to create some mapping component. Mapping from a JSON source to JSON target format. This can be seen on the screen shot below. In order to migrate to this editor I look for two features:

  1. highlight/select a element in the displayed JSON document, something like setSelection(path)
  2. register a callback if an element is selected in the editor: something like onSelection(path)

The current mapper works as follows:

  1. you select an element in the source document: pathSource
  2. you select an element in the target document: pathTarget
  3. this create a mapping

Is something like this possible with the current editor? I have read the other issues and got the impression that for 1. there exists already a feature request #163.

Regards Christof

Generic_MQTT_MappingTemplate
josdejong commented 1 year ago

Thanks for your inputs! Yes #163 is to discuss both getting and setting a selection. I've updated my comment there to clarify that a bit more. Let's continue the discussion there to keep it focused.