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

Images boundaries seen outside the editor frame

1 Answer 36 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Avi
Top achievements
Rank 1
Avi asked on 25 Mar 2009, 09:31 AM

Hi,
When im adding an image that is bigger then the editor's content frame and then clicking on the image,
the image boundaries are seen outside the editor's content frame.
Is there a fix for that or some workaround to avoid this?

Thanks in advanced

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Mar 2009, 04:45 PM
Hi Avi,

The content area of RadEditor is editable IFRAME element which depends on the browser's Rich Text Editing engine. The observed behavior and the images handlers are entirely controlled by the browser and it is not possible to hide them with javascript or css. However, if you disable the image resizing by setting the unselectable="on" attribute to all IMG tags, then the browser will not display the image handlers. Here is the solution:

<script type="text/javascript">
function OnClientSelectionChange(editor)
{
    var images = editor.get_document().getElementsByTagName("IMG");
    for (var i = 0; i < images.length; i++)
    {
        var image = images[i];
        image.setAttribute("unselectable", "on");
    }
}
</script>
   
<telerik:RadEditor ID="RadEditor1"

 OnClientSelectionChange="OnClientSelectionChange"

runat="server"  Width="100%" Height="345px">
    <Content>
      <img src="http://www.telerik.com/DEMOS/ASPNET/RadControls/Editor/Skins/Default/buttons/CustomDialog.gif"/>
      <a href="www.telerik.com">telerik</a>
      <img src="http://www.telerik.com/DEMOS/ASPNET/RadControls/Editor/Skins/Default/buttons/CustomDialog.gif"/>
    </Content>
</telerik:RadEditor>


Sincerely,
Rumen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Avi
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or