fix merge conflict

This commit is contained in:
jos 2019-05-29 17:25:28 +02:00
commit d2ef76abb5
16 changed files with 242 additions and 148 deletions

3
.travis.yml Normal file
View File

@ -0,0 +1,3 @@
language: node_js
node_js:
- "lts/*"

View File

@ -3,6 +3,21 @@
https://github.com/josdejong/jsoneditor
## not yet published, version 5.33.0
- Fixed #697: JSON Schema enum dropdown not working inside an array.
- Fixed #698: When using `onCreateMenu`, `node.path` is null when clicking
on an append node or when multiple nodes are selected.
- Upgraded dependencies to `mobius1-selectr@2.4.10`, `vanilla-picker@2.8.0`.
## 2019-04-27, version 5.32.5
- Fixed a bug in the JMESPath query wizard which didn't correctly handle
selecting multiple fields.
- Fixed context menu not working when multiple nodes are selected.
## 2019-04-10, version 5.32.4
- Fixed #682 and #687: JSONEditor not being able to handle JSON schema

View File

@ -24,8 +24,8 @@
* Copyright (c) 2011-2019 Jos de Jong, http://jsoneditoronline.org
*
* @author Jos de Jong, <wjosdejong@gmail.com>
* @version 5.32.4
* @date 2019-04-10
* @version 5.33.0
* @date 2019-05-29
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
@ -3148,8 +3148,16 @@ return /******/ (function(modules) { // webpackBootstrap
}
});
if (this.editor.options.onCreateMenu) {
items = this.editor.options.onCreateMenu(items, { path : node.getPath() });
if (this.options.onCreateMenu) {
var paths = selectedNodes.map(function (node) {
return node.getPath();
});
items = this.options.onCreateMenu(items, {
type: 'multiple',
path: paths[0],
paths: paths
});
}
var menu = new ContextMenu(items, {close: onClose});
@ -9949,12 +9957,6 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
}
else if (childSchema.items && childSchema.items.properties) {
childSchema = childSchema.items.properties[key];
if (childSchema) {
foundSchema = Node._findSchema(childSchema, schemaRefs, nextPath);
}
}
else if (typeof key === 'string' && childSchema.properties) {
if (!(key in childSchema.properties)) {
foundSchema = null;
@ -11729,7 +11731,13 @@ return /******/ (function(modules) { // webpackBootstrap
}
if (this.editor.options.onCreateMenu) {
items = this.editor.options.onCreateMenu(items, { path : node.getPath() });
var path = node.getPath();
items = this.editor.options.onCreateMenu(items, {
type: 'single',
path: path,
paths: [path]
});
}
var menu = new ContextMenu(items, {close: onClose});
@ -13866,7 +13874,13 @@ return /******/ (function(modules) { // webpackBootstrap
];
if (this.editor.options.onCreateMenu) {
items = this.editor.options.onCreateMenu(items, { path : node.getPath() });
var path = node.parent.getPath();
items = this.editor.options.onCreateMenu(items, {
type: 'append',
path: path,
paths: [path]
});
}
var menu = new ContextMenu(items, {close: onClose});
@ -15048,14 +15062,14 @@ return /******/ (function(modules) { // webpackBootstrap
}
if (values.length === 1) {
query.value += '.' + selectedValue;
query.value += '.' + values[0];
}
else if (values.length > 1) {
query.value += '.{' +
values.map(function (value) {
var parts = value.split('.');
var last = parts[parts.length - 1];
return last + ': ' + selectedValue;
return last + ': ' + value;
}).join(', ') +
'}';
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/jsoneditor.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -163,14 +163,26 @@ Constructs a new JSONEditor.
See also option `schema` for JSON schema validation.
- `{function} onCreateMenu(items,{path})`
- `{function} onCreateMenu(items, node)`
Customize context menus in tree mode.
Sets a callback function to customize the context menu in tree mode. Each time the user clicks on the context menu button, an array of menu items is created. If this callback is set, the array is passed to this function along with an object containing the current path (if any). This function can customize any aspect of these menu items, including deleting them and/or adding new items. Each menu item is represented by an object, which may also contain a submenu array of items. See the source code of example 21 in the examples folder for more info on the format of the items and submenu objects.
The function should return the final array of menu items to be displayed to the user.
Sets a callback function to customize the context menu in tree mode. Each time the user clicks on the context menu button, an array of menu items is created. If this callback is configured, the array with menu items is passed to this function. The menu items can be customized in this function in any aspect of these menu items, including deleting them and/or adding new items. The function should return the final array of menu items to be displayed to the user.
Each menu item is represented by an object, which may also contain a submenu array of items. See the source code of example 21 in the examples folder for more info on the format of the items and submenu objects.
The second argument `node` is an object containing the following properties:
```
{
type: 'single' | 'multiple' | 'append'
path: Array,
paths: Array with paths
}
```
The property `path` containing the path of the node, and `paths` contains the same path or in case there are multiple selected nodes it contains the paths of all selected nodes.
When the user opens the context menu of an append node (in an empty object or array), the `type` will be `'append'` and the `path` will contain the path of the parent node.
- `{boolean} escapeUnicode`

View File

@ -61,7 +61,8 @@
onCreateMenu : function (items, node) {
var path = node.path
console.log(items); // log the current items for inspection
// log the current items and node for inspection
console.log('items:', items, 'node:', node);
// We are going to add a menu item which returns the current node path
// as a jq path selector ( https://stedolan.github.io/jq/ ). First we

185
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "jsoneditor",
"version": "5.32.4",
"version": "5.33.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -28,9 +28,9 @@
"dev": true
},
"acorn-globals": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.0.tgz",
"integrity": "sha512-hMtHj3s5RnuhvHPowpBYvJVj3rAar82JiDQHvGs1zO0l10ocX/xEdBShNHTJaboucJUsScghp74pH3s7EnHHQw==",
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.2.tgz",
"integrity": "sha512-BbzvZhVtZP+Bs1J1HcwrQe8ycfO0wStkSGxuul3He3GkHOIZ6eTqOkPuw9IP1X3+IkOo4wiJmwkobzXYz4wewQ==",
"dev": true,
"requires": {
"acorn": "^6.0.1",
@ -288,11 +288,12 @@
}
},
"assert": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz",
"integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=",
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
"integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==",
"dev": true,
"requires": {
"object-assign": "^4.1.1",
"util": "0.10.3"
},
"dependencies": {
@ -302,6 +303,12 @@
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=",
"dev": true
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"dev": true
},
"util": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
@ -344,9 +351,9 @@
}
},
"async-each": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.2.tgz",
"integrity": "sha512-6xrbvN0MOBKSJDdonmSSz2OwFSgxRaVtBDes26mj9KIGtDo+g9xosFRSC+i1gQh2oAN/tQ62AI/pGZGQjVOiRg==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
"integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==",
"dev": true
},
"async-limiter": {
@ -640,9 +647,9 @@
}
},
"chokidar": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.5.tgz",
"integrity": "sha512-i0TprVWp+Kj4WRPtInjexJ8Q+BqTE909VpH8xVhXrJkoc5QC8VO9TryGOqTr+2hljzc1sC62t22h5tZePodM/A==",
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.6.tgz",
"integrity": "sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g==",
"dev": true,
"requires": {
"anymatch": "^2.0.0",
@ -729,9 +736,9 @@
"dev": true
},
"cloneable-readable": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz",
"integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==",
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.3.tgz",
"integrity": "sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==",
"dev": true,
"requires": {
"inherits": "^2.0.1",
@ -786,9 +793,9 @@
"dev": true
},
"combined-stream": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
"integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==",
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"requires": {
"delayed-stream": "~1.0.0"
@ -801,9 +808,9 @@
"dev": true
},
"component-emitter": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
"dev": true
},
"concat-map": {
@ -1215,9 +1222,9 @@
}
},
"es5-ext": {
"version": "0.10.49",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.49.tgz",
"integrity": "sha512-3NMEhi57E31qdzmYp2jwRArIUsj1HI/RxbQ4bgnSB+AIKIxsAmTiK83bYMifIcpWvEc3P1X30DhUKOqEtF/kvg==",
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"dev": true,
"requires": {
"es6-iterator": "~2.0.3",
@ -1583,9 +1590,9 @@
}
},
"fined": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/fined/-/fined-1.1.1.tgz",
"integrity": "sha512-jQp949ZmEbiYHk3gkbdtpJ0G1+kgtLQBNdP5edFP7Fh+WAYceLQz6yO1SBj72Xkg8GVyTB3bBzAYrHJVh5Xd5g==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz",
"integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==",
"dev": true,
"requires": {
"expand-tilde": "^2.0.2",
@ -1669,14 +1676,14 @@
"dev": true
},
"fsevents": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz",
"integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==",
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz",
"integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==",
"dev": true,
"optional": true,
"requires": {
"nan": "^2.9.2",
"node-pre-gyp": "^0.10.0"
"nan": "^2.12.1",
"node-pre-gyp": "^0.12.0"
},
"dependencies": {
"abbrev": {
@ -1754,12 +1761,12 @@
"optional": true
},
"debug": {
"version": "2.6.9",
"version": "4.1.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ms": "2.0.0"
"ms": "^2.1.1"
}
},
"deep-extend": {
@ -1930,24 +1937,24 @@
}
},
"ms": {
"version": "2.0.0",
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
},
"needle": {
"version": "2.2.4",
"version": "2.3.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"debug": "^2.1.2",
"debug": "^4.1.0",
"iconv-lite": "^0.4.4",
"sax": "^1.2.4"
}
},
"node-pre-gyp": {
"version": "0.10.3",
"version": "0.12.0",
"bundled": true,
"dev": true,
"optional": true,
@ -1975,13 +1982,13 @@
}
},
"npm-bundled": {
"version": "1.0.5",
"version": "1.0.6",
"bundled": true,
"dev": true,
"optional": true
},
"npm-packlist": {
"version": "1.2.0",
"version": "1.4.1",
"bundled": true,
"dev": true,
"optional": true,
@ -2120,7 +2127,7 @@
"optional": true
},
"semver": {
"version": "5.6.0",
"version": "5.7.0",
"bundled": true,
"dev": true,
"optional": true
@ -2254,9 +2261,9 @@
}
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@ -2441,9 +2448,9 @@
},
"dependencies": {
"gulp-cli": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.1.0.tgz",
"integrity": "sha512-txzgdFVlEPShBZus6JJyGyKJoBVDq6Do0ZQgIgx5RAsmhNVTDjymmOxpQvo3c20m66FldilS68ZXj2Q9w5dKbA==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.2.0.tgz",
"integrity": "sha512-rGs3bVYHdyJpLqR0TUBnlcZ1O5O++Zs4bA0ajm+zr3WFCfiSLjGwoCBqFs18wzN+ZxahT9DkOK5nDf26iDsWjA==",
"dev": true,
"requires": {
"ansi-colors": "^1.0.1",
@ -3606,18 +3613,18 @@
}
},
"mime-db": {
"version": "1.38.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz",
"integrity": "sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg==",
"version": "1.40.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==",
"dev": true
},
"mime-types": {
"version": "2.1.22",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.22.tgz",
"integrity": "sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog==",
"version": "2.1.24",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
"dev": true,
"requires": {
"mime-db": "~1.38.0"
"mime-db": "1.40.0"
}
},
"minimatch": {
@ -3674,9 +3681,9 @@
}
},
"mobius1-selectr": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/mobius1-selectr/-/mobius1-selectr-2.4.2.tgz",
"integrity": "sha512-yfy1sLxIDlgZjhThuG6gBsI4L2pJHRNaHth/hwPN5ESH5n2qkhfay/OnVmwhhDVYeui54NKIWeu6zWcobVcYtQ=="
"version": "2.4.10",
"resolved": "https://registry.npmjs.org/mobius1-selectr/-/mobius1-selectr-2.4.10.tgz",
"integrity": "sha512-U/pQ8jZwO7z3Mf9OYzJR6AKfleF5jSBIueKKxGMr/tgyLuTWgchgFyeaXpAIz3Cbp+7eIN1hw5D2gxc4cNnOkQ=="
},
"mocha": {
"version": "5.2.0",
@ -3753,9 +3760,9 @@
"dev": true
},
"nan": {
"version": "2.13.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz",
"integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==",
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
"dev": true,
"optional": true
},
@ -3869,9 +3876,9 @@
}
},
"now-and-later": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz",
"integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz",
"integrity": "sha512-KGvQ0cB70AQfg107Xvs/Fbu+dGmZoTRJp2TaPwcwQm3/7PteUyN2BCgk8KBMPGBUXZdVwyWS8fDCGFygBm19UQ==",
"dev": true,
"requires": {
"once": "^1.3.2"
@ -3884,9 +3891,9 @@
"dev": true
},
"nwsapi": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.3.tgz",
"integrity": "sha512-RowAaJGEgYXEZfQ7tvvdtAQUKPyTR6T6wNu0fwlNsGQYr/h3yQc6oI8WnVZh3Y/Sylwc+dtAlvPqfFZjhTyk3A==",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.4.tgz",
"integrity": "sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw==",
"dev": true
},
"oauth-sign": {
@ -3933,9 +3940,9 @@
}
},
"object-keys": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz",
"integrity": "sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
"dev": true
},
"object-visit": {
@ -4326,9 +4333,9 @@
"dev": true
},
"psl": {
"version": "1.1.31",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz",
"integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==",
"version": "1.1.32",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.1.32.tgz",
"integrity": "sha512-MHACAkHpihU/REGGPLj4sEfc/XKW2bheigvHO1dUqjaKigMp1C8+WLQYRGgeKFMsw5PMfegZcaN8IDXK/cD0+g==",
"dev": true
},
"pump": {
@ -4613,9 +4620,9 @@
"dev": true
},
"resolve": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
"integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==",
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@ -4972,9 +4979,9 @@
}
},
"spdx-license-ids": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.3.tgz",
"integrity": "sha512-uBIcIl3Ih6Phe3XHK1NqboJLdGfwr1UN3k6wSD1dZpmPsIkb8AGNbZYJ1fOBk834+Gxy8rpfDxrS6XLEMZMY2g==",
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz",
"integrity": "sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA==",
"dev": true
},
"split-string": {
@ -5362,9 +5369,9 @@
"dev": true
},
"undertaker": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.0.tgz",
"integrity": "sha1-M52kZGJS0ILcN45wgGcpl1DhG0k=",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.1.tgz",
"integrity": "sha512-71WxIzDkgYk9ZS+spIB8iZXchFhAdEo2YU8xYqBYJ39DIUIqziK78ftm26eecoIY49X0J2MLhG4hr18Yp6/CMA==",
"dev": true,
"requires": {
"arr-flatten": "^1.0.1",
@ -5545,9 +5552,9 @@
"dev": true
},
"v8flags": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.2.tgz",
"integrity": "sha512-MtivA7GF24yMPte9Rp/BWGCYQNaUj86zeYxV/x2RRJMKagImbbv3u8iJC57lNhWLPcGLJmHcHmFWkNsplbbLWw==",
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz",
"integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==",
"dev": true,
"requires": {
"homedir-polyfill": "^1.0.1"
@ -5570,11 +5577,11 @@
"dev": true
},
"vanilla-picker": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/vanilla-picker/-/vanilla-picker-2.4.2.tgz",
"integrity": "sha512-fAjOGwruYIrRSWtMfriwE2zya2IDHcI7ncundd1NWh/Py3WzuNIAcj6dwaoG7f72ZT9YHRCAfy84f0BoJb0tyA==",
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/vanilla-picker/-/vanilla-picker-2.8.0.tgz",
"integrity": "sha512-NPBxrtLi2LA2mEyRLW+Lyt7Eqtm0t0SmKqscE5RaugXLtJXXjPzy6r65fqLiQkhRc2WoLnmj2m/EnTWKN4hL+g==",
"requires": {
"@sphinxxxx/color-conversion": "^2.1.1",
"@sphinxxxx/color-conversion": "^2.2.1",
"drag-tracker": "^1.0.0"
}
},

