mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-05 08:14:00 +01:00
Shift key, Save As and loading mask
shiftKeyDown now detected Loading mask hidden on load Setting ctrlKeyDown to false on all functions to avoid stickiness Same for shiftKeyDown Save As functionality added Window no longer opens on CTRL+Enter if it's a new file
This commit is contained in:
30
lib/coder.js
30
lib/coder.js
@@ -12,6 +12,7 @@ var ICEcoder = {
|
||||
selectedTab: 0, // The tab that's currently selected
|
||||
changedContent: [], // Binary array to indicate which tabs have changed
|
||||
ctrlKeyDown: false, // Indicates if CTRL keydown
|
||||
shiftKeyDown: false, // Indicates if Shift keydown
|
||||
delKeyDown: false, // Indicates if DEL keydown
|
||||
canSwitchTabs: true, // Stops switching of tabs when trying to close
|
||||
openFiles: [], // Array of open file URLs
|
||||
@@ -36,6 +37,9 @@ var ICEcoder = {
|
||||
|
||||
// Set layout & the nest location
|
||||
ICEcoder.setLayout();
|
||||
|
||||
// Hide the loading screen
|
||||
top.document.getElementById('loadingMask').style.visibility = "hidden";
|
||||
},
|
||||
|
||||
// Set out our layout according to the browser size
|
||||
@@ -192,24 +196,38 @@ var ICEcoder = {
|
||||
top.ICEcoder.ctrlKeyDown = true;
|
||||
return false;
|
||||
|
||||
// Shift key down
|
||||
} else if(key==16) {
|
||||
top.ICEcoder.shiftKeyDown = true;
|
||||
return false;
|
||||
|
||||
// CTRL+F (Find)
|
||||
} else if(key==70 && top.ICEcoder.ctrlKeyDown==true) {
|
||||
top.document.getElementById('find').focus();
|
||||
top.ICEcoder.ctrlKeyDown = false;
|
||||
return false;
|
||||
|
||||
// CTRL+G (Go to Line)
|
||||
} else if(key==71 && top.ICEcoder.ctrlKeyDown==true) {
|
||||
top.document.getElementById('goToLineNo').focus();
|
||||
top.ICEcoder.ctrlKeyDown = false;
|
||||
return false;
|
||||
|
||||
// CTRL+S (Save)
|
||||
} else if(key==83 && top.ICEcoder.ctrlKeyDown==true) {
|
||||
top.ICEcoder.saveFile();
|
||||
if(top.ICEcoder.shiftKeyDown==true) {
|
||||
top.ICEcoder.saveFile('saveAs');
|
||||
top.ICEcoder.shiftKeyDown = false;
|
||||
} else {
|
||||
top.ICEcoder.saveFile();
|
||||
}
|
||||
top.ICEcoder.ctrlKeyDown = false;
|
||||
return false;
|
||||
|
||||
// CTRL+Enter (Open Webpage)
|
||||
} else if(key==13 && top.ICEcoder.ctrlKeyDown==true) {
|
||||
} else if(key==13 && top.ICEcoder.ctrlKeyDown==true && top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] != "/[NEW]") {
|
||||
window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]);
|
||||
top.ICEcoder.ctrlKeyDown = false;
|
||||
return false;
|
||||
|
||||
// ESC (Comment/Uncomment line)
|
||||
@@ -229,6 +247,7 @@ var ICEcoder = {
|
||||
key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
|
||||
|
||||
if (key==17) {top.ICEcoder.ctrlKeyDown = false;}
|
||||
if (key==16) {top.ICEcoder.shiftKeyDown = false;}
|
||||
if (key==46) {top.ICEcoder.delKeyDown = false;}
|
||||
},
|
||||
|
||||
@@ -651,8 +670,11 @@ var ICEcoder = {
|
||||
},
|
||||
|
||||
// Save a file on demand
|
||||
saveFile: function() {
|
||||
filesFrame.contentWindow.frames['fileControl'].location.href="lib/file-control.php?action=save&file="+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(/\//g,"|");
|
||||
saveFile: function(saveAs) {
|
||||
var saveType;
|
||||
|
||||
if (saveAs) {saveType = "saveAs"} else {saveType = "save"};
|
||||
filesFrame.contentWindow.frames['fileControl'].location.href="lib/file-control.php?action=save&file="+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(/\//g,"|")+"&saveType="+saveType;
|
||||
},
|
||||
|
||||
// Prompt a rename dialog on demand
|
||||
|
||||
Reference in New Issue
Block a user