Table of Contents
Customizing Context Menu

EO.Web Editor provides ContextMenuID property through which you can specify a custom context menu for the editor.

Context Menu Items

A context menu can carry out a built-in or custom command. When using built-in command, it is associated with a pre-defined command through the menu item's ItemID property. For example, the following menu item is associated with InsertOrEditLink command:

ASPX
<eo:MenuItem ItemID="InsertOrEditLink" Text-Html="Edit Link"></eo:MenuItem>

Each menu item is automatically displayed or hidden according to the current context. For example, the above menu item would be visible only if the current edit point is inside a HTML link element.

A context menu can also be associated with a custom command by setting it its ItemID to a string that starts with "custom:". When an item is associated with a custom command, the editor does not automatically enable/disables the item, nor does it carry out any action when the item is clicked. You must handle the menu item's client side event to carry out the corresponding logics by yourself. For example, the following menu item set the item's OnClickScript to insert text to the editor:

ASPX
<eo:MenuItem 
     ItemID="custom:insertABC" Text-Html="Insert 'ABC'"
     OnClickScript="eo_GetObject('Editor1').execCommand('InsertHTML', 'abc');"
></eo:MenuItem>

The appearance of the menu and menu items is customized on the ContextMenu control.