Disable right click menu on preview window (Javascript)


I’m working on a preview of jscad files and right click is displaying menu, but I want to bypass it.

I saw solution here, but it is not works for me.

I’m using javascript for my package and

require ('atom').$

return undefined, so I cannot subscribe to contextmenu event.

Direct link to the view class source


If you want jQuery, you’ll have to add a dependency and import it yourself. Atom Core doesn’t provide it anymore. (I’m assuming that’s what you want since you’re trying to import $.)


I don’t want to use jquery, I want to subscribe and/or cancel contextmenu or right click somehow. How?


Solution is easy:

element.addEventListener ('contextmenu', function (evt) {
    evt.stopPropagation ();