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

How to create my own context menu in RadEditor

1 Answer 69 Views
Editor
This is a migrated thread and some comments may be shown as answers.
vikram
Top achievements
Rank 1
vikram asked on 23 Mar 2009, 02:30 PM
Hi,
 I am using radEditor control in a web application in which i want to implement the context menu, where the labels of the context menu should be as per my specification.

How can I use labels as per my specification?
Thanks
Vikram

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Mar 2009, 01:15 PM
Hi Vikram,

You can create your own custom menu using the oncontextmenu event of RadEditor:

    <script type="text/javascript">
    function CallContextMenu(editor) 
    { 
        editor.attachEventHandler ("oncontextmenu", function (e) 
        {   
            var oSelection = editor.getSelection().getParentElement(); //get the selected element
            if(oSelection.tagName == "IMG")
            {
                    alert("the 'e' argument returns the mouse position " + e);
                    alert("get a reference to the editor's body " + editor.get_document().body);
                    alert("the selected element is " + oSelection.tagName);
            }
        });
    } 
    </script>
    <telerik:RadEditor runat="server" ID="edContent" OnClientLoad="CallContextMenu">
        <Content>sample content <br/> sample content <img src="" /></Content>
    </telerik:RadEditor> 


Best regards,
Rumen
the Telerik team

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