fixed bug with editor close, when started from menu

This commit is contained in:
coderaiser 2012-11-30 05:25:01 -05:00
parent 47d3edc744
commit 4db2f9f93e
2 changed files with 33 additions and 21 deletions

View file

@ -131,6 +131,8 @@ config.json only if it setted up.
* Fixed bug with slashes on win32.
* Fixed bug with editor close, when started from menu.
2012.10.01, Version 0.1.7

View file

@ -10,7 +10,14 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
CodeMirrorLoaded = false,
/* indicator says CodeMirror still loads */
Loading = false,
ReadOnly = false;
ReadOnly = false,
CallBacks = [
hide,
initCodeMirror,
show,
load
];
cloudcmd.Editor = {
get : (function(){
@ -70,8 +77,8 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
extraKeys: {
//Сохранение
'Esc': function(){
DOM.remove(lCSS, document.head);
Util.exec(pData.callback);
DOM.remove(lCSS, document.head);
}
},
readOnly : ReadOnly
@ -105,7 +112,7 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
/**
* function shows CodeMirror editor
*/
CodeMirrorEditor.show = function(pCallBack){
function show(pCallBack){
/* if CodeMirror function show already
* called do not call it again
@ -180,7 +187,7 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
/**
* function hides CodeMirror editor
*/
CodeMirrorEditor.hide = function() {
function hide() {
var lElem = CodeMirrorElement;
KeyBinding.set();
@ -188,27 +195,30 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
FM.removeChild(lElem);
DOM.showPanel();
}
/**
* function calls all CodeMirror editor functions
*/
CodeMirrorEditor.show = function(){
DOM.Images.showLoad();
Util.loadOnLoad( CallBacks );
};
/**
* function hides CodeMirror editor
*/
CodeMirrorEditor.hide = hide;
/**
* function bind keys
*/
cloudcmd.Editor.Keys = function(pReadOnly){
ReadOnly = pReadOnly;
var lShowCodemirror = [
CodeMirrorEditor.hide,
initCodeMirror,
CodeMirrorEditor.show,
load
],
lEditor = function(){
DOM.Images.showLoad();
Util.loadOnLoad( lShowCodemirror );
};
lEditor();
lShowCodemirror.pop();
CodeMirrorEditor.show();
CallBacks.pop();
var lKeyListener = function(pEvent){
/* если клавиши можно обрабатывать */
@ -222,19 +232,19 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
{
case lF4:
ReadOnly = false;
lEditor();
CodeMirrorEditor.show();
break;
case lF3:
ReadOnly = true;
lEditor();
CodeMirrorEditor.show();
break;
}
}
};
/* добавляем обработчик клавишь */
DOM.addKeyListener( lKeyListener )
.setButtonKey('f4', lEditor);
DOM.addKeyListener( lKeyListener );
DOM.setButtonKey('f4', CodeMirrorEditor.show);
};
cloudcmd.Editor.CodeMirror = CodeMirrorEditor;