aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-06 12:16:11 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-08-06 13:19:38 +0530
commit7232876d621ad7a40506bfe129972b602b0f40d6 (patch)
tree48354a339c6ca889ba4d13b1d21b7279f61c4caf
parent5.6.1-nightly.16 [skip ci] (diff)
downloadferdium-app-7232876d621ad7a40506bfe129972b602b0f40d6.tar.gz
ferdium-app-7232876d621ad7a40506bfe129972b602b0f40d6.tar.zst
ferdium-app-7232876d621ad7a40506bfe129972b602b0f40d6.zip
refactor: prep for i18n of context menu items
-rw-r--r--src/components/settings/services/EditServiceForm.js2
-rw-r--r--src/webview/contextMenuBuilder.js21
2 files changed, 12 insertions, 11 deletions
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js
index 5e424fdd5..c41cdd56a 100644
--- a/src/components/settings/services/EditServiceForm.js
+++ b/src/components/settings/services/EditServiceForm.js
@@ -1,4 +1,4 @@
1import React, { Component, Fragment } from 'react'; 1import React, { Component } from 'react';
2import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
3import { observer } from 'mobx-react'; 3import { observer } from 'mobx-react';
4import { Link } from 'react-router'; 4import { Link } from 'react-router';
diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js
index 2598dbf03..ebf98ee76 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 { isMac } from '../environment'; 13import { cmdKey, 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
@@ -28,6 +28,7 @@ const contextMenuStringTable = {
28 cut: () => 'Cut', 28 cut: () => 'Cut',
29 copy: () => 'Copy', 29 copy: () => 'Copy',
30 paste: () => 'Paste', 30 paste: () => 'Paste',
31 pasteAndMatchStyle: () => 'Paste and match style',
31 searchWith: ({ searchEngine }) => `Search with ${searchEngine}`, 32 searchWith: ({ searchEngine }) => `Search with ${searchEngine}`,
32 openLinkUrl: () => 'Open Link', 33 openLinkUrl: () => 'Open Link',
33 openLinkInFerdiUrl: () => 'Open Link in Ferdi', 34 openLinkInFerdiUrl: () => 'Open Link in Ferdi',
@@ -261,7 +262,7 @@ module.exports = class ContextMenuBuilder {
261 if (menuInfo.misspelledWord) { 262 if (menuInfo.misspelledWord) {
262 menu.append( 263 menu.append(
263 new MenuItem({ 264 new MenuItem({
264 label: 'Add to dictionary', 265 label: this.stringTable.addToDictionary(),
265 click: () => webContents.session.addWordToSpellCheckerDictionary(menuInfo.misspelledWord), 266 click: () => webContents.session.addWordToSpellCheckerDictionary(menuInfo.misspelledWord),
266 }), 267 }),
267 ); 268 );
@@ -375,7 +376,7 @@ module.exports = class ContextMenuBuilder {
375 const webContents = this.getWebContents(); 376 const webContents = this.getWebContents();
376 menu.append(new MenuItem({ 377 menu.append(new MenuItem({
377 label: this.stringTable.cut(), 378 label: this.stringTable.cut(),
378 accelerator: 'CommandOrControl+X', 379 accelerator: `${cmdKey}+X`,
379 enabled: menuInfo.editFlags.canCut, 380 enabled: menuInfo.editFlags.canCut,
380 click: () => webContents.cut(), 381 click: () => webContents.cut(),
381 })); 382 }));
@@ -390,7 +391,7 @@ module.exports = class ContextMenuBuilder {
390 const webContents = this.getWebContents(); 391 const webContents = this.getWebContents();
391 menu.append(new MenuItem({ 392 menu.append(new MenuItem({
392 label: this.stringTable.copy(), 393 label: this.stringTable.copy(),
393 accelerator: 'CommandOrControl+C', 394 accelerator: `${cmdKey}+C`,
394 enabled: menuInfo.editFlags.canCopy, 395 enabled: menuInfo.editFlags.canCopy,
395 click: () => webContents.copy(), 396 click: () => webContents.copy(),
396 })); 397 }));
@@ -405,7 +406,7 @@ module.exports = class ContextMenuBuilder {
405 const webContents = this.getWebContents(); 406 const webContents = this.getWebContents();
406 menu.append(new MenuItem({ 407 menu.append(new MenuItem({
407 label: this.stringTable.paste(), 408 label: this.stringTable.paste(),
408 accelerator: 'CommandOrControl+V', 409 accelerator: `${cmdKey}+V`,
409 enabled: menuInfo.editFlags.canPaste, 410 enabled: menuInfo.editFlags.canPaste,
410 click: () => webContents.paste(), 411 click: () => webContents.paste(),
411 })); 412 }));
@@ -422,8 +423,8 @@ module.exports = class ContextMenuBuilder {
422 const webContents = this.getWebContents(); 423 const webContents = this.getWebContents();
423 menu.append( 424 menu.append(
424 new MenuItem({ 425 new MenuItem({
425 label: 'Paste as plain text', 426 label: this.stringTable.pasteAndMatchStyle(),
426 accelerator: 'CommandOrControl+Shift+V', 427 accelerator: `${cmdKey}+Shift+V`,
427 click: () => webContents.pasteAndMatchStyle(), 428 click: () => webContents.pasteAndMatchStyle(),
428 }), 429 }),
429 ); 430 );
@@ -489,7 +490,7 @@ module.exports = class ContextMenuBuilder {
489 const webContents = this.getWebContents(); 490 const webContents = this.getWebContents();
490 menu.append(new MenuItem({ 491 menu.append(new MenuItem({
491 label: this.stringTable.goBack(), 492 label: this.stringTable.goBack(),
492 accelerator: 'CommandOrControl+left', 493 accelerator: `${cmdKey}+left`,
493 enabled: webContents.canGoBack(), 494 enabled: webContents.canGoBack(),
494 click: () => webContents.goBack(), 495 click: () => webContents.goBack(),
495 })); 496 }));
@@ -504,7 +505,7 @@ module.exports = class ContextMenuBuilder {
504 const webContents = this.getWebContents(); 505 const webContents = this.getWebContents();
505 menu.append(new MenuItem({ 506 menu.append(new MenuItem({
506 label: this.stringTable.goForward(), 507 label: this.stringTable.goForward(),
507 accelerator: 'CommandOrControl+right', 508 accelerator: `${cmdKey}+right`,
508 enabled: webContents.canGoForward(), 509 enabled: webContents.canGoForward(),
509 click: () => webContents.goForward(), 510 click: () => webContents.goForward(),
510 })); 511 }));
@@ -535,7 +536,7 @@ module.exports = class ContextMenuBuilder {
535 const baseURL = new URL(menuInfo.pageURL); 536 const baseURL = new URL(menuInfo.pageURL);
536 menu.append(new MenuItem({ 537 menu.append(new MenuItem({
537 label: this.stringTable.goToHomePage(), 538 label: this.stringTable.goToHomePage(),
538 accelerator: 'CommandOrControl+Home', 539 accelerator: `${cmdKey}+Home`,
539 enabled: true, 540 enabled: true,
540 click: () => { 541 click: () => {
541 // webContents.loadURL(baseURL.origin); 542 // webContents.loadURL(baseURL.origin);