zoukankan      html  css  js  c++  java
  • [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}。

  • 相关阅读:
    centos7安装zabbix3.4
    Linux修改网卡名称enss33到eth0--Ubuntu16和centos7
    记一次zabbix server挂掉的事件
    angularJs 技巧总结及最佳实践
    Yii2中的format
    本博客停止更新,新内容在个人网站上
    说下browserslist
    Yii2 软删除
    vue-webpack-boilerplate分析
    Node总结 模块机制
  • 原文地址:https://www.cnblogs.com/wanping/p/3006513.html
Copyright © 2011-2022 走看看