aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/contextMenuBuilder.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview/contextMenuBuilder.js')
-rw-r--r--src/webview/contextMenuBuilder.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js
index b5095915c..49c4550a9 100644
--- a/src/webview/contextMenuBuilder.js
+++ b/src/webview/contextMenuBuilder.js
@@ -8,6 +8,8 @@
8 */ 8 */
9import { isMac } from '../environment'; 9import { isMac } from '../environment';
10 10
11import { SEARCH_ENGINE_NAMES, SEARCH_ENGINE_URLS } from '../config';
12
11const { 13const {
12 clipboard, nativeImage, remote, shell, 14 clipboard, nativeImage, remote, shell,
13} = require('electron'); 15} = require('electron');
@@ -27,7 +29,7 @@ const contextMenuStringTable = {
27 cut: () => 'Cut', 29 cut: () => 'Cut',
28 copy: () => 'Copy', 30 copy: () => 'Copy',
29 paste: () => 'Paste', 31 paste: () => 'Paste',
30 searchGoogle: () => 'Search with Google', 32 searchWith: ({ searchEngine }) => `Search with ${searchEngine}`,
31 openLinkUrl: () => 'Open Link', 33 openLinkUrl: () => 'Open Link',
32 openLinkInFerdiUrl: () => 'Open Link in Ferdi', 34 openLinkInFerdiUrl: () => 'Open Link in Ferdi',
33 openInBrowser: () => 'Open in Browser', 35 openInBrowser: () => 'Open in Browser',
@@ -286,10 +288,9 @@ module.exports = class ContextMenuBuilder {
286 } 288 }
287 289
288 const search = new MenuItem({ 290 const search = new MenuItem({
289 label: this.stringTable.searchGoogle(), 291 label: this.stringTable.searchWith({ searchEngine: SEARCH_ENGINE_NAMES[menuInfo.searchEngine] }),
290 click: () => { 292 click: () => {
291 const url = `https://www.google.com/search?q=${encodeURIComponent(menuInfo.selectionText)}`; 293 const url = SEARCH_ENGINE_URLS[menuInfo.searchEngine]({ searchTerm: encodeURIComponent(menuInfo.selectionText) });
292
293 shell.openExternal(url); 294 shell.openExternal(url);
294 }, 295 },
295 }); 296 });