Merge pull request #272 from jnugh/context-menu

Use electron-context-menu insted of bare contextmenu
This commit is contained in:
Yuya Ochiai
2016-09-13 00:43:20 +09:00
committed by GitHub
5 changed files with 9 additions and 37 deletions

View File

@@ -9,6 +9,7 @@ Release date: TBD
### Improvements
#### All platforms
- Use `electron-context-menu` to have a working and consistent context menu
- Show current channel/team in window title
- Changed display of unread messages on the team tabbar, they are now shown as bold text
- Reload only the selected tab and keep its URL on "Reload" and "Clear Cache and Reload".

View File

@@ -417,6 +417,10 @@ var MattermostView = React.createClass({
}
});
}
require('electron-context-menu')({
window: webview
});
});
webview.addEventListener('ipc-message', function(event) {
@@ -598,12 +602,6 @@ if (config.teams.length === 0) {
window.location = 'settings.html';
}
var contextMenu = require('./menus/context');
var menu = contextMenu.createDefault();
window.addEventListener('contextmenu', function(e) {
menu.popup(remote.getCurrentWindow());
}, false);
var showUnreadBadgeWindows = function(unreadCount, mentionCount) {
const badge = require('./js/badge');
const sendBadge = function(dataURL, description) {

View File

@@ -1,26 +0,0 @@
'use strict';
const remote = require('electron').remote;
const Menu = remote.Menu;
const MenuItem = remote.MenuItem;
var createDefault = function() {
var menu = new Menu();
menu.append(new MenuItem({
role: 'cut'
}));
menu.append(new MenuItem({
role: 'copy'
}));
menu.append(new MenuItem({
role: 'paste'
}));
menu.append(new MenuItem({
role: 'selectall'
}));
return menu;
};
module.exports = {
createDefault: createDefault
};

View File

@@ -512,11 +512,9 @@ var TeamListItemNew = React.createClass({
var configFile = remote.getGlobal('config-file');
var contextMenu = require('./menus/context');
var menu = contextMenu.createDefault();
window.addEventListener('contextmenu', function(e) {
menu.popup(remote.getCurrentWindow());
}, false);
require('electron-context-menu')({
window: remote.getCurrentWindow()
});
ReactDOM.render(
<SettingsPage configFile={ configFile } />,

View File

@@ -16,6 +16,7 @@
"dependencies": {
"auto-launch": "^2.1.0",
"bootstrap": "^3.3.7",
"electron-context-menu": "^0.5.0",
"electron-squirrel-startup": "^1.0.0",
"os-locale": "^1.4.0",
"react": "^15.3.0",