Skip to content

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

:zap: https://github.com/siyuan-note/siyuan/issues/5875

Vanessa0fce368d103a
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index 6802224cd0..51a20c9fcf 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -360,6 +360,18 @@ const renderPDF = (id: string) => {
item.style.zoom = item.parentElement.clientWidth / item.clientWidth;
}
})
+ previewElement.addEventListener("click", (event) => {
+ if (event.target.tagName === "A") {
+ const linkAddress = event.target.getAttribute("href");
+ if (linkAddress.startsWith("#")) {
+ // 导出预览模式点击块引转换后的脚注跳转不正确 https://github.com/siyuan-note/siyuan/issues/5700
+ previewElement.querySelector(linkAddress).scrollIntoView();
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
+ }
+ });
const actionElement = document.getElementById('action');
actionElement.querySelector('.b3-button--cancel').addEventListener('click', () => {
const {ipcRenderer} = require("electron");
@@ -386,6 +398,12 @@ const renderPDF = (id: string) => {
id,
tpl: html
}, response => {
+ if (response.code === 1) {
+ hideMessage();
+ showMessage(response.msg, undefined, "error");
+ destroyWin(win);
+ return;
+ }
win.loadURL(response.data.url);
});
};
diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts
index 73a335f925..0d501824ae 100644
--- a/app/src/protyle/preview/index.ts
+++ b/app/src/protyle/preview/index.ts
@@ -39,7 +39,7 @@ export class Preview {
const linkAddress = event.target.getAttribute("href");
if (linkAddress.startsWith("#")) {
// 导出预览模式点击块引转换后的脚注跳转不正确 https://github.com/siyuan-note/siyuan/issues/5700
- // 对于超链接锚点不做任何处理
+ previewElement.querySelector(linkAddress).scrollIntoView();
event.stopPropagation();
event.preventDefault();
return;