Skip to content

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

:recycle: https://github.com/siyuan-note/siyuan/pull/7089/files

Vanessa2b06134a5a52
diff --git a/app/src/asset/index.ts b/app/src/asset/index.ts
index 5aeab591ad..1d322403f9 100644
--- a/app/src/asset/index.ts
+++ b/app/src/asset/index.ts
@@ -9,7 +9,7 @@ import {webViewerLoad} from "./pdf/viewer";
import {webViewerPageNumberChanged} from "./pdf/app";
/// #endif
import {fetchPost} from "../util/fetch";
-import { setStorageVal } from "../protyle/util/compatibility";
+import {setStorageVal} from "../protyle/util/compatibility";
export class Asset extends Model {
public path: string;
@@ -57,7 +57,7 @@ export class Asset extends Model {
}
public goToPage(pdfId: string | number) {
- if (typeof pdfId === "undefined") {
+ if (typeof pdfId === "undefined" || pdfId === null) {
return;
}
this.pdfId = pdfId;
@@ -68,7 +68,9 @@ export class Asset extends Model {
});
return;
}
- webViewerPageNumberChanged({value: this.pdfId, pdfInstance: this.pdfObject});
+ if (typeof pdfId === "number" && !isNaN(pdfId)) {
+ webViewerPageNumberChanged({value: this.pdfId, pdfInstance: this.pdfObject});
+ }
/// #endif
}
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index 678960536a..27b68f0f87 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -299,12 +299,12 @@ export const JSONToLayout = (isStart: boolean) => {
});
}
// https://github.com/siyuan-note/siyuan/pull/7086
- const openId = getSearch("id", window.location.href);
+ const openId = getSearch("id");
if (openId !== null) {
openFileById({
id: openId,
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
- zoomIn: getSearch("focus", window.location.href) === "1"
+ zoomIn: getSearch("focus") === "1"
});
}
};
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index 982fb7ba6c..3b589e105a 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -128,10 +128,10 @@ export const initFramework = () => {
});
initEditorName();
if (getOpenNotebookCount() > 0) {
- const openId = getSearch("id", window.location.href);
+ const openId = getSearch("id");
if (openId !== null) {
openMobileFileById(openId,
- getSearch("focus", window.location.href) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
+ getSearch("focus") === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
} else {
const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index c8cb90a868..cfd9aef14d 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1577,8 +1577,7 @@ export class WYSIWYG {
} else if (window.siyuan.shiftIsPressed) {
openBy(linkAddress, "app");
} else {
- const page = getSearch("page", linkAddress);
- openAsset(linkPathname, page === null ? undefined : parseInt(page), "right");
+ openAsset(linkPathname, parseInt(getSearch("page", linkAddress)), "right");
}
} else {
/// #if !BROWSER