docs updated
This commit is contained in:
parent
78547dbdbc
commit
147eddc9e0
16
doc/api.md
16
doc/api.md
|
@ -35,14 +35,14 @@ Constructs a new JSONEditor.
|
|||
- `{String} name`.
|
||||
Initial field name for the root node, is undefined by default.
|
||||
Can also be set using `JSONEditor.setName(name)`.
|
||||
Only applicable when mode is 'tree', 'view', or 'form'.
|
||||
Only applicable when `mode` is 'tree', 'view', or 'form'.
|
||||
- `{boolean} search`.
|
||||
Enables a search box in the upper right corner of the JSONEditor.
|
||||
True by default.
|
||||
Only applicable when mode is 'tree', 'view', or 'form'.
|
||||
Only applicable when `mode` is 'tree', 'view', or 'form'.
|
||||
- `{Number} indentation`.
|
||||
Number of indentation spaces. 4 by default.
|
||||
Only applicable when mode is 'code' or 'text'.
|
||||
Only applicable when `mode` is 'code' or 'text'.
|
||||
|
||||
- `{JSON} json`
|
||||
Initial JSON data to be loaded into the JSONEditor. Alternatively, the method `JSONEditor.set(json)` can be used to load JSON data into the editor.
|
||||
|
@ -72,6 +72,15 @@ Set JSON data.
|
|||
- `{JSON} json`
|
||||
JSON data to be displayed in the JSONEditor.
|
||||
|
||||
#### `JSONEditor.setMode(mode)`
|
||||
|
||||
Switch mode. Mode `code` requires the [Ace editor](http://ace.ajax.org/).
|
||||
|
||||
*Parameters:*
|
||||
|
||||
- `{String} mode`
|
||||
Available values: `tree`, 'view', `form`, `code`, `text`.
|
||||
|
||||
#### `JSONEditor.setName(name)`
|
||||
|
||||
Set a field name for the root node.
|
||||
|
@ -81,7 +90,6 @@ Set a field name for the root node.
|
|||
- `{String | undefined} name`
|
||||
Field name of the root node. If undefined, the current name will be removed.
|
||||
|
||||
|
||||
#### `JSONEditor.setText(jsonString)`
|
||||
|
||||
Set text data in the formatter.
|
||||
|
|
17
doc/usage.md
17
doc/usage.md
|
@ -10,16 +10,16 @@ with bower:
|
|||
|
||||
npm install bower
|
||||
|
||||
downloads:
|
||||
download:
|
||||
|
||||
[http://jsoneditoronline.org/downloads/](http://jsoneditoronline.org/downloads/)
|
||||
[http://jsoneditoronline.org/downloads/](http://jsoneditoronline.org/downloads/)
|
||||
|
||||
The library consists of three files: one javascript file, one css file and an
|
||||
image. Both full and minified version are available.
|
||||
|
||||
## Load
|
||||
|
||||
To implement JSON Editor in a web application, load the javascript and css file
|
||||
To implement JSONEditor in a web application, load the javascript and css file
|
||||
in the head of the HTML page:
|
||||
|
||||
```html
|
||||
|
@ -38,8 +38,8 @@ more detailed error messages.
|
|||
|
||||
### Code editor
|
||||
|
||||
The mode 'code' requires the [Ace editor](http://ace.ajax.org/) sources to be
|
||||
loaded. Also, the content type must be specified on the page.
|
||||
The mode 'code' requires the [Ace editor](http://ace.ajax.org/) to be loaded.
|
||||
Also, the content type must be specified on the page.
|
||||
|
||||
```html
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
|
@ -68,7 +68,7 @@ var options = {
|
|||
var editor = new jsoneditor.JSONEditor(container, options);
|
||||
```
|
||||
|
||||
To set JSON data, use set:
|
||||
To set JSON data in the editor:
|
||||
|
||||
```js
|
||||
var json = {
|
||||
|
@ -82,7 +82,7 @@ var json = {
|
|||
editor.set(json);
|
||||
```
|
||||
|
||||
To get edited JSON data, use get:
|
||||
To get JSON data from the editor:
|
||||
|
||||
```js
|
||||
var json = editor.get();
|
||||
|
@ -132,3 +132,6 @@ var json = editor.get();
|
|||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
For more examples, see the
|
||||
[examples section](https://github.com/josdejong/jsoneditor/tree/master/examples).
|
||||
|
|
Loading…
Reference in New Issue