fix: 修正复制标题链接路径问题

This commit is contained in:
purocean
2021-08-04 17:07:57 +08:00
parent 1da66ebc42
commit 99cd856416
+6 -1
View File
@@ -22,7 +22,12 @@ export default {
if (['H1', 'H2', 'H3', 'H4', 'H5', 'H6'].indexOf(target.tagName) > -1 && target.id && hasCtrlCmd(e)) {
const { currentFile } = store.state
if (currentFile) {
copyText(encodeMarkdownLink(currentFile.path) + '#' + encodeMarkdownLink(decodeURIComponent(target.id)))
let path = currentFile.path
if (!path.startsWith('/')) {
path = '/' + path
}
copyText(encodeMarkdownLink(path) + '#' + encodeMarkdownLink(decodeURIComponent(target.id)))
return preventEvent()
}
}