Plugin API
English
English
  • Getting Started
    • Introduction
    • Your First Plugin
    • File Structure Overview
    • Plugin Types
      • Window
      • Background Service
      • Format Extension
      • Inspector
    • Debug Plugin
  • Distribution
    • Prepare Plugin
    • Package Plugin
    • Publish Plugin
    • Update Plugin
    • Developer Policies
    • Plugin Icon Template
  • Developer Guide
    • manifest.json Configuration
    • Retrieve Data
    • Modify Data
    • Access Local Files
    • Issue Network Requests
    • Using Node.js Native API
    • Using Third-Party Modules
    • Multilingual (i18n)
    • Frameless Window
  • API Reference
    • event
    • item
    • folder
    • tag
    • tagGroup
    • library
    • window
    • app
    • os
    • screen
    • notification
    • contextMenu
    • dialog
    • clipboard
    • drag
    • shell
    • log
  • Extra Moudle
    • FFmpeg
Powered by GitBook
On this page
  • Methods
  • open(menuItems)
  1. API Reference

contextMenu

Create native application context menus.

PreviousnotificationNextdialog

Last updated 1 year ago

Methods

open(menuItems)

Pops up the right-click menu.

  • menuItems :

    • 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") }
    }
])
MenuItem