abricotine
abricotine copied to clipboard
Add a way to open custom context menu
Would be useful for spelling suggestion/add to dictionary, images, etc.
My idea:
// abr-document.js
// Listener for context menu
document.addEventListener("contextmenu", function () {
var context = // check stuffs about sursor position and return a string such as "misspelled"
ipcClient.trigger("openContextMenu", context);
}, false);
Then in menu-context.json:
{
"labelKey": "menu-add-to-dictionary",
"command": "addToDict",
"context": "misspelled"
},
Finally, hide/show menu entries depending on context when context menu is displayed.