aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/contextMenuBuilder.js
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-13 00:24:40 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-08-13 00:24:40 +0530
commit52dba987668f4962895e8298d8d32fe877240a76 (patch)
tree9ccbd1938ab9ee066918252347d7b87bad549529 /src/webview/contextMenuBuilder.js
parentFix error while importing without workspaces (#1776) (diff)
downloadferdium-app-52dba987668f4962895e8298d8d32fe877240a76.tar.gz
ferdium-app-52dba987668f4962895e8298d8d32fe877240a76.tar.zst
ferdium-app-52dba987668f4962895e8298d8d32fe877240a76.zip
refactor: Use the 'shortcutKey' function without exposing the 'ctrlKey' or the 'cmdKey'
Diffstat (limited to 'src/webview/contextMenuBuilder.js')
-rw-r--r--src/webview/contextMenuBuilder.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js
index ebf98ee76..602ce06f5 100644
--- a/src/webview/contextMenuBuilder.js
+++ b/src/webview/contextMenuBuilder.js
@@ -10,7 +10,7 @@ import {
10 clipboard, ipcRenderer, nativeImage, shell, 10 clipboard, ipcRenderer, nativeImage, shell,
11} from 'electron'; 11} from 'electron';
12import { Menu, MenuItem } from '@electron/remote'; 12import { Menu, MenuItem } from '@electron/remote';
13import { cmdKey, isMac } from '../environment'; 13import { shortcutKey, isMac } from '../environment';
14 14
15import { SEARCH_ENGINE_NAMES, SEARCH_ENGINE_URLS } from '../config'; 15import { SEARCH_ENGINE_NAMES, SEARCH_ENGINE_URLS } from '../config';
16 16
@@ -376,7 +376,7 @@ module.exports = class ContextMenuBuilder {
376 const webContents = this.getWebContents(); 376 const webContents = this.getWebContents();
377 menu.append(new MenuItem({ 377 menu.append(new MenuItem({
378 label: this.stringTable.cut(), 378 label: this.stringTable.cut(),
379 accelerator: `${cmdKey}+X`, 379 accelerator: `${shortcutKey()}+X`,
380 enabled: menuInfo.editFlags.canCut, 380 enabled: menuInfo.editFlags.canCut,
381 click: () => webContents.cut(), 381 click: () => webContents.cut(),
382 })); 382 }));
@@ -391,7 +391,7 @@ module.exports = class ContextMenuBuilder {
391 const webContents = this.getWebContents(); 391 const webContents = this.getWebContents();
392 menu.append(new MenuItem({ 392 menu.append(new MenuItem({
393 label: this.stringTable.copy(), 393 label: this.stringTable.copy(),
394 accelerator: `${cmdKey}+C`, 394 accelerator: `${shortcutKey()}+C`,
395 enabled: menuInfo.editFlags.canCopy, 395 enabled: menuInfo.editFlags.canCopy,
396 click: () => webContents.copy(), 396 click: () => webContents.copy(),
397 })); 397 }));
@@ -406,7 +406,7 @@ module.exports = class ContextMenuBuilder {
406 const webContents = this.getWebContents(); 406 const webContents = this.getWebContents();
407 menu.append(new MenuItem({ 407 menu.append(new MenuItem({
408 label: this.stringTable.paste(), 408 label: this.stringTable.paste(),
409 accelerator: `${cmdKey}+V`, 409 accelerator: `${shortcutKey()}+V`,
410 enabled: menuInfo.editFlags.canPaste, 410 enabled: menuInfo.editFlags.canPaste,
411 click: () => webContents.paste(), 411 click: () => webContents.paste(),
412 })); 412 }));
@@ -424,7 +424,7 @@ module.exports = class ContextMenuBuilder {
424 menu.append( 424 menu.append(
425 new MenuItem({ 425 new MenuItem({
426 label: this.stringTable.pasteAndMatchStyle(), 426 label: this.stringTable.pasteAndMatchStyle(),
427 accelerator: `${cmdKey}+Shift+V`, 427 accelerator: `${shortcutKey()}+Shift+V`,
428 click: () => webContents.pasteAndMatchStyle(), 428 click: () => webContents.pasteAndMatchStyle(),
429 }), 429 }),
430 ); 430 );
@@ -490,7 +490,7 @@ module.exports = class ContextMenuBuilder {
490 const webContents = this.getWebContents(); 490 const webContents = this.getWebContents();
491 menu.append(new MenuItem({ 491 menu.append(new MenuItem({
492 label: this.stringTable.goBack(), 492 label: this.stringTable.goBack(),
493 accelerator: `${cmdKey}+left`, 493 accelerator: `${shortcutKey()}+left`,
494 enabled: webContents.canGoBack(), 494 enabled: webContents.canGoBack(),
495 click: () => webContents.goBack(), 495 click: () => webContents.goBack(),
496 })); 496 }));
@@ -505,7 +505,7 @@ module.exports = class ContextMenuBuilder {
505 const webContents = this.getWebContents(); 505 const webContents = this.getWebContents();
506 menu.append(new MenuItem({ 506 menu.append(new MenuItem({
507 label: this.stringTable.goForward(), 507 label: this.stringTable.goForward(),
508 accelerator: `${cmdKey}+right`, 508 accelerator: `${shortcutKey()}+right`,
509 enabled: webContents.canGoForward(), 509 enabled: webContents.canGoForward(),
510 click: () => webContents.goForward(), 510 click: () => webContents.goForward(),
511 })); 511 }));
@@ -536,7 +536,7 @@ module.exports = class ContextMenuBuilder {
536 const baseURL = new URL(menuInfo.pageURL); 536 const baseURL = new URL(menuInfo.pageURL);
537 menu.append(new MenuItem({ 537 menu.append(new MenuItem({
538 label: this.stringTable.goToHomePage(), 538 label: this.stringTable.goToHomePage(),
539 accelerator: `${cmdKey}+Home`, 539 accelerator: `${shortcutKey()}+Home`,
540 enabled: true, 540 enabled: true,
541 click: () => { 541 click: () => {
542 // webContents.loadURL(baseURL.origin); 542 // webContents.loadURL(baseURL.origin);