From 99cd856416bcc2372203284f6166bea312e9d0b1 Mon Sep 17 00:00:00 2001 From: purocean Date: Wed, 4 Aug 2021 17:07:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E9=93=BE=E6=8E=A5=E8=B7=AF=E5=BE=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/plugins/copy-text.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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() } }