2
elFinder를 사용하는 CodeMirror! 어디서나 예제를 찾을 수 없었으므로 알아낼 수 밖에 없었습니다. 결국 정말 간단하다는 것이 밝혀졌습니다. 그러나 알아내는 데는 약간의 시간이 걸렸습니다. 그래서 누군가가 그것을 필요로 할 것이기 때문에 이것을 게시하고 있습니다.elFinder 편집기로 CodeMirror 사용
$().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');
});
이 코드를 사용하여 잘 작동하지만 코드 미러 테마가 작동하지 않습니다. 이유는 알지 못합니다. –