【问题标题】:post kendo editor value as html rich text将 kendo 编辑器值发布为 html 富文本
【发布时间】:2016-03-06 07:44:59
【问题描述】:

在将(通过 ajax)editor.value() 富 html 文本发布到服务器时,我注意到 Kendo ui editot 存在问题。

当使用 html 设计发布几行时 -> 在服务器中我只得到第一行,直到第一个 '&nbsp'。

$("#emailTxtEditor").kendoEditor({
    //encoded: false,
    resizable: true
 });

例如,我采用This Sample,在设计了一些文本后,帖子缺少很多 html 内容...

ps,服务器中没有模型,因为我不保存此内容。 如何解决这个问题?

【问题讨论】:

    标签: kendo-ui kendo-editor


    【解决方案1】:

    你可以这样做:

    $("#emailTxtEditor").kendoEditor(
            {
                tools:
                  [
                      "bold",
                      "italic",
                      .....
                  ],
                messages: {
                    bold: "Bold",
                    italic: "Italic",
                    underline: "Underline",
                    ....
                },
                encoded: false,                
                keyup: function () {
                    $("#YourTextbox").val(encodeURIComponent($("#emailTxtEditor").data("kendoEditor").value())),
                    $("#YourTextbox").focusin()
                },
                change: function () {
                    $("#YourTextbox").val(encodeURIComponent($("#emailTxtEditor").data("kendoEditor").value())),
                    $("#YourTextbox").focusin()
                }
            })
    

    在控制器中:

    var emailContent = HttpUtility.UrlDecode(Email.EmailContent);//Email is model (for ex)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多