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');
});发布于 2014-05-23 09:59:03
答案在上面!我真应该把这个问题当作一个问题来问,然后再回答。抱歉的。
https://stackoverflow.com/questions/20359471
复制相似问题