Open ungoldman opened 8 years ago
I believe it's supposed to be referring to something similar to this: https://github.com/connors/photon/blob/master/docs/demo-app.html#L51-L53
... but that doesn't appear to have been included in the template-app example.
I think it's an incomplete adaptation of https://github.com/atom/electron/blob/master/docs/api/menu.md.
window.addEventListener('contextmenu', function (e) {
e.preventDefault();
menu.popup(remote.getCurrentWindow());
}, false);
One way around the error produced by the current implementation in this repo would be to modify it like this:
document.addEventListener('DOMContentLoaded', function () {
var nodeList = document.querySelectorAll('.js-context-menu')
Array.prototype.forEach.call(nodeList, function (item) {
item.addEventListener('contextmenu', function (event) {
menu.popup(remote.getCurrentWindow());
})
})
})
That way there will be no error if the node list is empty. I'm using this workaround in https://github.com/ngoldman/proton without any issues so far.
I'm noticing
dist/template-app/menu.js
is trying to attach a click event to.js-context-menu
but there's no element indist/template-app/index.html
that matches that. I looked around in each of the releases and wasn't able to find it there either.Really cool project btw. Looks fantastic.