# contextMenu（コンテキストメニュー）

## 方法 <a href="#z1a5y" id="z1a5y"></a>

## open(menuItems) <a href="#tkp0d" id="tkp0d"></a>

コンテキストメニューを表示します。

* `menuItems` : [MenuItem](https://www.electronjs.org/docs/latest/api/menu-item)
  * `id` string - メニューアイテムID
  * `label` string - メニューアイテム表示テキスト
  * `submenu` \[MenuItem] - サブメニュー

```javascript
eagle.contextMenu.open([
    {
        id: "edit",
        label: "Edit",
        submenu: [
            {
                id: "resize",
                label: "Resize",
                click: () => { alert("画像サイズ変更") }
            },
            {
                id: "crop",
                label: "Crop",
                click: () => { alert("画像切り取り") }
            },
            {
                id: "rotate",
                label: "Rotate",
                click: () => { alert("画像回転") }
            }
        ]
    },
    {
        id: "effects",
        label: "Effects",
        submenu: [
            {
                id: "grayscale",
                label: "Grayscale",
                click: () => { alert("グレースケール効果適用") }
            },
            {
                id: "sepia",
                label: "Sepia",
                click: () => { alert("セピア効果適用") }
            },
            {
                id: "invert",
                label: "Invert Colors",
                click: () => { alert("色反転効果適用") }
            }
        ]
    },
    {
        id: "export",
        label: "Export",
        click: () => { alert("画像エクスポート") }
    }
])
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.eagle.cool/plugin-api/ja-jp/api/context-menu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
