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

[Solved] Image, RadWindow and Editor

1 Answer 74 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Abdullah Önden
Top achievements
Rank 1
Abdullah Önden asked on 21 Oct 2009, 02:13 PM
Hi,

I wonder is there any property in editor that when someone clicks on a image, it shows the full sized image in a lightbox? Is that possible?

Abdullah

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Oct 2009, 08:48 AM
Hi Abdullah,

RadEditor is an WYSIWYG editor for editing HTML / XHTML content. The requested feature is not part of the advertised editor's functionality and we do not support it. 

What you can do is to try the code below as a base and implement the requested functionality yourself:

<script type="text/javascript">
  function OnClientLoad(editor, args)
  {
         
       var element = document.all ? editor.get_document().body : editor.get_document();
       $telerik.addExternalHandler(element, "click", function(e)
       {
            var elem = editor.getSelectedElement();
            alert(elem.src);
            if (elem.tagName == "IMG");
             
            var href = elem.src; //get the href values of the images
            window.open(href, null, "height=500,width=500,status=no,toolbar=no,menubar=no,location=no");
            return false;;
            
       });
}
</script>
<telerik:radeditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">
   <ImageManager ViewPaths="~/Images" UploadPaths="~/Images" />
   <Content>
   </Content>
</telerik:radeditor>

The code shows how to attach to the onclick event of the editor's content area, check for the selected element and if it is of type IMG to execute window.open to open the selected image in a new window.

Please note that you need to double click on the image in Internet Explorer to open to open it in a new window.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Abdullah Önden
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or