• kindeditor编辑器


    一:官网

    http://kindeditor.net/doc3.php

    二:引用

    <!-- kindeditor --> 
       <script charset="utf-8" src="plug-in/kindeditor/kindeditor-all.js"></script>
        <script charset="utf-8" src="plug-in/kindeditor/lang/zh-CN.js"></script>
       <script charset="utf-8" src="plug-in/kindeditor/plugins/code/prettify.js"></script> <link rel="stylesheet" href="plug-in/kindeditor/themes/default/default.css" /> <link rel="stylesheet" href="plug-in/kindeditor/plugins/code/prettify.css" />

    三:功能

    (1)上传图片

      上传图片需要设置三个初始化参数:uploadJson, fileManagerJson ,allowFileManager 。

          KindEditor.ready(function(K) {
                               window.editor = K.create('#content',{
                     uploadJson : 'plug-in/kindeditor/jsp/upload_json.jsp',
                    fileManagerJson : 'plug-in/kindeditor/jsp/file_manager_json.jsp',
                    allowFileManager : true,
             urlType:"domain",
            });
          });

    var html = editor.html();
    $("#content").val(html);

    获取编辑器内容,并赋给绑定的textarea。

    urlType
    改变站内本地URL,可设置空、relative、absolute、domain。空为不修改URL,relative为相对路径,absolute为绝对路径,domain为带域名的绝对路径。
    数据类型:String
    默认值:空
    注: 3.4版本开始支持,3.4.1版本开始默认值为空。

    (2)textarea增加字数限制

     KindEditor.ready(function(K) {
                         window.editor = K.create('#content',{
                         afterChange : function() {    
                           K('.word_count').html(this.count('text'));
                           K('#wordcount').val(this.count('text'));
                        }       
            });
          });

      您当前输入了 <span class="word_count">0</span>个文字。
      <input id="wordcount" datatype="n1-4" errormsg="须10000字以内" style="40px"
      ignore="ignore" type="hidden" class="word_count" value="0"/>

  • 相关阅读:
    nginx安装和配置
    AgileReview 代码检视工具使用
    jmh 微基准测试
    dubbo源码分析
    springweb 详解。
    spring web 测试用例
    ParameterizedType 使用方法
    Protobuf协议--java实现
    spring自定义标签
    java设计模式之命令模式
  • 原文地址:https://www.cnblogs.com/fdzfd/p/5711994.html
Copyright © 2020-2023  润新知