defaultMenuOptions
Description
An array of objects with default configuration parameters for context menu itemsDefault config
const defaultMenuOptions = [
{
id: "add-task",
text: "Add",
icon: "wxi-plus",
data: [
{ id: "add-task:child", text: "Child task" },
{ id: "add-task:before", text: "Task above" },
{ id: "add-task:after", text: "Task below" },
],
},
{ type: "separator" },
{
id: "convert-task",
text: "Convert to",
icon: "wxi-swap-horizontal",
dataFactory: (type) => {
return {
id: `convert-task:${type.id}`,
text: `${type.label}`,
check: exclude(type.id),
};
},
},
{
id: "edit-task",
text: "Edit",
icon: "wxi-edit",
},
{ id: "cut-task", text: "Cut", icon: "wxi-content-cut" },
{ id: "copy-task", text: "Copy", icon: "wxi-content-copy" },
{ id: "paste-task", text: "Paste", icon: "wxi-content-paste" },
{
id: "move-task",
text: "Move",
icon: "wxi-swap-vertical",
data: [
{ id: "move-task:up", text: "Up" },
{ id: "move-task:down", text: "Down" },
],
},
{ type: "separator" },
{ id: "indent-task:add", text: "Indent", icon: "wxi-indent" },
{ id: "indent-task:remove", text: "Outdent", icon: "wxi-unindent" },
{ type: "separator" },
{
id: "delete-task",
icon: "wxi-delete",
text: "Delete",
},
];
Parameters
The array includes objects with the next parameters for each menu item:
id
- the id of a menu itemtext
- the text for an itemicon
- the name of an icon displayed before the text. It converts to adding "i class={item.icon}", so any icons with the wxi- prefix can be used here, e.g ".wxi-plus" or any customer icons defined on the page.type
- the type of an item. It can be a "separator" or a custom type registered as a menu item (e.g. type:"button)data
- an array of sub items for a menu item. Used to create a tree-like menu structurecheck
- the function that checks if the menu should be shown for the specified task
Related articles: