How Can I Have multiple snippets for a single Kendo Editor?

392 views Asked by At

I need two snippets for a single Kendo editor. This my Kendo Editor Code for a single snippet which works perfectly and the snippet is also working as expected.

$("#TemplateBodyId).kendoEditor({
                messages: { insertHtml: "Insert Variable" },


                tools: [
                       "bold",
                       "italic",
                       "underline",
                       "strikethrough",
                       "fontName",
                       "fontSize",
                       "foreColor",
                       "backColor",
                       "insertHtml",
                       "insertHtml1"

                ],
                insertHtml: [
                    { text: "Request.FirstName", value: "#Request.FirstName#" },
                    { text: "Request.LastName", value: "#Request.LastName#" }
                ],

                encoded:false,


            });

What I am trying to do is get multiple snippets and I modified my code as:

$("#TemplateBodyInNepali").kendoEditor({
                messages: { insertHtml: "Insert Variable" },
                messages: { insertHtml1: "Insert Number" },

                tools: [
                       "bold",
                       "italic",
                       "underline",
                       "strikethrough",
                       "fontName",
                       "fontSize",
                       "foreColor",
                       "backColor",
                       "insertHtml",
                       "insertHtml1"

                ],
                insertHtml: [
                    { text: "Request.FirstName", value: "#Request.FirstName#" },
                    { text: "Request.LastName", value: "#Request.LastName#" }
                ],
                insertHtml1: [
                    { text: "Request.Number", value: "#Request.Decimal#" },
                    { text: "Request.Integer", value: "#Request.Value#" }
                ],
                encoded:false,


            });

But sadly it doesn't work. I get only one snippet, the first one, is it possible to have multiple snippets for a single kendo editor ?

1

There are 1 answers

0
Sampanna Pokhrel On

Declaring several insertHtml tools is not supported by the Editor. What you can consider doing is declaring only one and adding a custom tool that will have a similar functionality as the default insertHtml tool. See the following demo for an example of adding custom tools to the Editor. A dropdown can be added as a custom tool as shown with the tool with name "customTemplate". And the tool with name "custom" demonstrates how a custom tool can be configured to execute a default command - in this case the insertHtml.

https://demos.telerik.com/kendo-ui/editor/custom-tools