Skip to content

Commit

Permalink
prevent context menu auto-closing on macOS
Browse files Browse the repository at this point in the history
* prevent "context-menu" event handlers duplication
  • Loading branch information
vladimiry committed May 16, 2018
1 parent d63a43d commit 147bb39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ is an unofficial [ProtonMail](https://protonmail.com/) desktop client. It's basi
- Cross platform, Linux/OSX/Windows packages [provided](https://github.com/vladimiry/protonmail-desktop-app/releases).
- Multi accounts support.
- Automatic login into the app with remembered master password using [keytar](https://github.com/atom/node-keytar) module ("Keep me signed in" feature).
- Automatic login into ProtonMail accounts using either saved in the settings password or KeePass password manager.. Two Factor Authentication (2FA) [is supported](https://github.com/vladimiry/protonmail-desktop-app/issues/10).
- Automatic login into ProtonMail accounts using either saved in the settings password or KeePass password manager. Two Factor Authentication (2FA) [is supported](https://github.com/vladimiry/protonmail-desktop-app/issues/10).
- Encrypted settings storage with switchable predefined key derivation and encryption presets. Argon2 is used as the default key derivation function.
- Native notifications for individual accounts clicking on which focuses the app window and selects respective account in the accounts list.
- System tray icon with a total number of unread messages shown on top of it.
Expand Down
14 changes: 7 additions & 7 deletions src/electron/main/web-content-context-menu.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as os from "os";
import {app, clipboard, ContextMenuParams, Event, Menu, PopupOptions} from "electron";
import {app, clipboard, ContextMenuParams, Event, Menu, PopupOptions, WebContents} from "electron";

import {Context} from "./model";

Expand Down Expand Up @@ -53,11 +53,11 @@ export function initWebContentContextMenu(ctx: Context) {
selectionMenu.popup(popupOptions);
}
};

app.on("browser-window-created", (event, {webContents}) => {
webContents.on("context-menu", contextMenuEvenHandler);
});
app.on("web-contents-created", (webContentsCreatedEvent, webContents) => {
const windowCreateHandler = (webContents: WebContents) => {
webContents.removeListener("context-menu", contextMenuEvenHandler);
webContents.on("context-menu", contextMenuEvenHandler);
});
};

app.on("browser-window-created", (event, {webContents}) => windowCreateHandler(webContents));
app.on("web-contents-created", (webContentsCreatedEvent, webContents) => windowCreateHandler(webContents));
}

0 comments on commit 147bb39

Please sign in to comment.