Is there a reason that ContentAreaMode is ignored when the editor is disabled?

1 Answer 42 Views
Editor
Mark
Top achievements
Rank 1
Iron
Mark asked on 16 Aug 2024, 03:55 PM

I have blocks of HTML that are entered (usually copy and pasted in from email messages) by users of our system.  We don't know what this content will contain, or if the content (html) is even completed (maybe the copied part of a HTML message).  For that reason we display the content in a radeditor.  This content is read-only, so we set the Enabled property of the RadEditor to "false".   However when we do that, the content is no longer displayed in an iframe, despite using ContentAreaMode="Iframe".  

 

When the editor is Enabled, it renders like this instead:

 

The reason that we are trying to have the content rendered in an IFRAME is because this content sometimes includes CSS/Styles that modify the content in the parent container. 

For instance today we discovered this HTML embedded into a <style> tag.

div {
       display: block !important;
       visibility: visible !important;
       opacity: 1 !important
    }

And this caused all kinds of rendering problems on the page because it forced a ton of modal popup <div>'s to become visible that should be hidden.

 

Thanks for your help!

-Mark

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Aug 2024, 02:14 PM

Hi Mark,

I hope you are doing well!

When the RadEditor is set to Enabled="false", it does not render the content in an iframe regardless of the ContentAreaMode setting. This behavior is by design to optimize performance and rendering when the editor is in read-only mode.

If you would like to disable the editor without hiding its tools, modules and content area then you should do that on the client using the editor.enableEditing(false) and set_editable(false) methods. Here is an example:

<telerik:RadEditor runat="server" ID="RadEditor1">
    <Content>some test content</Content>
</telerik:RadEditor>
<input type="button" onclick="toggleEditing();return false;" value="Toggle editing" />
<script type="text/javascript">
var toggle = true;
function toggleEditing()
{
    var editor = $find("<%=RadEditor1.ClientID%>");
    toggle = !toggle;
    editor.enableEditing(toggle);
    editor.set_editable(toggle);
    if (toggle == false) editor.get_document().body.style.backgroundColor = "gray";
    else editor.get_document().body.style.backgroundColor = "";
}
</script>

 

Regards,
Rumen
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Tags
Editor
Asked by
Mark
Top achievements
Rank 1
Iron
Answers by
Rumen
Telerik team
Share this question
or