FormatSets Question

2 posts, 1 answers
  1. Dan Ehrmann
    Dan Ehrmann avatar
    166 posts
    Member since:
    Jul 2004

    Posted 17 Apr 2012 Link to this post

    Using the new FormatSets gadget - very nice!

    One question - can I change the section titles in the drop down?

    For example, rather than "Inline Format Sets", I might like it to say "Inline Styles"
  2. Answer
    Rumen
    Admin
    Rumen avatar
    14351 posts

    Posted 20 Apr 2012 Link to this post

    Hi,

    The FormatSets tool still does not offer a localization and the only possible way to rename the strings is by overwriting the JavaScript of the tool. Here is how to do that (see the highlighted lines below):

    <telerik:RadEditor ID="RadEditor1" runat="server">
        <Tools>
            <telerik:EditorToolGroup>
                <telerik:EditorTool Name="FormatSets" />
            </telerik:EditorToolGroup>
        </Tools>
        <FormatSets>
            <telerik:EditorFormatSet Tag="H1" Title="<h1 style='color: green'>green header 1</h1>">
                <attributes>
                    <telerik:EditorFormatSetAttribute Name="class" Value="greenClass" />
                    <telerik:EditorFormatSetAttribute Name="style" Value="color: green;" />
                </attributes>
            </telerik:EditorFormatSet>
            <telerik:EditorFormatSet Tag="img" Title="<span style='border: 1px solid red;'>red border image</span>">
                <attributes>
                    <telerik:EditorFormatSetAttribute Name="class" Value="redBorderImage" />
                    <telerik:EditorFormatSetAttribute Name="style" Value="border: 1px solid red; margin: 10px;" />
                </attributes>
            </telerik:EditorFormatSet>
            <telerik:EditorFormatSet Tag="li" Title="<ul><li style='list-style-type: square;color: Red;'>square red list</li></ul>">
                <attributes>
                    <telerik:EditorFormatSetAttribute Name="style" Value="list-style-type: square;color: red;" />
                </attributes>
            </telerik:EditorFormatSet>
            <telerik:EditorFormatSet Tag="" Title="<span style='color: Magenta'>magenta text</span>">
                <attributes>
                    <telerik:EditorFormatSetAttribute Name="style" Value="color: Magenta" />
                </attributes>
            </telerik:EditorFormatSet>
        </FormatSets>
    </telerik:RadEditor>
    <script type="text/javascript">
        var $ = $telerik.$,
        $T = Telerik.Web.UI;
        $.registerControlProperties($T.Editor.FormatSetsDropDown, {
            clientStateFieldID: null,
            blockSetsText: "Block Styles",
            inlineSetsText: "Inline Styles",
            elementSetsText: "Element Styles",
            blockSets: [],
            inlineSets: [],
            elementSets: [],
            selectedElement: null,
            clientTypeName: "Telerik.Web.UI.Editor.FormatSetsDropDown"
        });
    </script>


    All the best,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top