Setting default Font for RadEditor

11 posts, 0 answers
  1. Ilyas Sapiyan
    Ilyas Sapiyan avatar
    4 posts
    Member since:
    Mar 2009

    Posted 16 Nov 2010 Link to this post



    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
     
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 16 Nov 2010 Link to this post

    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.
  3. Ilyas Sapiyan
    Ilyas Sapiyan avatar
    4 posts
    Member since:
    Mar 2009

    Posted 18 Nov 2010 Link to this post

    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
  4. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 23 Nov 2010 Link to this post

    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.
  5. Gioi Hoang Manh
    Gioi Hoang Manh avatar
    1 posts
    Member since:
    Oct 2009

    Posted 06 Jan 2012 Link to this post

    Hi Rumen!

    I did like your demo but still the default font is 12px.
    Please help me !
  6. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 09 Jan 2012 Link to this post

    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
  7. Charlie
    Charlie avatar
    12 posts
    Member since:
    Nov 2014

    Posted 29 Jul 2015 Link to this post

    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

  8. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 29 Jul 2015 Link to this post

    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
  9. Charlie
    Charlie avatar
    12 posts
    Member since:
    Nov 2014

    Posted 29 Jul 2015 in reply to Ianko Link to this post

    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

  10. Florian
    Florian avatar
    1 posts
    Member since:
    Jun 2016

    Posted 22 Jun Link to this post

    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

  11. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 27 Jun Link to this post

    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.
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!