2
CodeMirror with elFinder!无法在任何地方找到示例,因此不得不弄清楚。事实证明,最终的结果非常简单,但它需要一点点弄清楚,所以我发布这个,因为最终有人需要它。使用CodeMirror作为elFinder编辑器
$().ready(function() {
var elf = $('#elfinder').elfinder({
url : 'elfinder-2.0-rc1/php/connector.php',
commandsOptions: {
edit : {
// list of allowed mimetypes to edit
// if empty - any text files can be edited
mimes : ['text/plain', 'text/html', 'text/javascript', 'text/css'],
// you can have a different editor for different mimes
editors : [{
mimes : ['text/plain', 'text/html', 'text/javascript', 'text/css'],
load : function(textarea) {
this.myCodeMirror = CodeMirror.fromTextArea(textarea, {
lineNumbers: true,
theme: "xq-dark"
})
},
close : function(textarea, instance) {
this.myCodeMirror = null;
},
save : function(textarea, editor) {
textarea.value = this.myCodeMirror.getValue();
this.myCodeMirror = null;
}
} ] //editors
} //edit
} //commandsoptions
}).elfinder('instance');
});
上午使用此代码其工作正常,但代码镜像主题不起作用。我不明白为什么 –