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

Setting the body's CssClass of the iframe

5 Answers 447 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Laurent
Top achievements
Rank 1
Laurent asked on 06 May 2009, 01:01 PM
Hi,

I would like to specify the CssClass of the body tag, which is in the Designer's iframe. I'm using the editor in my CMS's Back-Office, outside of the website. Some of my customers have specified a CssClass on the body tag, and to reproduce the same behavior in the Back-Office, I need to customize the designer's iframe.

I saw that : http://www.telerik.com/help/aspnet-ajax/editor-setting-content-area-defaults.html, but I don't think It matches my needs.

Thanks in advance for reply,
Laurent

5 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 11 May 2009, 06:44 AM
Hello Laurent,

Did you try the solution provided in the following live example: Customize Content Area? It demonstrates how to set the body class of the RadEditor's content area by importing an external css file via the ContentAreaCssFile property.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Laurent
Top achievements
Rank 1
answered on 11 May 2009, 08:07 AM
Actually no, it does not demonstrate how to set the body class, but it demonstrate how to apply a style to the body ... that's quite different.

As I said, I'm using Telerik RadEditor in the backoffice. In the front office, some of my customers have Css like that :

body.myclass { something }

And their html doc is like that : <body class="myclass">...</body>

But, in RadEdtior, I only have "<body></body>" and I cannot apply a css class. My goal is to use the same CSS File without modifying it. So what I need is a property "ContentAreaBodyCssClass" which applies a Css class to the body.

I know that applying a CSS Class on the body tag is not a best-practice, but our goal is to be compliant with most of my custormer's styles.
0
Tervel
Telerik team
answered on 11 May 2009, 08:22 AM
Hello Laurent,

Perhaps the following demo will be useful to you then:
http://demos.telerik.com/aspnet-ajax/editor/examples/completehtmlsupport/defaultcs.aspx

All the best,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Laurent
Top achievements
Rank 1
answered on 11 May 2009, 10:38 AM
Ok, I saw that, but as I expected, when saving, I'm getting back the "<body class=..." in the Content property. So, as there are no other solution, a little regex removes it.

Thanks for the answers Rumen & Tervel
0
Rumen
Telerik team
answered on 11 May 2009, 10:56 AM
Hello Laurent,

Yes, you can strip the tag when submitting the content.

Another approach is to append programmatically the class to the body element of the content area. Here is an example:

<script type="text/javascript">  
function OnClientLoad(editor)  
{  
    editor.get_document().body.className = "myclass";  
</script> 
<telerik:RadEditor ID="RadEditor1" runat="server"  OnClientLoad="OnClientLoad"
</telerik:RadEditor> 




Sincerely yours,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Laurent
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Laurent
Top achievements
Rank 1
Tervel
Telerik team
Share this question
or