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

Simple Link Manager

1 Answer 148 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 21 May 2009, 10:49 AM
Hi,

I have followed the instructions from : http://www.telerik.com/support/kb/aspnet-ajax/editor/creating-a-simple-link-manager.aspx
to create a 'Simple Link Manager'.

This works fine, however, once a link has been added, if you right click on the link and select 'Set Link Properties', the editor trys to open the full telerik Link Manager, which is a problem as we do not wish to allow links to be edited in that way.

Is there a way to redirect that menu option to the simple link manager, or to remove the edit option altogether?

Regards,

Sean Duffy.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 23 May 2009, 07:23 PM
Hello Sean,

You can easily predefine the ContextMenu items for link tags using the following <contextMenus> inner-tag of RadEditor:

<telerik:radeditor runat="server" ID="RadEditor1"    
 OnClientCommandExecuting="OnClientCommandExecuting"  
 Height="400px">   
    <Tools>  
        <telerik:EditorToolGroup>  
            <telerik:EditorTool Name="LinkManager" Text="Link Manager" />  
        </telerik:EditorToolGroup>                 
    </Tools>    
    <ContextMenus> 
        <telerik:EditorContextMenu TagName="A"
            <telerik:EditorTool Name="LinkManager" /> 
            <telerik:EditorTool Name="Unlink" /> 
        </telerik:EditorContextMenu> 
    </ContextMenus>                    
</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>     

More information is available here.

Sincerely,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Sean
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or