Cute Editor for ASP

How To Control the Context Menu in the CuteEditor?

How To Control the Context Menu in CuteEditor?   

Cute Editor is a context sensitive application, it is aware of it's context and acts accordingly. Many functions of CuteEditor are accessible via the context menus (accessible through a right-click menu in the content area). This section describes how to control the context menu behavior in a Cute Editor control. 


There are many ways to control the context menu behavior in a Cute Editor control:


1. Disable the default context menu.
2. Disable the default context menu of the browser
3. Load the different configuration file dynamically using Editor.ContextMenuMode property.
4. Disable the context menu group by modifying the context menu configuration files.
5. Change the available context menu items and the order of the items by editing context menu definition file.
6. Change the available context menu items and the order of the items by editing context menu definition file.

1. Disable the Default Context Menu



To turn off context menus, you can choose one of the following methods:


1. Using the Editor.EnableContextMenu Property to specify whether the context menu is enabled.

2. Edit context menu configuration files .

All the context menu configuration files can be found in the cuteeditor_files/Configuration/ContextMenuMode folder. In the context menu configuration files, you can find the contextmenu element which contains the configuration information for the context menus within CuteEditor.

To turn off context menus, you need to disable all of the context menu groups.


Example:

 

  1. <?xml version="1.0" encoding="utf-8" ?>  
  2. <configuration>  
  3. <!--definition see shared/common.config-->  
  4.  <contextmenus>  
  5.   <ref name="Undo" />  
  6.   <spliter />  
  7.   <ref name="Cut" />  
  8.   <ref name="Copy" />  
  9.   <ref name="Paste" />  
  10.   <ref name="Delete" />  
  11.   <spliter />  
  12.   <ref name="SelectAll" />  
  13.   <ref name="EditGroup" />  
  14.   <ref name="FormattingGroup" />  
  15.   <ref name="InsertGroup" />  
  16.   <special type="tags"/>  
  17.   <special type="verbs"/>  
  18.   <special type="relative"/>  
  19.   <special type="style" />  
  20.   <special type="property" />  
  21.  </contextmenus>  
  22. </configuration>   

 

2. Disable the default context menu of the browser



To turn off context menus of the browser, you need to set Editor.EnableBrowserContextMenu Property to false.

Example:

 

  1. <%   
  2.            Dim editor   
  3.            Set editor = New CuteEditor   
  4.            editor.ID= "Editor1"    
  5.            editor.EnableContextMenu = "false"  
  6.            editor.EnableBrowserContextMenu = "false"  
  7.            editor.Text = "Hello World"  
  8.            editor.Draw()   
  9. %>  

 


3. Load the different configuration file dynamically using Editor.ContextMenuMode property.


Example:

 

  1. <%   
  2.            Dim editor   
  3.            Set editor = New CuteEditor   
  4.            editor.ID= "Editor1"    
  5.            editor.ContextMenuMode = "Simple"  
  6.            editor.Text = "Hello World"  
  7.            editor.Draw()   
  8. %>  

 


4. Disable the context menu group by modifying the context menu configuration files


For example, to disable edit group menu, you need to remove the following code:

 

  1. <ref name="EditGroup" />  

 

5. Modify the context menu definition file.



The context menu definition file (Common.config) can be found in the cuteeditor_files/Configuration/Shared folder. The context menu definition influences the available context menu items and the order of the context menu items. You can easily customize the context menu to address your unique needs.

For example, to modify EditGroup menu, you need to change the following code:


 <define name="EditGroup" text="[[Edit]]">
   <subItems>
    <ref name="Undo" />
    <ref name="Redo" />
    <spliter />
    <ref name="SelectAll" />
    <ref name="PasteText" />
    <ref name="PasteWord" />
    <spliter />
    <ref name="ToggleBorder" />
    <ref name="FromFullPage" />
    <ref name="ToFullPage" />
   </subItems>
   <initializer>
   <![CDATA[
   ]]>
   </initializer>
  </define>