跳到主要内容

ContextMenuItem

The context menu item.

Properties

NameTypeDescription
idstringThe item ID.
textstringThe item text.
datastringThe item data (this data will be sent to the click event callback).
disabledbooleanSpecifies if the current item is disabled or not.
iconsstringThe item icons (see the plugins {@link /plugin/config config} documentation).
itemsContextMenuItem[]An array containing the context menu items for the current item.

Type

Object

Example

let contextMenuItems = function getContextMenuItems() {
let settings = {
guid: window.Asc.plugin.guid,
items: [
{
id : 'onConvert',
text : getMessage('Convert to Markdown or HTML')
}
]
};
return settings;
};

window.Asc.plugin.attachEvent('onContextMenuShow', function(options) {
if (!options) return;

if (options.type === 'Selection' || options.type === 'Target')
this.executeMethod('AddContextMenuItem', [contextMenuItems]);
});