Skip to content

Commit

Permalink
Released v5.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Dec 18, 2017
1 parent da26bae commit 22e99aa
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 46 deletions.
4 changes: 3 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
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.
Thanks @israelito3000.
- Upgraded dependencies
- `[email protected]`


## 2017-11-22, version 5.11.0
Expand Down
39 changes: 27 additions & 12 deletions dist/jsoneditor-minimalist.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* Copyright (c) 2011-2017 Jos de Jong, http://jsoneditoronline.org
*
* @author Jos de Jong, <[email protected]>
* @version 5.11.0
* @date 2017-11-22
* @version 5.12.0
* @date 2017-12-18
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
Expand Down Expand Up @@ -8498,6 +8498,7 @@ return /******/ (function(modules) { // webpackBootstrap
function completely(config) {
config = config || {};
config.confirmKeys = config.confirmKeys || [39, 35, 9] // right, end, tab
config.caseSensitive = config.caseSensitive || false // autocomplete case sensitive

var fontSize = '';
var fontFamily = '';
Expand Down Expand Up @@ -8542,22 +8543,26 @@ return /******/ (function(modules) { // webpackBootstrap

rows = [];
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');
divRow.className = 'item';
//divRow.style.color = config.color;
divRow.onmouseover = onMouseOver;
divRow.onmouseout = onMouseOut;
divRow.onmousedown = onMouseDown;
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);
elem.appendChild(divRow);
}
if (rows.length === 0) {
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.
}

Expand Down Expand Up @@ -8743,8 +8748,10 @@ return /******/ (function(modules) { // webpackBootstrap

for (var i = 0; i < optionsLength; i++) {
var opt = this.options[i];
if (opt.indexOf(token) === 0) { // <-- how about upperCase vs. lowercase
this.elementHint.innerText = leftSide + opt;
if ( (!config.caseSensitive && opt.toLowerCase().indexOf(token.toLowerCase()) === 0)
|| (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;
}
}
Expand Down Expand Up @@ -8778,15 +8785,19 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

var text = this.element.innerText;
text = text.replace('\n', '');
var startFrom = this.startFrom;

if (config.confirmKeys.indexOf(keyCode) >= 0) { // (autocomplete triggered)
if (keyCode == 9) {
if (this.elementHint.innerText.length == 0) {
rs.onTab();
}
}
if (this.elementHint.innerText.length > 0) { // if there is a hint
if (this.element.innerText != this.elementHint.innerText) {
this.element.innerText = this.elementHint.innerText;
if (this.element.innerText != this.elementHint.realInnerText) {
this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown();
setEndOfContenteditable(this.element);
if (keyCode == 9) {
Expand All @@ -8813,7 +8824,7 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

this.element.innerText = this.elementHint.innerText;
this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown();
setEndOfContenteditable(this.element);
e.preventDefault();
Expand All @@ -8823,18 +8834,22 @@ return /******/ (function(modules) { // webpackBootstrap
}

if (keyCode == 40) { // down
var token = text.substring(this.startFrom);
var m = dropDownController.move(+1);
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.stopPropagation();
return;
}

if (keyCode == 38) { // up
var token = text.substring(this.startFrom);
var m = dropDownController.move(-1);
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.stopPropagation();
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/jsoneditor-minimalist.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/jsoneditor-minimalist.min.js

Large diffs are not rendered by default.

60 changes: 44 additions & 16 deletions dist/jsoneditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* Copyright (c) 2011-2017 Jos de Jong, http://jsoneditoronline.org
*
* @author Jos de Jong, <[email protected]>
* @version 5.11.0
* @date 2017-11-22
* @version 5.12.0
* @date 2017-12-18
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
Expand Down Expand Up @@ -615,18 +615,20 @@ 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 {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.
* @return {Ajv} this for method chaining
*/
function addSchema(schema, key, _skipValidation, _meta) {
if (Array.isArray(schema)){
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
return;
return this;
}
var id = this._getId(schema);
if (id !== undefined && typeof id != 'string')
throw new Error('schema id must be string');
key = resolve.normalizeId(key || id);
checkUnique(this, key);
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
return this;
}


Expand All @@ -637,9 +639,11 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {Object} schema schema object
* @param {String} key optional schema key
* @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) {
this.addSchema(schema, key, skipValidation, true);
return this;
}


Expand Down Expand Up @@ -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.
* @this Ajv
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @return {Ajv} this for method chaining
*/
function removeSchema(schemaKeyRef) {
if (schemaKeyRef instanceof RegExp) {
_removeAllSchemas(this, this._schemas, schemaKeyRef);
_removeAllSchemas(this, this._refs, schemaKeyRef);
return;
return this;
}
switch (typeof schemaKeyRef) {
case 'undefined':
_removeAllSchemas(this, this._schemas);
_removeAllSchemas(this, this._refs);
this._cache.clear();
return;
return this;
case 'string':
var schemaObj = _getSchemaObj(this, schemaKeyRef);
if (schemaObj) this._cache.del(schemaObj.cacheKey);
delete this._schemas[schemaKeyRef];
delete this._refs[schemaKeyRef];
return;
return this;
case 'object':
var serialize = this._opts.serialize;
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
Expand All @@ -766,6 +771,7 @@ return /******/ (function(modules) { // webpackBootstrap
delete this._refs[id];
}
}
return this;
}


Expand Down Expand Up @@ -916,10 +922,12 @@ return /******/ (function(modules) { // webpackBootstrap
* @this Ajv
* @param {String} name format name
* @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) {
if (typeof format == 'string') format = new RegExp(format);
this._formats[name] = format;
return this;
}


Expand Down Expand Up @@ -7420,6 +7428,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @this Ajv
* @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`.
* @return {Ajv} this for method chaining
*/
function addKeyword(keyword, definition) {
/* jshint validthis: true */
Expand Down Expand Up @@ -7497,6 +7506,8 @@ return /******/ (function(modules) { // webpackBootstrap
function checkDataType(dataType) {
if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType);
}

return this;
}


Expand All @@ -7517,6 +7528,7 @@ return /******/ (function(modules) { // webpackBootstrap
* Remove keyword
* @this Ajv
* @param {String} keyword pre-defined or custom keyword.
* @return {Ajv} this for method chaining
*/
function removeKeyword(keyword) {
/* jshint validthis: true */
Expand All @@ -7533,6 +7545,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
}
return this;
}


Expand Down Expand Up @@ -16031,6 +16044,7 @@ return /******/ (function(modules) { // webpackBootstrap
function completely(config) {
config = config || {};
config.confirmKeys = config.confirmKeys || [39, 35, 9] // right, end, tab
config.caseSensitive = config.caseSensitive || false // autocomplete case sensitive

var fontSize = '';
var fontFamily = '';
Expand Down Expand Up @@ -16075,22 +16089,26 @@ return /******/ (function(modules) { // webpackBootstrap

rows = [];
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');
divRow.className = 'item';
//divRow.style.color = config.color;
divRow.onmouseover = onMouseOver;
divRow.onmouseout = onMouseOut;
divRow.onmousedown = onMouseDown;
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);
elem.appendChild(divRow);
}
if (rows.length === 0) {
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.
}

Expand Down Expand Up @@ -16276,8 +16294,10 @@ return /******/ (function(modules) { // webpackBootstrap

for (var i = 0; i < optionsLength; i++) {
var opt = this.options[i];
if (opt.indexOf(token) === 0) { // <-- how about upperCase vs. lowercase
this.elementHint.innerText = leftSide + opt;
if ( (!config.caseSensitive && opt.toLowerCase().indexOf(token.toLowerCase()) === 0)
|| (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;
}
}
Expand Down Expand Up @@ -16311,15 +16331,19 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

var text = this.element.innerText;
text = text.replace('\n', '');
var startFrom = this.startFrom;

if (config.confirmKeys.indexOf(keyCode) >= 0) { // (autocomplete triggered)
if (keyCode == 9) {
if (this.elementHint.innerText.length == 0) {
rs.onTab();
}
}
if (this.elementHint.innerText.length > 0) { // if there is a hint
if (this.element.innerText != this.elementHint.innerText) {
this.element.innerText = this.elementHint.innerText;
if (this.element.innerText != this.elementHint.realInnerText) {
this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown();
setEndOfContenteditable(this.element);
if (keyCode == 9) {
Expand All @@ -16346,7 +16370,7 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

this.element.innerText = this.elementHint.innerText;
this.element.innerText = this.elementHint.realInnerText;
rs.hideDropDown();
setEndOfContenteditable(this.element);
e.preventDefault();
Expand All @@ -16356,18 +16380,22 @@ return /******/ (function(modules) { // webpackBootstrap
}

if (keyCode == 40) { // down
var token = text.substring(this.startFrom);
var m = dropDownController.move(+1);
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.stopPropagation();
return;
}

if (keyCode == 38) { // up
var token = text.substring(this.startFrom);
var m = dropDownController.move(-1);
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.stopPropagation();
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/jsoneditor.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/jsoneditor.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ function minify(name) {
}
});

if (result.error) {
throw result.error
}

var fileMin = DIST + '/' + name + '.min.js';
var fileMap = DIST + '/' + name + '.map';

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsoneditor",
"version": "5.11.0",
"version": "5.12.0",
"main": "./index",
"description": "A web-based tool to view, edit, format, and validate JSON",
"tags": [
Expand All @@ -23,7 +23,7 @@
"test": "mocha test"
},
"dependencies": {
"ajv": "5.4.0",
"ajv": "5.5.2",
"brace": "0.11.0",
"javascript-natural-sort": "0.7.1"
},
Expand Down

0 comments on commit 22e99aa

Please sign in to comment.