mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
minor changes
This commit is contained in:
parent
6c84676af1
commit
aa15e5aadf
1 changed files with 34 additions and 30 deletions
|
|
@ -5,11 +5,39 @@ var CloudCommander, CodeMirror;
|
|||
CloudCommander.Editor = {};
|
||||
CloudCommander.Editor.CodeMirror = {
|
||||
load: (function(){ /* function loads CodeMirror js and css files */
|
||||
|
||||
|
||||
/* function shows editor */
|
||||
var showEditor = function (pParent){
|
||||
return 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(pParent)
|
||||
}
|
||||
});
|
||||
}else console.log('Error. Something went wrong FM not found');
|
||||
}
|
||||
};
|
||||
};
|
||||
/* function loads css files
|
||||
* of CodeMirror
|
||||
*/
|
||||
var load_all = function(pParent) {
|
||||
var loadAll = function(pParent) {
|
||||
return function(){
|
||||
CloudCommander.cssLoad({
|
||||
src : 'http://codemirror.net/lib/codemirror.css',
|
||||
|
|
@ -36,38 +64,14 @@ CloudCommander.Editor.CodeMirror = {
|
|||
'}'
|
||||
});
|
||||
|
||||
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(pParent)
|
||||
}
|
||||
});
|
||||
}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', showEditor(pParent));
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/* load CodeMirror main module */
|
||||
CloudCommander.jsload('http://codemirror.net/lib/codemirror.js', load_all(this));
|
||||
CloudCommander.jsload('http://codemirror.net/lib/codemirror.js', loadAll(this));
|
||||
}),
|
||||
|
||||
show : (function(){ /* function shows CodeMirror editor */
|
||||
/* if CloudEditor is not loaded - loading him */
|
||||
document.getElementById('CloudEditor') ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue