Hi frJericho,
Please try the example below. It shows you how to add the code snippets dynamically in javascript.
If you want to add it in server side code, please refer to http://richtexteditor.com/document/scr/html/code-snippets-dropdown.htm
- <%@ Page Language="c#" ValidateRequest="false" %>
-
- <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>example</title>
- </head>
-
- <body>
- <form id="Form1" method="post" runat="server">
-
- <RTE:Editor ID="editor1" runat="server"/>
- <input type="button" value="add custom template" onclick="addCustomTemplate()" />
- </form>
- </body>
- </html>
-
- <script type="text/javascript">
- var editor1;
- function RichTextEditor_OnLoad(editor) {
- editor1 = editor;
- }
- function addCustomTemplate()
- {
- editor1.LoadTemplates(function (group) {
- group.groups.push({
- text: "custom group", groups: [], templates: [
- { text: "sub template", href: "",code:"template text 1" }
- ]
- });
- group.templates.push({
- text: "my Template", href: "",code:"template text 2"
- });
- });
- }
-
- </script>
Regards,
Ken