View File

@ -1,6 +1,6 @@
{
"name": "jsoneditor",
"version": "5.32.4",
"version": "5.33.0",
"main": "./index",
"description": "A web-based tool to view, edit, format, and validate JSON",
"tags": [
@ -28,9 +28,9 @@
"javascript-natural-sort": "0.7.1",
"jmespath": "0.15.0",
"json-source-map": "0.4.0",
"mobius1-selectr": "2.4.2",
"mobius1-selectr": "2.4.10",
"picomodal": "3.0.0",
"vanilla-picker": "2.4.2"
"vanilla-picker": "2.8.0"
},
"devDependencies": {
"gulp": "4.0.0",
@ -38,7 +38,7 @@
"gulp-concat-css": "2.3.0",
"gulp-shell": "0.6.3",
"gulp-util": "3.0.8",
"jsdom": "^13.2.0",
"jsdom": "13.2.0",
"json-loader": "0.5.7",
"mkdirp": "0.5.1",
"mocha": "5.2.0",

View File

@ -2659,12 +2659,6 @@ Node._findSchema = function (schema, schemaRefs, path) {
}
}
}
else if (childSchema.items && childSchema.items.properties) {
childSchema = childSchema.items.properties[key];
if (childSchema) {
foundSchema = Node._findSchema(childSchema, schemaRefs, nextPath);
}
}
else if (typeof key === 'string' && childSchema.properties) {
if (!(key in childSchema.properties)) {
foundSchema = null;
@ -4439,7 +4433,13 @@ Node.prototype.showContextMenu = function (anchor, onClose) {
}
if (this.editor.options.onCreateMenu) {
items = this.editor.options.onCreateMenu(items, { path : node.getPath() });
var path = node.getPath();
items = this.editor.options.onCreateMenu(items, {
type: 'single',
path: path,
paths: [path]
});
}
var menu = new ContextMenu(items, {close: onClose});

View File

@ -202,7 +202,13 @@ function appendNodeFactory(Node) {
];
if (this.editor.options.onCreateMenu) {
items = this.editor.options.onCreateMenu(items, { path : node.getPath() });
var path = node.parent.getPath();
items = this.editor.options.onCreateMenu(items, {
type: 'append',
path: path,
paths: [path]
});
}
var menu = new ContextMenu(items, {close: onClose});

View File

@ -233,14 +233,14 @@ function showTransformModal (node, container) {
}
if (values.length === 1) {
query.value += '.' + selectedValue;
query.value += '.' + values[0];
}
else if (values.length > 1) {
query.value += '.{' +
values.map(function (value) {
var parts = value.split('.');
var last = parts[parts.length - 1];
return last + ': ' + selectedValue;
return last + ': ' + value;
}).join(', ') +
'}';
}

View File

@ -1685,8 +1685,16 @@ treemode.showContextMenu = function (anchor, onClose) {
}
});
if (this.editor.options.onCreateMenu) {
items = this.editor.options.onCreateMenu(items, { path : node.getPath() });
if (this.options.onCreateMenu) {
var paths = selectedNodes.map(function (node) {
return node.getPath();
});
items = this.options.onCreateMenu(items, {
type: 'multiple',
path: paths[0],
paths: paths
});
}
var menu = new ContextMenu(items, {close: onClose});

View File

@ -27,6 +27,34 @@ describe('Node', function () {
assert.strictEqual(Node._findSchema(schema, {}, path), schema.properties.child);
});
it('should find schema inside an array item', function () {
var schema = {
properties: {
job: {
type: 'array',
items: {
type: 'object',
properties: {
company: {
enum: ['test1', 'test2']
}
}
}
}
}
};
assert.strictEqual(Node._findSchema(schema, {}, []), schema);
assert.strictEqual(Node._findSchema(schema, {}, ['job']), schema.properties.job);
assert.strictEqual(Node._findSchema(schema, {}, ['job', 0]),
schema.properties.job.items);
assert.strictEqual(Node._findSchema(schema, {}, ['job', 0, 'company']),
schema.properties.job.items.properties.company);
});
it('should find schema within multi-level object properties', function () {
var schema = {
type: 'object',