Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 604c54e

Browse files
Merge pull request #1163 from ssbc/open-image-with-browser
Add context menu option to open image in browser
2 parents a7dd205 + 8843f2d commit 604c54e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/context-menu-and-spellcheck.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function setupContextMenuAndSpellCheck (config, { navigate, getMessageText }) {
1616

1717
const contextMenuBuilder = new ContextMenuBuilder(spellCheckHandler, null, true, (menu, menuInfo) => {
1818
const ddg = new MenuItem({
19-
label: 'Search with DuckDuckGo',
19+
label: 'Search With DuckDuckGo',
2020
click: () => {
2121
const url = `https://duckduckgo.com/?q=${encodeURIComponent(menuInfo.selectionText)}`
2222
shell.openExternal(url)
@@ -95,6 +95,16 @@ function setupContextMenuAndSpellCheck (config, { navigate, getMessageText }) {
9595
}
9696
})
9797
menu.append(copyEmbed)
98+
const openImageInBrowser = new MenuItem({
99+
label: 'Open Image With Browser',
100+
click: () => {
101+
const host = config.ws.host === '::' ? 'localhost' : config.ws.host
102+
const blobKey = encodeURIComponent(extractedRef)
103+
const url = `http://${host}:${config.ws.port}/blobs/get/${blobKey}`
104+
shell.openExternal(url)
105+
}
106+
})
107+
menu.append(openImageInBrowser)
98108
}
99109
}
100110

0 commit comments

Comments
 (0)