New to Kendo UI for jQuery? Download free 30-day trial

Replace All String Occurrences in Editor Content

Environment

Product Progress® Kendo UI® Editor for jQuery

Description

How can I replace all specific string occurrences in the Kendo UI Editor content?

Solution

Use the deserioalization.custom option of the Editor to plug a custom callback that will return the modified content.

<div id="example">
    <div class="demo-section k-content">
        <textarea id="editor"></textarea>
    </div>
</div>

<script>
    $("#editor").kendoEditor({
        value: "Random @text@ with several @placeholders@.",
        deserialization: {
          custom: function(html) {
            return html.replace(/@(.*?)@/gi, "strings");
          }
        }
    });
</script>

In this article