/ui/layers/panels/jsonEditor

The layer panels module exports a default method to open a dialog with a layerJSE element to update the mapp layer.

Requires

Methods

(inner) jsonEditor(layer) → {HTMLElement}

The jsonEditor method asigns a jsoneditor element to the decorated layer and a removeCallback method to close the dialog.

The button returned from the panel method will display a modal dialog with the jsoneditor element.

The 'Update Layer' button of the jsoneditor element will attempt to update the layer object with the json content of the editor.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer.

Returns:

A button to toggle the jsoneditor dialog.

Type: 
HTMLElement

(async, inner) updateLayer(jse, layer) → {Promise.<layer>}

The method extracts the content from the provided jsoneditor argument and attempts to decorate a new layer from the json content.

The view of the new layer is inserted before the view of the current layer, which may be in a listview group. The current layer is removed and the new layer is assigned with the key of the current layer to the mapview.layers.

Parameters:
NameTypeDescription
jsejse

A jsoneditor instance.

layerlayer

A decorated mapp layer.

Returns:

The new decorated mapp layer.

Type: 
Promise.<layer>