From 3258c45eb9417b3a32863f95cfcc1f353ceb1866 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 29 Oct 2014 14:54:58 +0000 Subject: [PATCH] Action correct pane - file/dir drag & fold/unfold Focus on last instance on file/dir drag - used by pasteURL to drop URL in correct pane Shortcut for fold/unfold line also needed to consider pane --- lib/ice-coder.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 4771e1e..6e1aaa8 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1398,7 +1398,7 @@ var ICEcoder = { newLI = document.createElement("li"); newLI.className = cssStyle; newLI.draggable = true; - newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.getcMInstance().focus()}}; + newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? top.ICEcoder.getcMInstance().focus() : top.ICEcoder.getcMdiffInstance().focus()}}; newLI.ondragend = function() {top.ICEcoder.dropFile(this)}; newLI.innerHTML = innerLI locNest.nextSibling.appendChild(newLI); @@ -1419,7 +1419,7 @@ var ICEcoder = { newLI = document.createElement("li"); newLI.className = cssStyle; newLI.draggable = true; - newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.getcMInstance().focus()}}; + newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? top.ICEcoder.getcMInstance().focus() : top.ICEcoder.getcMdiffInstance().focus()}}; newLI.ondragend = function() {top.ICEcoder.dropFile(this)}; newLI.innerHTML = innerLI; // Append or insert depending on which of the above if statements is true @@ -2983,7 +2983,7 @@ var ICEcoder = { // Detect keys/combos plus identify our area and set the vars, perform actions interceptKeys: function(area, evt) { - var key; + var key, cM, cMdiff, thisCM; key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode; @@ -3130,10 +3130,12 @@ var ICEcoder = { // CTRL + . (Fold/unfold current line) } else if(key==190 && (evt.ctrlKey||top.ICEcoder.cmdKey)) { - var cM = ICEcoder.getcMInstance(); - var line = cM.getCursor().line; - cM.getLine(line).indexOf("{")>-1 - ? top.contentFrame.codeFoldBrace(cM, line) : top.contentFrame.codeFoldTag(cM, line); + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + var line = thisCM.getCursor().line; + top.contentFrame.CodeMirror.doFold(thisCM.getLine(line).indexOf("{")>-1 ? "brace" : "xml",null,"+","-",false)(thisCM, line); + return false; // ESC in content area (Comment/Uncomment line)