Closed Nantris closed 5 years ago
const processMenu = (menu, menuInfo) => {
const target = webContents.getFocusedWebContents();
if (menuInfo.editFlags.canPaste && !menuInfo.linkText && !menuInfo.hasImageContents) {
menu.insert(3, new MenuItem({
label: 'Paste as plain text',
accelerator: 'CommandOrControl+Shift+V',
click: () => target.pasteAndMatchStyle()
}));
}
return menu
}
const contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler, null, true, processMenu);
I might be overlooking something simple here, but I don't understand how we get the data to paste in a custom menu item added using the 4th argument of
ContextMenuBuilder
, aprocessMenu
function.How can we order the menu so that
Paste as plaintext
appears belowPaste
, instead of below the separator.