Skip to content

Commit e66fcaa

Browse files
committed
fix(Windows): Fix copy & paste in service context menus
Closes #1316
1 parent c62a6a6 commit e66fcaa

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

Diff for: src/webview/contextMenu.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const buildMenuTpl = (props, suggestions, isSpellcheckEnabled, defaultSpellcheck
3333
const canGoBack = webContents.canGoBack();
3434
const canGoForward = webContents.canGoForward();
3535

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
3638
let menuTpl = [
3739
{
3840
type: 'separator',
@@ -48,19 +50,32 @@ const buildMenuTpl = (props, suggestions, isSpellcheckEnabled, defaultSpellcheck
4850
type: 'separator',
4951
}, {
5052
id: 'cut',
51-
role: can('Cut') ? 'cut' : '',
53+
label: 'Cut',
54+
click() {
55+
if (can('Cut')) {
56+
webContents.cut();
57+
}
58+
},
5259
enabled: can('Cut'),
5360
visible: hasText && props.isEditable,
5461
}, {
5562
id: 'copy',
5663
label: 'Copy',
57-
role: can('Copy') ? 'copy' : '',
64+
click() {
65+
if (can('Copy')) {
66+
webContents.copy();
67+
}
68+
},
5869
enabled: can('Copy'),
5970
visible: props.isEditable || hasText,
6071
}, {
6172
id: 'paste',
6273
label: 'Paste',
63-
role: editFlags.canPaste ? 'paste' : '',
74+
click() {
75+
if (editFlags.canPaste) {
76+
webContents.paste();
77+
}
78+
},
6479
enabled: editFlags.canPaste,
6580
visible: props.isEditable,
6681
}, {

0 commit comments

Comments
 (0)