aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/contextMenu.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-03-12 14:04:13 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-03-12 14:04:13 +0100
commit9af01849f895230ae60a635c9756a5e206aa0fa1 (patch)
treeb0b99f324c1a2e8c52e1fadf1152efac6d1028d2 /src/webview/contextMenu.js
parentBump version to 5.0.1-beta.1 (diff)
parentMerge branch 'sergiughf-hotfix/update-electron' into develop (diff)
downloadferdium-app-9af01849f895230ae60a635c9756a5e206aa0fa1.tar.gz
ferdium-app-9af01849f895230ae60a635c9756a5e206aa0fa1.tar.zst
ferdium-app-9af01849f895230ae60a635c9756a5e206aa0fa1.zip
Merge branch 'develop' into release/5.0.1-beta.1
Diffstat (limited to 'src/webview/contextMenu.js')
-rw-r--r--src/webview/contextMenu.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js
index afb1d8912..a4a6ab899 100644
--- a/src/webview/contextMenu.js
+++ b/src/webview/contextMenu.js
@@ -33,6 +33,8 @@ const buildMenuTpl = (props, suggestions, isSpellcheckEnabled, defaultSpellcheck
33 const canGoBack = webContents.canGoBack(); 33 const canGoBack = webContents.canGoBack();
34 const canGoForward = webContents.canGoForward(); 34 const canGoForward = webContents.canGoForward();
35 35
36 // @adlk: we can't use roles here due to a bug with electron where electron.remote.webContents.getFocusedWebContents() returns the first webview in DOM instead of the focused one
37 // Github issue creation is pending
36 let menuTpl = [ 38 let menuTpl = [
37 { 39 {
38 type: 'separator', 40 type: 'separator',
@@ -48,19 +50,32 @@ const buildMenuTpl = (props, suggestions, isSpellcheckEnabled, defaultSpellcheck
48 type: 'separator', 50 type: 'separator',
49 }, { 51 }, {
50 id: 'cut', 52 id: 'cut',
51 role: can('Cut') ? 'cut' : '', 53 label: 'Cut',
54 click() {
55 if (can('Cut')) {
56 webContents.cut();
57 }
58 },
52 enabled: can('Cut'), 59 enabled: can('Cut'),
53 visible: hasText && props.isEditable, 60 visible: hasText && props.isEditable,
54 }, { 61 }, {
55 id: 'copy', 62 id: 'copy',
56 label: 'Copy', 63 label: 'Copy',
57 role: can('Copy') ? 'copy' : '', 64 click() {
65 if (can('Copy')) {
66 webContents.copy();
67 }
68 },
58 enabled: can('Copy'), 69 enabled: can('Copy'),
59 visible: props.isEditable || hasText, 70 visible: props.isEditable || hasText,
60 }, { 71 }, {
61 id: 'paste', 72 id: 'paste',
62 label: 'Paste', 73 label: 'Paste',
63 role: editFlags.canPaste ? 'paste' : '', 74 click() {
75 if (editFlags.canPaste) {
76 webContents.paste();
77 }
78 },
64 enabled: editFlags.canPaste, 79 enabled: editFlags.canPaste,
65 visible: props.isEditable, 80 visible: props.isEditable,
66 }, { 81 }, {