electron-userland / electron-spellchecker

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

How to add inspector to context menu #118

Closed rkpatel33 closed 6 years ago

rkpatel33 commented 6 years ago

I have read the docs as well as looked at the code, but I am still confused as to how to use the ContextMenuBuilder.addInspectElement method. I am trying this based on the quickstart code:

let contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler);
contextMenuBuilder.debugMode = true;
let contextMenuListener = new ContextMenuListener((info) => {
  // trying to add the inspect option here, not sure what menu to pass here
  contextMenuBuilder.addInspectElement(contextMenuBuilder.menu);
  contextMenuBuilder.showPopupMenu(info);
});

Just not sure what menu I should be passing and when.

WilliamHolmes commented 6 years ago

@rkpatel33 try ...

let contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler, null, true);
let contextMenuListener = new ContextMenuListener((info) => { 
  contextMenuBuilder.showPopupMenu(info);
});

The source code has some good useful comments.

rkpatel33 commented 6 years ago

Thanks will do.