Merge branch 'master' into path_and_count

# Conflicts:
#	HISTORY.md
#	dist/jsoneditor-minimalist.js
#	dist/jsoneditor-minimalist.map
#	dist/jsoneditor-minimalist.min.js
#	dist/jsoneditor.js
#	dist/jsoneditor.map
#	dist/jsoneditor.min.js
#	package.json
This commit is contained in:
Meir Rotstein 2017-08-31 01:23:06 +03:00
commit 6d4aa7d082
9 changed files with 73 additions and 25 deletions

View File

@ -3,6 +3,18 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## 2017-08-26, version 5.9.5
- Fixed a regression introduced in `v5.9.4`: after using the context
menu once, it was not possible to set focus to an other input field
anymore.
## 2017-08-20, version 5.9.4
- Fixed #447: context menus not working in Shadow DOM. Thanks @tomalec.
## 2017-07-24, version 5.9.3 ## 2017-07-24, version 5.9.3
- Fixed broken multi-selection (regression). - Fixed broken multi-selection (regression).

View File

@ -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.9.3 * @version 5.9.5
* @date 2017-07-24 * @date 2017-08-26
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
@ -3681,6 +3681,15 @@ return /******/ (function(modules) { // webpackBootstrap
var util = __webpack_require__(4); var util = __webpack_require__(4);
/**
* Node.getRootNode shim
* @param {Node} node node to check
* @return {Node} node's rootNode or `window` if there is ShadowDOM is not supported.
*/
function getRootNode(node){
return node.getRootNode && node.getRootNode() || window;
}
/** /**
* A context menu * A context menu
* @param {Object[]} items Array containing the menu structure * @param {Object[]} items Array containing the menu structure
@ -3912,6 +3921,9 @@ return /******/ (function(modules) { // webpackBootstrap
this.dom.menu.style.bottom = '0px'; this.dom.menu.style.bottom = '0px';
} }
// find the root node of the page (window, or a shadow dom root element)
this.rootNode = getRootNode(anchor);
// attach the menu to the parent of the anchor // attach the menu to the parent of the anchor
var parent = anchor.parentNode; var parent = anchor.parentNode;
parent.insertBefore(this.dom.root, parent.firstChild); parent.insertBefore(this.dom.root, parent.firstChild);
@ -3919,7 +3931,7 @@ return /******/ (function(modules) { // webpackBootstrap
// create and attach event listeners // create and attach event listeners
var me = this; var me = this;
var list = this.dom.list; var list = this.dom.list;
this.eventListeners.mousedown = util.addEventListener(window, 'mousedown', function (event) { this.eventListeners.mousedown = util.addEventListener(this.rootNode, 'mousedown', function (event) {
// hide menu on click outside of the menu // hide menu on click outside of the menu
var target = event.target; var target = event.target;
if ((target != list) && !me._isChildOf(target, list)) { if ((target != list) && !me._isChildOf(target, list)) {
@ -3928,7 +3940,7 @@ return /******/ (function(modules) { // webpackBootstrap
event.preventDefault(); event.preventDefault();
} }
}); });
this.eventListeners.keydown = util.addEventListener(window, 'keydown', function (event) { this.eventListeners.keydown = util.addEventListener(this.rootNode, 'keydown', function (event) {
me._onKeyDown(event); me._onKeyDown(event);
}); });
@ -3963,7 +3975,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.eventListeners.hasOwnProperty(name)) { if (this.eventListeners.hasOwnProperty(name)) {
var fn = this.eventListeners[name]; var fn = this.eventListeners[name];
if (fn) { if (fn) {
util.removeEventListener(window, name, fn); util.removeEventListener(this.rootNode, name, fn);
} }
delete this.eventListeners[name]; delete this.eventListeners[name];
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

22
dist/jsoneditor.js vendored
View File

@ -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.9.3 * @version 5.9.5
* @date 2017-07-24 * @date 2017-08-26
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
@ -11657,6 +11657,15 @@ return /******/ (function(modules) { // webpackBootstrap
var util = __webpack_require__(57); var util = __webpack_require__(57);
/**
* Node.getRootNode shim
* @param {Node} node node to check
* @return {Node} node's rootNode or `window` if there is ShadowDOM is not supported.
*/
function getRootNode(node){
return node.getRootNode && node.getRootNode() || window;
}
/** /**
* A context menu * A context menu
* @param {Object[]} items Array containing the menu structure * @param {Object[]} items Array containing the menu structure
@ -11888,6 +11897,9 @@ return /******/ (function(modules) { // webpackBootstrap
this.dom.menu.style.bottom = '0px'; this.dom.menu.style.bottom = '0px';
} }
// find the root node of the page (window, or a shadow dom root element)
this.rootNode = getRootNode(anchor);
// attach the menu to the parent of the anchor // attach the menu to the parent of the anchor
var parent = anchor.parentNode; var parent = anchor.parentNode;
parent.insertBefore(this.dom.root, parent.firstChild); parent.insertBefore(this.dom.root, parent.firstChild);
@ -11895,7 +11907,7 @@ return /******/ (function(modules) { // webpackBootstrap
// create and attach event listeners // create and attach event listeners
var me = this; var me = this;
var list = this.dom.list; var list = this.dom.list;
this.eventListeners.mousedown = util.addEventListener(window, 'mousedown', function (event) { this.eventListeners.mousedown = util.addEventListener(this.rootNode, 'mousedown', function (event) {
// hide menu on click outside of the menu // hide menu on click outside of the menu
var target = event.target; var target = event.target;
if ((target != list) && !me._isChildOf(target, list)) { if ((target != list) && !me._isChildOf(target, list)) {
@ -11904,7 +11916,7 @@ return /******/ (function(modules) { // webpackBootstrap
event.preventDefault(); event.preventDefault();
} }
}); });
this.eventListeners.keydown = util.addEventListener(window, 'keydown', function (event) { this.eventListeners.keydown = util.addEventListener(this.rootNode, 'keydown', function (event) {
me._onKeyDown(event); me._onKeyDown(event);
}); });
@ -11939,7 +11951,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.eventListeners.hasOwnProperty(name)) { if (this.eventListeners.hasOwnProperty(name)) {
var fn = this.eventListeners[name]; var fn = this.eventListeners[name];
if (fn) { if (fn) {
util.removeEventListener(window, name, fn); util.removeEventListener(this.rootNode, name, fn);
} }
delete this.eventListeners[name]; delete this.eventListeners[name];
} }

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.9.3", "version": "5.9.5",
"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": [

View File

@ -2,6 +2,15 @@
var util = require('./util'); var util = require('./util');
/**
* Node.getRootNode shim
* @param {Node} node node to check
* @return {Node} node's rootNode or `window` if there is ShadowDOM is not supported.
*/
function getRootNode(node){
return node.getRootNode && node.getRootNode() || window;
}
/** /**
* A context menu * A context menu
* @param {Object[]} items Array containing the menu structure * @param {Object[]} items Array containing the menu structure
@ -233,6 +242,9 @@ ContextMenu.prototype.show = function (anchor, contentWindow) {
this.dom.menu.style.bottom = '0px'; this.dom.menu.style.bottom = '0px';
} }
// find the root node of the page (window, or a shadow dom root element)
this.rootNode = getRootNode(anchor);
// attach the menu to the parent of the anchor // attach the menu to the parent of the anchor
var parent = anchor.parentNode; var parent = anchor.parentNode;
parent.insertBefore(this.dom.root, parent.firstChild); parent.insertBefore(this.dom.root, parent.firstChild);
@ -240,7 +252,7 @@ ContextMenu.prototype.show = function (anchor, contentWindow) {
// create and attach event listeners // create and attach event listeners
var me = this; var me = this;
var list = this.dom.list; var list = this.dom.list;
this.eventListeners.mousedown = util.addEventListener(window, 'mousedown', function (event) { this.eventListeners.mousedown = util.addEventListener(this.rootNode, 'mousedown', function (event) {
// hide menu on click outside of the menu // hide menu on click outside of the menu
var target = event.target; var target = event.target;
if ((target != list) && !me._isChildOf(target, list)) { if ((target != list) && !me._isChildOf(target, list)) {
@ -249,7 +261,7 @@ ContextMenu.prototype.show = function (anchor, contentWindow) {
event.preventDefault(); event.preventDefault();
} }
}); });
this.eventListeners.keydown = util.addEventListener(window, 'keydown', function (event) { this.eventListeners.keydown = util.addEventListener(this.rootNode, 'keydown', function (event) {
me._onKeyDown(event); me._onKeyDown(event);
}); });
@ -284,7 +296,7 @@ ContextMenu.prototype.hide = function () {
if (this.eventListeners.hasOwnProperty(name)) { if (this.eventListeners.hasOwnProperty(name)) {
var fn = this.eventListeners[name]; var fn = this.eventListeners[name];
if (fn) { if (fn) {
util.removeEventListener(window, name, fn); util.removeEventListener(this.rootNode, name, fn);
} }
delete this.eventListeners[name]; delete this.eventListeners[name];
} }