Skip to content

Commit f24f81d

Browse files
committed
Adds Paste and Match Style to context menu [#1147]
1 parent 32c2ed1 commit f24f81d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/main/electron.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,24 @@ if (process.argv.indexOf('--disable-acceleration') !== -1)
3939

4040
// Configure context menu for text fields
4141
contextMenu({
42-
showCopyImage: false,
42+
showCopyImage: true,
43+
showSaveImage: true,
44+
showSaveImageAs: true,
4345
showLookUpSelection: false,
4446
showSearchWithGoogle: false,
45-
showCopyLink: false
47+
showCopyLink: false,
48+
showSelectAll: true,
49+
append: (defaultActions, params, browserWindow) => [
50+
{
51+
label: 'Paste and Match Style',
52+
// Only show this item when there's a text in the clipboard
53+
visible: clipboard.availableFormats().includes('text/plain'),
54+
click: () => {
55+
// Execute the paste command in the focused window
56+
browserWindow.webContents.pasteAndMatchStyle();
57+
}
58+
}
59+
]
4660
});
4761

4862
const __DEV__ = process.env.DRAWIO_ENV === 'dev'

0 commit comments

Comments
 (0)