mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 22:22:18 +08:00
parent
53c6a39faf
commit
572ed9ee86
@ -419,14 +419,17 @@ ipcMain.on('mt::format-link-click', (e, { data, dirname }) => {
|
||||
}
|
||||
|
||||
let pathname = null
|
||||
if (path.isAbsolute(href) && isMarkdownFile(href)) {
|
||||
if (path.isAbsolute(href)) {
|
||||
pathname = href
|
||||
} else if (!path.isAbsolute(href) && isMarkdownFile(path.join(dirname, href))) {
|
||||
} else if (dirname && !path.isAbsolute(href)) {
|
||||
pathname = path.join(dirname, href)
|
||||
}
|
||||
if (pathname) {
|
||||
|
||||
if (pathname && isMarkdownFile(pathname)) {
|
||||
const win = BrowserWindow.fromWebContents(e.sender)
|
||||
return openFileOrFolder(win, pathname)
|
||||
} else if (pathname) {
|
||||
return shell.openPath(pathname)
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user