美文网首页
kindeditor获取值和kindeditor同一页面多编辑器

kindeditor获取值和kindeditor同一页面多编辑器

作者: 戬谷stone | 来源:发表于2019-05-20 11:30 被阅读0次

kindeditor 多窗口实现 html (任意多个)

<div class="layui-form-item layui-form-text" style="width:60%;margin-top:20px">

<label for="zltext" class="layui-form-label">

<span class="x-red">*</span>治疗

    </label>

<div class="layui-input-block">

<textarea id="zltext" name="zltext"></textarea>

</div>

</div>

kindeditor 多窗口实现 JS

<script>

var options = {

width :'921px',

height:'400px',

cssData:'body {font-family: "微软雅黑"; font-size: 14px}',

allowImageUpload:true,//允许上传图片

        allowImageRemote :false,//上传图片框网络图片的功能,false为隐藏,默认为true

        filterMode :false,//HTML特殊代码过滤

        allowFileManager:true,

afterBlur:function(){this.sync()},

uploadJson:'uploadImg_article',

afterUpload :function(url) {

var img =new Image();img.src = url;

img.onload =function(){

if(img.width>640)editor.html(editor.html().replace('<img src="' + url +'"','<img src="' + url +'" width="640"'))

}

},

items: [

'source','|','undo','redo','|','preview','template',

'plainpaste','|','justifyleft','justifycenter','justifyright',

'justifyfull','insertorderedlist','insertunorderedlist','indent','outdent','subscript',

'superscript','clearhtml','quickformat','|','fullscreen','/','formatblock','fontname','fontsize','|','forecolor','hilitecolor','bold','italic','underline','strikethrough','lineheight','removeformat','|','image','multiimage','table','hr','link','unlink'

        ],

};

var editor =new Array();

//有多少个窗口加多少个数组

KindEditor.ready(function(K) {

editor[0] = K.create("#fbyytext",options);

editor[1] = K.create("#bfztext",options);

editor[2] = K.create("#zztext",options);

editor[3] = K.create("#yftext",options);

editor[4] = K.create("#jctext",options);

editor[5] = K.create("#ystext",options);

editor[6] = K.create("#zltext",options);

});

</script>

以上配置中 afterBlur:function(){this.sync()} 是解决editor的关键

afterBlur:function(){this.sync()}  加入配置即可

相关文章

网友评论

      本文标题:kindeditor获取值和kindeditor同一页面多编辑器

      本文链接:https://www.haomeiwen.com/subject/tbnhzqtx.html