aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-03-12 12:26:04 +0100
committerLibravatar GitHub <noreply@github.com>2019-03-12 12:26:04 +0100
commit7afc049585807b489c85c6f72021f2390d4b6489 (patch)
tree1f5167ef65c7bf8197e5efcc96a793751b394f68 /src
parentMerge branch 'develop' of https://github.com/meetfranz/franz into develop (diff)
parentfix(Windows): Fix copy & paste in service context menus (diff)
downloadferdium-app-7afc049585807b489c85c6f72021f2390d4b6489.tar.gz
ferdium-app-7afc049585807b489c85c6f72021f2390d4b6489.tar.zst
ferdium-app-7afc049585807b489c85c6f72021f2390d4b6489.zip
Merge pull request #1329 from meetfranz/fix/windows-copy-paste
Fix windows copy paste context menu on Windows
Diffstat (limited to 'src')
-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 }, {