fix: ELECTRON-1037 (Disable context menu for notification windows) (#708)

* ELECTRON-1037 - Disable context menu for notification windows

* ELECTRON-1037 - Fix typo
This commit is contained in:
Kiran Niranjan 2019-07-09 12:19:46 +05:30 committed by Vishwas Shashidhar
parent 5faa766f07
commit 278257c1d1

View File

@ -23,6 +23,7 @@ export default class NotificationComp extends React.Component<{}, IState> {
private readonly eventHandlers = {
onClose: (winKey) => (_event: mouseEventButton) => this.close(winKey),
onClick: (data) => (_event: mouseEventButton) => this.click(data),
onContextMenu: (event) => this.contextMenu(event),
};
constructor(props) {
@ -59,7 +60,7 @@ export default class NotificationComp extends React.Component<{}, IState> {
const bgColor = { backgroundColor: colorHex || '#ffffff' };
return (
<div className='container' role='alert' style={bgColor} onClick={this.eventHandlers.onClick(id)}>
<div className='container' onContextMenu={this.eventHandlers.onContextMenu} role='alert' style={bgColor} onClick={this.eventHandlers.onClick(id)}>
<div className='logo-container'>
<img className={`logo ${theme}`} alt='symphony logo'/>
</div>
@ -99,6 +100,15 @@ export default class NotificationComp extends React.Component<{}, IState> {
ipcRenderer.send('close-notification', id);
}
/**
* Disable context menu
*
* @param event
*/
private contextMenu(event) {
event.preventDefault();
}
/**
* Sets the About app state
*