mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-08 01:26:47 +01:00
focus method added and only actions if not iThing
CodeMirror focus method was causing no keyboard issues on iPad/iPhone/iPod All focus() calls nowrunning through new focus method, which acts as a single point to do this Will not do this if iPhone|iPad|iPod test is true
This commit is contained in:
@@ -352,7 +352,7 @@ if (action=="load") {
|
||||
cM.setValue(document.getElementById('loadedFile').value);
|
||||
top.document.getElementById('content').style.visibility='visible';
|
||||
top.ICEcoder.switchTab(top.ICEcoder.selectedTab);
|
||||
cM.focus();
|
||||
top.ICEcoder.focus();
|
||||
|
||||
// Then clean it up, set the text cursor, update the display and get the character data
|
||||
top.ICEcoder.contentCleanUp();
|
||||
|
||||
@@ -216,13 +216,23 @@ var ICEcoder = {
|
||||
cM.setSelection({line:line,ch:0}, {line:line,ch:cM.lineInfo(line).text.length});
|
||||
},
|
||||
|
||||
// Focus the editor
|
||||
focus: function(line) {
|
||||
var cM;
|
||||
|
||||
if (!(/iPhone|iPad|iPod/i.test(navigator.userAgent))) {
|
||||
cM = top.ICEcoder.getcMInstance();
|
||||
cM.focus();
|
||||
}
|
||||
},
|
||||
|
||||
// Go to a specific line number
|
||||
goToLine: function(lineNo) {
|
||||
var cM;
|
||||
|
||||
cM = ICEcoder.getcMInstance();
|
||||
cM.setCursor(lineNo ? lineNo-1 : top.get('goToLineNo').value-1);
|
||||
cM.focus();
|
||||
top.ICEcoder.focus();
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -367,7 +377,7 @@ var ICEcoder = {
|
||||
// Set our ch position just after the tag, and refocus on the editor
|
||||
ch = cM.getLine(line).indexOf(">",cM.getLine(line).indexOf("<"+tag))+1;
|
||||
cM.setCursor(line,ch);
|
||||
cM.focus();
|
||||
top.ICEcoder.focus();
|
||||
// Now update nest display to this nest depth & without any HTML tags to kill further interactivity
|
||||
chPos = 0;
|
||||
for (var i=0;i<=nestPos;i++) {
|
||||
@@ -1102,7 +1112,7 @@ var ICEcoder = {
|
||||
}
|
||||
// Finally, highlight our selection
|
||||
cM.setSelection(cursor.from(), cursor.to());
|
||||
cM.focus();
|
||||
top.ICEcoder.focus();
|
||||
top.ICEcoder.findMode = true;
|
||||
}
|
||||
return true;
|
||||
@@ -1514,7 +1524,7 @@ var ICEcoder = {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
top.ICEcoder.codeAssist = !top.ICEcoder.codeAssist;
|
||||
top.ICEcoder.cssColorPreview();
|
||||
cM.focus();
|
||||
top.ICEcoder.focus();
|
||||
|
||||
for (i=0;i<top.ICEcoder.cMInstances.length;i++) {
|
||||
if (top.ICEcoder.openFiles[i].indexOf(".js")>-1) {
|
||||
@@ -1787,7 +1797,7 @@ var ICEcoder = {
|
||||
cM.getWrapperElement().style.display = "block";
|
||||
|
||||
// Focus on & refresh our selected instance
|
||||
if (!noFocus) {setTimeout(function() {cM.focus();},4);}
|
||||
if (!noFocus) {setTimeout(function() {top.ICEcoder.focus();},4);}
|
||||
cM.refresh();
|
||||
|
||||
// Highlight the selected tab
|
||||
@@ -2303,7 +2313,7 @@ var ICEcoder = {
|
||||
// Space outisde of editor (Focus on editor)
|
||||
} else if(key==32 && area!="content" && ["find","replace"].indexOf(document.activeElement.id)==-1) {
|
||||
if (top.ICEcoder.getcMInstance()) {
|
||||
top.ICEcoder.getcMInstance().focus();
|
||||
top.ICEcoder.focus();
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -2401,7 +2411,7 @@ var ICEcoder = {
|
||||
cM.setLine(lineNo, replacedLine.replace("CURSOR",""));
|
||||
cM.setCursor(lineNoCount,curPos);
|
||||
// Finally, focus on the editor
|
||||
cM.focus();
|
||||
top.ICEcoder.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user