Adding a Custom Language to Code Blocks?

2 posts, 0 answers
  1. Steven
    Steven avatar
    1 posts
    Member since:
    Jun 2011

    Posted 06 Jun 2011 Link to this post

    I'm working with a client who uses the telerik editor in their community forum.  As a tech company they have a priority language for one of their devices (it closely follows C#).  While the Code Block Editor is great, they have been asking me about adding in some minor changes to the formatting rules to better represent their specific language syntax and color coding.

    Is this possible?
  2. Rumen
    Admin
    Rumen avatar
    13803 posts

    Posted 09 Jun 2011 Link to this post

    Hello Steven,

    You can get access to the content inserted via the FormatCodeBlock dialog using the OnClientPasteHtml event of RadEditor, e.g.

    <script type="text/javascript">
        function OnClientPasteHtml(sender, args) {
            var commandName = args.get_commandName();
            var value = args.get_value();
            if (commandName == "FormatCodeBlock") {
                //modify and set new content
                args.set_value("new content");
            }
        }
    </script>
    <telerik:RadEditor runat="server"
    OnClientPasteHtml="OnClientPasteHtml"
    ImageManager-ViewPaths="~/"
    ID="RadEditor1">
    </telerik:RadEditor>

    Once you obtain the content in this event you can modify it.

    You can see how to access the contents of the dialog in this demo: Customize Built-in Dialogs.

    Best regards,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top