kendo-uihtml-entitieshtml-encodekendo-editor

Kendo UI Editor, show HTML in Editor with encode html entities


I would like to see HTML in the Kendo UI Editor like

<h1>Hello World</h1>

How can i do these?


Solution

  • My sample show on: https://dojo.telerik.com/ezOPAz/3

      $("#editor").kendoEditor({
        value: "<h1>Hello World</h1>",
        encoded: false,
                tools: [
                    "viewHtml"
                ],
        deserialization: {
                  custom: function(html) {
                     var encodedStr = html.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
                         return '&#'+i.charCodeAt(0)+';';
                      });
                    return encodedStr;
                  }
              }
      });