Skip to content

Commit

Permalink
Merge pull request #16 from maxwondercorn/master
Browse files Browse the repository at this point in the history
Updated docs/fixed warnings #14
  • Loading branch information
maxwondercorn authored Apr 28, 2018
2 parents dfc5f9f + 613f02d commit 18e7f2c
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 137 deletions.
50 changes: 43 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
**Live demo**: http://glavin001.github.io/ember-jsoneditor/

---
## Installation

```
ember install ember-jsoneditor
```

## Usage

Expand All @@ -16,17 +21,48 @@ For a complete example, see the [dummy test app in `tests/dummy/app/`](https://g

## Documentation

See [jsoneditor](https://github.com/josdejong/jsoneditor/blob/master/docs/api.md) for configuration details. ember-jsoneditor supports the following configuration options:

```
mode, modes, onChange, search, history, name, indentation and onError
```
See [jsoneditor](https://github.com/josdejong/jsoneditor/blob/master/docs/api.md) 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
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

```javascript
// app/controllers/application.js
import Controller from '@ember/controller';

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

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

Breaking Changes - prior versions of [jsoneditor](https://github.com/josdejong/jsoneditor) used `change` and `error` rather than `onChange` and `onError`
```javascript
// app/templates/application.hbs

{{json-editor json=model mode=mode name=name change=(action 'itChanged') error=(action 'myError')}}

```

## Installation
## Development

* `git clone <repository-url>` this repository
* `cd my-addon`
Expand Down
Loading

0 comments on commit 18e7f2c

Please sign in to comment.