Fixed quickkeys alt+arrows moving over "show more" tag

This commit is contained in:
jos 2018-05-12 16:14:19 +02:00
parent 92a431e37d
commit 6a15c04053
2 changed files with 18 additions and 7 deletions

View File

@ -193,6 +193,11 @@ div.jsoneditor-tree div.jsoneditor-show-more a {
color: #808080;
}
div.jsoneditor-tree div.jsoneditor-show-more a:hover,
div.jsoneditor-tree div.jsoneditor-show-more a:focus {
color: #ee422e;
}
div.jsoneditor {
color: #1A1A1A;
border: 1px solid #3883fa;

View File

@ -1623,6 +1623,14 @@ Node.prototype.getDom = function() {
return dom.tr;
};
/**
* Test whether a Node is rendered and visible
* @returns {boolean}
*/
Node.prototype.isVisible = function () {
return this.dom && this.dom.tr && this.dom.tr.parentNode || false
};
/**
* DragStart event, fired on mousedown on the dragarea at the left side of a Node
* @param {Node[] | Node} nodes
@ -2510,7 +2518,7 @@ Node.prototype.onEvent = function (event) {
// focus
// when clicked in whitespace left or right from the field or value, set focus
var domTree = dom.tree;
if (target == domTree.parentNode && type == 'click' && !event.hasMoved) {
if (domTree && target == domTree.parentNode && type == 'click' && !event.hasMoved) {
var left = (event.offsetX != undefined) ?
(event.offsetX < (this.getLevel() + 1) * 24) :
(event.pageX < util.getAbsoluteLeft(dom.tdSeparator));// for FF
@ -2744,9 +2752,7 @@ Node.prototype.onKeyDown = function (event) {
var prevDom = dom.previousSibling;
if (prevDom) {
prevNode = Node.getNodeFromTarget(prevDom);
if (prevNode && prevNode.parent &&
(prevNode instanceof AppendNode)
&& !prevNode.isVisible()) {
if (prevNode && prevNode.parent && !prevNode.isVisible()) {
oldSelection = this.editor.getDomSelection();
oldBeforeNode = lastNode.nextSibling();
@ -3179,7 +3185,7 @@ Node.prototype._previousNode = function () {
prevDom = prevDom.previousSibling;
prevNode = Node.getNodeFromTarget(prevDom);
}
while (prevDom && (prevNode instanceof AppendNode && !prevNode.isVisible()));
while (prevDom && prevNode && !prevNode.isVisible());
}
return prevNode;
};
@ -3199,7 +3205,7 @@ Node.prototype._nextNode = function () {
nextDom = nextDom.nextSibling;
nextNode = Node.getNodeFromTarget(nextDom);
}
while (nextDom && (nextNode instanceof AppendNode && !nextNode.isVisible()));
while (nextDom && nextNode && !nextNode.isVisible());
}
return nextNode;
@ -3232,7 +3238,7 @@ Node.prototype._lastNode = function () {
if (dom && dom.parentNode) {
var lastDom = dom.parentNode.lastChild;
lastNode = Node.getNodeFromTarget(lastDom);
while (lastDom && (lastNode instanceof AppendNode && !lastNode.isVisible())) {
while (lastDom && lastNode && !lastNode.isVisible()) {
lastDom = lastDom.previousSibling;
lastNode = Node.getNodeFromTarget(lastDom);
}