minor changes

This commit is contained in:
coderaiser 2012-09-28 11:04:43 -04:00
parent 3008e2a004
commit eae20a674e
2 changed files with 62 additions and 62 deletions

View file

@ -194,18 +194,24 @@ var CloudCommander, CloudFunc, CodeMirror;
var lShow = Util.bind(lThis.show, lThis);
if(!pEvent.shiftKey){
if(pEvent.keyCode === lF4)
lShow();
else if(pEvent.keyCode === lF3){
lShow(true);
}
switch(pEvent.keyCode)
{
case lF4:
ReadOnly = false;
lShow();
break;
case lF3:
ReadOnly = true;
lShow();
break;
}
}
}
};
/* добавляем обработчик клавишь */
if (document.addEventListener)
document.addEventListener('keydown', key_event,false);
document.addEventListener('keydown', key_event, false);
else{
var lFunc;

View file

@ -9,7 +9,8 @@ var CloudCommander, CloudFunc, ace;
KeyBinding = CloudCommander.KeyBinding,
AceEditor = {},
AceLoaded = false,
AceEditorElement,
ReadOnly = false,
AceElement,
FM;
CloudCommander.Editor = {
@ -22,64 +23,19 @@ var CloudCommander, CloudFunc, ace;
AceEditor.dir = cloudcmd.Editor.dir + 'ace/';
var createEditorDiv = function(){
/* private functions */
function initCodeMirror(pValue){
if(!FM)
FM = Util.getById('fm');
AceEditorElement = Util.anyload({
AceElement = Util.anyload({
name : 'div',
id : 'AceEditor',
id : 'CodeMirrorEditor',
className : 'panel',
parent : FM
});
};
/* indicator says Ace still loads */
AceEditor.loading = false;
/* function loads Ace js and css files */
AceEditor.load = (function(pIsReadOnly){
Util.cssSet({id:'editor',
inner : '#AceEditor{' +
'font-size : 15px;' +
'padding : 0 0 0 0;' +
'}'
});
/* load Ace main module */
Util.jsload(AceEditor.dir + 'ace.js', function() {
Util.jsload(AceEditor.dir + 'mode-javascript.js',
function(){
AceLoaded = true;
AceEditor.show(pIsReadOnly);
});
});
});
/* function shows Ace editor */
AceEditor.show = (function(pIsReadOnly){
/* if Ace function show already
* called do not call it again
* if f4 key pressed couple times
*/
if(this.loading)
return;
if(!AceLoaded){
return AceEditor.load(pIsReadOnly);
}
/* when folder view
* is no need to edit
* data
*/
var lReadOnly = pIsReadOnly || false;
var lThis = this;
var initAce_f = function(pValue){
createEditorDiv();
var editor = ace.edit("AceEditor");
var editor = ace.edit("AceEditor");
editor.setTheme("ace/theme/tomorrow_night_blue");
editor.getSession().setMode("ace/mode/javascript");
@ -95,11 +51,45 @@ var CloudCommander, CloudFunc, ace;
});
*/
editor.setReadOnly(lReadOnly);
editor.setReadOnly(ReadOnly);
editor.setValue(pValue);
};
}
/* indicator says Ace still loads */
AceEditor.loading = false;
/* function loads Ace js and css files */
AceEditor.load = (function(){
Util.cssSet({id:'editor',
inner : '#AceEditor{' +
'font-size : 15px;' +
'padding : 0 0 0 0;' +
'}'
});
/* load Ace main module */
Util.jsload(AceEditor.dir + 'ace.js', function() {
Util.jsload(AceEditor.dir + 'mode-javascript.js',
function(){
AceLoaded = true;
AceEditor.show();
});
});
});
/* function shows Ace editor */
AceEditor.show = (function(){
/* if Ace function show already
* called do not call it again
* if f4 key pressed couple times
*/
if(this.loading)
return;
if(!AceLoaded){
return AceEditor.load();
}
/* getting link */
var lCurrentFile = Util.getCurrentFile(),
@ -121,7 +111,11 @@ var CloudCommander, CloudFunc, ace;
if (lA.indexOf(CloudFunc.NOJS) ===
CloudFunc.FS.length) {
lA = lA.replace(CloudFunc.NOJS, '');
lReadOnly = true;
/* when folder view
* is no need to edit
* data
*/
ReadOnly = true;
}
}
}
@ -160,7 +154,7 @@ var CloudCommander, CloudFunc, ace;
/* function hides Ace editor */
AceEditor.hide = (function() {
var lElem = AceEditorElement;
var lElem = AceElement;
KeyBinding.set();
if(lElem && FM)