y393791327 2016-05-12 06:56 采纳率: 0%
浏览 1632
已采纳

extjs4.2+kindeditor无法保存html格式求指教

扩展

 Ext.define('WMC.common.view.ExtKindEditor', {
      extend: 'Ext.form.field.TextArea',
      alias: 'widget.extkindeditor',//xtype名称
      initComponent: function () {
          this.html = "<textarea id='" + this.getId() + "-input' name='" + this.name + "'></textarea>";
          this.callParent(arguments);
          this.on("boxready", function (t) {
              this.inputEL = Ext.get(this.getId() + "-input");
              this.editor = KindEditor.create('textarea[name="' + this.name + '"]', {
                 height: t.getHeight()-18,//有底边高度,需要减去
                 /*width: t.getWidth() - t.getLabelWidth(),//宽度需要减去label的宽度
*/                 basePath: 'kindeditor/',
                 uploadJson: 'kindeditor/upload_json.jsp',//路径自己改一下
                 fileManagerJson: 'kindeditor/file_manager_json.jsp',//路径自己改一下
                 resizeType: 0,
                 wellFormatMode: true,
                 newlineTag: 'br',
                 allowFileManager: true,
                 allowPreviewEmoticons: true,
                 allowImageUpload: true,
                 items: [
                     'source', '|', 'justifyleft', 'justifycenter', 'justifyright',
                     'insertorderedlist', 'insertunorderedlist', '|',
                     'formatblock', 'fontname', 'fontsize', '|','hilitecolor', 'forecolor', 'bold',
                     'italic', 'underline', '|', 'image', 
                     'table','link', 'unlink', 'fullscreen'
                 ]
             });
         });
         /*this.on("resize", function (t, w, h) {
             this.editor.resize(w - t.getLabelWidth(), h-18);
         });*/
     },
     setValue: function (value) {
         if (this.editor) {
             this.editor.html(value);
         }
     },
     reset: function () {
         if (this.editor) {
             this.editor.html('');
         }
     },
     setRawValue: function (value) {
         if (this.editor) {
             this.editor.text(value);
         }
     },
     getValue: function () {
         alert("are you sure");
         if (this.editor) {
             return this.editor.html();
         } else {
             return ''
         }
     },

     getRawValue: function () {
         if (this.editor) {
             return this.editor.text();
         } else {
             return ''
         }
     }
 });

引用

 {
                        xtype: 'extkindeditor',
                        allowBlank: false,
                        name: 'info',
                        height: 280,
                        flex: 1,
                        id: 'Responsibilities',
                        fieldLabel: '内容描述'
                    }

提交之后能得到数据,但是无法得到格式。

  • 写回答

3条回答 默认 最新

  • Go 旅城通票 2016-05-12 08:55
    关注

    什么版本的ext?4.1测试这个扩展没有问题,可以得到带格式的html代码字符串

    Ext4如何使用集成kindeditor

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • y393791327 2016-05-12 07:18
    关注
    评论
  • long_fei_fei 2016-05-25 10:27
    关注

    也遇到这个问题了,求解决办法。

    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 div editable中的光标问题
  • ¥15 mysql报错1415Not allowed to return a result set from a trigger 不知如何修改
  • ¥60 Python输出Excel数据整理,算法较为复杂
  • ¥15 看一下这个,可以商量
  • ¥15 回答几个问题 关于数据库
  • ¥15 51单片机串口通信问题,未完成且要修改
  • ¥15 百鸡问题 c++编程问题(相关搜索:输出数据)
  • ¥30 如何在CMD中设置代理
  • ¥15 我有一块薛定谔的硬盘
  • ¥15 微信小游戏开发2D碰撞检测问题