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.
- function CuteEditor_AddMainMenuItems(menuitem)
- {
- menuitem.AddMenuItem(1,"Hello","bold.gif",DefaultMenuHandler);
- }
- function DefaultMenuHandler(menuitem)
- {
- alert("You clicked "+menuitem.editor.id+":"+menuitem.html);
- }
2. Add custom items to tag context menu
The following code shows how to add custom items to tag context menu.
- function CuteEditor_AddTagMenuItems(menuitem,element)
- {
-
- menuitem.AddMenuItem(1,"MyMenuItem","bold.gif",HandleMyMenuItem);
-
- function HandleMyMenuItem()
- {
- alert(element.nodeName);
- }
- }
3. Add custom items to Verb context menu
The following code shows how to add custom items to Verb context menu.
- function CuteEditor_AddVerbMenuItems(menuitem,element)
- {
-
- menuitem.AddMenuItem(1,"MyMenuItem","bold.gif",HandleMyMenuItem);
-
- function HandleMyMenuItem()
- {
- alert(element.nodeName);
- }
- }