This is a migrated thread and some comments may be shown as answers.

Setting default Font for RadEditor

10 Answers 449 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ilyas Sapiyan
Top achievements
Rank 1
Ilyas Sapiyan asked on 16 Nov 2010, 08:23 AM


Hi ,  Telerik Team .

I want to set default font for Rad Editor . but i don't know the way to do .Pls help me . 

Example for this case  :

Users will set the default font for their operation .Next time when they use system. Font will be set.

Thanks and Best Regards
 

10 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 16 Nov 2010, 02:44 PM
Hi Ilyas,

You can find detailed information on how to set default styling to the RadEditor's content area in the following help article and live demo:
Setting Content Area Defaults
Editor / Customize Content Area

I hope this helps.

All the best,
Dobromir
the Telerik team
Browse the vast support resources we have to jumpstart 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.
0
Ilyas Sapiyan
Top achievements
Rank 1
answered on 18 Nov 2010, 08:58 AM
Hi Telerik Team ,  

Thanks very much for your help . 

One thing i don't know, if  i can set default font for RadEditor (DropdownToolbar (Font Name) as well as the content area )   in C# without javascript .?



Best Regards
0
Rumen
Telerik team
answered on 23 Nov 2010, 10:56 AM
Hello Ilyas Sapiyan,

You can set the default font through the codebehind using the following C# code:

protected void Page_Load(object sender, EventArgs e)
{
    RadEditor1.OnClientLoad = "OnClientLoad";
    string js = @" 
    <script language='javascript'
        function OnClientLoad(editor, args) {
            setTimeout(function()
            {
                  var style = editor.get_contentArea().style;
                  style.fontFamily= 'Tahoma';
                  style.fontSize= 20 + 'px';
            }, 100);
        }
    </script>";
    ClientScript.RegisterClientScriptBlock(this.GetType(), "myscriptkey", js);
}


Kind regards,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart 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.
0
Gioi Hoang Manh
Top achievements
Rank 1
answered on 06 Jan 2012, 09:16 AM
Hi Rumen!

I did like your demo but still the default font is 12px.
Please help me !
0
Rumen
Telerik team
answered on 09 Jan 2012, 03:48 PM
Hi,

Which version of RadEditor do you use? I need the name of the assembly and its version.


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
0
Charlie
Top achievements
Rank 1
answered on 29 Jul 2015, 07:02 AM

Hi I know this post has been closed for many years now but I have been trying to use this code to set my default font but this doesn't work as desired. I don't mind setting the font in Javascript or C# I can do this just fine and I can get the drop down the show the correct font and to display any text typed in that font but the issue is on saving the content area. The text is plain text in the content area. If I manually select a font  while in design it inserts a span tag with a font property so that if the content is exported it can still keep the styling. I would like to replicate this when I set the default font so that it always starts with a span. 

 

thanks in advance

0
Ianko
Telerik team
answered on 29 Jul 2015, 07:47 AM
Hi Charlie,

Try out if the following configuration leads to the required output:
<telerik:RadEditor runat="server" ID="RadEditor1">
    <Content>
        <span style="font-family: Arial;">​&#8203;</span>
    </Content>
</telerik:RadEditor>


Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Charlie
Top achievements
Rank 1
answered on 29 Jul 2015, 09:18 AM

Hi sorry no this does not work. I can work around it on the submit of the page if I can get the current font from the dropdownlist in C# but I am unsure how to do this also?

 It would be better if I could prefix the content area beforehand though.

Regards,

Charlie

0
Florian
Top achievements
Rank 1
answered on 22 Jun 2016, 01:32 PM

Hi there,

I still have the same problem like Charlie in Juli 2015.

My editor is empty and I enter a text with the selected default font. After saving the content without changing some styles, the editor returns only the plain text without any HTML Tags. So the editor implies I write in Arial and Save in Arial, but its saved without any HTML Tags, and when I use this text later, its not formatted like it should be.

Are there any suggestions to avoid this behaviour? 

Thanks in advance

0
Ianko
Telerik team
answered on 27 Jun 2016, 06:07 AM
Hello Florian,

The case Charlie had was regarding preserving, or more accurately, utilizing a default font for the text produced by RadEditor. This can be done by inline CSS styles and a wrapper DOM element that lets the child elements (the content) to have a predefined font. 

If I understand correctly, your case is rather related to tag formatting, e.g., H1, H2, P, SPAN, UL and so on. This is no matter of and RadEditor should preserve this formatting without any problems. That said, with the information provided I can only guess what the problem might be and I will need more details in order to examine this behavior. 

As this thread is old and addresses too many unrelated issues, I suggest you to open a new forum thread or sent an official support ticket to us with more details about:
  • The HTML produced by RadEditor;
  • The way you get the HTML content;
  • What is the HTML you expect to see in the code behind and the actual one.

Regards,

Ianko
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Ilyas Sapiyan
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Ilyas Sapiyan
Top achievements
Rank 1
Rumen
Telerik team
Gioi Hoang Manh
Top achievements
Rank 1
Charlie
Top achievements
Rank 1
Ianko
Telerik team
Florian
Top achievements
Rank 1
Share this question
or