Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: 导出预览模式点击块引转换后的脚注跳转不正确 Fix https://github.com/siyuan-note/siyuan/issues/5700

Liang Ding02c2c529bd9a
diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts
index 059dcad1d8..9af7f2ac63 100644
--- a/app/src/protyle/preview/index.ts
+++ b/app/src/protyle/preview/index.ts
@@ -37,6 +37,14 @@ export class Preview {
previewElement.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
if (event.target.tagName === "A") {
const linkAddress = event.target.getAttribute("href");
+ if (linkAddress.startsWith("#")) {
+ // 导出预览模式点击块引转换后的脚注跳转不正确 https://github.com/siyuan-note/siyuan/issues/5700
+ // 对于超链接锚点不做任何处理
+ event.stopPropagation();
+ event.preventDefault();
+ return
+ }
+
if (isMobile()) {
openByMobile(linkAddress);
event.stopPropagation();