【问题标题】:How to print html response (tinymce) in x-editable如何在 x-editable 中打印 html 响应(tinymce)
【发布时间】:2014-10-08 13:33:38
【问题描述】:

使用 x-editable 和 tinymce 编辑字段,但是在重新加载页面时打印返回值并显示 html 代码(使用

等)。

保存字段时显示的示例;

<p>this is a test response</p>
<p>&nbsp;</p>

(代替)

this is a test response
 

可编辑的初始化代码:

 $('.editable').editable('option','validate', function (v) {
     if (this.dataset.type == 'textarea') {
        return {newValue: tinyMCE.activeEditor.getContent()};
     }
 });

这是可编辑字段:

    <%= editable @article, :introduction, url: article_update_path(@article), type: 'textarea', onblur: 'ignore' %>

我希望它显示“html 输出”而不是 html 代码。

【问题讨论】:

    标签: javascript ruby-on-rails tinymce-4 x-editable


    【解决方案1】:

    问题解决了:

     $('.editable').editable('option','display', function (value, sourceData) {
         this.innerHTML = value;
     });
    

    【讨论】:

      猜你喜欢
      • 2011-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-22
      • 2018-06-18
      相关资源
      最近更新 更多