diff --git a/src/renderer/plugins/copy-text.ts b/src/renderer/plugins/copy-text.ts index 581135ff..e7594b8e 100644 --- a/src/renderer/plugins/copy-text.ts +++ b/src/renderer/plugins/copy-text.ts @@ -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() } }