Skip to content

Commit 28a4968

Browse files
committed
merge upstream
2 parents d54993a + 160c82f commit 28a4968

19 files changed

+4647
-1020
lines changed

HISTORY.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,28 @@
33
https://github.com/josdejong/jsoneditor
44

55

6-
## not yet published, version 5.26.4
6+
## not yet released, version 5.28.0
77

8+
- Implemented new option `maxVisibleChilds` to customize the maximum number
9+
childs that is rendered by default. Thanks @20goto10.
10+
11+
12+
## 2019-01-16, version 5.27.1
13+
14+
- Improved navigating deeply nested paths via the navigation bar, see #619.
15+
Thanks @meirotstein.
16+
- Sdd title from schema description to show the tips for user input.
17+
Thanks @tylerchen.
18+
- Fix JSON Schema not resolving refs `$ref`, and not creating enum dropdowns.
19+
Thanks @tylerchen.
20+
21+
22+
## 2019-01-05, version 5.27.0
23+
24+
- Implemented customizing object and array names via a new option
25+
`onNodeName`. Thanks @bnanchen.
26+
- Visibility of schema validation errors at the bottom of mode code and text
27+
are now toggleable. Thanks @meirotstein.
828
- Fixed text of the mode switcher not being translated. Thanks @antfu.
929

1030

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
JSON Editor
22
https://github.com/josdejong/jsoneditor
33

4-
Copyright (C) 2011-2018 Jos de Jong
4+
Copyright (C) 2011-2019 Jos de Jong
55

66

