Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/3716

Vanessa9a834d0464de
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 8b113f497b..76df5c4af6 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -17,6 +17,8 @@ import {initMessage} from "../dialog/message";
import {goBack} from "./util/MobileBackFoward";
import {hideKeyboardToolbar, showKeyboardToolbar} from "./util/showKeyboardToolbar";
import {getLocalStorage} from "../protyle/util/compatibility";
+import {openMobileFileById} from "./editor";
+import {getSearch} from "../util/functions";
class App {
constructor() {
@@ -82,3 +84,11 @@ new App();
window.goBack = goBack;
window.showKeyboardToolbar = showKeyboardToolbar;
window.hideKeyboardToolbar = hideKeyboardToolbar;
+window.openFileByURL = (openURL) => {
+ if (openURL && !/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(openURL)) {
+ openMobileFileById(openURL.substr(16, 22),
+ getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
+ return true
+ }
+ return false
+}
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index 4db52addd0..dfcf989f8f 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -138,11 +138,8 @@ export const initFramework = () => {
});
if (getOpenNotebookCount() > 0) {
if (window.JSAndroid) {
- const openURL = window.JSAndroid.getBlockURL();
- if (openURL && !/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(openURL)) {
- openMobileFileById(openURL.substr(16, 22),
- getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
- return;
+ if (window.openFileByURL(window.JSAndroid.getBlockURL())) {
+ return;
}
}
const openId = getSearch("id");
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index c2b72c9589..1e8aae4e7b 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -50,6 +50,8 @@ interface Window {
showKeyboardToolbar(bottom?: number): void
hideKeyboardToolbar(): void
+
+ openFileByURL(URL: string): boolean
}
interface IWorkspace {