-
Notifications
You must be signed in to change notification settings - Fork 27
Right click menus #82
base: master
Are you sure you want to change the base?
Changes from 4 commits
3226b14
89287f7
74f4455
bb2e396
dcca6cc
916eabf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
var reload = function(item, focusedWindow) { | ||
if (focusedWindow) { | ||
focusedWindow.webContents.reload(); | ||
} | ||
}; | ||
|
||
var windows_linux_template = [ | ||
{ | ||
label: 'Undo', | ||
accelerator: 'CmdOrCtrl+Z', | ||
role: 'undo:' | ||
}, | ||
{ | ||
label: 'Redo', | ||
accelerator: 'Shift+CmdOrCtrl+Z', | ||
role: 'redo:' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Cut', | ||
accelerator: 'CmdOrCtrl+X', | ||
role: 'cut:' | ||
}, | ||
{ | ||
label: 'Copy', | ||
accelerator: 'CmdOrCtrl+C', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, they both say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference is that OSx uses the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried |
||
role: 'copy:' | ||
}, | ||
{ | ||
label: 'Paste', | ||
accelerator: 'CmdOrCtrl+V', | ||
role: 'paste:' | ||
}, | ||
{ | ||
label: 'Select All', | ||
accelerator: 'CmdOrCtrl+A', | ||
role: 'selectAll:' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Reload', | ||
accelerator: 'CmdOrCtrl+R', | ||
click: reload | ||
} | ||
]; | ||
|
||
var osx_template = [ | ||
{ | ||
label: 'Undo', | ||
accelerator: 'CmdOrCtrl+Z', | ||
selector: 'undo:' | ||
}, | ||
{ | ||
label: 'Redo', | ||
accelerator: 'Shift+CmdOrCtrl+Z', | ||
selector: 'redo:' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Cut', | ||
accelerator: 'CmdOrCtrl+X', | ||
selector: 'cut:' | ||
}, | ||
{ | ||
label: 'Copy', | ||
accelerator: 'CmdOrCtrl+C', | ||
selector: 'copy:' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it appears that cut/copy/paste all have default actions, so we don't need to code anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what you're trying to say here. From what I can tell the |
||
}, | ||
{ | ||
label: 'Paste', | ||
accelerator: 'CmdOrCtrl+V', | ||
selector: 'paste:' | ||
}, | ||
{ | ||
label: 'Select All', | ||
accelerator: 'CmdOrCtrl+A', | ||
selector: 'selectAll:' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Reload', | ||
accelerator: 'CmdOrCtrl+R', | ||
click: reload | ||
} | ||
]; | ||
|
||
if (process.platform === 'darwin') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you change this condition so it is false you'll see that the use of |
||
module.exports = osx_template | ||
} else { | ||
module.exports = windows_linux_template; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var remote = require('remote'); | ||
var Menu = remote.require('menu'); | ||
var template = require("./context-menu-template.js"); | ||
|
||
var menu = {}; | ||
|
||
menu.load = function(){ | ||
var contextMenu = Menu.buildFromTemplate(template); | ||
document.addEventListener('contextmenu', function (e) { | ||
e.preventDefault(); | ||
contextMenu.popup(remote.getCurrentWindow()); | ||
}, false); | ||
}; | ||
|
||
module.exports = menu; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require("./mattermost-observer.js"); | ||
require("./context-menu.js").load(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man, this seems like a lot of duplication just to show keyboard shortcuts. 😦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these actually identical?