CuteEditor for .NET

Add custom items to context menu

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 add custom items to context menu

1. Add custom items to main context menu

The following code shows how to add custom items to main context menu.

  1. function CuteEditor_AddMainMenuItems(menuitem)   
  2. {   
  3.     menuitem.AddMenuItem(1,"Hello","bold.gif",DefaultMenuHandler);   
  4. }   
  5. function DefaultMenuHandler(menuitem)   
  6. {   
  7.    alert("You clicked "+menuitem.editor.id+":"+menuitem.html);   
  8. }  

2. Add custom items to tag context menu

The following code shows how to add custom items to tag context menu.

  1. function CuteEditor_AddTagMenuItems(menuitem,element)   
  2. {   
  3.  //you can see the menu item in the TagList   
  4.  menuitem.AddMenuItem(1,"MyMenuItem","bold.gif",HandleMyMenuItem);   
  5.     
  6. function HandleMyMenuItem()   
  7.  {   
  8.   alert(element.nodeName);   
  9.  }   
  10. }  

3. Add custom items to Verb context menu

The following code shows how to add custom items to Verb context menu.

  1. function CuteEditor_AddVerbMenuItems(menuitem,element)   
  2. {   
  3.    //you can see the menu item in the Verb context menu   
  4.    menuitem.AddMenuItem(1,"MyMenuItem","bold.gif",HandleMyMenuItem);   
  5.     
  6.    function HandleMyMenuItem()   
  7.   {   
  8.      alert(element.nodeName);   
  9.    }   
  10. }