From a03ea9a2d09ba74ece279814b98604d060eca07e Mon Sep 17 00:00:00 2001 From: josdejong Date: Thu, 2 May 2013 22:03:17 +0200 Subject: [PATCH] Added shortcut key Ctrl+Enter on the Expand button --- jsoneditor/js/node.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/jsoneditor/js/node.js b/jsoneditor/js/node.js index 52cc15f..9b410b4 100644 --- a/jsoneditor/js/node.js +++ b/jsoneditor/js/node.js @@ -1131,7 +1131,7 @@ Node.prototype._getDomField = function(silent) { Node.prototype.clearDom = function() { // TODO: hide the node first? //this.hide(); - // TOOD: recursively clear dom? + // TODO: recursively clear dom? this.dom = {}; }; @@ -1226,9 +1226,8 @@ Node.prototype._onDragStart = function (event) { * @private */ Node.prototype._onDrag = function (event) { - // TODO: this method has grown to large. Split it in a number of methods + // TODO: this method has grown too large. Split it in a number of methods event = event || window.event; - // TODO: make a separate function to get the absolute mouseY and mouseX var mouseY = util.getMouseY(event); var mouseX = util.getMouseX(event); @@ -1745,7 +1744,6 @@ Node.prototype.onEvent = function (event) { } // expand events - var domExpand = dom.expand; if (type == 'click' && target == dom.expand) { if (expandable) { var recurse = event.ctrlKey; // with ctrl-key, expand/collapse all @@ -1911,6 +1909,15 @@ Node.prototype.onKeyDown = function (event) { } } } + else if (target == this.dom.expand) { + var expandable = this._hasChilds(); + if (expandable) { + var recurse = event.ctrlKey; // with ctrl-key, expand/collapse all + this._onExpand(recurse); + target.focus(); + handled = true; + } + } } else if (keynum == 68) { // D if (ctrlKey) { // Ctrl+D @@ -2700,7 +2707,6 @@ Node.prototype.showContextMenu = function (anchor, onClose) { 'className': 'type-string', 'title': titles.string, 'click': function () { - // TODO: settings type string does not work, will become auto node._onInsertBefore('', '', 'string'); } }