Released version 5.1.2

This commit is contained in:
jos 2016-01-21 20:01:49 +01:00
parent 419880dba8
commit 69f106a911
8 changed files with 6773 additions and 6394 deletions

View File

@ -3,12 +3,14 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet released, version 5.1.2 ## 2016-01-21, version 5.1.2
- Improvements in sanitizing invalid JSON. - Improvements in sanitizing invalid JSON.
- Updated dependencies to the latest version.
- Fixed clicking format/compact not triggering an onChange event. - Fixed clicking format/compact not triggering an onChange event.
- Fixed #259: when having a JSONEditor inside an HTML form, clicking an entry - Fixed #259: when having a JSONEditor inside an HTML form, clicking an entry
in the context menu did submit the form. in the context menu did submit the form.
- Fixed browserify build, see #260. Thanks @onip.
## 2016-01-16, version 5.1.1 ## 2016-01-16, version 5.1.1

View File

@ -24,8 +24,8 @@
* Copyright (c) 2011-2016 Jos de Jong, http://jsoneditoronline.org * Copyright (c) 2011-2016 Jos de Jong, http://jsoneditoronline.org
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 5.1.1 * @version 5.1.2
* @date 2016-01-16 * @date 2016-01-21
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
@ -85,7 +85,7 @@ return /******/ (function(modules) { // webpackBootstrap
var Ajv; var Ajv;
try { try {
Ajv = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"ajv/dist/ajv.bundle.js\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); Ajv = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"ajv\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
} }
catch (err) { catch (err) {
// no problem... when we need Ajv we will throw a neat exception // no problem... when we need Ajv we will throw a neat exception
@ -1717,6 +1717,7 @@ return /******/ (function(modules) { // webpackBootstrap
buttonFormat.onclick = function () { buttonFormat.onclick = function () {
try { try {
me.format(); me.format();
me._onChange();
} }
catch (err) { catch (err) {
me._onError(err); me._onError(err);
@ -1731,6 +1732,7 @@ return /******/ (function(modules) { // webpackBootstrap
buttonCompact.onclick = function () { buttonCompact.onclick = function () {
try { try {
me.compact(); me.compact();
me._onChange();
} }
catch (err) { catch (err) {
me._onError(err); me._onError(err);
@ -1853,9 +1855,11 @@ return /******/ (function(modules) { // webpackBootstrap
if (keynum == 220 && event.ctrlKey) { if (keynum == 220 && event.ctrlKey) {
if (event.shiftKey) { // Ctrl+Shift+\ if (event.shiftKey) { // Ctrl+Shift+\
this.compact(); this.compact();
this._onChange();
} }
else { // Ctrl+\ else { // Ctrl+\
this.format(); this.format();
this._onChange();
} }
handled = true; handled = true;
} }
@ -2139,26 +2143,23 @@ return /******/ (function(modules) { // webpackBootstrap
function next() { return jsString.charAt(i + 1); } function next() { return jsString.charAt(i + 1); }
function prev() { return jsString.charAt(i - 1); } function prev() { return jsString.charAt(i - 1); }
// test whether the last non-whitespace character was a brace-open '{' // get the last parsed non-whitespace character
function prevIsBrace() { function lastNonWhitespace () {
var ii = i - 1; var p = chars.length - 1;
while (ii >= 0) {
var cc = jsString.charAt(ii); while (p >= 0) {
if (cc === '{') { var pp = chars[p];
return true; if (pp !== ' ' && pp !== '\n' && pp !== '\r' && pp !== '\t') { // non whitespace
} return pp;
else if (cc === ' ' || cc === '\n' || cc === '\r') { // whitespace
ii--;
}
else {
return false;
} }
p--;
} }
return false;
return '';
} }
// skip a block comment '/* ... */' // skip a block comment '/* ... */'
function skipComment () { function skipBlockComment () {
i += 2; i += 2;
while (i < jsString.length && (curr() !== '*' || next() !== '/')) { while (i < jsString.length && (curr() !== '*' || next() !== '/')) {
i++; i++;
@ -2166,6 +2167,14 @@ return /******/ (function(modules) { // webpackBootstrap
i += 2; i += 2;
} }
// skip a comment '// ...'
function skipComment () {
i += 2;
while (i < jsString.length && (curr() !== '\n')) {
i++;
}
}
// parse single or double quoted string // parse single or double quoted string
function parseString(quote) { function parseString(quote) {
chars.push('"'); chars.push('"');
@ -2223,12 +2232,15 @@ return /******/ (function(modules) { // webpackBootstrap
var c = curr(); var c = curr();
if (c === '/' && next() === '*') { if (c === '/' && next() === '*') {
skipBlockComment();
}
else if (c === '/' && next() === '/') {
skipComment(); skipComment();
} }
else if (c === '\'' || c === '"') { else if (c === '\'' || c === '"') {
parseString(c); parseString(c);
} }
else if (/[a-zA-Z_$]/.test(c) && prevIsBrace()) { else if (/[a-zA-Z_$]/.test(c) && ['{', ','].indexOf(lastNonWhitespace()) !== -1) {
// an unquoted object key (like a in '{a:2}') // an unquoted object key (like a in '{a:2}')
parseKey(); parseKey();
} }
@ -3579,6 +3591,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
if (item.click) { if (item.click) {
button.onclick = function () { button.onclick = function () {
event.preventDefault();
me.hide(); me.hide();
item.click(); item.click();
}; };
@ -3619,7 +3632,8 @@ return /******/ (function(modules) { // webpackBootstrap
} }
// attach a handler to expand/collapse the submenu // attach a handler to expand/collapse the submenu
buttonSubmenu.onclick = function () { buttonSubmenu.onclick = function (event) {
event.preventDefault();
me._onExpandItem(domItem); me._onExpandItem(domItem);
buttonSubmenu.focus(); buttonSubmenu.focus();
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

13028
dist/jsoneditor.js vendored

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

@ -1,6 +1,6 @@
{ {
"name": "jsoneditor", "name": "jsoneditor",
"version": "5.1.1", "version": "5.1.2",
"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,19 +23,19 @@
"test": "mocha test" "test": "mocha test"
}, },
"dependencies": { "dependencies": {
"ajv": "3.2.0", "ajv": "3.4.0",
"brace": "0.7.0" "brace": "0.7.0"
}, },
"devDependencies": { "devDependencies": {
"gulp": "^3.8.11", "gulp": "3.9.0",
"gulp-concat-css": "^2.0.0", "gulp-concat-css": "2.2.0",
"gulp-minify-css": "^0.4.5", "gulp-minify-css": "1.2.3",
"gulp-shell": "^0.3.0", "gulp-shell": "0.5.1",
"gulp-util": "^3.0.3", "gulp-util": "3.0.7",
"json-loader": "^0.5.4", "json-loader": "0.5.4",
"mkdirp": "^0.5.0", "mkdirp": "0.5.1",
"mocha": "^2.1.0", "mocha": "2.3.4",
"uglify-js": "^2.4.16", "uglify-js": "2.6.1",
"webpack": "^1.5.3" "webpack": "1.12.11"
} }
} }