@@ -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 ( `` )
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 ( `` )
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 ) ) {
0 commit comments