Publish v5.26.0
This commit is contained in:
parent
d7551da7e6
commit
bd8bac03bd
|
@ -3,6 +3,12 @@
|
||||||
https://github.com/josdejong/jsoneditor
|
https://github.com/josdejong/jsoneditor
|
||||||
|
|
||||||
|
|
||||||
|
## 2018-11-12, version 5.26.0
|
||||||
|
|
||||||
|
- Implemented option `mainMenuBar` to enable/disable the main menu bar.
|
||||||
|
Thanks @tanmayrajani.
|
||||||
|
|
||||||
|
|
||||||
## 2018-10-29, version 5.25.0
|
## 2018-10-29, version 5.25.0
|
||||||
|
|
||||||
- Implemented options `enableSort` and `enableTransform` so you can turn off
|
- Implemented options `enableSort` and `enableTransform` so you can turn off
|
||||||
|
|
|
@ -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.25.0
|
* @version 5.26.0
|
||||||
* @date 2018-10-29
|
* @date 2018-11-12
|
||||||
*/
|
*/
|
||||||
(function webpackUniversalModuleDefinition(root, factory) {
|
(function webpackUniversalModuleDefinition(root, factory) {
|
||||||
if(typeof exports === 'object' && typeof module === 'object')
|
if(typeof exports === 'object' && typeof module === 'object')
|
||||||
|
@ -252,7 +252,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
'colorPicker', 'onColorPicker',
|
'colorPicker', 'onColorPicker',
|
||||||
'timestampTag',
|
'timestampTag',
|
||||||
'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation',
|
'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation',
|
||||||
'sortObjectKeys', 'navigationBar', 'statusBar', 'languages', 'language', 'enableSort', 'enableTransform'
|
'sortObjectKeys', 'navigationBar', 'statusBar', 'mainMenuBar', 'languages', 'language', 'enableSort', 'enableTransform'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1580,8 +1580,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._setOptions = function (options) {
|
treemode._setOptions = function (options) {
|
||||||
var editor = this;
|
|
||||||
|
|
||||||
this.options = {
|
this.options = {
|
||||||
search: true,
|
search: true,
|
||||||
history: true,
|
history: true,
|
||||||
|
@ -1591,6 +1589,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
schemaRefs: null,
|
schemaRefs: null,
|
||||||
autocomplete: null,
|
autocomplete: null,
|
||||||
navigationBar : true,
|
navigationBar : true,
|
||||||
|
mainMenuBar: true,
|
||||||
onSelectionChange: null,
|
onSelectionChange: null,
|
||||||
colorPicker: true,
|
colorPicker: true,
|
||||||
onColorPicker: function (parent, color, onChange) {
|
onColorPicker: function (parent, color, onChange) {
|
||||||
|
@ -1600,11 +1599,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
color: color,
|
color: color,
|
||||||
popup: 'bottom',
|
popup: 'bottom',
|
||||||
onDone: function (color) {
|
onDone: function (color) {
|
||||||
var alpha = color.rgba[3]
|
var alpha = color.rgba[3];
|
||||||
var hex = (alpha === 1)
|
var hex = (alpha === 1)
|
||||||
? color.hex.substr(0, 7) // return #RRGGBB
|
? color.hex.substr(0, 7) // return #RRGGBB
|
||||||
: color.hex // return #RRGGBBAA
|
: color.hex; // return #RRGGBBAA
|
||||||
onChange(hex)
|
onChange(hex);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
@ -2393,6 +2392,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.frame.className = 'jsoneditor jsoneditor-mode-' + this.options.mode;
|
this.frame.className = 'jsoneditor jsoneditor-mode-' + this.options.mode;
|
||||||
this.container.appendChild(this.frame);
|
this.container.appendChild(this.frame);
|
||||||
|
|
||||||
|
this.contentOuter = document.createElement('div');
|
||||||
|
this.contentOuter.className = 'jsoneditor-outer';
|
||||||
|
|
||||||
// create one global event listener to handle all events from all nodes
|
// create one global event listener to handle all events from all nodes
|
||||||
var editor = this;
|
var editor = this;
|
||||||
function onEvent(event) {
|
function onEvent(event) {
|
||||||
|
@ -2431,105 +2433,109 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.frame.onfocusin = onEvent; // for IE
|
this.frame.onfocusin = onEvent; // for IE
|
||||||
this.frame.onfocusout = onEvent; // for IE
|
this.frame.onfocusout = onEvent; // for IE
|
||||||
|
|
||||||
// create menu
|
if (this.options.mainMenuBar) {
|
||||||
this.menu = document.createElement('div');
|
util.addClassName(this.contentOuter, 'has-main-menu-bar');
|
||||||
this.menu.className = 'jsoneditor-menu';
|
|
||||||
this.frame.appendChild(this.menu);
|
|
||||||
|
|
||||||
// create expand all button
|
// create menu
|
||||||
var expandAll = document.createElement('button');
|
this.menu = document.createElement('div');
|
||||||
expandAll.type = 'button';
|
this.menu.className = 'jsoneditor-menu';
|
||||||
expandAll.className = 'jsoneditor-expand-all';
|
this.frame.appendChild(this.menu);
|
||||||
expandAll.title = translate('expandAll');
|
|
||||||
expandAll.onclick = function () {
|
|
||||||
editor.expandAll();
|
|
||||||
};
|
|
||||||
this.menu.appendChild(expandAll);
|
|
||||||
|
|
||||||
// create collapse all button
|
// create expand all button
|
||||||
var collapseAll = document.createElement('button');
|
var expandAll = document.createElement('button');
|
||||||
collapseAll.type = 'button';
|
expandAll.type = 'button';
|
||||||
collapseAll.title = translate('collapseAll');
|
expandAll.className = 'jsoneditor-expand-all';
|
||||||
collapseAll.className = 'jsoneditor-collapse-all';
|
expandAll.title = translate('expandAll');
|
||||||
collapseAll.onclick = function () {
|
expandAll.onclick = function () {
|
||||||
editor.collapseAll();
|
editor.expandAll();
|
||||||
};
|
|
||||||
this.menu.appendChild(collapseAll);
|
|
||||||
|
|
||||||
// create sort button
|
|
||||||
if (this.options.enableSort) {
|
|
||||||
var sort = document.createElement('button');
|
|
||||||
sort.type = 'button';
|
|
||||||
sort.className = 'jsoneditor-sort';
|
|
||||||
sort.title = translate('sortTitleShort');
|
|
||||||
sort.onclick = function () {
|
|
||||||
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
|
||||||
showSortModal(editor.node, anchor)
|
|
||||||
};
|
};
|
||||||
this.menu.appendChild(sort);
|
this.menu.appendChild(expandAll);
|
||||||
|
|
||||||
|
// create collapse all button
|
||||||
|
var collapseAll = document.createElement('button');
|
||||||
|
collapseAll.type = 'button';
|
||||||
|
collapseAll.title = translate('collapseAll');
|
||||||
|
collapseAll.className = 'jsoneditor-collapse-all';
|
||||||
|
collapseAll.onclick = function () {
|
||||||
|
editor.collapseAll();
|
||||||
|
};
|
||||||
|
this.menu.appendChild(collapseAll);
|
||||||
|
|
||||||
|
// create sort button
|
||||||
|
if (this.options.enableSort) {
|
||||||
|
var sort = document.createElement('button');
|
||||||
|
sort.type = 'button';
|
||||||
|
sort.className = 'jsoneditor-sort';
|
||||||
|
sort.title = translate('sortTitleShort');
|
||||||
|
sort.onclick = function () {
|
||||||
|
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
||||||
|
showSortModal(editor.node, anchor)
|
||||||
|
};
|
||||||
|
this.menu.appendChild(sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create transform button
|
||||||
|
if (this.options.enableTransform) {
|
||||||
|
var transform = document.createElement('button');
|
||||||
|
transform.type = 'button';
|
||||||
|
transform.title = translate('transformTitleShort');
|
||||||
|
transform.className = 'jsoneditor-transform';
|
||||||
|
transform.onclick = function () {
|
||||||
|
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
||||||
|
showTransformModal(editor.node, anchor)
|
||||||
|
};
|
||||||
|
this.menu.appendChild(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create undo/redo buttons
|
||||||
|
if (this.history) {
|
||||||
|
// create undo button
|
||||||
|
var undo = document.createElement('button');
|
||||||
|
undo.type = 'button';
|
||||||
|
undo.className = 'jsoneditor-undo jsoneditor-separator';
|
||||||
|
undo.title = translate('undo');
|
||||||
|
undo.onclick = function () {
|
||||||
|
editor._onUndo();
|
||||||
|
};
|
||||||
|
this.menu.appendChild(undo);
|
||||||
|
this.dom.undo = undo;
|
||||||
|
|
||||||
|
// create redo button
|
||||||
|
var redo = document.createElement('button');
|
||||||
|
redo.type = 'button';
|
||||||
|
redo.className = 'jsoneditor-redo';
|
||||||
|
redo.title = translate('redo');
|
||||||
|
redo.onclick = function () {
|
||||||
|
editor._onRedo();
|
||||||
|
};
|
||||||
|
this.menu.appendChild(redo);
|
||||||
|
this.dom.redo = redo;
|
||||||
|
|
||||||
|
// register handler for onchange of history
|
||||||
|
this.history.onChange = function () {
|
||||||
|
undo.disabled = !editor.history.canUndo();
|
||||||
|
redo.disabled = !editor.history.canRedo();
|
||||||
|
};
|
||||||
|
this.history.onChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
// create mode box
|
||||||
|
if (this.options && this.options.modes && this.options.modes.length) {
|
||||||
|
var me = this;
|
||||||
|
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
||||||
|
// switch mode and restore focus
|
||||||
|
me.setMode(mode);
|
||||||
|
me.modeSwitcher.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// create search box
|
||||||
|
if (this.options.search) {
|
||||||
|
this.searchBox = new SearchBox(this, this.menu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create transform button
|
if (this.options.navigationBar) {
|
||||||
if (this.options.enableTransform) {
|
|
||||||
var transform = document.createElement('button');
|
|
||||||
transform.type = 'button';
|
|
||||||
transform.title = translate('transformTitleShort');
|
|
||||||
transform.className = 'jsoneditor-transform';
|
|
||||||
transform.onclick = function () {
|
|
||||||
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
|
||||||
showTransformModal(editor.node, anchor)
|
|
||||||
};
|
|
||||||
this.menu.appendChild(transform);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create undo/redo buttons
|
|
||||||
if (this.history) {
|
|
||||||
// create undo button
|
|
||||||
var undo = document.createElement('button');
|
|
||||||
undo.type = 'button';
|
|
||||||
undo.className = 'jsoneditor-undo jsoneditor-separator';
|
|
||||||
undo.title = translate('undo');
|
|
||||||
undo.onclick = function () {
|
|
||||||
editor._onUndo();
|
|
||||||
};
|
|
||||||
this.menu.appendChild(undo);
|
|
||||||
this.dom.undo = undo;
|
|
||||||
|
|
||||||
// create redo button
|
|
||||||
var redo = document.createElement('button');
|
|
||||||
redo.type = 'button';
|
|
||||||
redo.className = 'jsoneditor-redo';
|
|
||||||
redo.title = translate('redo');
|
|
||||||
redo.onclick = function () {
|
|
||||||
editor._onRedo();
|
|
||||||
};
|
|
||||||
this.menu.appendChild(redo);
|
|
||||||
this.dom.redo = redo;
|
|
||||||
|
|
||||||
// register handler for onchange of history
|
|
||||||
this.history.onChange = function () {
|
|
||||||
undo.disabled = !editor.history.canUndo();
|
|
||||||
redo.disabled = !editor.history.canRedo();
|
|
||||||
};
|
|
||||||
this.history.onChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create mode box
|
|
||||||
if (this.options && this.options.modes && this.options.modes.length) {
|
|
||||||
var me = this;
|
|
||||||
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
|
||||||
// switch mode and restore focus
|
|
||||||
me.setMode(mode);
|
|
||||||
me.modeSwitcher.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// create search box
|
|
||||||
if (this.options.search) {
|
|
||||||
this.searchBox = new SearchBox(this, this.menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.options.navigationBar) {
|
|
||||||
// create second menu row for treepath
|
// create second menu row for treepath
|
||||||
this.navBar = document.createElement('div');
|
this.navBar = document.createElement('div');
|
||||||
this.navBar.className = 'jsoneditor-navigation-bar nav-bar-empty';
|
this.navBar.className = 'jsoneditor-navigation-bar nav-bar-empty';
|
||||||
|
@ -2660,7 +2666,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
name: getName(node),
|
name: getName(node),
|
||||||
node: node,
|
node: node,
|
||||||
children: []
|
children: []
|
||||||
}
|
};
|
||||||
if (node.childs && node.childs.length) {
|
if (node.childs && node.childs.length) {
|
||||||
node.childs.forEach(function (childNode) {
|
node.childs.forEach(function (childNode) {
|
||||||
pathObj.children.push({
|
pathObj.children.push({
|
||||||
|
@ -2824,10 +2830,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End of multiselect nodes by dragging
|
* End of multiselect nodes by dragging
|
||||||
* @param event
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._onMultiSelectEnd = function (event) {
|
treemode._onMultiSelectEnd = function () {
|
||||||
// set focus to the context menu button of the first node
|
// set focus to the context menu button of the first node
|
||||||
if (this.multiselection.nodes[0]) {
|
if (this.multiselection.nodes[0]) {
|
||||||
this.multiselection.nodes[0].dom.menu.focus();
|
this.multiselection.nodes[0].dom.menu.focus();
|
||||||
|
@ -3051,16 +3056,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._createTable = function () {
|
treemode._createTable = function () {
|
||||||
var contentOuter = document.createElement('div');
|
if (this.options.navigationBar) {
|
||||||
contentOuter.className = 'jsoneditor-outer';
|
util.addClassName(this.contentOuter, 'has-nav-bar');
|
||||||
if(this.options.navigationBar) {
|
|
||||||
util.addClassName(contentOuter, 'has-nav-bar');
|
|
||||||
}
|
}
|
||||||
this.contentOuter = contentOuter;
|
|
||||||
|
|
||||||
this.scrollableContent = document.createElement('div');
|
this.scrollableContent = document.createElement('div');
|
||||||
this.scrollableContent.className = 'jsoneditor-tree';
|
this.scrollableContent.className = 'jsoneditor-tree';
|
||||||
contentOuter.appendChild(this.scrollableContent);
|
this.contentOuter.appendChild(this.scrollableContent);
|
||||||
|
|
||||||
// the jsoneditor-tree-inner div with bottom padding is here to
|
// the jsoneditor-tree-inner div with bottom padding is here to
|
||||||
// keep space for the action menu dropdown. It's created as a
|
// keep space for the action menu dropdown. It's created as a
|
||||||
|
@ -3094,7 +3096,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.tbody = document.createElement('tbody');
|
this.tbody = document.createElement('tbody');
|
||||||
this.table.appendChild(this.tbody);
|
this.table.appendChild(this.tbody);
|
||||||
|
|
||||||
this.frame.appendChild(contentOuter);
|
this.frame.appendChild(this.contentOuter);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3158,12 +3160,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback registraion for selection change
|
* Callback registration for selection change
|
||||||
* @param {selectionCallback} callback
|
* @param {selectionCallback} callback
|
||||||
*
|
*
|
||||||
* @callback selectionCallback
|
* @callback selectionCallback
|
||||||
* @param {SerializableNode=} start
|
|
||||||
* @param {SerializableNode=} end
|
|
||||||
*/
|
*/
|
||||||
treemode.onSelectionChange = function (callback) {
|
treemode.onSelectionChange = function (callback) {
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
|
@ -3182,7 +3182,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
treemode.setSelection = function (start, end) {
|
treemode.setSelection = function (start, end) {
|
||||||
// check for old usage
|
// check for old usage
|
||||||
if (start && start.dom && start.range) {
|
if (start && start.dom && start.range) {
|
||||||
console.warn('setSelection/getSelection usage for text selection is depracated and should not be used, see documantaion for supported selection options');
|
console.warn('setSelection/getSelection usage for text selection is deprecated and should not be used, see documentation for supported selection options');
|
||||||
this.setDomSelection(start);
|
this.setDomSelection(start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3198,7 +3198,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
* Returns a set of Nodes according to a range of selection
|
* Returns a set of Nodes according to a range of selection
|
||||||
* @param {{path: Array.<String>}} start object contains the path for range start
|
* @param {{path: Array.<String>}} start object contains the path for range start
|
||||||
* @param {{path: Array.<String>}=} end object contains the path for range end
|
* @param {{path: Array.<String>}=} end object contains the path for range end
|
||||||
* @return {Array.<Node>} Node intances on the given range
|
* @return {Array.<Node>} Node instances on the given range
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._getNodeInstancesByRange = function (start, end) {
|
treemode._getNodeInstancesByRange = function (start, end) {
|
||||||
|
@ -8246,7 +8246,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.childs = [];
|
this.childs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.childs.forEach(function (child, index) {
|
this.childs.forEach(function (child) {
|
||||||
child.clearDom();
|
child.clearDom();
|
||||||
delete child.index;
|
delete child.index;
|
||||||
child.fieldEditable = true;
|
child.fieldEditable = true;
|
||||||
|
@ -10222,7 +10222,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove nodes
|
* Remove nodes
|
||||||
|
@ -10720,7 +10720,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the focus of given nodes, and move the focus to the (a) node before,
|
* Remove the focus of given nodes, and move the focus to the (a) node before,
|
||||||
|
@ -17244,10 +17244,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
// read options
|
// read options
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
if(typeof options.statusBar === 'undefined') {
|
if (typeof options.statusBar === 'undefined') {
|
||||||
options.statusBar = true;
|
options.statusBar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setting default for textmode
|
||||||
|
options.mainMenuBar = options.mainMenuBar !== false;
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
// indentation
|
// indentation
|
||||||
|
@ -17311,67 +17314,89 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.frame.onkeydown = function (event) {
|
this.frame.onkeydown = function (event) {
|
||||||
me._onKeyDown(event);
|
me._onKeyDown(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
// create menu
|
|
||||||
this.menu = document.createElement('div');
|
|
||||||
this.menu.className = 'jsoneditor-menu';
|
|
||||||
this.frame.appendChild(this.menu);
|
|
||||||
|
|
||||||
// create format button
|
this.content = document.createElement('div');
|
||||||
var buttonFormat = document.createElement('button');
|
this.content.className = 'jsoneditor-outer';
|
||||||
buttonFormat.type = 'button';
|
|
||||||
buttonFormat.className = 'jsoneditor-format';
|
|
||||||
buttonFormat.title = 'Format JSON data, with proper indentation and line feeds (Ctrl+\\)';
|
|
||||||
this.menu.appendChild(buttonFormat);
|
|
||||||
buttonFormat.onclick = function () {
|
|
||||||
try {
|
|
||||||
me.format();
|
|
||||||
me._onChange();
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
me._onError(err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create compact button
|
if (this.options.mainMenuBar) {
|
||||||
var buttonCompact = document.createElement('button');
|
util.addClassName(this.content, 'has-main-menu-bar');
|
||||||
buttonCompact.type = 'button';
|
|
||||||
buttonCompact.className = 'jsoneditor-compact';
|
|
||||||
buttonCompact.title = 'Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)';
|
|
||||||
this.menu.appendChild(buttonCompact);
|
|
||||||
buttonCompact.onclick = function () {
|
|
||||||
try {
|
|
||||||
me.compact();
|
|
||||||
me._onChange();
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
me._onError(err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create repair button
|
// create menu
|
||||||
var buttonRepair = document.createElement('button');
|
this.menu = document.createElement('div');
|
||||||
buttonRepair.type = 'button';
|
this.menu.className = 'jsoneditor-menu';
|
||||||
buttonRepair.className = 'jsoneditor-repair';
|
this.frame.appendChild(this.menu);
|
||||||
buttonRepair.title = 'Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.';
|
|
||||||
this.menu.appendChild(buttonRepair);
|
|
||||||
buttonRepair.onclick = function () {
|
|
||||||
try {
|
|
||||||
me.repair();
|
|
||||||
me._onChange();
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
me._onError(err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create mode box
|
// create format button
|
||||||
if (this.options && this.options.modes && this.options.modes.length) {
|
var buttonFormat = document.createElement('button');
|
||||||
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
buttonFormat.type = 'button';
|
||||||
// switch mode and restore focus
|
buttonFormat.className = 'jsoneditor-format';
|
||||||
me.setMode(mode);
|
buttonFormat.title = 'Format JSON data, with proper indentation and line feeds (Ctrl+\\)';
|
||||||
me.modeSwitcher.focus();
|
this.menu.appendChild(buttonFormat);
|
||||||
});
|
buttonFormat.onclick = function () {
|
||||||
|
try {
|
||||||
|
me.format();
|
||||||
|
me._onChange();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
me._onError(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create compact button
|
||||||
|
var buttonCompact = document.createElement('button');
|
||||||
|
buttonCompact.type = 'button';
|
||||||
|
buttonCompact.className = 'jsoneditor-compact';
|
||||||
|
buttonCompact.title = 'Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)';
|
||||||
|
this.menu.appendChild(buttonCompact);
|
||||||
|
buttonCompact.onclick = function () {
|
||||||
|
try {
|
||||||
|
me.compact();
|
||||||
|
me._onChange();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
me._onError(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create repair button
|
||||||
|
var buttonRepair = document.createElement('button');
|
||||||
|
buttonRepair.type = 'button';
|
||||||
|
buttonRepair.className = 'jsoneditor-repair';
|
||||||
|
buttonRepair.title = 'Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.';
|
||||||
|
this.menu.appendChild(buttonRepair);
|
||||||
|
buttonRepair.onclick = function () {
|
||||||
|
try {
|
||||||
|
me.repair();
|
||||||
|
me._onChange();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
me._onError(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create mode box
|
||||||
|
if (this.options && this.options.modes && this.options.modes.length) {
|
||||||
|
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
||||||
|
// switch mode and restore focus
|
||||||
|
me.setMode(mode);
|
||||||
|
me.modeSwitcher.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mode == 'code') {
|
||||||
|
var poweredBy = document.createElement('a');
|
||||||
|
poweredBy.appendChild(document.createTextNode('powered by ace'));
|
||||||
|
poweredBy.href = 'http://ace.ajax.org';
|
||||||
|
poweredBy.target = '_blank';
|
||||||
|
poweredBy.className = 'jsoneditor-poweredBy';
|
||||||
|
poweredBy.onclick = function () {
|
||||||
|
// TODO: this anchor falls below the margin of the content,
|
||||||
|
// therefore the normal a.href does not work. We use a click event
|
||||||
|
// for now, but this should be fixed.
|
||||||
|
window.open(poweredBy.href, poweredBy.target);
|
||||||
|
};
|
||||||
|
this.menu.appendChild(poweredBy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var emptyNode = {};
|
var emptyNode = {};
|
||||||
|
@ -17379,10 +17404,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
&& typeof(this.options.onEditable === 'function')
|
&& typeof(this.options.onEditable === 'function')
|
||||||
&& !this.options.onEditable(emptyNode));
|
&& !this.options.onEditable(emptyNode));
|
||||||
|
|
||||||
this.content = document.createElement('div');
|
|
||||||
this.content.className = 'jsoneditor-outer';
|
|
||||||
this.frame.appendChild(this.content);
|
this.frame.appendChild(this.content);
|
||||||
|
|
||||||
this.container.appendChild(this.frame);
|
this.container.appendChild(this.frame);
|
||||||
|
|
||||||
if (this.mode == 'code') {
|
if (this.mode == 'code') {
|
||||||
|
@ -17427,19 +17449,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var poweredBy = document.createElement('a');
|
|
||||||
poweredBy.appendChild(document.createTextNode('powered by ace'));
|
|
||||||
poweredBy.href = 'http://ace.ajax.org';
|
|
||||||
poweredBy.target = '_blank';
|
|
||||||
poweredBy.className = 'jsoneditor-poweredBy';
|
|
||||||
poweredBy.onclick = function () {
|
|
||||||
// TODO: this anchor falls below the margin of the content,
|
|
||||||
// therefore the normal a.href does not work. We use a click event
|
|
||||||
// for now, but this should be fixed.
|
|
||||||
window.open(poweredBy.href, poweredBy.target);
|
|
||||||
};
|
|
||||||
this.menu.appendChild(poweredBy);
|
|
||||||
|
|
||||||
// register onchange event
|
// register onchange event
|
||||||
aceEditor.on('change', this._onChange.bind(this));
|
aceEditor.on('change', this._onChange.bind(this));
|
||||||
aceEditor.on('changeSelection', this._onSelect.bind(this));
|
aceEditor.on('changeSelection', this._onSelect.bind(this));
|
||||||
|
@ -17472,12 +17481,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.dom.validationErrorsContainer = validationErrorsContainer;
|
this.dom.validationErrorsContainer = validationErrorsContainer;
|
||||||
this.frame.appendChild(validationErrorsContainer);
|
this.frame.appendChild(validationErrorsContainer);
|
||||||
|
|
||||||
var additinalErrorsIndication = document.createElement('div');
|
var additionalErrorsIndication = document.createElement('div');
|
||||||
additinalErrorsIndication.style.display = 'none';
|
additionalErrorsIndication.style.display = 'none';
|
||||||
additinalErrorsIndication.className = "jsoneditor-additional-errors fadein";
|
additionalErrorsIndication.className = "jsoneditor-additional-errors fadein";
|
||||||
additinalErrorsIndication.innerHTML = "Scroll for more ▿";
|
additionalErrorsIndication.innerHTML = "Scroll for more ▿";
|
||||||
this.dom.additinalErrorsIndication = additinalErrorsIndication;
|
this.dom.additionalErrorsIndication = additionalErrorsIndication;
|
||||||
validationErrorsContainer.appendChild(additinalErrorsIndication);
|
validationErrorsContainer.appendChild(additionalErrorsIndication);
|
||||||
|
|
||||||
if (options.statusBar) {
|
if (options.statusBar) {
|
||||||
util.addClassName(this.content, 'has-status-bar');
|
util.addClassName(this.content, 'has-status-bar');
|
||||||
|
@ -17631,20 +17640,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler for mousedown.
|
* Event handler for mousedown.
|
||||||
* @param {Event} event
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
textmode._onMouseDown = function (event) {
|
textmode._onMouseDown = function () {
|
||||||
this._updateCursorInfo();
|
this._updateCursorInfo();
|
||||||
this._emitSelectionChange();
|
this._emitSelectionChange();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler for blur.
|
* Event handler for blur.
|
||||||
* @param {Event} event
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
textmode._onBlur = function (event) {
|
textmode._onBlur = function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
// this allows to avoid blur when clicking inner elements (like the errors panel)
|
// this allows to avoid blur when clicking inner elements (like the errors panel)
|
||||||
// just make sure to set the isFocused to true on the inner element onclick callback
|
// just make sure to set the isFocused to true on the inner element onclick callback
|
||||||
|
@ -17684,7 +17691,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
line: line,
|
line: line,
|
||||||
column: col,
|
column: col,
|
||||||
count: count
|
count: count
|
||||||
}
|
};
|
||||||
|
|
||||||
if(me.options.statusBar) {
|
if(me.options.statusBar) {
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
@ -17703,7 +17710,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
line: line,
|
line: line,
|
||||||
column: col,
|
column: col,
|
||||||
count: count
|
count: count
|
||||||
}
|
};
|
||||||
|
|
||||||
if(this.options.statusBar) {
|
if(this.options.statusBar) {
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
@ -17731,7 +17738,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var currentSelection = this.getTextSelection();
|
var currentSelection = this.getTextSelection();
|
||||||
this._selectionChangedHandler(currentSelection.start, currentSelection.end, currentSelection.text);
|
this._selectionChangedHandler(currentSelection.start, currentSelection.end, currentSelection.text);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* refresh ERROR annotations state
|
* refresh ERROR annotations state
|
||||||
|
@ -17746,7 +17753,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var errEnnotations = session.getAnnotations().filter(function(annotation) {return annotation.type === 'error' });
|
var errEnnotations = session.getAnnotations().filter(function(annotation) {return annotation.type === 'error' });
|
||||||
session.setAnnotations(errEnnotations);
|
session.setAnnotations(errEnnotations);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy the editor. Clean up DOM, event listeners, and web workers.
|
* Destroy the editor. Clean up DOM, event listeners, and web workers.
|
||||||
|
@ -18051,7 +18058,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (this.dom.validationErrors) {
|
if (this.dom.validationErrors) {
|
||||||
this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors);
|
this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors);
|
||||||
this.dom.validationErrors = null;
|
this.dom.validationErrors = null;
|
||||||
this.dom.additinalErrorsIndication.style.display = 'none';
|
this.dom.additionalErrorsIndication.style.display = 'none';
|
||||||
|
|
||||||
this.content.style.marginBottom = '';
|
this.content.style.marginBottom = '';
|
||||||
this.content.style.paddingBottom = '';
|
this.content.style.paddingBottom = '';
|
||||||
|
@ -18136,12 +18143,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
this.dom.validationErrors = validationErrors;
|
this.dom.validationErrors = validationErrors;
|
||||||
this.dom.validationErrorsContainer.appendChild(validationErrors);
|
this.dom.validationErrorsContainer.appendChild(validationErrors);
|
||||||
this.dom.additinalErrorsIndication.title = errors.length + " errors total";
|
this.dom.additionalErrorsIndication.title = errors.length + " errors total";
|
||||||
|
|
||||||
if (this.dom.validationErrorsContainer.clientHeight < this.dom.validationErrorsContainer.scrollHeight) {
|
if (this.dom.validationErrorsContainer.clientHeight < this.dom.validationErrorsContainer.scrollHeight) {
|
||||||
this.dom.additinalErrorsIndication.style.display = 'block';
|
this.dom.additionalErrorsIndication.style.display = 'block';
|
||||||
this.dom.validationErrorsContainer.onscroll = function () {
|
this.dom.validationErrorsContainer.onscroll = function () {
|
||||||
me.dom.additinalErrorsIndication.style.display =
|
me.dom.additionalErrorsIndication.style.display =
|
||||||
(me.dom.validationErrorsContainer.clientHeight > 0 && me.dom.validationErrorsContainer.scrollTop === 0) ? 'block' : 'none';
|
(me.dom.validationErrorsContainer.clientHeight > 0 && me.dom.validationErrorsContainer.scrollTop === 0) ? 'block' : 'none';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -18230,13 +18237,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback registraion for selection change
|
* Callback registration for selection change
|
||||||
* @param {selectionCallback} callback
|
* @param {selectionCallback} callback
|
||||||
*
|
*
|
||||||
* @callback selectionCallback
|
* @callback selectionCallback
|
||||||
* @param {{row:Number, column:Number}} startPos selection start position
|
|
||||||
* @param {{row:Number, column:Number}} endPos selected end position
|
|
||||||
* @param {String} text selected text
|
|
||||||
*/
|
*/
|
||||||
textmode.onTextSelectionChange = function (callback) {
|
textmode.onTextSelectionChange = function (callback) {
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -269,21 +269,31 @@ div.jsoneditor-outer {
|
||||||
position: static;
|
position: static;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: -35px 0 0 0;
|
margin: 0;
|
||||||
padding: 35px 0 0 0;
|
padding: 0;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.jsoneditor-outer.has-nav-bar {
|
div.jsoneditor-outer.has-nav-bar {
|
||||||
margin: -61px 0 0 0;
|
margin-top: -26px;
|
||||||
padding: 61px 0 0 0;
|
padding-top: 26px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.jsoneditor-outer.has-status-bar {
|
div.jsoneditor-outer.has-status-bar {
|
||||||
margin: -35px 0 -26px 0;
|
margin-bottom: -26px;
|
||||||
padding: 35px 0 26px 0;
|
padding-bottom: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jsoneditor-outer.has-main-menu-bar {
|
||||||
|
margin-top: -35px;
|
||||||
|
padding-top: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jsoneditor-outer.has-nav-bar.has-main-menu-bar {
|
||||||
|
margin-top: -61px;
|
||||||
|
padding-top: 61px;
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea.jsoneditor-text,
|
textarea.jsoneditor-text,
|
||||||
|
|
|
@ -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.25.0
|
* @version 5.26.0
|
||||||
* @date 2018-10-29
|
* @date 2018-11-12
|
||||||
*/
|
*/
|
||||||
(function webpackUniversalModuleDefinition(root, factory) {
|
(function webpackUniversalModuleDefinition(root, factory) {
|
||||||
if(typeof exports === 'object' && typeof module === 'object')
|
if(typeof exports === 'object' && typeof module === 'object')
|
||||||
|
@ -252,7 +252,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
'colorPicker', 'onColorPicker',
|
'colorPicker', 'onColorPicker',
|
||||||
'timestampTag',
|
'timestampTag',
|
||||||
'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation',
|
'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation',
|
||||||
'sortObjectKeys', 'navigationBar', 'statusBar', 'languages', 'language', 'enableSort', 'enableTransform'
|
'sortObjectKeys', 'navigationBar', 'statusBar', 'mainMenuBar', 'languages', 'language', 'enableSort', 'enableTransform'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30222,8 +30222,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._setOptions = function (options) {
|
treemode._setOptions = function (options) {
|
||||||
var editor = this;
|
|
||||||
|
|
||||||
this.options = {
|
this.options = {
|
||||||
search: true,
|
search: true,
|
||||||
history: true,
|
history: true,
|
||||||
|
@ -30233,6 +30231,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
schemaRefs: null,
|
schemaRefs: null,
|
||||||
autocomplete: null,
|
autocomplete: null,
|
||||||
navigationBar : true,
|
navigationBar : true,
|
||||||
|
mainMenuBar: true,
|
||||||
onSelectionChange: null,
|
onSelectionChange: null,
|
||||||
colorPicker: true,
|
colorPicker: true,
|
||||||
onColorPicker: function (parent, color, onChange) {
|
onColorPicker: function (parent, color, onChange) {
|
||||||
|
@ -30242,11 +30241,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
color: color,
|
color: color,
|
||||||
popup: 'bottom',
|
popup: 'bottom',
|
||||||
onDone: function (color) {
|
onDone: function (color) {
|
||||||
var alpha = color.rgba[3]
|
var alpha = color.rgba[3];
|
||||||
var hex = (alpha === 1)
|
var hex = (alpha === 1)
|
||||||
? color.hex.substr(0, 7) // return #RRGGBB
|
? color.hex.substr(0, 7) // return #RRGGBB
|
||||||
: color.hex // return #RRGGBBAA
|
: color.hex; // return #RRGGBBAA
|
||||||
onChange(hex)
|
onChange(hex);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
@ -31035,6 +31034,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.frame.className = 'jsoneditor jsoneditor-mode-' + this.options.mode;
|
this.frame.className = 'jsoneditor jsoneditor-mode-' + this.options.mode;
|
||||||
this.container.appendChild(this.frame);
|
this.container.appendChild(this.frame);
|
||||||
|
|
||||||
|
this.contentOuter = document.createElement('div');
|
||||||
|
this.contentOuter.className = 'jsoneditor-outer';
|
||||||
|
|
||||||
// create one global event listener to handle all events from all nodes
|
// create one global event listener to handle all events from all nodes
|
||||||
var editor = this;
|
var editor = this;
|
||||||
function onEvent(event) {
|
function onEvent(event) {
|
||||||
|
@ -31073,105 +31075,109 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.frame.onfocusin = onEvent; // for IE
|
this.frame.onfocusin = onEvent; // for IE
|
||||||
this.frame.onfocusout = onEvent; // for IE
|
this.frame.onfocusout = onEvent; // for IE
|
||||||
|
|
||||||
// create menu
|
if (this.options.mainMenuBar) {
|
||||||
this.menu = document.createElement('div');
|
util.addClassName(this.contentOuter, 'has-main-menu-bar');
|
||||||
this.menu.className = 'jsoneditor-menu';
|
|
||||||
this.frame.appendChild(this.menu);
|
|
||||||
|
|
||||||
// create expand all button
|
// create menu
|
||||||
var expandAll = document.createElement('button');
|
this.menu = document.createElement('div');
|
||||||
expandAll.type = 'button';
|
this.menu.className = 'jsoneditor-menu';
|
||||||
expandAll.className = 'jsoneditor-expand-all';
|
this.frame.appendChild(this.menu);
|
||||||
expandAll.title = translate('expandAll');
|
|
||||||
expandAll.onclick = function () {
|
|
||||||
editor.expandAll();
|
|
||||||
};
|
|
||||||
this.menu.appendChild(expandAll);
|
|
||||||
|
|
||||||
// create collapse all button
|
// create expand all button
|
||||||
var collapseAll = document.createElement('button');
|
var expandAll = document.createElement('button');
|
||||||
collapseAll.type = 'button';
|
expandAll.type = 'button';
|
||||||
collapseAll.title = translate('collapseAll');
|
expandAll.className = 'jsoneditor-expand-all';
|
||||||
collapseAll.className = 'jsoneditor-collapse-all';
|
expandAll.title = translate('expandAll');
|
||||||
collapseAll.onclick = function () {
|
expandAll.onclick = function () {
|
||||||
editor.collapseAll();
|
editor.expandAll();
|
||||||
};
|
|
||||||
this.menu.appendChild(collapseAll);
|
|
||||||
|
|
||||||
// create sort button
|
|
||||||
if (this.options.enableSort) {
|
|
||||||
var sort = document.createElement('button');
|
|
||||||
sort.type = 'button';
|
|
||||||
sort.className = 'jsoneditor-sort';
|
|
||||||
sort.title = translate('sortTitleShort');
|
|
||||||
sort.onclick = function () {
|
|
||||||
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
|
||||||
showSortModal(editor.node, anchor)
|
|
||||||
};
|
};
|
||||||
this.menu.appendChild(sort);
|
this.menu.appendChild(expandAll);
|
||||||
|
|
||||||
|
// create collapse all button
|
||||||
|
var collapseAll = document.createElement('button');
|
||||||
|
collapseAll.type = 'button';
|
||||||
|
collapseAll.title = translate('collapseAll');
|
||||||
|
collapseAll.className = 'jsoneditor-collapse-all';
|
||||||
|
collapseAll.onclick = function () {
|
||||||
|
editor.collapseAll();
|
||||||
|
};
|
||||||
|
this.menu.appendChild(collapseAll);
|
||||||
|
|
||||||
|
// create sort button
|
||||||
|
if (this.options.enableSort) {
|
||||||
|
var sort = document.createElement('button');
|
||||||
|
sort.type = 'button';
|
||||||
|
sort.className = 'jsoneditor-sort';
|
||||||
|
sort.title = translate('sortTitleShort');
|
||||||
|
sort.onclick = function () {
|
||||||
|
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
||||||
|
showSortModal(editor.node, anchor)
|
||||||
|
};
|
||||||
|
this.menu.appendChild(sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create transform button
|
||||||
|
if (this.options.enableTransform) {
|
||||||
|
var transform = document.createElement('button');
|
||||||
|
transform.type = 'button';
|
||||||
|
transform.title = translate('transformTitleShort');
|
||||||
|
transform.className = 'jsoneditor-transform';
|
||||||
|
transform.onclick = function () {
|
||||||
|
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
||||||
|
showTransformModal(editor.node, anchor)
|
||||||
|
};
|
||||||
|
this.menu.appendChild(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create undo/redo buttons
|
||||||
|
if (this.history) {
|
||||||
|
// create undo button
|
||||||
|
var undo = document.createElement('button');
|
||||||
|
undo.type = 'button';
|
||||||
|
undo.className = 'jsoneditor-undo jsoneditor-separator';
|
||||||
|
undo.title = translate('undo');
|
||||||
|
undo.onclick = function () {
|
||||||
|
editor._onUndo();
|
||||||
|
};
|
||||||
|
this.menu.appendChild(undo);
|
||||||
|
this.dom.undo = undo;
|
||||||
|
|
||||||
|
// create redo button
|
||||||
|
var redo = document.createElement('button');
|
||||||
|
redo.type = 'button';
|
||||||
|
redo.className = 'jsoneditor-redo';
|
||||||
|
redo.title = translate('redo');
|
||||||
|
redo.onclick = function () {
|
||||||
|
editor._onRedo();
|
||||||
|
};
|
||||||
|
this.menu.appendChild(redo);
|
||||||
|
this.dom.redo = redo;
|
||||||
|
|
||||||
|
// register handler for onchange of history
|
||||||
|
this.history.onChange = function () {
|
||||||
|
undo.disabled = !editor.history.canUndo();
|
||||||
|
redo.disabled = !editor.history.canRedo();
|
||||||
|
};
|
||||||
|
this.history.onChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
// create mode box
|
||||||
|
if (this.options && this.options.modes && this.options.modes.length) {
|
||||||
|
var me = this;
|
||||||
|
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
||||||
|
// switch mode and restore focus
|
||||||
|
me.setMode(mode);
|
||||||
|
me.modeSwitcher.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// create search box
|
||||||
|
if (this.options.search) {
|
||||||
|
this.searchBox = new SearchBox(this, this.menu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create transform button
|
if (this.options.navigationBar) {
|
||||||
if (this.options.enableTransform) {
|
|
||||||
var transform = document.createElement('button');
|
|
||||||
transform.type = 'button';
|
|
||||||
transform.title = translate('transformTitleShort');
|
|
||||||
transform.className = 'jsoneditor-transform';
|
|
||||||
transform.onclick = function () {
|
|
||||||
var anchor = editor.options.modalAnchor || DEFAULT_MODAL_ANCHOR;
|
|
||||||
showTransformModal(editor.node, anchor)
|
|
||||||
};
|
|
||||||
this.menu.appendChild(transform);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create undo/redo buttons
|
|
||||||
if (this.history) {
|
|
||||||
// create undo button
|
|
||||||
var undo = document.createElement('button');
|
|
||||||
undo.type = 'button';
|
|
||||||
undo.className = 'jsoneditor-undo jsoneditor-separator';
|
|
||||||
undo.title = translate('undo');
|
|
||||||
undo.onclick = function () {
|
|
||||||
editor._onUndo();
|
|
||||||
};
|
|
||||||
this.menu.appendChild(undo);
|
|
||||||
this.dom.undo = undo;
|
|
||||||
|
|
||||||
// create redo button
|
|
||||||
var redo = document.createElement('button');
|
|
||||||
redo.type = 'button';
|
|
||||||
redo.className = 'jsoneditor-redo';
|
|
||||||
redo.title = translate('redo');
|
|
||||||
redo.onclick = function () {
|
|
||||||
editor._onRedo();
|
|
||||||
};
|
|
||||||
this.menu.appendChild(redo);
|
|
||||||
this.dom.redo = redo;
|
|
||||||
|
|
||||||
// register handler for onchange of history
|
|
||||||
this.history.onChange = function () {
|
|
||||||
undo.disabled = !editor.history.canUndo();
|
|
||||||
redo.disabled = !editor.history.canRedo();
|
|
||||||
};
|
|
||||||
this.history.onChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// create mode box
|
|
||||||
if (this.options && this.options.modes && this.options.modes.length) {
|
|
||||||
var me = this;
|
|
||||||
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
|
||||||
// switch mode and restore focus
|
|
||||||
me.setMode(mode);
|
|
||||||
me.modeSwitcher.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// create search box
|
|
||||||
if (this.options.search) {
|
|
||||||
this.searchBox = new SearchBox(this, this.menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.options.navigationBar) {
|
|
||||||
// create second menu row for treepath
|
// create second menu row for treepath
|
||||||
this.navBar = document.createElement('div');
|
this.navBar = document.createElement('div');
|
||||||
this.navBar.className = 'jsoneditor-navigation-bar nav-bar-empty';
|
this.navBar.className = 'jsoneditor-navigation-bar nav-bar-empty';
|
||||||
|
@ -31302,7 +31308,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
name: getName(node),
|
name: getName(node),
|
||||||
node: node,
|
node: node,
|
||||||
children: []
|
children: []
|
||||||
}
|
};
|
||||||
if (node.childs && node.childs.length) {
|
if (node.childs && node.childs.length) {
|
||||||
node.childs.forEach(function (childNode) {
|
node.childs.forEach(function (childNode) {
|
||||||
pathObj.children.push({
|
pathObj.children.push({
|
||||||
|
@ -31466,10 +31472,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End of multiselect nodes by dragging
|
* End of multiselect nodes by dragging
|
||||||
* @param event
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._onMultiSelectEnd = function (event) {
|
treemode._onMultiSelectEnd = function () {
|
||||||
// set focus to the context menu button of the first node
|
// set focus to the context menu button of the first node
|
||||||
if (this.multiselection.nodes[0]) {
|
if (this.multiselection.nodes[0]) {
|
||||||
this.multiselection.nodes[0].dom.menu.focus();
|
this.multiselection.nodes[0].dom.menu.focus();
|
||||||
|
@ -31693,16 +31698,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._createTable = function () {
|
treemode._createTable = function () {
|
||||||
var contentOuter = document.createElement('div');
|
if (this.options.navigationBar) {
|
||||||
contentOuter.className = 'jsoneditor-outer';
|
util.addClassName(this.contentOuter, 'has-nav-bar');
|
||||||
if(this.options.navigationBar) {
|
|
||||||
util.addClassName(contentOuter, 'has-nav-bar');
|
|
||||||
}
|
}
|
||||||
this.contentOuter = contentOuter;
|
|
||||||
|
|
||||||
this.scrollableContent = document.createElement('div');
|
this.scrollableContent = document.createElement('div');
|
||||||
this.scrollableContent.className = 'jsoneditor-tree';
|
this.scrollableContent.className = 'jsoneditor-tree';
|
||||||
contentOuter.appendChild(this.scrollableContent);
|
this.contentOuter.appendChild(this.scrollableContent);
|
||||||
|
|
||||||
// the jsoneditor-tree-inner div with bottom padding is here to
|
// the jsoneditor-tree-inner div with bottom padding is here to
|
||||||
// keep space for the action menu dropdown. It's created as a
|
// keep space for the action menu dropdown. It's created as a
|
||||||
|
@ -31736,7 +31738,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.tbody = document.createElement('tbody');
|
this.tbody = document.createElement('tbody');
|
||||||
this.table.appendChild(this.tbody);
|
this.table.appendChild(this.tbody);
|
||||||
|
|
||||||
this.frame.appendChild(contentOuter);
|
this.frame.appendChild(this.contentOuter);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31800,12 +31802,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback registraion for selection change
|
* Callback registration for selection change
|
||||||
* @param {selectionCallback} callback
|
* @param {selectionCallback} callback
|
||||||
*
|
*
|
||||||
* @callback selectionCallback
|
* @callback selectionCallback
|
||||||
* @param {SerializableNode=} start
|
|
||||||
* @param {SerializableNode=} end
|
|
||||||
*/
|
*/
|
||||||
treemode.onSelectionChange = function (callback) {
|
treemode.onSelectionChange = function (callback) {
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
|
@ -31824,7 +31824,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
treemode.setSelection = function (start, end) {
|
treemode.setSelection = function (start, end) {
|
||||||
// check for old usage
|
// check for old usage
|
||||||
if (start && start.dom && start.range) {
|
if (start && start.dom && start.range) {
|
||||||
console.warn('setSelection/getSelection usage for text selection is depracated and should not be used, see documantaion for supported selection options');
|
console.warn('setSelection/getSelection usage for text selection is deprecated and should not be used, see documentation for supported selection options');
|
||||||
this.setDomSelection(start);
|
this.setDomSelection(start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31840,7 +31840,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
* Returns a set of Nodes according to a range of selection
|
* Returns a set of Nodes according to a range of selection
|
||||||
* @param {{path: Array.<String>}} start object contains the path for range start
|
* @param {{path: Array.<String>}} start object contains the path for range start
|
||||||
* @param {{path: Array.<String>}=} end object contains the path for range end
|
* @param {{path: Array.<String>}=} end object contains the path for range end
|
||||||
* @return {Array.<Node>} Node intances on the given range
|
* @return {Array.<Node>} Node instances on the given range
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
treemode._getNodeInstancesByRange = function (start, end) {
|
treemode._getNodeInstancesByRange = function (start, end) {
|
||||||
|
@ -36888,7 +36888,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.childs = [];
|
this.childs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.childs.forEach(function (child, index) {
|
this.childs.forEach(function (child) {
|
||||||
child.clearDom();
|
child.clearDom();
|
||||||
delete child.index;
|
delete child.index;
|
||||||
child.fieldEditable = true;
|
child.fieldEditable = true;
|
||||||
|
@ -38864,7 +38864,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove nodes
|
* Remove nodes
|
||||||
|
@ -39362,7 +39362,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the focus of given nodes, and move the focus to the (a) node before,
|
* Remove the focus of given nodes, and move the focus to the (a) node before,
|
||||||
|
@ -45886,10 +45886,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
// read options
|
// read options
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
if(typeof options.statusBar === 'undefined') {
|
if (typeof options.statusBar === 'undefined') {
|
||||||
options.statusBar = true;
|
options.statusBar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setting default for textmode
|
||||||
|
options.mainMenuBar = options.mainMenuBar !== false;
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
// indentation
|
// indentation
|
||||||
|
@ -45953,67 +45956,89 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.frame.onkeydown = function (event) {
|
this.frame.onkeydown = function (event) {
|
||||||
me._onKeyDown(event);
|
me._onKeyDown(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
// create menu
|
|
||||||
this.menu = document.createElement('div');
|
|
||||||
this.menu.className = 'jsoneditor-menu';
|
|
||||||
this.frame.appendChild(this.menu);
|
|
||||||
|
|
||||||
// create format button
|
this.content = document.createElement('div');
|
||||||
var buttonFormat = document.createElement('button');
|
this.content.className = 'jsoneditor-outer';
|
||||||
buttonFormat.type = 'button';
|
|
||||||
buttonFormat.className = 'jsoneditor-format';
|
|
||||||
buttonFormat.title = 'Format JSON data, with proper indentation and line feeds (Ctrl+\\)';
|
|
||||||
this.menu.appendChild(buttonFormat);
|
|
||||||
buttonFormat.onclick = function () {
|
|
||||||
try {
|
|
||||||
me.format();
|
|
||||||
me._onChange();
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
me._onError(err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create compact button
|
if (this.options.mainMenuBar) {
|
||||||
var buttonCompact = document.createElement('button');
|
util.addClassName(this.content, 'has-main-menu-bar');
|
||||||
buttonCompact.type = 'button';
|
|
||||||
buttonCompact.className = 'jsoneditor-compact';
|
|
||||||
buttonCompact.title = 'Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)';
|
|
||||||
this.menu.appendChild(buttonCompact);
|
|
||||||
buttonCompact.onclick = function () {
|
|
||||||
try {
|
|
||||||
me.compact();
|
|
||||||
me._onChange();
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
me._onError(err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create repair button
|
// create menu
|
||||||
var buttonRepair = document.createElement('button');
|
this.menu = document.createElement('div');
|
||||||
buttonRepair.type = 'button';
|
this.menu.className = 'jsoneditor-menu';
|
||||||
buttonRepair.className = 'jsoneditor-repair';
|
this.frame.appendChild(this.menu);
|
||||||
buttonRepair.title = 'Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.';
|
|
||||||
this.menu.appendChild(buttonRepair);
|
|
||||||
buttonRepair.onclick = function () {
|
|
||||||
try {
|
|
||||||
me.repair();
|
|
||||||
me._onChange();
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
me._onError(err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create mode box
|
// create format button
|
||||||
if (this.options && this.options.modes && this.options.modes.length) {
|
var buttonFormat = document.createElement('button');
|
||||||
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
buttonFormat.type = 'button';
|
||||||
// switch mode and restore focus
|
buttonFormat.className = 'jsoneditor-format';
|
||||||
me.setMode(mode);
|
buttonFormat.title = 'Format JSON data, with proper indentation and line feeds (Ctrl+\\)';
|
||||||
me.modeSwitcher.focus();
|
this.menu.appendChild(buttonFormat);
|
||||||
});
|
buttonFormat.onclick = function () {
|
||||||
|
try {
|
||||||
|
me.format();
|
||||||
|
me._onChange();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
me._onError(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create compact button
|
||||||
|
var buttonCompact = document.createElement('button');
|
||||||
|
buttonCompact.type = 'button';
|
||||||
|
buttonCompact.className = 'jsoneditor-compact';
|
||||||
|
buttonCompact.title = 'Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)';
|
||||||
|
this.menu.appendChild(buttonCompact);
|
||||||
|
buttonCompact.onclick = function () {
|
||||||
|
try {
|
||||||
|
me.compact();
|
||||||
|
me._onChange();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
me._onError(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create repair button
|
||||||
|
var buttonRepair = document.createElement('button');
|
||||||
|
buttonRepair.type = 'button';
|
||||||
|
buttonRepair.className = 'jsoneditor-repair';
|
||||||
|
buttonRepair.title = 'Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.';
|
||||||
|
this.menu.appendChild(buttonRepair);
|
||||||
|
buttonRepair.onclick = function () {
|
||||||
|
try {
|
||||||
|
me.repair();
|
||||||
|
me._onChange();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
me._onError(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create mode box
|
||||||
|
if (this.options && this.options.modes && this.options.modes.length) {
|
||||||
|
this.modeSwitcher = new ModeSwitcher(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) {
|
||||||
|
// switch mode and restore focus
|
||||||
|
me.setMode(mode);
|
||||||
|
me.modeSwitcher.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mode == 'code') {
|
||||||
|
var poweredBy = document.createElement('a');
|
||||||
|
poweredBy.appendChild(document.createTextNode('powered by ace'));
|
||||||
|
poweredBy.href = 'http://ace.ajax.org';
|
||||||
|
poweredBy.target = '_blank';
|
||||||
|
poweredBy.className = 'jsoneditor-poweredBy';
|
||||||
|
poweredBy.onclick = function () {
|
||||||
|
// TODO: this anchor falls below the margin of the content,
|
||||||
|
// therefore the normal a.href does not work. We use a click event
|
||||||
|
// for now, but this should be fixed.
|
||||||
|
window.open(poweredBy.href, poweredBy.target);
|
||||||
|
};
|
||||||
|
this.menu.appendChild(poweredBy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var emptyNode = {};
|
var emptyNode = {};
|
||||||
|
@ -46021,10 +46046,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
&& typeof(this.options.onEditable === 'function')
|
&& typeof(this.options.onEditable === 'function')
|
||||||
&& !this.options.onEditable(emptyNode));
|
&& !this.options.onEditable(emptyNode));
|
||||||
|
|
||||||
this.content = document.createElement('div');
|
|
||||||
this.content.className = 'jsoneditor-outer';
|
|
||||||
this.frame.appendChild(this.content);
|
this.frame.appendChild(this.content);
|
||||||
|
|
||||||
this.container.appendChild(this.frame);
|
this.container.appendChild(this.frame);
|
||||||
|
|
||||||
if (this.mode == 'code') {
|
if (this.mode == 'code') {
|
||||||
|
@ -46069,19 +46091,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var poweredBy = document.createElement('a');
|
|
||||||
poweredBy.appendChild(document.createTextNode('powered by ace'));
|
|
||||||
poweredBy.href = 'http://ace.ajax.org';
|
|
||||||
poweredBy.target = '_blank';
|
|
||||||
poweredBy.className = 'jsoneditor-poweredBy';
|
|
||||||
poweredBy.onclick = function () {
|
|
||||||
// TODO: this anchor falls below the margin of the content,
|
|
||||||
// therefore the normal a.href does not work. We use a click event
|
|
||||||
// for now, but this should be fixed.
|
|
||||||
window.open(poweredBy.href, poweredBy.target);
|
|
||||||
};
|
|
||||||
this.menu.appendChild(poweredBy);
|
|
||||||
|
|
||||||
// register onchange event
|
// register onchange event
|
||||||
aceEditor.on('change', this._onChange.bind(this));
|
aceEditor.on('change', this._onChange.bind(this));
|
||||||
aceEditor.on('changeSelection', this._onSelect.bind(this));
|
aceEditor.on('changeSelection', this._onSelect.bind(this));
|
||||||
|
@ -46114,12 +46123,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.dom.validationErrorsContainer = validationErrorsContainer;
|
this.dom.validationErrorsContainer = validationErrorsContainer;
|
||||||
this.frame.appendChild(validationErrorsContainer);
|
this.frame.appendChild(validationErrorsContainer);
|
||||||
|
|
||||||
var additinalErrorsIndication = document.createElement('div');
|
var additionalErrorsIndication = document.createElement('div');
|
||||||
additinalErrorsIndication.style.display = 'none';
|
additionalErrorsIndication.style.display = 'none';
|
||||||
additinalErrorsIndication.className = "jsoneditor-additional-errors fadein";
|
additionalErrorsIndication.className = "jsoneditor-additional-errors fadein";
|
||||||
additinalErrorsIndication.innerHTML = "Scroll for more ▿";
|
additionalErrorsIndication.innerHTML = "Scroll for more ▿";
|
||||||
this.dom.additinalErrorsIndication = additinalErrorsIndication;
|
this.dom.additionalErrorsIndication = additionalErrorsIndication;
|
||||||
validationErrorsContainer.appendChild(additinalErrorsIndication);
|
validationErrorsContainer.appendChild(additionalErrorsIndication);
|
||||||
|
|
||||||
if (options.statusBar) {
|
if (options.statusBar) {
|
||||||
util.addClassName(this.content, 'has-status-bar');
|
util.addClassName(this.content, 'has-status-bar');
|
||||||
|
@ -46273,20 +46282,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler for mousedown.
|
* Event handler for mousedown.
|
||||||
* @param {Event} event
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
textmode._onMouseDown = function (event) {
|
textmode._onMouseDown = function () {
|
||||||
this._updateCursorInfo();
|
this._updateCursorInfo();
|
||||||
this._emitSelectionChange();
|
this._emitSelectionChange();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler for blur.
|
* Event handler for blur.
|
||||||
* @param {Event} event
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
textmode._onBlur = function (event) {
|
textmode._onBlur = function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
// this allows to avoid blur when clicking inner elements (like the errors panel)
|
// this allows to avoid blur when clicking inner elements (like the errors panel)
|
||||||
// just make sure to set the isFocused to true on the inner element onclick callback
|
// just make sure to set the isFocused to true on the inner element onclick callback
|
||||||
|
@ -46326,7 +46333,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
line: line,
|
line: line,
|
||||||
column: col,
|
column: col,
|
||||||
count: count
|
count: count
|
||||||
}
|
};
|
||||||
|
|
||||||
if(me.options.statusBar) {
|
if(me.options.statusBar) {
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
@ -46345,7 +46352,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
line: line,
|
line: line,
|
||||||
column: col,
|
column: col,
|
||||||
count: count
|
count: count
|
||||||
}
|
};
|
||||||
|
|
||||||
if(this.options.statusBar) {
|
if(this.options.statusBar) {
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
@ -46373,7 +46380,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var currentSelection = this.getTextSelection();
|
var currentSelection = this.getTextSelection();
|
||||||
this._selectionChangedHandler(currentSelection.start, currentSelection.end, currentSelection.text);
|
this._selectionChangedHandler(currentSelection.start, currentSelection.end, currentSelection.text);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* refresh ERROR annotations state
|
* refresh ERROR annotations state
|
||||||
|
@ -46388,7 +46395,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var errEnnotations = session.getAnnotations().filter(function(annotation) {return annotation.type === 'error' });
|
var errEnnotations = session.getAnnotations().filter(function(annotation) {return annotation.type === 'error' });
|
||||||
session.setAnnotations(errEnnotations);
|
session.setAnnotations(errEnnotations);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy the editor. Clean up DOM, event listeners, and web workers.
|
* Destroy the editor. Clean up DOM, event listeners, and web workers.
|
||||||
|
@ -46693,7 +46700,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (this.dom.validationErrors) {
|
if (this.dom.validationErrors) {
|
||||||
this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors);
|
this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors);
|
||||||
this.dom.validationErrors = null;
|
this.dom.validationErrors = null;
|
||||||
this.dom.additinalErrorsIndication.style.display = 'none';
|
this.dom.additionalErrorsIndication.style.display = 'none';
|
||||||
|
|
||||||
this.content.style.marginBottom = '';
|
this.content.style.marginBottom = '';
|
||||||
this.content.style.paddingBottom = '';
|
this.content.style.paddingBottom = '';
|
||||||
|
@ -46778,12 +46785,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
this.dom.validationErrors = validationErrors;
|
this.dom.validationErrors = validationErrors;
|
||||||
this.dom.validationErrorsContainer.appendChild(validationErrors);
|
this.dom.validationErrorsContainer.appendChild(validationErrors);
|
||||||
this.dom.additinalErrorsIndication.title = errors.length + " errors total";
|
this.dom.additionalErrorsIndication.title = errors.length + " errors total";
|
||||||
|
|
||||||
if (this.dom.validationErrorsContainer.clientHeight < this.dom.validationErrorsContainer.scrollHeight) {
|
if (this.dom.validationErrorsContainer.clientHeight < this.dom.validationErrorsContainer.scrollHeight) {
|
||||||
this.dom.additinalErrorsIndication.style.display = 'block';
|
this.dom.additionalErrorsIndication.style.display = 'block';
|
||||||
this.dom.validationErrorsContainer.onscroll = function () {
|
this.dom.validationErrorsContainer.onscroll = function () {
|
||||||
me.dom.additinalErrorsIndication.style.display =
|
me.dom.additionalErrorsIndication.style.display =
|
||||||
(me.dom.validationErrorsContainer.clientHeight > 0 && me.dom.validationErrorsContainer.scrollTop === 0) ? 'block' : 'none';
|
(me.dom.validationErrorsContainer.clientHeight > 0 && me.dom.validationErrorsContainer.scrollTop === 0) ? 'block' : 'none';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -46872,13 +46879,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback registraion for selection change
|
* Callback registration for selection change
|
||||||
* @param {selectionCallback} callback
|
* @param {selectionCallback} callback
|
||||||
*
|
*
|
||||||
* @callback selectionCallback
|
* @callback selectionCallback
|
||||||
* @param {{row:Number, column:Number}} startPos selection start position
|
|
||||||
* @param {{row:Number, column:Number}} endPos selected end position
|
|
||||||
* @param {String} text selected text
|
|
||||||
*/
|
*/
|
||||||
textmode.onTextSelectionChange = function (callback) {
|
textmode.onTextSelectionChange = function (callback) {
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -55,9 +55,6 @@ Publish to npm:
|
||||||
|
|
||||||
npm publish
|
npm publish
|
||||||
|
|
||||||
Publish at cdnjs: test after 30 to 60 minutes whether the new version is
|
|
||||||
published at cdnjs (should auto update).
|
|
||||||
|
|
||||||
|
|
||||||
## Test published library
|
## Test published library
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jsoneditor",
|
"name": "jsoneditor",
|
||||||
"version": "5.24.5",
|
"version": "5.26.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jsoneditor",
|
"name": "jsoneditor",
|
||||||
"version": "5.25.0",
|
"version": "5.26.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": [
|
||||||
|
|
Loading…
Reference in New Issue