abricotine icon indicating copy to clipboard operation
abricotine copied to clipboard

Add a way to open custom context menu

Open brrd opened this issue 7 years ago • 0 comments

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.

brrd avatar May 10 '18 11:05 brrd