JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 636
  • Score
    100M100P100Q104910F
  • License MIT

Ember component to view, edit and format JSON.

Package Exports

  • ember-jsoneditor

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ember-jsoneditor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Ember JSON Editor npm version

Ember component for JSON Editor to view, edit and format JSON.

Live demo: http://glavin001.github.io/ember-jsoneditor/


Installation

ember install ember-jsoneditor

Usage

{{json-editor json=model mode=mode name=name}}

Or using angle bracket invocation, available in Ember 3.4+

<JsonEditor @json={{model}} @mode={{mode}} @name={{name}} />

For a complete example, see the dummy test app in tests/dummy/app/.

Documentation

See jsoneditor for configuration details. ember-jsoneditor supports the following jsoneditor options:

Option Description Default
change maps to jsoneditor's onChange event null
error maps to jsoneditor's onError event null
expand if true, renders with json tree expanded false
history Enables history undo/redo button true
indentation number of indentation spaces 2
mode Editor mode - modes tree
modes Drop down to select editor mode. Options: 'tree', 'view', 'form', 'code', 'text' All options
name Field name for the JSON root node, null
search boolean - show editor search box true

Example for using event options

// app/templates/application.hbs

{{json-editor json=model mode=mode name=name change=(action 'itChanged') error=(action 'myError')}}
// app/controllers/application.js
import Controller from '@ember/controller';

export default Controller.extend({
   /// ....
   actions: {
    myError(error){
      alert(`Error: ${error}`)
    },

    itChanged() {
      alert("The Data Changed!");
    }
  }
})

Development

  • git clone <repository-url> this repository
  • cd my-addon
  • npm install

Linting

  • npm run lint:hbs
  • npm run lint:js
  • npm run lint:js -- --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

License

This project is licensed under the MIT License.