contextMenu

Create native application context menus.

Methods

open(menuItems)

Pops up the right-click menu.

  • menuItems : MenuItem

    • id string - Menu item ID

    • label string - Text displayed for the menu item

    • submenu [MenuItem] - Submenu

eagle.contextMenu.open([
    {
        id: "edit",
        label: "Edit",
        submenu: [
            {
                id: "resize",
                label: "Resize",
                click: () => { alert("Image resized") }
            },
            {
                id: "crop",
                label: "Crop",
                click: () => { alert("Image cropped") }
            },
            {
                id: "rotate",
                label: "Rotate",
                click: () => { alert("Image rotated") }
            }
        ]
    },
    {
        id: "effects",
        label: "Effects",
        submenu: [
            {
                id: "grayscale",
                label: "Grayscale",
                click: () => { alert("Grayscale effect applied") }
            },
            {
                id: "sepia",
                label: "Sepia",
                click: () => { alert("Sepia effect applied") }
            },
            {
                id: "invert",
                label: "Invert Colors",
                click: () => { alert("Color inversion applied") }
            }
        ]
    },
    {
        id: "export",
        label: "Export",
        click: () => { alert("Image exported") }
    }
])

Last updated