2013-12-03 2 views
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'); 

}); 

답변

0

답변은 위! 저는 이것을 질문으로 물어보고 대답해야합니다. 죄송합니다.

+0

이 코드를 사용하여 잘 작동하지만 코드 미러 테마가 작동하지 않습니다. 이유는 알지 못합니다. –