mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-02 23:03:59 +01:00
Only setOption if we have a CM instance
Only focus on editor if we have a CM instance On dragging files/folders, get the path if a file, otherwise go with the folder path. If we have CTRL key down, copy the selectedFiles and paste to the tgtPath just established Display temp message about move function coming soon
This commit is contained in:
@@ -275,9 +275,9 @@ var ICEcoder = {
|
||||
|
||||
cM = ICEcoder.getcMInstance();
|
||||
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
|
||||
if (mode) {
|
||||
if (cM && mode) {
|
||||
cM.setOption("mode",mode);
|
||||
} else if (fileName) {
|
||||
} else if (cM && fileName) {
|
||||
fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript")
|
||||
: fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript")
|
||||
: fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby")
|
||||
@@ -964,7 +964,7 @@ var ICEcoder = {
|
||||
newLI = document.createElement("li");
|
||||
newLI.className = cssStyle;
|
||||
newLI.draggable = true;
|
||||
newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);top.ICEcoder.getcMInstance().focus()};
|
||||
newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.getcMInstance().focus()}};
|
||||
newLI.ondragend = function() {top.ICEcoder.dropFile(this)};
|
||||
newLI.innerHTML = innerLI
|
||||
locNest.nextSibling.appendChild(newLI);
|
||||
@@ -985,7 +985,7 @@ var ICEcoder = {
|
||||
newLI = document.createElement("li");
|
||||
newLI.className = cssStyle;
|
||||
newLI.draggable = true;
|
||||
newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);top.ICEcoder.getcMInstance().focus()};
|
||||
newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.getcMInstance().focus()}};
|
||||
newLI.ondragend = function() {top.ICEcoder.dropFile(this)};
|
||||
newLI.innerHTML = innerLI;
|
||||
// Append or insert depending on which of the above if statements is true
|
||||
@@ -1090,11 +1090,21 @@ var ICEcoder = {
|
||||
|
||||
// On dropping a file, do something
|
||||
dropFile: function(elem) {
|
||||
var tgtPath;
|
||||
|
||||
if (top.ICEcoder.area=='editor') {
|
||||
top.ICEcoder.pasteURL(elem.childNodes[0].childNodes[1].id.replace(/\|/g,"/"));
|
||||
};
|
||||
if (top.ICEcoder.area=='files') {
|
||||
alert('Will drag files/folders soon!');
|
||||
setTimeout(function() {
|
||||
tgtPath = ICEcoder.thisFileFolderType == "folder" ? ICEcoder.thisFileFolderLink : ICEcoder.thisFileFolderLink.substr(0,ICEcoder.thisFileFolderLink.lastIndexOf("|"));
|
||||
if(top.ICEcoder.draggingWithKey == "CTRL") {
|
||||
top.ICEcoder.copyFiles(top.ICEcoder.selectedFiles);
|
||||
top.ICEcoder.pasteFiles(tgtPath);
|
||||
} else {
|
||||
top.ICEcoder.message("Move files/folders coming soon!\n\nFor now you can hold CTRL/Cmd to copy to that location");
|
||||
}
|
||||
},4);
|
||||
};
|
||||
top.ICEcoder.mouseDown=false;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user