77
Licensed under the Apache License, Version 2.0 (the "License");

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Version](https://img.shields.io/npm/v/jsoneditor.svg)](https://www.npmjs.com/package/jsoneditor)
44
[![Downloads](https://img.shields.io/npm/dm/jsoneditor.svg)](https://www.npmjs.com/package/jsoneditor)
5-
![Maintenance](https://img.shields.io/maintenance/yes/2018.svg)
5+
![Maintenance](https://img.shields.io/maintenance/yes/2019.svg)
66
[![License](https://img.shields.io/github/license/josdejong/jsoneditor.svg)](https://github.com/josdejong/jsoneditor/blob/master/LICENSE)
77
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjosdejong%2Fjsoneditor.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjosdejong%2Fjsoneditor?ref=badge_shield)
88

docs/api.md

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,21 @@ Constructs a new JSONEditor.
7171
The callback will only be triggered on changes made by the user, not in case of programmatic changes via the functions `set`, `setText`, `update`, or `updateText`.
7272
See also callback function `onChangeJSON(json)`.
7373

74-
- `{function} onEditable(node)`
74+
- `{function} onEditable({ field, value, path })`
7575

7676
Set a callback function to determine whether individual nodes are editable or read-only. Only applicable when option `mode` is `tree`, `text`, or `code`.
7777

78-
In case of mode `tree`, the callback is invoked as `editable(node)`, where `node` is an object `{field: string, value: string, path: string[]}`. The function must either return a boolean value to set both the nodes field and value editable or read-only, or return an object `{field: boolean, value: boolean}` to set set the read-only attribute for field and value individually.
78+
In case of mode `tree`, the callback is invoked as `editable(node)`, where the first parameter is an object:
79+
80+
```
81+
{
82+
field: string,
83+
value: string,
84+
path: string[]
85+
}
86+
```
87+
88+
The function must either return a boolean value to set both the nodes field and value editable or read-only, or return an object `{field: boolean, value: boolean}` to set set the read-only attribute for field and value individually.
7989

8090
In modes `text` and `code`, the callback is invoked as `editable(node)` where `node` is an empty object (no field, value, or path). In that case the function can return false to make the text or code editor completely read-only.
8191

@@ -89,6 +99,24 @@ Constructs a new JSONEditor.
8999
Set a callback function triggered right after the mode is changed by the user. Only applicable when
90100
the mode can be changed by the user (i.e. when option `modes` is set).
91101

102+
- `{function} onNodeName({ path, type, size })`
103+
104+
Customize the name of object and array nodes. By default the names are brackets with the number of childs inside,
105+
like `{5}` and `[32]`. The number inside can be customized. using `onNodeName`.
106+
107+
The first parameter is an object containing the following properties:
108+
109+
```
110+
{
111+
path: string[],
112+
type: 'object' | 'array',
113+
size: number
114+
}
115+
```
116+
117+
The `onNodeName` function should return a string containing the name for the node. If nothing is returned,
118+
the size (number of childs) will be displayed.
119+
92120
- `{function} onValidate(json)`
93121

94122
Set a callback function for custom validation. Available in all modes.
@@ -246,24 +274,24 @@ Constructs a new JSONEditor.
246274

247275
Adds status bar to the bottom of the editor - the status bar shows the cursor position and a count of the selected characters. True by default. Only applicable when `mode` is 'code' or 'text'.
248276

249-
- `{function} onTextSelectionChange`
277+
- `{function} onTextSelectionChange(start, end, text)`
250278

251279
Set a callback function triggered when a text is selected in the JSONEditor.
252280

253281
callback signature should be:
254282
```js
255283
/**
256-
* @param {{row:Number, column:Number}} startPos selection start position
257-
* @param {{row:Number, column:Number}} endPos selected end position
284+
* @param {{row:Number, column:Number}} start Selection start position
285+
* @param {{row:Number, column:Number}} end Selected end position
258286
* @param {String} text selected text
259287
*/
260-
function onTextSelectionChange(startPos, endPos, text) {
288+
function onTextSelectionChange(start, end, text) {
261289
...
262290
}
263291
```
264292
Only applicable when `mode` is 'code' or 'text'.
265293

266-
- `{function} onSelectionChange`
294+
- `{function} onSelectionChange(start, end)`
267295

268296
Set a callback function triggered when Nodes are selected in the JSONEditor.
269297

@@ -281,15 +309,29 @@ Constructs a new JSONEditor.
281309
```
282310
Only applicable when `mode` is 'tree'.
283311

284-
- `{function} onEvent`
312+
- `{function} onEvent({ field, path, value? }, event)`
285313

286314
Set a callback function that will be triggered when an event will occur in
287315
a JSON field or value.
288316

289317
In case of field event, node information will be
290-
`{field: string, path: {string|number}[]}`.
318+
319+
```
320+
{
321+
field: string,
322+
path: {string|number}[]
323+
}
324+
```
325+
291326
In case of value event, node information will be
292-
`{field: string, path: {string|number}[], value: string}`
327+
328+
```
329+
{
330+
field: string,
331+
path: {string|number}[],
332+
value: string
333+
}
334+
```
293335

294336
signature should be:
295337
```js
@@ -374,6 +416,10 @@ Constructs a new JSONEditor.
374416

375417
Enable filtering, sorting, and transforming JSON using a [JMESPath](http://jmespath.org/) query. Only applicable for mode 'tree'. True by default.
376418

419+
- `{Number} maxVisibleChilds`
420+
421+
Number of children allowed for a given node before the "show more / show all" message appears (in 'tree', 'view', or 'form' modes). 100 by default.
422+
377423
### Methods
378424

379425
#### `JSONEditor.collapseAll()`

examples/20_custom_css_style_for_nodes.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
}
9898
},
9999
onChangeJSON: function (j) {
100-
rightJson = j;
100+
leftJson = j;
101101
}
102102
};
103103

@@ -128,7 +128,7 @@
128128
}
129129
},
130130
onChangeJSON: function (j) {
131-
leftJson = j;
131+
rightJson = j;
132132
}
133133
};
134134

misc/how_to_publish.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ This document describes the steps required to publish a new version of jsonedito
77

88
Update the version number in package.json.
99

10+
Update package-lock.json:
11+
12+
npm install
13+
1014

1115
## Update history
1216

0 commit comments

Comments
 (0)