diff options
author | 2019-03-08 16:45:14 +0100 | |
---|---|---|
committer | 2019-03-08 16:45:14 +0100 | |
commit | e66fcaa1a8d17d2edfc8e262b7e012a55c1b484b (patch) | |
tree | abdb73974c784ce089892e69645f65d16e2f6b6f /src/webview | |
parent | correctly update services submenu on language change (diff) | |
download | ferdium-app-e66fcaa1a8d17d2edfc8e262b7e012a55c1b484b.tar.gz ferdium-app-e66fcaa1a8d17d2edfc8e262b7e012a55c1b484b.tar.zst ferdium-app-e66fcaa1a8d17d2edfc8e262b7e012a55c1b484b.zip |
fix(Windows): Fix copy & paste in service context menus
Closes #1316
Diffstat (limited to 'src/webview')
-rw-r--r-- | src/webview/contextMenu.js | 21 |
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 | }, { |