Class: JSONEditorView

JSONEditorView()

Edits JSON values and keeps incomplete drafts.

Screenshot

Constructor

new JSONEditorView()

Since:
  • 2.41.0
Source:

Extends

  • Backbone.View

Members

className

Source:

events

Source:

Methods

focus()

Focus the editor without changing its text selection
Source:

hasPendingChanges() → {boolean}

Check whether the draft differs from its last accepted value.
Source:
Returns:
Whether changes are pending
Type
boolean

initialize(options)

Store the initial JSON as text so caller edits can't change it.
Parameters:
Name Type Description
options object View options
Properties
Name Type Description
value * A JSON value
label string The visible field label
Source:

parse() → {Object}

Parse the draft without accepting it. Show syntax errors in the editor.
Source:
Returns:
Parsed value or syntax error
Type
Object

render()

Source:

setValue(value)

Replace the draft and baseline with an accepted or discarded value.
Parameters:
Name Type Description
value * A JSON value
Source:

showError(message)

Show syntax errors or caller feedback as text.
Parameters:
Name Type Description
message string The error message, or an empty string to clear it
Source:

template() → {string}

The HTML template for the view.
Source:
Returns:
The template string
Type
string

updateDraft(event)

Update the draft and clear old feedback. Fire change:draft when edits become pending or return to the accepted text.
Parameters:
Name Type Description
event Event The input event
Source: