electron-contextmenu-wrapper was forked from electron-spellchecker to provide a robust context handling library that's also callable from inside of a webview preloader.
const {ContextMenuListener, ContextMenuBuilder} = require('electron-contextmenu-wrapper');
let contextMenuBuilder = new ContextMenuBuilder();
let contextMenuListener = new ContextMenuListener((event, info) => {
contextMenuBuilder.showPopupMenu(info);
});
Additionally, there are
ContextMenuBuilder.prependContextMenuItem(new MenuItem(label: "Work!"))
and
ContextMenuBuilder.appendContextMenuItem(new MenuItem(label: "Smarter!"))
to customize the context menus.
- Run
npm start
to start the example application and play around.