KindEditor单独上传图片、单独上传文件、编辑器的通用设置与调用

    KindEditor.ready(function(K){
        var editor = K.editor({
            allowFileManager:true
        });
                // 上传图片
        K('#imageBtn').click(function(){
            editor.loadPlugin('image', function(){
                editor.plugin.imageDialog({
                    imageUrl:K('#image').val(),
                    clickFn:function(url){
                        K('#image').val(url);
                        editor.hideDialog();
                    }
                });
            });
        });
        // 上传文件
        K('#fileBtn').click(function(){
            editor.loadPlugin('insertfile', function(){
                editor.plugin.fileDialog({
                    fileUrl:K('#file').val(),
                    clickFn:function(url, title){
                        K('#file').val(url);
                        editor.hideDialog();
                    }
                });
            });
        });
    });

编辑器的设置与调用

    KindEditor.ready(function(K){
        var options = {
            width:'670px',
            minWidth:'670px',
            height:'200px',
            resizeType:0,
            newlineTag:'br',
            filterMode:false,
            wellFormatMode:false,
            afterBlur:function() {
                this.sync();
            }
        };
        var editor = K.create('textarea[name="content"]', options);
    });

 

posted @ 2015-12-03 19:37  smismile  阅读(900)  评论(0编辑  收藏  举报