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

Commit 7bbe753

Browse files
Change to update SSB-Markdown
1 parent bc49bc6 commit 7bbe753

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

lib/context-menu-and-spellcheck.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,26 @@ function setupContextMenuAndSpellCheck (config, { navigate, getMessageText, lang
3535
menu.append(oldItem)
3636
}
3737
})
38+
39+
if (menuInfo.mediaType !== 'none') {
40+
console.log(menuInfo)
41+
const copyEmbed = new MenuItem({
42+
label: 'Copy Embed Markdown',
43+
click: () => {
44+
// Omit the mailto: portion of the link; we just want the address
45+
const extractedRef = ref.extract(menuInfo.srcURL)
46+
clipboard.writeText(`![${menuInfo.titleText}](${extractedRef})`)
47+
}
48+
})
49+
menu.append(copyEmbed)
50+
const openImageInBrowser = new MenuItem({
51+
label: 'Open Image With Browser',
52+
click: () => {
53+
shell.openExternal(menuInfo.srcURL)
54+
}
55+
})
56+
menu.append(openImageInBrowser)
57+
}
3858
})
3959

4060
contextMenuBuilder.buildMenuForLink = function (menuInfo) {
@@ -85,27 +105,6 @@ function setupContextMenuAndSpellCheck (config, { navigate, getMessageText, lang
85105
}
86106
})
87107
menu.append(copyRef)
88-
89-
if (ref.isBlob(extractedRef) && menuInfo.hasImageContents) {
90-
const copyEmbed = new MenuItem({
91-
label: 'Copy Embed Markdown',
92-
click: () => {
93-
// Omit the mailto: portion of the link; we just want the address
94-
clipboard.writeText(`![${menuInfo.titleText}](${extractedRef})`)
95-
}
96-
})
97-
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)
108-
}
109108
}
110109

111110
if (this.isSrcUrlValid(menuInfo)) {

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"ssb-keys": "^7.2.0",
8080
"ssb-lan": "^0.1.3",
8181
"ssb-logging": "^1.0.0",
82-
"ssb-markdown": "^5.1.3",
82+
"ssb-markdown": "^6.0.2",
8383
"ssb-master": "^1.0.3",
8484
"ssb-mentions": "^0.5.0",
8585
"ssb-msgs": "^5.2.0",

0 commit comments

Comments
 (0)