• [struts]集成kindeditor出现的问题


    1、

    错误现象:使用textarea取不到值,仅为“”。

    KindEditor.ready(function(K) {
                var editor1 = K.create('textarea[name="paperContent"]', {
                    cssPath : 'kindeditor/plugins/code/prettify.css',
                    uploadJson : 'admin/resource/common_uploadFile.action',
                    allowFileManager : false,
                    afterCreate : function() {
                        var self = this;
                        K.ctrl(document, 13, function() {
                            self.sync();
                            document.forms['form'].submit();
                        });
                        K.ctrl(self.edit.doc, 13, function() {
                            self.sync();
                            document.forms['form'].submit();
                        });
                    },
                    afterBlur:function(){
                        this.sync();
                    }
                });
                prettyPrint();
            });

    错误原因:

    未知。

    解决办法:

    如果你的按钮是input[type=submit]的话你不需要考虑这个问题,但如果你使用js提交那么在提交之前要调用一下editor.sync()

    函数用以赋值给你的textarea。即需要加上

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

    KindEditor.ready(function(K) {
                var editor1 = K.create('textarea[name="paperContent"]', {
                    cssPath : 'kindeditor/plugins/code/prettify.css',
                    uploadJson : 'admin/resource/common_uploadFile.action',
                    allowFileManager : false,
                    afterCreate : function() {
                        var self = this;
                        K.ctrl(document, 13, function() {
                            self.sync();
                            document.forms['form'].submit();
                        });
                        K.ctrl(self.edit.doc, 13, function() {
                            self.sync();
                            document.forms['form'].submit();
                        });
                    },
                    afterBlur:function(){
                        this.sync();
                    }
                });
                prettyPrint();
            });

    2、

    错误现象:编辑内容前台显示不正确,直接将html标签显示出来。

    如:

    正确显示应该为:

    错误原因:

    使用<s:property value="paper.content"/>显示数据,返回的是字符串,带双引号如:“xxxxx”。

    解决办法:

    直接用jstl标签${paper.content}。

  • 相关阅读:
    POJ 3278 Catch That Cow
    Object-C 函数定义 -- 笔记
    Object-C变量作用域 -- 笔记
    Object-C 对象 (创建/销毁 对象)-- 笔记
    Object-C 类定义 -- 笔记
    JavaScript 自动分页插件 datatables
    JavaScript 随机数函数
    Server Job: error: String or binary data would be truncated. The statement has been terminated.
    SQL Server error "Xml data type is not supported in distributed queries" and workaround for it
    angularJS怎么实现与服务端的PHP进行数据交互
  • 原文地址:https://www.cnblogs.com/wanping/p/3006513.html
Copyright © 2020-2023  润新知