【JQuery插件】Kindeditor 在MVC使用细节问题

来源:互联网 发布:网络语233是什么意思 编辑:程序博客网 时间:2024/06/02 03:40

在以前WebFrom项目 中使用Kindeditor 是极其容易及快速上交项目 ,这次在使用MVC使用 。。。脑子有点缺氧(晚上少看点 “ 澳首家线上场”)。。。

对于咱们 懒人而言 干活就是 下载直接能使用。

1.提交却没有数据值

<input type="hidden" name="Content" value="@ModelContent" />提交前 复制 到Hidden                $("input[name=DocumentContent]").val(                    window.editor.html().replace(/</g, "<").replace(/>/g, ">")                );   

解决办法:用找一个额外的容器

2.提交数据不一定是最新的

KindEditor.ready(function (K) {        window.editor = K.create('#editor_id', {            resizeType: 1,            uploadJson: '/System/Common/EditorFile',            afterBlur: function () {  //利用该方法处理当富文本编辑框失焦之后,立即同步数据                KindEditor.sync("#editor_id");            }        });    });

利用该方法处理当富文本编辑框失焦之后,立即同步数据

3.复制Work内容到编辑器、修改字体大小颜色、添加图片后 转换成控制器中的实体出错。

.replace(/</g, "&lt;").replace(/>/g, "&gt;")

两个标签没有自动 转换

4.再次编辑时,内容变成全是HTML代码

          <textarea id="editor_id"  style="height:600px;"  >                                               @Model.Content.Replace( "&lt;", "<").Replace( "&gt;", ">")                                        </textarea>

从数据库出来里 预处理

原创粉丝点击