Released v5.0.1

This commit is contained in:
jos 2015-12-31 17:03:49 +01:00
parent 593c6bd528
commit 4ad31c5bf1
5 changed files with 135 additions and 134 deletions

View File

@ -3,7 +3,7 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet released, version 5.0.1 ## 2015-12-31, version 5.0.1
- Fixed a bug in positioning of the context menu for multiple selected nodes. - Fixed a bug in positioning of the context menu for multiple selected nodes.
- Fixed #130: option `onEditable` not available in mode `form`. - Fixed #130: option `onEditable` not available in mode `form`.

255
dist/jsoneditor.js vendored
View File

@ -23,7 +23,7 @@
* Copyright (c) 2011-2015 Jos de Jong, http://jsoneditoronline.org * Copyright (c) 2011-2015 Jos de Jong, http://jsoneditoronline.org
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 5.0.0 * @version 5.0.1
* @date 2015-12-31 * @date 2015-12-31
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
@ -402,12 +402,12 @@ return /******/ (function(modules) { // webpackBootstrap
/* 1 */ /* 1 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var Highlighter = __webpack_require__(5); var Highlighter = __webpack_require__(4);
var History = __webpack_require__(6); var History = __webpack_require__(5);
var SearchBox = __webpack_require__(7); var SearchBox = __webpack_require__(6);
var ContextMenu = __webpack_require__(8); var ContextMenu = __webpack_require__(7);
var Node = __webpack_require__(9); var Node = __webpack_require__(8);
var modeswitcher = __webpack_require__(4); var modeswitcher = __webpack_require__(9);
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
@ -1057,7 +1057,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (node && node.selected) { if (node && node.selected) {
if (event.type == 'click') { if (event.type == 'click') {
if (event.target == node.dom.menu) { if (event.target == node.dom.menu) {
this.showContextMenu(event.target.parentNode); this.showContextMenu(event.target);
// stop propagation (else we will open the context menu of a single node) // stop propagation (else we will open the context menu of a single node)
return; return;
@ -1467,7 +1467,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__(4); var modeswitcher = __webpack_require__(9);
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
@ -2457,117 +2457,6 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 4 */ /* 4 */
/***/ 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 + ' &#x25BE;';
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;
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -2657,7 +2546,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 6 */ /* 5 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(3); var util = __webpack_require__(3);
@ -2915,7 +2804,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 7 */ /* 6 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -3216,7 +3105,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 8 */ /* 7 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(3); var util = __webpack_require__(3);
@ -3675,10 +3564,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 9 */ /* 8 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var ContextMenu = __webpack_require__(8); var ContextMenu = __webpack_require__(7);
var appendNodeFactory = __webpack_require__(12); var appendNodeFactory = __webpack_require__(12);
var util = __webpack_require__(3); var util = __webpack_require__(3);
@ -3723,7 +3612,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.editable.field = this.editor.options.mode === 'tree'; this.editable.field = this.editor.options.mode === 'tree';
this.editable.value = this.editor.options.mode !== 'view'; this.editable.value = this.editor.options.mode !== 'view';
if (this.editor.options.mode === 'tree' && (typeof this.editor.options.onEditable === 'function')) { if ((this.editor.options.mode === 'tree' || this.editor.options.mode === 'form') &&
(typeof this.editor.options.onEditable === 'function')) {
var editable = this.editor.options.onEditable({ var editable = this.editor.options.onEditable({
field: this.field, field: this.field,
value: this.value, value: this.value,
@ -6823,6 +6713,117 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = Node; module.exports = Node;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
var ContextMenu = __webpack_require__(7);
/**
* 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 + ' &#x25BE;';
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;
/***/ }, /***/ },
/* 10 */ /* 10 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
@ -7266,7 +7267,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(3); var util = __webpack_require__(3);
var ContextMenu = __webpack_require__(8); var ContextMenu = __webpack_require__(7);
/** /**
* A factory function to create an AppendNode, which depends on a Node * A factory function to create an AppendNode, which depends on a Node

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.0.0", "version": "5.0.1",
"main": "./index", "main": "./index",
"description": "A web-based tool to view, edit and format JSON", "description": "A web-based tool to view, edit and format JSON",
"tags": [ "tags": [