Released version 5.1.1
This commit is contained in:
parent
ae2f4e923f
commit
5a5c04e48f
|
@ -3,7 +3,7 @@
|
||||||
https://github.com/josdejong/jsoneditor
|
https://github.com/josdejong/jsoneditor
|
||||||
|
|
||||||
|
|
||||||
## not yet released, version 5.1.1
|
## 2016-01-16, version 5.1.1
|
||||||
|
|
||||||
- Fixed #257: Improving error messages for enum errors failed when the
|
- Fixed #257: Improving error messages for enum errors failed when the
|
||||||
schema contains references.
|
schema contains references.
|
||||||
|
|
|
@ -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.0
|
* @version 5.1.1
|
||||||
* @date 2016-01-14
|
* @date 2016-01-16
|
||||||
*/
|
*/
|
||||||
(function webpackUniversalModuleDefinition(root, factory) {
|
(function webpackUniversalModuleDefinition(root, factory) {
|
||||||
if(typeof exports === 'object' && typeof module === 'object')
|
if(typeof exports === 'object' && typeof module === 'object')
|
||||||
|
@ -162,7 +162,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
'ace', 'theme',
|
'ace', 'theme',
|
||||||
'ajv', 'schema',
|
'ajv', 'schema',
|
||||||
'onChange', 'onEditable', 'onError', 'onModeChange',
|
'onChange', 'onEditable', 'onError', 'onModeChange',
|
||||||
'escapeUnicode', 'history', 'mode', 'modes', 'name', 'indentation'
|
'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation'
|
||||||
];
|
];
|
||||||
|
|
||||||
Object.keys(options).forEach(function (option) {
|
Object.keys(options).forEach(function (option) {
|
||||||
|
@ -361,7 +361,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var ajv;
|
var ajv;
|
||||||
try {
|
try {
|
||||||
// grab ajv from options if provided, else create a new instance
|
// grab ajv from options if provided, else create a new instance
|
||||||
ajv = this.options.ajv || Ajv({ allErrors: true });
|
ajv = this.options.ajv || Ajv({ allErrors: true, verbose: true });
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -607,7 +607,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear search
|
// clear search
|
||||||
this.searchBox.clear();
|
if (this.searchBox) {
|
||||||
|
this.searchBox.clear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -832,12 +834,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (this.validateSchema) {
|
if (this.validateSchema) {
|
||||||
var valid = this.validateSchema(root.getValue());
|
var valid = this.validateSchema(root.getValue());
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
var schema = this.options.schema;
|
|
||||||
|
|
||||||
// apply all new errors
|
// apply all new errors
|
||||||
schemaErrors = this.validateSchema.errors
|
schemaErrors = this.validateSchema.errors
|
||||||
.map(function (error) {
|
.map(function (error) {
|
||||||
return util.improveSchemaError(schema, error);
|
return util.improveSchemaError(error);
|
||||||
})
|
})
|
||||||
.map(function findNode (error) {
|
.map(function findNode (error) {
|
||||||
return {
|
return {
|
||||||
|
@ -1611,6 +1611,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 2 */
|
/* 2 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
@ -2022,11 +2023,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (doValidate && this.validateSchema) {
|
if (doValidate && this.validateSchema) {
|
||||||
var valid = this.validateSchema(json);
|
var valid = this.validateSchema(json);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
var schema = this.options.schema;
|
errors = this.validateSchema.errors.map(function (error) {
|
||||||
errors = this.validateSchema.errors
|
return util.improveSchemaError(error);
|
||||||
.map(function (error) {
|
});
|
||||||
return util.improveSchemaError(schema, error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2755,34 +2754,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
return [prop].concat(parsePath(remainder))
|
return [prop].concat(parsePath(remainder))
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve a part of the schema
|
|
||||||
* @param {Object} schema
|
|
||||||
* @param {string} schemaPath A path like "#/properties/gender/enum"
|
|
||||||
* @return {Object} Returns the found part of the schema, or undefined when not found.
|
|
||||||
*/
|
|
||||||
exports.getFromSchema = function (schema, schemaPath) {
|
|
||||||
var path = schemaPath.split('/');
|
|
||||||
path.shift(); // remove the first #
|
|
||||||
|
|
||||||
var obj = schema;
|
|
||||||
var prop;
|
|
||||||
while (prop = path.shift()) {
|
|
||||||
obj = obj[prop];
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve the error message of a JSON schema error
|
* Improve the error message of a JSON schema error
|
||||||
* @param {Object} schema
|
|
||||||
* @param {Object} error
|
* @param {Object} error
|
||||||
* @return {Object} The error
|
* @return {Object} The error
|
||||||
*/
|
*/
|
||||||
exports.improveSchemaError = function (schema, error) {
|
exports.improveSchemaError = function (error) {
|
||||||
if (error.keyword === 'enum') {
|
if (error.keyword === 'enum' && Array.isArray(error.schema)) {
|
||||||
var enums = exports.getFromSchema(schema, error.schemaPath);
|
var enums = error.schema;
|
||||||
if (enums) {
|
if (enums) {
|
||||||
enums = enums.map(function (value) {
|
enums = enums.map(function (value) {
|
||||||
return JSON.stringify(value);
|
return JSON.stringify(value);
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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.0
|
* @version 5.1.1
|
||||||
* @date 2016-01-15
|
* @date 2016-01-16
|
||||||
*/
|
*/
|
||||||
(function webpackUniversalModuleDefinition(root, factory) {
|
(function webpackUniversalModuleDefinition(root, factory) {
|
||||||
if(typeof exports === 'object' && typeof module === 'object')
|
if(typeof exports === 'object' && typeof module === 'object')
|
||||||
|
@ -361,7 +361,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var ajv;
|
var ajv;
|
||||||
try {
|
try {
|
||||||
// grab ajv from options if provided, else create a new instance
|
// grab ajv from options if provided, else create a new instance
|
||||||
ajv = this.options.ajv || Ajv({ allErrors: true });
|
ajv = this.options.ajv || Ajv({ allErrors: true, verbose: true });
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -460,12 +460,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
/* 1 */
|
/* 1 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var Highlighter = __webpack_require__(6);
|
var Highlighter = __webpack_require__(5);
|
||||||
var History = __webpack_require__(7);
|
var History = __webpack_require__(6);
|
||||||
var SearchBox = __webpack_require__(8);
|
var SearchBox = __webpack_require__(7);
|
||||||
var ContextMenu = __webpack_require__(9);
|
var ContextMenu = __webpack_require__(8);
|
||||||
var Node = __webpack_require__(10);
|
var Node = __webpack_require__(9);
|
||||||
var modeswitcher = __webpack_require__(5);
|
var modeswitcher = __webpack_require__(10);
|
||||||
var util = __webpack_require__(3);
|
var util = __webpack_require__(3);
|
||||||
|
|
||||||
// create a mixin with the functions for tree mode
|
// create a mixin with the functions for tree mode
|
||||||
|
@ -607,7 +607,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear search
|
// clear search
|
||||||
this.searchBox.clear();
|
if (this.searchBox) {
|
||||||
|
this.searchBox.clear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -832,12 +834,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (this.validateSchema) {
|
if (this.validateSchema) {
|
||||||
var valid = this.validateSchema(root.getValue());
|
var valid = this.validateSchema(root.getValue());
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
var schema = this.options.schema;
|
|
||||||
|
|
||||||
// apply all new errors
|
// apply all new errors
|
||||||
schemaErrors = this.validateSchema.errors
|
schemaErrors = this.validateSchema.errors
|
||||||
.map(function (error) {
|
.map(function (error) {
|
||||||
return util.improveSchemaError(schema, error);
|
return util.improveSchemaError(error);
|
||||||
})
|
})
|
||||||
.map(function findNode (error) {
|
.map(function findNode (error) {
|
||||||
return {
|
return {
|
||||||
|
@ -1611,6 +1611,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 2 */
|
/* 2 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
@ -1623,7 +1624,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
// failed to load ace, no problem, we will fall back to plain text
|
// failed to load ace, no problem, we will fall back to plain text
|
||||||
}
|
}
|
||||||
|
|
||||||
var modeswitcher = __webpack_require__(5);
|
var modeswitcher = __webpack_require__(10);
|
||||||
var util = __webpack_require__(3);
|
var util = __webpack_require__(3);
|
||||||
|
|
||||||
// create a mixin with the functions for text mode
|
// create a mixin with the functions for text mode
|
||||||
|
@ -2022,11 +2023,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (doValidate && this.validateSchema) {
|
if (doValidate && this.validateSchema) {
|
||||||
var valid = this.validateSchema(json);
|
var valid = this.validateSchema(json);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
var schema = this.options.schema;
|
errors = this.validateSchema.errors.map(function (error) {
|
||||||
errors = this.validateSchema.errors
|
return util.improveSchemaError(error);
|
||||||
.map(function (error) {
|
});
|
||||||
return util.improveSchemaError(schema, error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2755,34 +2754,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
return [prop].concat(parsePath(remainder))
|
return [prop].concat(parsePath(remainder))
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve a part of the schema
|
|
||||||
* @param {Object} schema
|
|
||||||
* @param {string} schemaPath A path like "#/properties/gender/enum"
|
|
||||||
* @return {Object} Returns the found part of the schema, or undefined when not found.
|
|
||||||
*/
|
|
||||||
exports.getFromSchema = function (schema, schemaPath) {
|
|
||||||
var path = schemaPath.split('/');
|
|
||||||
path.shift(); // remove the first #
|
|
||||||
|
|
||||||
var obj = schema;
|
|
||||||
var prop;
|
|
||||||
while (prop = path.shift()) {
|
|
||||||
obj = obj[prop];
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve the error message of a JSON schema error
|
* Improve the error message of a JSON schema error
|
||||||
* @param {Object} schema
|
|
||||||
* @param {Object} error
|
* @param {Object} error
|
||||||
* @return {Object} The error
|
* @return {Object} The error
|
||||||
*/
|
*/
|
||||||
exports.improveSchemaError = function (schema, error) {
|
exports.improveSchemaError = function (error) {
|
||||||
if (error.keyword === 'enum') {
|
if (error.keyword === 'enum' && Array.isArray(error.schema)) {
|
||||||
var enums = exports.getFromSchema(schema, error.schemaPath);
|
var enums = error.schema;
|
||||||
if (enums) {
|
if (enums) {
|
||||||
enums = enums.map(function (value) {
|
enums = enums.map(function (value) {
|
||||||
return JSON.stringify(value);
|
return JSON.stringify(value);
|
||||||
|
@ -9492,117 +9471,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 5 */
|
/* 5 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
var ContextMenu = __webpack_require__(9);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a select box to be used in the editor menu's, which allows to switch mode
|
|
||||||
* @param {Object} editor
|
|
||||||
* @param {String[]} modes Available modes: 'code', 'form', 'text', 'tree', 'view'
|
|
||||||
* @param {String} current Available modes: 'code', 'form', 'text', 'tree', 'view'
|
|
||||||
* @returns {HTMLElement} box
|
|
||||||
*/
|
|
||||||
function createModeSwitcher(editor, modes, current) {
|
|
||||||
// TODO: decouple mode switcher from editor
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Switch the mode of the editor
|
|
||||||
* @param {String} mode
|
|
||||||
*/
|
|
||||||
function switchMode(mode) {
|
|
||||||
// switch mode
|
|
||||||
editor.setMode(mode);
|
|
||||||
|
|
||||||
// restore focus on mode box
|
|
||||||
var modeBox = editor.dom && editor.dom.modeBox;
|
|
||||||
if (modeBox) {
|
|
||||||
modeBox.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// available modes
|
|
||||||
var availableModes = {
|
|
||||||
code: {
|
|
||||||
'text': 'Code',
|
|
||||||
'title': 'Switch to code highlighter',
|
|
||||||
'click': function () {
|
|
||||||
switchMode('code')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
'text': 'Form',
|
|
||||||
'title': 'Switch to form editor',
|
|
||||||
'click': function () {
|
|
||||||
switchMode('form');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
'text': 'Text',
|
|
||||||
'title': 'Switch to plain text editor',
|
|
||||||
'click': function () {
|
|
||||||
switchMode('text');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tree: {
|
|
||||||
'text': 'Tree',
|
|
||||||
'title': 'Switch to tree editor',
|
|
||||||
'click': function () {
|
|
||||||
switchMode('tree');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
view: {
|
|
||||||
'text': 'View',
|
|
||||||
'title': 'Switch to tree view',
|
|
||||||
'click': function () {
|
|
||||||
switchMode('view');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// list the selected modes
|
|
||||||
var items = [];
|
|
||||||
for (var i = 0; i < modes.length; i++) {
|
|
||||||
var mode = modes[i];
|
|
||||||
var item = availableModes[mode];
|
|
||||||
if (!item) {
|
|
||||||
throw new Error('Unknown mode "' + mode + '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
item.className = 'jsoneditor-type-modes' + ((current == mode) ? ' jsoneditor-selected' : '');
|
|
||||||
items.push(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
// retrieve the title of current mode
|
|
||||||
var currentMode = availableModes[current];
|
|
||||||
if (!currentMode) {
|
|
||||||
throw new Error('Unknown mode "' + current + '"');
|
|
||||||
}
|
|
||||||
var currentTitle = currentMode.text;
|
|
||||||
|
|
||||||
// create the html element
|
|
||||||
var box = document.createElement('button');
|
|
||||||
box.className = 'jsoneditor-modes jsoneditor-separator';
|
|
||||||
box.innerHTML = currentTitle + ' ▾';
|
|
||||||
box.title = 'Switch editor mode';
|
|
||||||
box.onclick = function () {
|
|
||||||
var menu = new ContextMenu(items);
|
|
||||||
menu.show(box);
|
|
||||||
};
|
|
||||||
|
|
||||||
var div = document.createElement('div');
|
|
||||||
div.className = 'jsoneditor-modes';
|
|
||||||
div.style.position = 'relative';
|
|
||||||
div.appendChild(box);
|
|
||||||
|
|
||||||
return div;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.create = createModeSwitcher;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 6 */
|
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9692,7 +9560,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 7 */
|
/* 6 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var util = __webpack_require__(3);
|
var util = __webpack_require__(3);
|
||||||
|
@ -9950,7 +9818,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 8 */
|
/* 7 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10251,7 +10119,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 9 */
|
/* 8 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var util = __webpack_require__(3);
|
var util = __webpack_require__(3);
|
||||||
|
@ -10710,11 +10578,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 10 */
|
/* 9 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var ContextMenu = __webpack_require__(9);
|
var ContextMenu = __webpack_require__(8);
|
||||||
var appendNodeFactory = __webpack_require__(14);
|
var appendNodeFactory = __webpack_require__(13);
|
||||||
var util = __webpack_require__(3);
|
var util = __webpack_require__(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14115,6 +13983,117 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
module.exports = Node;
|
module.exports = Node;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 10 */
|
||||||
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
var ContextMenu = __webpack_require__(8);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a select box to be used in the editor menu's, which allows to switch mode
|
||||||
|
* @param {Object} editor
|
||||||
|
* @param {String[]} modes Available modes: 'code', 'form', 'text', 'tree', 'view'
|
||||||
|
* @param {String} current Available modes: 'code', 'form', 'text', 'tree', 'view'
|
||||||
|
* @returns {HTMLElement} box
|
||||||
|
*/
|
||||||
|
function createModeSwitcher(editor, modes, current) {
|
||||||
|
// TODO: decouple mode switcher from editor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch the mode of the editor
|
||||||
|
* @param {String} mode
|
||||||
|
*/
|
||||||
|
function switchMode(mode) {
|
||||||
|
// switch mode
|
||||||
|
editor.setMode(mode);
|
||||||
|
|
||||||
|
// restore focus on mode box
|
||||||
|
var modeBox = editor.dom && editor.dom.modeBox;
|
||||||
|
if (modeBox) {
|
||||||
|
modeBox.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// available modes
|
||||||
|
var availableModes = {
|
||||||
|
code: {
|
||||||
|
'text': 'Code',
|
||||||
|
'title': 'Switch to code highlighter',
|
||||||
|
'click': function () {
|
||||||
|
switchMode('code')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
'text': 'Form',
|
||||||
|
'title': 'Switch to form editor',
|
||||||
|
'click': function () {
|
||||||
|
switchMode('form');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
'text': 'Text',
|
||||||
|
'title': 'Switch to plain text editor',
|
||||||
|
'click': function () {
|
||||||
|
switchMode('text');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tree: {
|
||||||
|
'text': 'Tree',
|
||||||
|
'title': 'Switch to tree editor',
|
||||||
|
'click': function () {
|
||||||
|
switchMode('tree');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
view: {
|
||||||
|
'text': 'View',
|
||||||
|
'title': 'Switch to tree view',
|
||||||
|
'click': function () {
|
||||||
|
switchMode('view');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// list the selected modes
|
||||||
|
var items = [];
|
||||||
|
for (var i = 0; i < modes.length; i++) {
|
||||||
|
var mode = modes[i];
|
||||||
|
var item = availableModes[mode];
|
||||||
|
if (!item) {
|
||||||
|
throw new Error('Unknown mode "' + mode + '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
item.className = 'jsoneditor-type-modes' + ((current == mode) ? ' jsoneditor-selected' : '');
|
||||||
|
items.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// retrieve the title of current mode
|
||||||
|
var currentMode = availableModes[current];
|
||||||
|
if (!currentMode) {
|
||||||
|
throw new Error('Unknown mode "' + current + '"');
|
||||||
|
}
|
||||||
|
var currentTitle = currentMode.text;
|
||||||
|
|
||||||
|
// create the html element
|
||||||
|
var box = document.createElement('button');
|
||||||
|
box.className = 'jsoneditor-modes jsoneditor-separator';
|
||||||
|
box.innerHTML = currentTitle + ' ▾';
|
||||||
|
box.title = 'Switch editor mode';
|
||||||
|
box.onclick = function () {
|
||||||
|
var menu = new ContextMenu(items);
|
||||||
|
menu.show(box);
|
||||||
|
};
|
||||||
|
|
||||||
|
var div = document.createElement('div');
|
||||||
|
div.className = 'jsoneditor-modes';
|
||||||
|
div.style.position = 'relative';
|
||||||
|
div.appendChild(box);
|
||||||
|
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.create = createModeSwitcher;
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 11 */
|
/* 11 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
@ -14125,7 +14104,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
// load required ace modules
|
// load required ace modules
|
||||||
__webpack_require__(16);
|
__webpack_require__(16);
|
||||||
__webpack_require__(17);
|
__webpack_require__(17);
|
||||||
__webpack_require__(13);
|
__webpack_require__(14);
|
||||||
|
|
||||||
module.exports = ace;
|
module.exports = ace;
|
||||||
|
|
||||||
|
@ -14555,160 +14534,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 13 */
|
/* 13 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Distributed under the BSD license:
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Ajax.org B.V.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of Ajax.org B.V. nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
ace.define('ace/theme/jsoneditor', ['require', 'exports', 'module', 'ace/lib/dom'], function(acequire, exports, module) {
|
|
||||||
|
|
||||||
exports.isDark = false;
|
|
||||||
exports.cssClass = "ace-jsoneditor";
|
|
||||||
exports.cssText = ".ace-jsoneditor .ace_gutter {\
|
|
||||||
background: #ebebeb;\
|
|
||||||
color: #333\
|
|
||||||
}\
|
|
||||||
\
|
|
||||||
.ace-jsoneditor.ace_editor {\
|
|
||||||
font-family: droid sans mono, consolas, monospace, courier new, courier, sans-serif;\
|
|
||||||
line-height: 1.3;\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_print-margin {\
|
|
||||||
width: 1px;\
|
|
||||||
background: #e8e8e8\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_scroller {\
|
|
||||||
background-color: #FFFFFF\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_text-layer {\
|
|
||||||
color: gray\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_variable {\
|
|
||||||
color: #1a1a1a\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_cursor {\
|
|
||||||
border-left: 2px solid #000000\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_overwrite-cursors .ace_cursor {\
|
|
||||||
border-left: 0px;\
|
|
||||||
border-bottom: 1px solid #000000\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_marker-layer .ace_selection {\
|
|
||||||
background: lightgray\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor.ace_multiselect .ace_selection.ace_start {\
|
|
||||||
box-shadow: 0 0 3px 0px #FFFFFF;\
|
|
||||||
border-radius: 2px\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_marker-layer .ace_step {\
|
|
||||||
background: rgb(255, 255, 0)\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_marker-layer .ace_bracket {\
|
|
||||||
margin: -1px 0 0 -1px;\
|
|
||||||
border: 1px solid #BFBFBF\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_marker-layer .ace_active-line {\
|
|
||||||
background: #FFFBD1\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_gutter-active-line {\
|
|
||||||
background-color : #dcdcdc\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_marker-layer .ace_selected-word {\
|
|
||||||
border: 1px solid lightgray\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_invisible {\
|
|
||||||
color: #BFBFBF\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_keyword,\
|
|
||||||
.ace-jsoneditor .ace_meta,\
|
|
||||||
.ace-jsoneditor .ace_support.ace_constant.ace_property-value {\
|
|
||||||
color: #AF956F\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_keyword.ace_operator {\
|
|
||||||
color: #484848\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_keyword.ace_other.ace_unit {\
|
|
||||||
color: #96DC5F\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_constant.ace_language {\
|
|
||||||
color: darkorange\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_constant.ace_numeric {\
|
|
||||||
color: red\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_constant.ace_character.ace_entity {\
|
|
||||||
color: #BF78CC\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_invalid {\
|
|
||||||
color: #FFFFFF;\
|
|
||||||
background-color: #FF002A;\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_fold {\
|
|
||||||
background-color: #AF956F;\
|
|
||||||
border-color: #000000\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_storage,\
|
|
||||||
.ace-jsoneditor .ace_support.ace_class,\
|
|
||||||
.ace-jsoneditor .ace_support.ace_function,\
|
|
||||||
.ace-jsoneditor .ace_support.ace_other,\
|
|
||||||
.ace-jsoneditor .ace_support.ace_type {\
|
|
||||||
color: #C52727\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_string {\
|
|
||||||
color: green\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_comment {\
|
|
||||||
color: #BCC8BA\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_entity.ace_name.ace_tag,\
|
|
||||||
.ace-jsoneditor .ace_entity.ace_other.ace_attribute-name {\
|
|
||||||
color: #606060\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_markup.ace_underline {\
|
|
||||||
text-decoration: underline\
|
|
||||||
}\
|
|
||||||
.ace-jsoneditor .ace_indent-guide {\
|
|
||||||
background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y\
|
|
||||||
}";
|
|
||||||
|
|
||||||
var dom = acequire("../lib/dom");
|
|
||||||
dom.importCssString(exports.cssText, exports.cssClass);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 14 */
|
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var util = __webpack_require__(3);
|
var util = __webpack_require__(3);
|
||||||
var ContextMenu = __webpack_require__(9);
|
var ContextMenu = __webpack_require__(8);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A factory function to create an AppendNode, which depends on a Node
|
* A factory function to create an AppendNode, which depends on a Node
|
||||||
|
@ -14935,6 +14764,156 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
module.exports = appendNodeFactory;
|
module.exports = appendNodeFactory;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 14 */
|
||||||
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/theme/jsoneditor', ['require', 'exports', 'module', 'ace/lib/dom'], function(acequire, exports, module) {
|
||||||
|
|
||||||
|
exports.isDark = false;
|
||||||
|
exports.cssClass = "ace-jsoneditor";
|
||||||
|
exports.cssText = ".ace-jsoneditor .ace_gutter {\
|
||||||
|
background: #ebebeb;\
|
||||||
|
color: #333\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-jsoneditor.ace_editor {\
|
||||||
|
font-family: droid sans mono, consolas, monospace, courier new, courier, sans-serif;\
|
||||||
|
line-height: 1.3;\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_print-margin {\
|
||||||
|
width: 1px;\
|
||||||
|
background: #e8e8e8\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_scroller {\
|
||||||
|
background-color: #FFFFFF\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_text-layer {\
|
||||||
|
color: gray\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_variable {\
|
||||||
|
color: #1a1a1a\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_cursor {\
|
||||||
|
border-left: 2px solid #000000\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_overwrite-cursors .ace_cursor {\
|
||||||
|
border-left: 0px;\
|
||||||
|
border-bottom: 1px solid #000000\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_marker-layer .ace_selection {\
|
||||||
|
background: lightgray\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor.ace_multiselect .ace_selection.ace_start {\
|
||||||
|
box-shadow: 0 0 3px 0px #FFFFFF;\
|
||||||
|
border-radius: 2px\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_marker-layer .ace_step {\
|
||||||
|
background: rgb(255, 255, 0)\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_marker-layer .ace_bracket {\
|
||||||
|
margin: -1px 0 0 -1px;\
|
||||||
|
border: 1px solid #BFBFBF\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_marker-layer .ace_active-line {\
|
||||||
|
background: #FFFBD1\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_gutter-active-line {\
|
||||||
|
background-color : #dcdcdc\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_marker-layer .ace_selected-word {\
|
||||||
|
border: 1px solid lightgray\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_invisible {\
|
||||||
|
color: #BFBFBF\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_keyword,\
|
||||||
|
.ace-jsoneditor .ace_meta,\
|
||||||
|
.ace-jsoneditor .ace_support.ace_constant.ace_property-value {\
|
||||||
|
color: #AF956F\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_keyword.ace_operator {\
|
||||||
|
color: #484848\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_keyword.ace_other.ace_unit {\
|
||||||
|
color: #96DC5F\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_constant.ace_language {\
|
||||||
|
color: darkorange\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_constant.ace_numeric {\
|
||||||
|
color: red\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_constant.ace_character.ace_entity {\
|
||||||
|
color: #BF78CC\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_invalid {\
|
||||||
|
color: #FFFFFF;\
|
||||||
|
background-color: #FF002A;\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_fold {\
|
||||||
|
background-color: #AF956F;\
|
||||||
|
border-color: #000000\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_storage,\
|
||||||
|
.ace-jsoneditor .ace_support.ace_class,\
|
||||||
|
.ace-jsoneditor .ace_support.ace_function,\
|
||||||
|
.ace-jsoneditor .ace_support.ace_other,\
|
||||||
|
.ace-jsoneditor .ace_support.ace_type {\
|
||||||
|
color: #C52727\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_string {\
|
||||||
|
color: green\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_comment {\
|
||||||
|
color: #BCC8BA\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_entity.ace_name.ace_tag,\
|
||||||
|
.ace-jsoneditor .ace_entity.ace_other.ace_attribute-name {\
|
||||||
|
color: #606060\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_markup.ace_underline {\
|
||||||
|
text-decoration: underline\
|
||||||
|
}\
|
||||||
|
.ace-jsoneditor .ace_indent-guide {\
|
||||||
|
background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y\
|
||||||
|
}";
|
||||||
|
|
||||||
|
var dom = acequire("../lib/dom");
|
||||||
|
dom.importCssString(exports.cssText, exports.cssClass);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 15 */
|
/* 15 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 21 KiB |
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jsoneditor",
|
"name": "jsoneditor",
|
||||||
"version": "5.1.0",
|
"version": "5.1.1",
|
||||||
"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": [
|
||||||
|
|
Loading…
Reference in New Issue