设置富文本编辑器(KindEditor)禁用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35713827/article/details/81114698

var editor;
    KindEditor.ready(function(K) {
        editor = K.create('textarea[name="content"]', {
            resizeType : 1,
            allowPreviewEmoticons : false,
            uploadJson : '图片上传路径',
            fileManagerJson : '${ctxKindeditor}/kindeditor/jsp/file_manager_json.jsp',
            allowFileManager : true,
            filePostName: 'upload_img',
          //上传文件后执行的回调函数,获取上传图片的路径
            afterUpload: function (url,data,name) {
               /*图片上传成功后回调函数(显示)*/
                //alert($("#uppics").val())
            },

            //将文本编辑器的值与对应标签值同步
            afterCreate : function(){this.sync();}, 
            afterBlur:function(){this.sync();},
            items : [
                'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                'insertunorderedlist', '|', 'emoticons', 'image', 'link']
        });     
    });

禁用:editor.readonly(true);

启用:editor.readonly(false);

猜你喜欢

转载自blog.csdn.net/qq_35713827/article/details/81114698