New to Kendo UI for jQueryStart a free 30-day trial

Serialization

configuration

Allows setting of serialization options.

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
    serialization: {
        custom: function(html) {
            return html.replace(/(<\/?)strong(\s?)/, "$1b$2");
        }
    }
});
</script>

Define custom serialization for the editable content. The method accepts a single parameter as a string and is expected to return a string.

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
    serialization: {
        custom: function(html) {
            return html.replace(/(<\/?)b(\s?)/, "$1strong$2");
        }
    }
});
</script>

Indicates whether the characters outside the ASCII range will be encoded as HTML entities. By default, they are encoded.

Default: true

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  value: "The character ä is an umlaut",
  serialization: {
    entities: true
  }
});
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log($("#editor").data("kendoEditor").value()); // logs "The character &auml; is an umlaut"
</script>

Indicates whether optizable tags should be removed from the DOM. Currently, optimizable tags are span and font elements with no attributes and no decoration or formatting applied (via inline styles/attributes).

Default: false

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  value: "<p><span>non-decorated text</span></p><p><span style=\"text-decoration: underline;\">underline text</span></p>",
  serialization: {
    optimizeTags: true
  }
});
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log($("#editor").data("kendoEditor").value()); // logs "The character &auml; is an umlaut"
</script>

Indicates whether inline scripts will be serialized and posted to the server.

Setting this option does not prevent cross-site scripting (XSS) attacks; you need server sanitization, too. See the preventing cross-site-scripting help topic for more information.

Default: false

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  value: "before script <script>alert(1);<\/script> after script",
  serialization: {
    scripts: true
  }
});
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log($("#editor").data("kendoEditor").value()); // log will contain the script tag
</script>

Indicates whether the font styles will be saved as semantic (strong / em / span) tags, or as presentational (b / i / u / font) tags. Used for outputting content for legacy systems.

Default: true

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  value: "Check out <em>this</em> <strong>kata</strong>.",
  serialization: {
    semantic: false
  }
});
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log($("#editor").data("kendoEditor").value()); // logs "Check out <i>this</i> <b>kata</b>.",
</script>