I just build an AppJs app using Node.js and Angular.js but I can't manage to make the keyboard shortcuts to work.
I have a menubar working, but the "&" trick doesn't work on my Mac:
var menubar = appjs.createMenu([{
label:'&File',
submenu:[{
label:'&Quit',
action: function(){
window.close();
}
}]
},
{
label:'&Window',
submenu:[
{
label:'&Fullscreen',
action:function(item) {
window.frame.fullscreen();
console.log(item.label+" called.");
}
},
{
label:'&Minimize',
action:function(){
window.frame.minimize();
}
},
{
label:'Maximize',
action:function(){
window.frame.maximize();
}
},
{
label:''//separator
},
{
label:'Restore',
action:function(){
window.frame.restore();
}
}
]
}
]);
The other thing I'm trying to do is to allow copy/paste and select all using CMD+C, CMD+V and CMD+A… but I can't find a way to do that…
I have this code in my "ready" event (server side) , witch captures the keyboard events, but I don't know what to do with them :(
window.on('ready', function(){
window.require = require;
window.process = process;
window.module = module;
window.addEventListener('keydown', function(e){
// SELECT ALL (CMD+A)
if (e.keyCode == 65) {
console.log('SELECT ALL');
}
// COPY (CMD+C)
if (e.keyCode == 67) {
console.log('COPY');
}
// PASTE (CMD+V)
if (e.keyCode == 86) {
console.log('PASTE');
}
if (e.keyIdentifier === 'F12' || e.keyCode === 74 && e.metaKey && e.altKey) {
window.frame.openDevTools();
}
});
});
Please, if you have any light in this subject, you'll be very appreciated :)