aspnetcore-js-devexpress-dot-richedit-6f99537c.md
Declares context menu settings and methods.
export interface IContextMenu
Specifies whether the context menu is enabled.
enabled: boolean
| Type | Description |
|---|---|
| boolean |
true , to enable the context menu; otherwise, false.
|
function onContextMenuShowing(s, e) {
var characterProperties = s.selection.activeSubDocument.getCharacterProperties(s.selection.intervals[0]);
if (characterProperties.strikeout==true ) {
e.contextMenu.enabled = false;
}
};
Provides access to the context menu item collection.
items: ContextMenuItem[]
| Type | Description |
|---|---|
| ContextMenuItem[] |
An array of items.
|
richEdit.contextMenu.removeItem(richEdit.contextMenu.items[10]);
The context menu contains the set of default commands. To customize it, use the following methods:
Returns a context menu item with the specified identifier.
getItem(
id: CommandId | RibbonItemId
): ContextMenuItem | null
| Name | Type | Description |
|---|---|---|
| id | CommandId | RibbonItemId |
An item identifier.
|
| Type | Description |
|---|---|
| ContextMenuItem |
An item with the specified id property value. null if an item with the specified identifier is not found.
|
richEdit.contextMenu.getItem(DevExpress.RichEdit.ContextMenuCommandId.Copy).text='Copy the text';
Run Demo: Context Menu Customization
Inserts an item at the specified position.
insertItem(
item: ContextMenuItem,
index?: number
): ContextMenuItem
| Name | Type | Description |
|---|---|---|
| item | ContextMenuItem |
A context menu item to insert.
| | index | number |
The zero-based index at which the specified item should be inserted.
|
| Type | Description |
|---|---|
| ContextMenuItem |
The item that was inserted.
|
richEdit.contextMenu.insertItem(
new DevExpress.RichEdit.ContextMenuItem(DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField,
{ icon: 'clock', text: 'Insert Date Field', beginGroup: true}), 1);
When you do not specify the item position, the control inserts the item at the bottom of the context menu.
Run Demo: Context Menu Customization
Inserts an item after the target item.
insertItemAfter(
item: ContextMenuItem,
target: ContextMenuItem | CommandId | RibbonItemId
): ContextMenuItem
| Name | Type | Description |
|---|---|---|
| item | ContextMenuItem |
A context menu item to insert.
| | target | ContextMenuItem | CommandId | RibbonItemId |
The target item or its identifier.
|
| Type | Description |
|---|---|
| ContextMenuItem |
The item that was inserted.
|
richEdit.contextMenu.insertItemAfter(
new DevExpress.RichEdit.ContextMenuItem(DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField,
{ icon: 'clock', text: 'Insert Date Field', beginGroup: true}), DevExpress.RichEdit.HomeTabCommandId.Copy);
When the context menu does not contain the target item, the control inserts the item at the bottom of the context menu.
Inserts an item before the target item.
insertItemBefore(
item: ContextMenuItem,
target: ContextMenuItem | CommandId | RibbonItemId
): ContextMenuItem
| Name | Type | Description |
|---|---|---|
| item | ContextMenuItem |
A context menu item to insert.
| | target | ContextMenuItem | CommandId | RibbonItemId |
The target item or its identifier.
|
| Type | Description |
|---|---|
| ContextMenuItem |
The item that was inserted.
|
richEdit.contextMenu.insertItemBefore(
new DevExpress.RichEdit.ContextMenuItem(DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField,
{ icon: 'clock', text: 'Insert Date Field', beginGroup: true}), DevExpress.RichEdit.HomeTabCommandId.Copy);
When the context menu does not contain the target item, the control inserts the item at the bottom of the context menu.
Removes an item with the specified identifier from the context menu.
removeItem(
id: CommandId | RibbonItemId
): ContextMenuItem | null
| Name | Type | Description |
|---|---|---|
| id | CommandId | RibbonItemId |
An item identifier.
|
| Type | Description |
|---|---|
| ContextMenuItem |
The item that was removed. null if the item with the specified id property value is not found.
|
richEdit.contextMenu.removeItem(DevExpress.RichEdit.HomeTabCommandId.Copy);
Run Demo: Context Menu Customization
Removes an item from the context menu.
removeItem(
item: ContextMenuItem
): ContextMenuItem | null
| Name | Type | Description |
|---|---|---|
| item | ContextMenuItem |
A context menu item to remove.
|
| Type | Description |
|---|---|
| ContextMenuItem |
The item that was removed. null if the specified item is not found.
|
richEdit.contextMenu.removeItem(richEdit.contextMenu.items[10]);