New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Disable image resize in RadEditor


Very often in CMS scenarios the size of the content area is limited and it is useful to prevent the image resize in the editor, so that the image does not exceeds the content boundaries. The solution shows how to completely disable the image resize in RadEditor.


The image resizing in Chrome, Edge Cromium and Firefox is handled by RadEditor and you can disable it by overriding the _elementResizingSelectionChangeHandler function:

    <telerik:RadEditor runat="server" ID="RadEditor1"><Content> <img src="../images/barcelona.jpg" /></Content></telerik:RadEditor>
        Telerik.Web.UI.RadEditor.prototype._elementResizingSelectionChangeHandler = function () { }

The image resizing in IE is handled by the broser itself and the solution there is to apply unselectable="on" to all images in the content area. This could happen in the OnClientLoad and/or OnClientSelectionChange event(s) of the editor:

<script type="text/javascript">
<telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad"><Content> <img src="../images/barcelona.jpg" /></Content></telerik:RadEditor>
function OnClientLoad(editor, args)
    var elems = editor.get_document().getElementsByTagName("IMG");  
    for (var i=0; i < elems.length; i++)  
        var image = elems[i];
In this article