summaryrefslogtreecommitdiffstats
path: root/src/webview/contextMenuBuilder.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview/contextMenuBuilder.js')
-rw-r--r--src/webview/contextMenuBuilder.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js
index 602ce06f5..126fa4086 100644
--- a/src/webview/contextMenuBuilder.js
+++ b/src/webview/contextMenuBuilder.js
@@ -6,13 +6,12 @@
6 * 6 *
7 * Source: https://github.com/electron-userland/electron-spellchecker/blob/master/src/context-menu-builder.js 7 * Source: https://github.com/electron-userland/electron-spellchecker/blob/master/src/context-menu-builder.js
8 */ 8 */
9import { 9import { clipboard, ipcRenderer, nativeImage } from 'electron';
10 clipboard, ipcRenderer, nativeImage, shell,
11} from 'electron';
12import { Menu, MenuItem } from '@electron/remote'; 10import { Menu, MenuItem } from '@electron/remote';
13import { shortcutKey, isMac } from '../environment'; 11import { shortcutKey, isMac } from '../environment';
14 12
15import { SEARCH_ENGINE_NAMES, SEARCH_ENGINE_URLS } from '../config'; 13import { SEARCH_ENGINE_NAMES, SEARCH_ENGINE_URLS } from '../config';
14import { openExternalUrl } from '../helpers/url-helpers';
16 15
17const { URL } = require('url'); 16const { URL } = require('url');
18 17
@@ -170,7 +169,7 @@ module.exports = class ContextMenuBuilder {
170 const openLink = new MenuItem({ 169 const openLink = new MenuItem({
171 label: this.stringTable.openLinkUrl(), 170 label: this.stringTable.openLinkUrl(),
172 click: () => { 171 click: () => {
173 shell.openExternal(menuInfo.linkURL); 172 openExternalUrl(menuInfo.linkURL, true);
174 }, 173 },
175 }); 174 });
176 175
@@ -299,7 +298,7 @@ module.exports = class ContextMenuBuilder {
299 label: this.stringTable.searchWith({ searchEngine: SEARCH_ENGINE_NAMES[menuInfo.searchEngine] }), 298 label: this.stringTable.searchWith({ searchEngine: SEARCH_ENGINE_NAMES[menuInfo.searchEngine] }),
300 click: () => { 299 click: () => {
301 const url = SEARCH_ENGINE_URLS[menuInfo.searchEngine]({ searchTerm: encodeURIComponent(menuInfo.selectionText) }); 300 const url = SEARCH_ENGINE_URLS[menuInfo.searchEngine]({ searchTerm: encodeURIComponent(menuInfo.selectionText) });
302 shell.openExternal(url); 301 openExternalUrl(url, true);
303 }, 302 },
304 }); 303 });
305 304
@@ -555,7 +554,7 @@ module.exports = class ContextMenuBuilder {
555 label: this.stringTable.openInBrowser(), 554 label: this.stringTable.openInBrowser(),
556 enabled: true, 555 enabled: true,
557 click: () => { 556 click: () => {
558 shell.openExternal(menuInfo.pageURL); 557 openExternalUrl(menuInfo.pageURL, true);
559 }, 558 },
560 })); 559 }));
561 560