【问题标题】:Using CodeMirror as elFinder editor使用 CodeMirror 作为 elFinder 编辑器
【发布时间】:2013-12-03 19:02:27
【问题描述】:

带有 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');

});

【问题讨论】:

    标签: javascript editor codemirror file-manager elfinder


    【解决方案1】:

    答案在上面! 我真的应该问这个问题然后回答它。对不起。

    【讨论】:

    • 我正在使用此代码,它工作正常,但代码镜像主题不起作用。我不明白为什么
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-12
    • 1970-01-01
    相关资源
    最近更新 更多