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

[Solved] contextmenus in toolsfile?

1 Answer 162 Views
Editor
This is a migrated thread and some comments may be shown as answers.
mac
Top achievements
Rank 1
mac asked on 13 Oct 2009, 08:18 PM
can someone post up a sample of what the contextMenus look like in the toolsfile? This http://www.telerik.com/help/aspnet-ajax/usintthetoolsfile.html is not very telling on how exactly to embed contextmenus. I have a requirement to only ever allow my users to pastePlainText. My toolsfile looks like this. The default set as well linked here http://www.telerik.com/support/kb/aspnet-ajax/editor/default-toolsfile-xml-file.aspx are also lacking any reference to contextMenus.

<?xml version="1.0" encoding="utf-8" ?> 
<root> 
<modules> 
    <module name="RadEditorStatistics" dockingZone="Bottom" enabled="true" visible="true"  /> 
    <module name="RadEditorDomInspector" dockingZone="Module" enabled="false" visible="false"  /> 
    <module name="RadEditorNodeInspector" dockingZone="Module" enabled="false" visible="false"  /> 
    <module name="RadEditorHtmlInspector" dockingZone="Module" enabled="false" visible="false"  /> 
</modules> 
 
    <tools> 
      
        <tool name="FindAndReplace" /> 
        <tool name="Undo" /> 
        <tool name="Redo" /> 
        <tool name="Cut" /> 
        <tool name="Copy" /> 
        <tool name="Paste" shortcut="CTRL+!"/>  
        <tool name="InsertOrderedList" /> 
        <tool name="InsertUnorderedList" /> 
      
<tool name="FormatStripper" /> 
<tool name="PasteFromWordNoFontsNoSizes" /> 
    <!--    <tool name="Italic" /> 
        <tool name="Underline" /> 
        <tool name="ForeColor" /> 
        <tool name="BackColor"/>  
      
        <tool separator="true"/>  
        <tool name="FontName"/>  
        <tool name="RealFontSize"/>--> 
    <tool separator="true"/>  
          
        <tool separator="true"/>  
        <tool name="FormatBlock" /> 
        <tool name="Bold" /> 
    </tools> 
    <paragraphs> 
        <paragraph name="Clear formatting" value="&lt;body&gt;" /> 
    <!--    <paragraph name="&lt;H1&gt;Heading 1&lt;/H1&gt;" value="&lt;H1&gt;" /> 
        <paragraph name="&lt;H2&gt;Heading 2&lt;/H2&gt;" value="&lt;H2&gt;" />--> 
        <paragraph name="&lt;H3&gt;Heading 3&lt;/H3&gt;" value="&lt;H3&gt;" /> 
    </paragraphs> 
    <contextMenus> 
        <contextMenu forElement="IMG" enabled="true">  
            <tool name="Paste" /> 
            <tool name="pastePlainText" /> 
             </contextMenu> 
    </contextMenus> 
</root> 
 
My context menus however are getting overwritten with the standards ones
<telerik:Radeditor toolsfile="Tools.xml" runat="server" id="Editor" >

1 Answer, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 16 Oct 2009, 01:20 PM
Hello,

I am attaching a screenshot of how the editor should look like with the tools file you provided. You should note that the context menu you defined will be shown only for images. If you right-click on another part of the editor content (table, text, etc.) you will see the default menu items. As you can see in the screenshot, the menu shows correctly for an image. The part which decides the elements for the context menu is the "forElement" attribute. In your case forElement="IMG", which means it will apply to IMG tags(images). If you want it to apply for all tags set forElement="*".

Kind regards,
Lini
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
Editor
Asked by
mac
Top achievements
Rank 1
Answers by
Lini
Telerik team
Share this question
or