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
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
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
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
I did like your demo but still the default font is 12px.
Please help me !
Which version of RadEditor do you use? I need the name of the assembly and its version.
All the best,
Rumen
the Telerik team
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
Try out if the following configuration leads to the required output:
<
telerik:RadEditor
runat
=
"server"
ID
=
"RadEditor1"
>
<
Content
>
<
span
style
=
"font-family: Arial;"
>​​</
span
>
</
Content
>
</
telerik:RadEditor
>
Regards,
Ianko
Telerik
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
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
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,
IankoTelerik