unnknown
unnknown

Reputation: 1785

How do I set the default font on Telerik's RadEditor?

There must be an easy way to set the default selected font of the Font Name dropdown list. I've been looking around on the Telerik site and forums but I can't find a simple way. Maybe there is no simple way, but maybe I just can't find it.

Here is my RadEditor:

      <telerik:RadEditor ID="RadEditor1" runat="server" ContentFilters="MakeUrlsAbsolute,ConvertToXhtml,RemoveScripts"
                    EditModes="All" EnableResize="false" Font-Bold="false" Font-Names="Arial" Font-Size="8pt"
                    Height="230px" MaxHtmlLength="3000" MaxTextLength="3000" NewLineMode="Br" Skin="Web20">
                    <Tools>
                        <telerik:EditorToolGroup>
                            <telerik:EditorTool Name="ImageManager" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Enabled="true" Name="FontName" />
                            <telerik:EditorTool Enabled="true" Name="FontSize" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Enabled="true" Name="BackColor" />
                            <telerik:EditorTool Enabled="true" Name="ForeColor" />
                            <telerik:EditorTool Enabled="true" Name="Bold" />
                            <telerik:EditorTool Enabled="true" Name="Italic" />
                            <telerik:EditorTool Enabled="true" Name="Underline" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Enabled="true" Name="Copy" />
                            <telerik:EditorTool Enabled="true" Name="Cut" />
                            <telerik:EditorTool Enabled="true" Name="Paste" />
                            <telerik:EditorTool Enabled="true" Name="AjaxSpellCheck" Text="Spell Check" />
                        </telerik:EditorToolGroup>
                    </Tools>
                    <ImageManager MaxUploadFileSize="1048576" SearchPatterns="*.jpg,*.jpeg,*.png,*.gif,*.bmp, *.ico"
                        UploadPaths="~/images/" ViewPaths="~/images/" />
                </telerik:RadEditor>

I hope one of you out there can tell me! Thanks!

Upvotes: 2

Views: 6255

Answers (3)

AnjuRaj
AnjuRaj

Reputation: 298

Create a css file 'RadEditorContentArea.css' with the following content:

body 
{  
   font-family: Arial!important;
}

Add this css file as the editor css file as follows

<telerik:RadEditor runat="server" ID="RadEditor1">
    <CssFiles>
        <telerik:EditorCssFile Value="~/RadEditorContentArea.css" />
    </CssFiles>
</telerik:RadEditor>

Check out this link for more: http://docs.telerik.com/devtools/aspnet-ajax/controls/editor/managing-content/content-area-appearance/default-font-for-editable-content

Upvotes: 0

Rumen Jekov
Rumen Jekov

Reputation: 1675

This article might be helpful http://www.telerik.com/help/aspnet-ajax/editor-default-font-for-editable-content.html

You can also set the default FontName header dropdown value in the OnClientLoad event using this code:

var tool = editor.getToolByName("FontName");
tool.set_value("Tahoma");

Upvotes: 5

unnknown
unnknown

Reputation: 1785

This worked:

The editor:

 <telerik:RadEditor ID="myEditor" OnClientLoad="RadEditorLoad" runat="server" ... >

Handler:

        function RadEditorLoad(editor, eventArgs) {

            // Set the Editor Default Font to Arial

             editor.get_contentArea().style.fontFamily = 'Arial'
        }

Found this at: http://www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-setting-font.aspx

Upvotes: 5

Related Questions