zoukankan      html  css  js  c++  java
  • kindeditor富文本编辑器的使用

    1.<script type="text/javascript" language="javascript" src="@Url.Content("~/kindeditor/kindeditor-min.js")"></script>
        <script type="text/javascript" language="javascript" src="@Url.Content("~/kindeditor/lang/zh_CN.js")"></script>

    <script type="text/javascript">
            var editor1;
            KindEditor.ready(function (K) {
                editor1 = K.create('#txtIntroduction', {
                    cssPath: 'http://www.cnblogs.com/kindeditor/plugins/code/prettify.css',
                    uploadJson: 'http://www.cnblogs.com/kindeditor/asp.net/upload_json.ashx',
                    fileManagerJson: 'http://www.cnblogs.com/kindeditor/asp.net/file_Manager_json.ashx',
                    allowFileManager: true,
                    afterCreate: function () {
                        var self = this;
                        K.ctrl(document, 13, function () {
                            self.sync();
                            K('form[name=example]')[0].submit();
                        });
                        K.ctrl(self.edit.doc, 13, function () {
                            self.sync();
                            K('form[name=example]')[0].submit();
                        });
                    }
                });
            });
        </script>

     <textarea id="txtIntroduction" name="txtIntroduction" style=" 670px; height: 400px;"></textarea>

    enctype = "multipart/form-data"

    3. 为什么会丢失某些HTML标签,是不是编辑器的BUG?这是因为3.4版本以前编辑器默认开启了过滤模式(filterMode:true)。当filterMode为true时,编辑器会根据htmlTags设定自动过滤HTML代码,主要是为了生成干净的代码。
    如果想保留所有HTML,请将filterMode设置成false。如果想保留特定HTML,请将filterMode设置成true后,配置htmlTags属性。
    从3.4版本开始默认关闭过滤模式,所以要过滤HTML,需要将filterMode设置成true。

    KE.show({
            id
    :'textarea_id',
            filterMode
    :true// true:开启过滤模式, false:关闭过滤模式
    });
       //使用正则表达式判断评论内容是否包含敏感词
               List<string> list =  db.Articel_Words.Select(a=>a.WordPattern).ToList();//敏感词集合
               string regexStr = string.Join("|", list);//格式:aa|bb|cc
               string commentMsg = "轮功";
               if (Regex.IsMatch(commentMsg,regexStr))
               {
                   ViewBag.Msg = "包含敏感词";    
               }
  • 相关阅读:
    文件上传,跨浏览器统一的样式
    JAVA与JSON的序列化、反序列化
    错误记录--更改tomcat端口号方法,Several ports (8005, 8080, 8009)
    45个非常有用的 Oracle 查询语句小结
    三分钟学会不吃球
    Linux命令:TOP
    【Oracle】Oracle官方文档
    【MySQL】MySQL官方文档
    【oracle】处理oracle用户密码中的特殊字符$和@
    【shell】整数运算,小数运算
  • 原文地址:https://www.cnblogs.com/yxlblogs/p/3041560.html
Copyright © 2011-2022 走看看