Menu Manager
View in MarkdownSourceProvides a registry for menu items that you'd like to appear in the application menu.
An instance of this class is always available as the inkdrop.menu global.
Menu JSON Format
Here is an example from the inkdrop-paste-as-markdown:
[
  {
    label: 'Plugins',
    submenu: [
      {
        label: 'Paste as Markdown',
        command: 'paste-as-markdown'
      }
    ]
  }
]
Use in your package's menu .json file requires that you place your menu structure under a menu key.
{
  "menu": [
    {
      "label": "File",
      "submenu": [
        {
          "label": "Import",
          "submenu": [
            { "label": "from HTML files..", "command": "import-html:import-from-file" }
          ]
        }
      ]
    }
  ]
}
See ::add for more info about adding menu's directly.
add(items)
Add Menu Items
Add items to the application menu.
Parameters
- Name
- items
- Type
- array
- Required
- Description
- An array of menu item objects containing the following keys: - Name
- label
- Type
- string
- Description
- The String menu label. 
 
- Name
- submenu
- Type
- object
- Description
- An optional Array of sub menu items. 
 
- Name
- command
- Type
- string
- Description
- An optional String command to trigger when the item is clicked. 
 
 item object
 
Returns
Returns a Disposable on which .dispose() can be called to remove the added menu items.
Adding Menu Items Example
inkdrop.menu.add([
  {
    label: 'Hello',
    submenu: [{ label: 'World!', command: 'hello:world' }]
  }
])
update()
Refresh the Menu
Refresh the currently visible menu to reflect any changes.