mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
added getById function to CloudCommander object
This commit is contained in:
parent
0cc8ef7f8d
commit
faa3b3bc0e
2 changed files with 89 additions and 66 deletions
|
|
@ -1,80 +1,100 @@
|
|||
var CloudCommander;
|
||||
var CloudCommander, CodeMirror;
|
||||
CloudCommander.Editor = {};
|
||||
CloudCommander.Editor.CloudMirror = { load: (function(){
|
||||
CloudCommander.Editor.CloudMirror = {
|
||||
load: (function(){
|
||||
|
||||
CloudCommander.jsload('http://codemirror.net/lib/codemirror.js', load_all(this));
|
||||
|
||||
function load_all(pParent) {
|
||||
return function(){
|
||||
CloudCommander.cssLoad({
|
||||
src : 'http://codemirror.net/lib/codemirror.css',
|
||||
element : document.head
|
||||
});
|
||||
|
||||
CloudCommander.cssLoad({
|
||||
src : 'http://codemirror.net/theme/night.css',
|
||||
element : document.head
|
||||
});
|
||||
|
||||
CloudCommander.cssSet({id:'editor',
|
||||
inner:'.CodeMirror{'+
|
||||
'font-family:\'Droid Sans Mono\';'+
|
||||
'font-size:15px;'+
|
||||
'resize:vertical;'+ 'margin:16px;'+'padding:20px;' +
|
||||
'}'+
|
||||
'.CodeMirror-scroll{'+
|
||||
'height: 660px;' +
|
||||
'}' +
|
||||
'.CodeMirror-scrollbar{'+
|
||||
'overflow-y:auto' +
|
||||
'}'
|
||||
});
|
||||
|
||||
var lShowEditor_f = function (){
|
||||
if (!document.getElementById('CloudEditor')) {
|
||||
var lEditor=document.createElement('div');
|
||||
lEditor.id ='CloudEditor';
|
||||
lEditor.className = 'hidden';
|
||||
fm.appendChild(lEditor);
|
||||
|
||||
CodeMirror(lEditor,{
|
||||
mode : "xml",
|
||||
htmlMode : true,
|
||||
theme : 'night',
|
||||
lineNumbers : true,
|
||||
//переносим длинные строки
|
||||
lineWrapping: true,
|
||||
extraKeys: {
|
||||
//Сохранение
|
||||
"Esc": pParent.hide
|
||||
},
|
||||
onLoad: pParent.show()
|
||||
});
|
||||
|
||||
}
|
||||
CloudCommander.jsload('http://codemirror.net/lib/codemirror.js', load_all(this));
|
||||
|
||||
function load_all(pParent) {
|
||||
return function(){
|
||||
CloudCommander.cssLoad({
|
||||
src : 'http://codemirror.net/lib/codemirror.css',
|
||||
element : document.head
|
||||
});
|
||||
|
||||
CloudCommander.cssLoad({
|
||||
src : 'http://codemirror.net/theme/night.css',
|
||||
element : document.head
|
||||
});
|
||||
|
||||
CloudCommander.cssSet({id:'editor',
|
||||
inner:'.CodeMirror{'+
|
||||
'font-family:\'Droid Sans Mono\';'+
|
||||
'font-size:15px;'+
|
||||
'resize:vertical;'+ 'margin:16px;'+'padding:20px;' +
|
||||
'}'+
|
||||
'.CodeMirror-scroll{'+
|
||||
'height: 660px;' +
|
||||
'}' +
|
||||
'.CodeMirror-scrollbar{'+
|
||||
'overflow-y:auto' +
|
||||
'}'
|
||||
});
|
||||
|
||||
var lShowEditor_f = function (){
|
||||
if (!document.getElementById('CloudEditor')) {
|
||||
var lEditor=document.createElement('div');
|
||||
lEditor.id ='CloudEditor';
|
||||
lEditor.className = 'hidden';
|
||||
var lFM = document.getElementById('fm');
|
||||
|
||||
if(lFM){
|
||||
lFM.appendChild(lEditor);
|
||||
|
||||
CodeMirror(lEditor,{
|
||||
mode : "xml",
|
||||
htmlMode : true,
|
||||
theme : 'night',
|
||||
lineNumbers : true,
|
||||
//переносим длинные строки
|
||||
lineWrapping: true,
|
||||
extraKeys: {
|
||||
//Сохранение
|
||||
"Esc": pParent.hide
|
||||
},
|
||||
onLoad: pParent.show()
|
||||
});
|
||||
}else console.log('Error. Something went wrong FM not found');
|
||||
}
|
||||
};
|
||||
CloudCommander.jsload('http://codemirror.net/mode/xml/xml.js', lShowEditor_f);
|
||||
};
|
||||
CloudCommander.jsload('http://codemirror.net/mode/xml/xml.js', lShowEditor_f);
|
||||
};
|
||||
}
|
||||
}),
|
||||
}
|
||||
}),
|
||||
show : (function(){
|
||||
/* if CloudEditor is not loaded - loading him */
|
||||
document.getElementById('CloudEditor') ||
|
||||
this.load();
|
||||
/* removing keyBinding if set */
|
||||
CloudCommander.keyBinded = false;
|
||||
left.className = 'panel hidden';
|
||||
CloudEditor.className = '';
|
||||
CloudCommander.keyBinded = false;
|
||||
|
||||
var lLeft = this.getById('left');
|
||||
var lCloudEditor = this.getById('CloudEditor');
|
||||
|
||||
lLeft &&
|
||||
lLeft.className = 'panel hidden';
|
||||
|
||||
lCloudEditor &&
|
||||
lCloudEditor
|
||||
.className = '';
|
||||
}),
|
||||
|
||||
|
||||
|
||||
|
||||
hide :(function() {
|
||||
hide :(function() {
|
||||
CloudCommander.keyBinded = true;
|
||||
CloudEditor.className='hidden';
|
||||
left.className = 'panel';
|
||||
})
|
||||
|
||||
var lLeft = this.getById('left');
|
||||
var lCloudEditor = this.getById('CloudEditor');
|
||||
|
||||
lCloudEditor &&
|
||||
lCloudEditor.className = 'hidden';
|
||||
|
||||
lLeft &&
|
||||
lLeft.className = 'panel';
|
||||
}),
|
||||
getById: function(pId){return document.getElementById(pId)}
|
||||
};
|
||||
CloudCommander.Editor.Keys = (function(){
|
||||
"use strict";
|
||||
|
|
@ -89,9 +109,12 @@ CloudCommander.Editor.Keys = (function(){
|
|||
};
|
||||
|
||||
/* добавляем обработчик клавишь */
|
||||
if(document.addEventListener)
|
||||
if (document.addEventListener)
|
||||
document.addEventListener('keydown', key_event,false);
|
||||
else document.onkeypress=key_event;
|
||||
|
||||
else
|
||||
document.onkeypress=key_event;
|
||||
|
||||
/* клавиши назначены*/
|
||||
CloudCommander.keyBinded=true;
|
||||
});
|
||||
2
node_modules/minify
generated
vendored
2
node_modules/minify
generated
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 8d386766868e176add3772365e277e501b0a37dd
|
||||
Subproject commit 24173f35158113193847d744dacce0faf266b074
|
||||
Loading…
Add table
Add a link
Reference in a new issue