An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: fix https://github.com/siyuan-note/siyuan/issues/11197
Vanessa950f60fe10bb
diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex 4a1366371b..cedc8b20e7 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -698,17 +698,27 @@ export const openBy = (url: string, type: "folder" | "app") => {export const openLink = (protyle: IProtyle, aLink: string, event?: MouseEvent, ctrlIsPressed = false) => {let linkAddress = Lute.UnEscapeHTMLStr(aLink);+ let pdfParams;+ if (isLocalPath(linkAddress) && !linkAddress.startsWith("file://") && linkAddress.indexOf(".pdf") > -1) {+ const pdfAddress = linkAddress.split("/");+ if (pdfAddress.length === 3 && pdfAddress[0] === "assets" && pdfAddress[1].endsWith(".pdf") && /\d{14}-\w{7}/.test(pdfAddress[2])) {+ linkAddress = `assets/${pdfAddress[1]}`;+ pdfParams = pdfAddress[2];+ } else {+ pdfParams = parseInt(getSearch("page", linkAddress));+ linkAddress = linkAddress.split("?page")[0];+ }+ }/// #if MOBILEopenByMobile(linkAddress);/// #elseif (isLocalPath(linkAddress)) {- const linkPathname = linkAddress.split("?page")[0];- if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname(linkPathname)) &&- (!linkPathname.endsWith(".pdf") ||- (linkPathname.endsWith(".pdf") && !linkAddress.startsWith("file://")))+ if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname(linkAddress)) &&+ (!linkAddress.endsWith(".pdf") ||+ (linkAddress.endsWith(".pdf") && !linkAddress.startsWith("file://")))) {if (event && event.altKey) {- openAsset(protyle.app, linkAddress, parseInt(getSearch("page", linkAddress)));+ openAsset(protyle.app, linkAddress, pdfParams);} else if (ctrlIsPressed) {/// #if !BROWSERopenBy(linkAddress, "folder");@@ -722,7 +732,7 @@ export const openLink = (protyle: IProtyle, aLink: string, event?: MouseEvent, copenByMobile(linkAddress);/// #endif} else {- openAsset(protyle.app, linkPathname, parseInt(getSearch("page", linkAddress)), "right");+ openAsset(protyle.app, linkAddress, pdfParams, "right");}} else {/// #if !BROWSERdiff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 615649919c..b1cdb1ada8 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -2104,9 +2104,7 @@ export class WYSIWYG {if (fileElement && range.toString() === "") {event.stopPropagation();event.preventDefault();- const fileIds = fileElement.getAttribute("data-id").split("/");- const linkAddress = `assets/${fileIds[1]}`;- openLink(protyle, linkAddress, event, ctrlIsPressed);+ openLink(protyle, fileElement.getAttribute("data-id"), event, ctrlIsPressed);return;}