electron-userland / electron-spellchecker

Implement spellchecking, correctly
MIT License
238 stars 83 forks source link

Question: When NOT to show the context menu #115

Open WilliamHolmes opened 6 years ago

WilliamHolmes commented 6 years ago

Question

Can we (or is it possible) to hide the context menu when no menu items are enabled?

Use Case

On some occasions I might only see the Copy menu item but its disabled. I'd rather not show the contextMenu at all in the case.

WilliamHolmes commented 6 years ago

I ended up extending the ContextMenuBuilder, including ...

  addCopy (menu, menuInfo) {
    const { editFlags: { canCopy } } = menuInfo;
    return canCopy ? super.addCopy(menu, menuInfo) : menu;
  }