Released v5.12.0

This commit is contained in:
jos 2017-12-18 20:42:48 +01:00
parent da26baec0c
commit 22e99aa801
9 changed files with 95 additions and 46 deletions

View File

@ -3,10 +3,12 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet released, version 5.13.0 ## 2017-12-18, version 5.12.0
- Implemented #482: Include `caseSensitive` option for autocomplete. - Implemented #482: Include `caseSensitive` option for autocomplete.
Thanks @israelito3000. Thanks @israelito3000.
- Upgraded dependencies
- `ajv@5.5.2`
## 2017-11-22, version 5.11.0 ## 2017-11-22, version 5.11.0

View File

@ -24,8 +24,8 @@
* Copyright (c) 2011-2017 Jos de Jong, http://jsoneditoronline.org * Copyright (c) 2011-2017 Jos de Jong, http://jsoneditoronline.org
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 5.11.0 * @version 5.12.0
* @date 2017-11-22 * @date 2017-12-18
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
@ -8498,6 +8498,7 @@ return /******/ (function(modules) { // webpackBootstrap
function completely(config) { function completely(config) {
config = config || {}; config = config || {};
config.confirmKeys = config.confirmKeys || [39, 35, 9] // right, end, tab config.confirmKeys = config.confirmKeys || [39, 35, 9] // right, end, tab
config.caseSensitive = config.caseSensitive || false // autocomplete case sensitive
var fontSize = ''; var fontSize = '';
var fontFamily = ''; var fontFamily = '';
@ -8542,7 +8543,10 @@ return /******/ (function(modules) { // webpackBootstrap
rows = []; rows = [];
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
if (array[i].indexOf(token) !== 0) { continue; }
if ( (config.caseSensitive && array[i].indexOf(token) !== 0)
||(!config.caseSensitive && array[i].toLowerCase().indexOf(token.toLowerCase()) !== 0)) { continue; }
var divRow = document.createElement('div'); var divRow = document.createElement('div');
divRow.className = 'item'; divRow.className = 'item';
//divRow.style.color = config.color; //divRow.style.color = config.color;
@ -8550,14 +8554,15 @@ return /******/ (function(modules) { // webpackBootstrap
divRow.onmouseout = onMouseOut; divRow.onmouseout = onMouseOut;
divRow.onmousedown = onMouseDown; divRow.onmousedown = onMouseDown;
divRow.__hint = array[i]; divRow.__hint = array[i];
divRow.innerHTML = token + '<b>' + array[i].substring(token.length) + '</b>'; divRow.innerHTML = array[i].substring(0, token.length) + '<b>' + array[i].substring(token.length) + '</b>';
rows.push(divRow); rows.push(divRow);
elem.appendChild(divRow); elem.appendChild(divRow);
} }
if (rows.length === 0) { if (rows.length === 0) {
return; // nothing to show. return; // nothing to show.
} }
if (rows.length === 1 && token === rows[0].__hint) { if (rows.length === 1 && ( (token.toLowerCase() === rows[0].__hint.toLowerCase() && !config.caseSensitive)
||(token === rows[0].__hint && config.caseSensitive))){
return; // do not show the dropDown if it has only one element which matches what we have just displayed. return; // do not show the dropDown if it has only one element which matches what we have just displayed.
} }
@ -8743,8 +8748,10 @@ return /******/ (function(modules) { // webpackBootstrap
for (var i = 0; i < optionsLength; i++) { for (var i = 0; i < optionsLength; i++) {
var opt = this.options[i]; var opt = this.options[i];
if (opt.indexOf(token) === 0) { // <-- how about upperCase vs. lowercase if ( (!config.caseSensitive && opt.toLowerCase().indexOf(token.toLowerCase()) === 0)
this.elementHint.innerText = leftSide + opt; || (config.caseSensitive && opt.indexOf(token) === 0)) { // <-- how about upperCase vs. lowercase
this.elementHint.innerText = leftSide + token + opt.substring(token.length);
this.elementHint.realInnerText = leftSide + opt;
break; break;
} }
} }
@ -8778,6 +8785,10 @@ return /******/ (function(modules) { // webpackBootstrap
return; return;
} }
var text = this.element.innerText;
text = text.replace('\n', '');
var startFrom = this.startFrom;
if (config.confirmKeys.indexOf(keyCode) >= 0) { // (autocomplete triggered) if (config.confirmKeys.indexOf(keyCode) >= 0) { // (autocomplete triggered)
if (keyCode == 9) { if (keyCode == 9) {
if (this.elementHint.innerText.length == 0) { if (this.elementHint.innerText.length == 0) {
@ -8785,8 +8796,8 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
if (this.elementHint.innerText.length > 0) { // if there is a hint if (this.elementHint.innerText.length > 0) { // if there is a hint
if (this.element.innerText != this.elementHint.innerText) { if (this.element.innerText != this.elementHint.realInnerText) {
this.element.innerText = this.elementHint.innerText; this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown(); rs.hideDropDown();
setEndOfContenteditable(this.element); setEndOfContenteditable(this.element);
if (keyCode == 9) { if (keyCode == 9) {
@ -8813,7 +8824,7 @@ return /******/ (function(modules) { // webpackBootstrap
return; return;
} }
this.element.innerText = this.elementHint.innerText; this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown(); rs.hideDropDown();
setEndOfContenteditable(this.element); setEndOfContenteditable(this.element);
e.preventDefault(); e.preventDefault();
@ -8823,18 +8834,22 @@ return /******/ (function(modules) { // webpackBootstrap
} }
if (keyCode == 40) { // down if (keyCode == 40) { // down
var token = text.substring(this.startFrom);
var m = dropDownController.move(+1); var m = dropDownController.move(+1);
if (m == '') { rs.onArrowDown(); } if (m == '') { rs.onArrowDown(); }
this.elementHint.innerText = leftSide + m; this.elementHint.innerText = leftSide + token + m.substring(token.length);
this.elementHint.realInnerText = leftSide + m;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return; return;
} }
if (keyCode == 38) { // up if (keyCode == 38) { // up
var token = text.substring(this.startFrom);
var m = dropDownController.move(-1); var m = dropDownController.move(-1);
if (m == '') { rs.onArrowUp(); } if (m == '') { rs.onArrowUp(); }
this.elementHint.innerText = leftSide + m; this.elementHint.innerText = leftSide + token + m.substring(token.length);
this.elementHint.realInnerText = leftSide + m;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return; return;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

60
dist/jsoneditor.js vendored
View File

@ -24,8 +24,8 @@
* Copyright (c) 2011-2017 Jos de Jong, http://jsoneditoronline.org * Copyright (c) 2011-2017 Jos de Jong, http://jsoneditoronline.org
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 5.11.0 * @version 5.12.0
* @date 2017-11-22 * @date 2017-12-18
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
@ -615,11 +615,12 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
* @return {Ajv} this for method chaining
*/ */
function addSchema(schema, key, _skipValidation, _meta) { function addSchema(schema, key, _skipValidation, _meta) {
if (Array.isArray(schema)){ if (Array.isArray(schema)){
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta); for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
return; return this;
} }
var id = this._getId(schema); var id = this._getId(schema);
if (id !== undefined && typeof id != 'string') if (id !== undefined && typeof id != 'string')
@ -627,6 +628,7 @@ return /******/ (function(modules) { // webpackBootstrap
key = resolve.normalizeId(key || id); key = resolve.normalizeId(key || id);
checkUnique(this, key); checkUnique(this, key);
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true); this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
return this;
} }
@ -637,9 +639,11 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {Object} schema schema object * @param {Object} schema schema object
* @param {String} key optional schema key * @param {String} key optional schema key
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema * @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
* @return {Ajv} this for method chaining
*/ */
function addMetaSchema(schema, key, skipValidation) { function addMetaSchema(schema, key, skipValidation) {
this.addSchema(schema, key, skipValidation, true); this.addSchema(schema, key, skipValidation, true);
return this;
} }
@ -736,25 +740,26 @@ return /******/ (function(modules) { // webpackBootstrap
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references. * Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
* @this Ajv * @this Ajv
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object * @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @return {Ajv} this for method chaining
*/ */
function removeSchema(schemaKeyRef) { function removeSchema(schemaKeyRef) {
if (schemaKeyRef instanceof RegExp) { if (schemaKeyRef instanceof RegExp) {
_removeAllSchemas(this, this._schemas, schemaKeyRef); _removeAllSchemas(this, this._schemas, schemaKeyRef);
_removeAllSchemas(this, this._refs, schemaKeyRef); _removeAllSchemas(this, this._refs, schemaKeyRef);
return; return this;
} }
switch (typeof schemaKeyRef) { switch (typeof schemaKeyRef) {
case 'undefined': case 'undefined':
_removeAllSchemas(this, this._schemas); _removeAllSchemas(this, this._schemas);
_removeAllSchemas(this, this._refs); _removeAllSchemas(this, this._refs);
this._cache.clear(); this._cache.clear();
return; return this;
case 'string': case 'string':
var schemaObj = _getSchemaObj(this, schemaKeyRef); var schemaObj = _getSchemaObj(this, schemaKeyRef);
if (schemaObj) this._cache.del(schemaObj.cacheKey); if (schemaObj) this._cache.del(schemaObj.cacheKey);
delete this._schemas[schemaKeyRef]; delete this._schemas[schemaKeyRef];
delete this._refs[schemaKeyRef]; delete this._refs[schemaKeyRef];
return; return this;
case 'object': case 'object':
var serialize = this._opts.serialize; var serialize = this._opts.serialize;
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef; var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
@ -766,6 +771,7 @@ return /******/ (function(modules) { // webpackBootstrap
delete this._refs[id]; delete this._refs[id];
} }
} }
return this;
} }
@ -916,10 +922,12 @@ return /******/ (function(modules) { // webpackBootstrap
* @this Ajv * @this Ajv
* @param {String} name format name * @param {String} name format name
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) * @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
* @return {Ajv} this for method chaining
*/ */
function addFormat(name, format) { function addFormat(name, format) {
if (typeof format == 'string') format = new RegExp(format); if (typeof format == 'string') format = new RegExp(format);
this._formats[name] = format; this._formats[name] = format;
return this;
} }
@ -7420,6 +7428,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @this Ajv * @this Ajv
* @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).
* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
* @return {Ajv} this for method chaining
*/ */
function addKeyword(keyword, definition) { function addKeyword(keyword, definition) {
/* jshint validthis: true */ /* jshint validthis: true */
@ -7497,6 +7506,8 @@ return /******/ (function(modules) { // webpackBootstrap
function checkDataType(dataType) { function checkDataType(dataType) {
if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType); if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType);
} }
return this;
} }
@ -7517,6 +7528,7 @@ return /******/ (function(modules) { // webpackBootstrap
* Remove keyword * Remove keyword
* @this Ajv * @this Ajv
* @param {String} keyword pre-defined or custom keyword. * @param {String} keyword pre-defined or custom keyword.
* @return {Ajv} this for method chaining
*/ */
function removeKeyword(keyword) { function removeKeyword(keyword) {
/* jshint validthis: true */ /* jshint validthis: true */
@ -7533,6 +7545,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
} }
return this;
} }
@ -16031,6 +16044,7 @@ return /******/ (function(modules) { // webpackBootstrap
function completely(config) { function completely(config) {
config = config || {}; config = config || {};
config.confirmKeys = config.confirmKeys || [39, 35, 9] // right, end, tab config.confirmKeys = config.confirmKeys || [39, 35, 9] // right, end, tab
config.caseSensitive = config.caseSensitive || false // autocomplete case sensitive
var fontSize = ''; var fontSize = '';
var fontFamily = ''; var fontFamily = '';
@ -16075,7 +16089,10 @@ return /******/ (function(modules) { // webpackBootstrap
rows = []; rows = [];
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
if (array[i].indexOf(token) !== 0) { continue; }
if ( (config.caseSensitive && array[i].indexOf(token) !== 0)
||(!config.caseSensitive && array[i].toLowerCase().indexOf(token.toLowerCase()) !== 0)) { continue; }
var divRow = document.createElement('div'); var divRow = document.createElement('div');
divRow.className = 'item'; divRow.className = 'item';
//divRow.style.color = config.color; //divRow.style.color = config.color;
@ -16083,14 +16100,15 @@ return /******/ (function(modules) { // webpackBootstrap
divRow.onmouseout = onMouseOut; divRow.onmouseout = onMouseOut;
divRow.onmousedown = onMouseDown; divRow.onmousedown = onMouseDown;
divRow.__hint = array[i]; divRow.__hint = array[i];
divRow.innerHTML = token + '<b>' + array[i].substring(token.length) + '</b>'; divRow.innerHTML = array[i].substring(0, token.length) + '<b>' + array[i].substring(token.length) + '</b>';
rows.push(divRow); rows.push(divRow);
elem.appendChild(divRow); elem.appendChild(divRow);
} }
if (rows.length === 0) { if (rows.length === 0) {
return; // nothing to show. return; // nothing to show.
} }
if (rows.length === 1 && token === rows[0].__hint) { if (rows.length === 1 && ( (token.toLowerCase() === rows[0].__hint.toLowerCase() && !config.caseSensitive)
||(token === rows[0].__hint && config.caseSensitive))){
return; // do not show the dropDown if it has only one element which matches what we have just displayed. return; // do not show the dropDown if it has only one element which matches what we have just displayed.
} }
@ -16276,8 +16294,10 @@ return /******/ (function(modules) { // webpackBootstrap
for (var i = 0; i < optionsLength; i++) { for (var i = 0; i < optionsLength; i++) {
var opt = this.options[i]; var opt = this.options[i];
if (opt.indexOf(token) === 0) { // <-- how about upperCase vs. lowercase if ( (!config.caseSensitive && opt.toLowerCase().indexOf(token.toLowerCase()) === 0)
this.elementHint.innerText = leftSide + opt; || (config.caseSensitive && opt.indexOf(token) === 0)) { // <-- how about upperCase vs. lowercase
this.elementHint.innerText = leftSide + token + opt.substring(token.length);
this.elementHint.realInnerText = leftSide + opt;
break; break;
} }
} }
@ -16311,6 +16331,10 @@ return /******/ (function(modules) { // webpackBootstrap
return; return;
} }
var text = this.element.innerText;
text = text.replace('\n', '');
var startFrom = this.startFrom;
if (config.confirmKeys.indexOf(keyCode) >= 0) { // (autocomplete triggered) if (config.confirmKeys.indexOf(keyCode) >= 0) { // (autocomplete triggered)
if (keyCode == 9) { if (keyCode == 9) {
if (this.elementHint.innerText.length == 0) { if (this.elementHint.innerText.length == 0) {
@ -16318,8 +16342,8 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
if (this.elementHint.innerText.length > 0) { // if there is a hint if (this.elementHint.innerText.length > 0) { // if there is a hint
if (this.element.innerText != this.elementHint.innerText) { if (this.element.innerText != this.elementHint.realInnerText) {
this.element.innerText = this.elementHint.innerText; this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown(); rs.hideDropDown();
setEndOfContenteditable(this.element); setEndOfContenteditable(this.element);
if (keyCode == 9) { if (keyCode == 9) {
@ -16346,7 +16370,7 @@ return /******/ (function(modules) { // webpackBootstrap
return; return;
} }
this.element.innerText = this.elementHint.innerText; this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown(); rs.hideDropDown();
setEndOfContenteditable(this.element); setEndOfContenteditable(this.element);
e.preventDefault(); e.preventDefault();
@ -16356,18 +16380,22 @@ return /******/ (function(modules) { // webpackBootstrap
} }
if (keyCode == 40) { // down if (keyCode == 40) { // down
var token = text.substring(this.startFrom);
var m = dropDownController.move(+1); var m = dropDownController.move(+1);
if (m == '') { rs.onArrowDown(); } if (m == '') { rs.onArrowDown(); }
this.elementHint.innerText = leftSide + m; this.elementHint.innerText = leftSide + token + m.substring(token.length);
this.elementHint.realInnerText = leftSide + m;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return; return;
} }
if (keyCode == 38) { // up if (keyCode == 38) { // up
var token = text.substring(this.startFrom);
var m = dropDownController.move(-1); var m = dropDownController.move(-1);
if (m == '') { rs.onArrowUp(); } if (m == '') { rs.onArrowUp(); }
this.elementHint.innerText = leftSide + m; this.elementHint.innerText = leftSide + token + m.substring(token.length);
this.elementHint.realInnerText = leftSide + m;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return; return;

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

@ -75,6 +75,10 @@ function minify(name) {
} }
}); });
if (result.error) {
throw result.error
}
var fileMin = DIST + '/' + name + '.min.js'; var fileMin = DIST + '/' + name + '.min.js';
var fileMap = DIST + '/' + name + '.map'; var fileMap = DIST + '/' + name + '.map';

View File

@ -1,6 +1,6 @@
{ {
"name": "jsoneditor", "name": "jsoneditor",
"version": "5.11.0", "version": "5.12.0",
"main": "./index", "main": "./index",
"description": "A web-based tool to view, edit, format, and validate JSON", "description": "A web-based tool to view, edit, format, and validate JSON",
"tags": [ "tags": [
@ -23,7 +23,7 @@
"test": "mocha test" "test": "mocha test"
}, },
"dependencies": { "dependencies": {
"ajv": "5.4.0", "ajv": "5.5.2",
"brace": "0.11.0", "brace": "0.11.0",
"javascript-natural-sort": "0.7.1" "javascript-natural-sort": "0.7.1"
}, },