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

DocumentManager

1 Answer 81 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Peter Zolja
Top achievements
Rank 1
Peter Zolja asked on 29 Jan 2009, 01:11 AM
Hi,

1) Is there a way to configure the document manager so that when I select a file it will let me specify the text of the link as well? This would prevent me from selecting the link and going to the link manager and changing it from there.
2) What's the easiest way (for the client / user) to insert an image and have that image link to a document that would normally show up in the document manager. So the HTML would look like <a href="the doc..."><img ... /></a>

Thanks.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 02 Feb 2009, 05:01 PM
Hi Peter,

Straight to the points:

1) Thank you for your feature request. I logged it in our ToDo list for the upcoming "Futures" build of RadEditor for ASP.NET AJAX and we will add a new textbox named Link Text to the Document manager.

2) Here is an code example which demonstrates how to select the inserted image via the image manager and apply a link to it via the link manager:

    <script type="text/javascript"
    function OnClientPasteHtml(editor, args)  
    {  
        var commandName = args.get_commandName();         
        if (commandName == "ImageManager") 
        { 
            var value = args.get_value();                                                                 
            //Set a temp id to retrive the image later 
            var id = "id" + (new Date() - 100); 
             
            valuevalue = value.replace(/<img/i, "<img id='" + id + "'");                 
                         
            args.set_value(value); 
                                             
            setTimeout(function() 
            { 
                //Get reference to image                     
                var img = editor.get_document().getElementById(id);  
                //remove temp ID 
                img.id = ""
                //Select image 
                editor.selectElement(img); 
                //Open Document manager or Link manager                 
                editor.fire("LinkManager"); 
            }, 100); 
        } 
    }  
    </script>  
 
    <telerik:RadEditor runat="server" OnClientPasteHtml="OnClientPasteHtml" 
        ID="RadEditor1" >   
        <ImageManager ViewPaths="~/" UploadPaths="~/" /> 
        <Content> 
            <p>testing</p> 
        </Content> 
    </telerik:RadEditor> 

For your convenience I have attached my test page.

Kind regards,
Rumen
the Telerik team

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