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

Simple LinkManager.ascx

2 Answers 168 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Chase Florell
Top achievements
Rank 1
Chase Florell asked on 15 Aug 2008, 01:36 AM
I am having a hard time customizing the LinkManager.ascx.

All I need is for the end user to be able to put in a link, specify the...

Type
URL
Link Text
Target

What is the easiest way to strip that down?  I have been manually removing the items from the markup but then because of the above Javascript (which I am not at all familiar with) I get tons of javascript errors.

Please help with a solution.

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 15 Aug 2008, 07:54 AM
Hi Chase,

All you need to do is to set

<telerik:radeditor runat="server" ID="RadEditor1" ExternalDialogsPath="~/EditorDialogs">
</telerik:radeditor>
 
Copy the EditorDialogs installation folder to the root of your web application and open the LinkManager.aspx. After that locate the html elements that you want to hide and apply style="display:none;" to them.

To hide the the tabs by putting the following css in the LinkManager control:

<style type="text/css">
#LinkManagerTab
{
    visibility: hidden;
}
</style>

For your convenience I have attached the modified version of the LinkManager.ascx file.

You can also replace the build-in hyperlink manager with the link manager of the browser. It is quite simple and it will be suitable for your scenario. Here is an example how to use the browser Create Link dialog:

<telerik:radeditor runat="server" ID="RadEditor1" 
 OnClientCommandExecuting="OnClientCommandExecuting"
 Height="400px">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="LinkManager" Text="Link Manager" />
        </telerik:EditorToolGroup>              
    </Tools>                    
</telerik:radeditor>
<script type="text/javascript">
 function OnClientCommandExecuting(editor, args)
 {              
    var commandName = args.get_commandName();
    if (commandName == "LinkManager")
    {
        editor.setFocus();
                                              
        //FireFox - will work only if there is selection of text, otherwise built-in browser command does not work
        if (!document.all)
        {                  
            var href = prompt("Enter a URL:", "http://");                      
            if (href) editor.get_document().execCommand("createlink", false, href); 
        }  
        else editor.get_document().execCommand("createlink", true, null);      
                
        //Cancel the further execution of the command to avoid error
        args.set_cancel(true);              
    }
 }       
 </script>

Best wishes,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chase Florell
Top achievements
Rank 1
answered on 15 Aug 2008, 04:39 PM
Great thanks, that works wonders.
Tags
Editor
Asked by
Chase Florell
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Chase Florell
Top achievements
Rank 1
Share this question
or