zoukankan      html  css  js  c++  java
  • kindeditor使用

    下载地址http://kindeditor.net/down.php

    @官方文档

    使用步骤:

    引入js

    <script charset="utf-8" src="resource/kindeditor-4.1.7/kindeditor.js"></script>
    <script charset="utf-8" src="resource/kindeditor-4.1.7/lang/zh_CN.js"></script>
    View Code

    编辑器初始化:

    KindEditor.ready(function(K) {
            var editor1 = K.create('#editor_id',{
                                        uploadJson : '<%=basePath%>resource/kindeditor-4.1.7/jsp/upload_json.jsp',
                                        fileManagerJson : '<%=basePath%>resource/kindeditor-4.1.7/jsp/file_manager_json.jsp',
                                        allowFileManager : true,
                                        imageSizeLimit : '2MB', //批量上传图片单张最大容量
                                        imageUploadLimit : 5, //批量上传图片同时上传最多个数
                                        afterCreate : function() {
                                            var self = this;
                                            K.ctrl(document, 13, function() {
                                                self.sync();
                                                document.forms['example'].submit();
                                            });
                                            K.ctrl(self.edit.doc, 13, function() {
                                                self.sync();
                                                document.forms['example'].submit();
                                            });
                                        }
                                    });
                });
    View Code

    html代码:

    <textarea id="editor_id" name="newsContent"  ></textarea>
    View Code

    上传图片注意:

    1,保存功能无需自己编写后台代码,配置好uploadJson 、 fileManagerJson 即可

    2,若多图上传失败,请检查uploadJson 、 fileManagerJson的路径

  • 相关阅读:
    css3 过渡
    2021.1.5 算法实训
    表单 form
    表格 table
    Windows系统重装记录
    多线程【基础】
    关于excuteQuery与execute()
    关于jsp的action如何调用servlet的自定义方法
    selenium
    验证码处理
  • 原文地址:https://www.cnblogs.com/yanan7890/p/6903550.html
Copyright © 2011-2022 走看看