Disable right click menu on preview window (Javascript)


#1

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


#2

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 $.)


#3

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


#4

Solution is easy:


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