This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,6 +99,9 @@ class MarkdownPreviewView extends ScrollView
9999 @ css (' zoom' , zoomLevel - .1 )
100100 ' markdown-preview:reset-zoom ' : =>
101101 @ css (' zoom' , 1 )
102+ ' click ' : (event )=>
103+ event .stopPropagation ()
104+ @ followLink (event)
102105
103106 changeHandler = =>
104107 @ renderMarkdown ()
@@ -253,6 +256,15 @@ class MarkdownPreviewView extends ScrollView
253256
254257 true
255258
259+ followLink : (event )->
260+ return false if @loading
261+ if event .target .tagName == ' A' && event .target .protocol == ' file:'
262+ activeFile = @ getPath ()
263+ activeFileDir = path .dirname (activeFile)
264+ clickedFile = event .target .getAttribute (' href' )
265+ clickedPath = path .join (activeFileDir, clickedFile)
266+ atom .workspace .open clickedPath, { split : ' left' }
267+
256268 saveAs : ->
257269 return if @loading
258270
You can’t perform that action at this time.
0 commit comments