Set Encoded Special Characters as Editor Values
Environment
Product | Progress® Kendo UI® Editor for jQuery |
Operating System | All |
Browser | All |
Preferred Language | JavaScript |
Description
How can I set the encoded special characters as Editor values and display them decoded?
Solution
Prior to passing them as a parameter to the value
method of the Editor, decode the encoded special characters.
<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor();
var editor = $("#editor").data("kendoEditor");
var encodedString = "<p>Paragraph with a > special character inside.</p>";
var parser = new DOMParser;
var dom = parser.parseFromString(
'<!doctype html><body>' + encodedString,
'text/html');
var decodedString = dom.body.textContent;
editor.value(decodedString);
</script>