An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/9981
Vanessafe98812f743a
diff --git a/app/src/mobile/dock/MobileBacklinks.ts b/app/src/mobile/dock/MobileBacklinks.tsindex d2f257a929..475673cefb 100644--- a/app/src/mobile/dock/MobileBacklinks.ts+++ b/app/src/mobile/dock/MobileBacklinks.ts@@ -44,14 +44,14 @@ export class MobileBacklinks {element: this.element.querySelector(".backlinkList") as HTMLElement,data: null,click(element: HTMLElement) {- openMobileFileById(app, element.getAttribute("data-node-id"), [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);+ openMobileFileById(app, element.getAttribute("data-node-id"), [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);}});this.mTree = new Tree({element: this.element.querySelector(".backlinkMList") as HTMLElement,data: null,click: (element) => {- openMobileFileById(app, element.getAttribute("data-node-id"), [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);+ openMobileFileById(app, element.getAttribute("data-node-id"), [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);},});this.element.addEventListener("click", (event) => {diff --git a/app/src/mobile/dock/MobileFiles.ts b/app/src/mobile/dock/MobileFiles.tsindex 444a5dfda3..68fddc7cc2 100644--- a/app/src/mobile/dock/MobileFiles.ts+++ b/app/src/mobile/dock/MobileFiles.ts@@ -215,7 +215,7 @@ export class MobileFiles extends Model {} else if (target.tagName === "LI") {this.setCurrent(target);if (target.getAttribute("data-type") === "navigation-file") {- openMobileFileById(app, target.getAttribute("data-node-id"));+ openMobileFileById(app, target.getAttribute("data-node-id"), [Constants.CB_GET_SCROLL, Constants.CB_GET_HL]);} else if (target.getAttribute("data-type") === "navigation-root") {const ulElement = hasTopClosestByTag(target, "UL");if (ulElement) {diff --git a/app/src/mobile/dock/MobileOutline.ts b/app/src/mobile/dock/MobileOutline.tsindex 4de1c9067d..e3a6c52702 100644--- a/app/src/mobile/dock/MobileOutline.ts+++ b/app/src/mobile/dock/MobileOutline.ts@@ -35,7 +35,7 @@ export class MobileOutline {document.getElementById(id)?.scrollIntoView();} else {checkFold(id, (zoomIn) => {- openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]);+ openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_HL, Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HL, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]);});}}diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.tsindex a7394d5446..87bc41c07c 100644--- a/app/src/mobile/editor.ts+++ b/app/src/mobile/editor.ts@@ -13,6 +13,7 @@ import {pushBack} from "./util/MobileBackFoward";import {setStorageVal} from "../protyle/util/compatibility";import {showMessage} from "../dialog/message";import {App} from "../index";+import {getDocByScroll, saveScroll} from "../protyle/scroll/saveScroll";export const getCurrentEditor = () => {return window.siyuan.mobile.popEditor || window.siyuan.mobile.editor;@@ -22,6 +23,7 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id};setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);if (window.siyuan.mobile.editor) {+ saveScroll(window.siyuan.mobile.editor.protyle);hideElements(["toolbar", "hint", "util"], window.siyuan.mobile.editor.protyle);if (window.siyuan.mobile.editor.protyle.contentElement.classList.contains("fn__none")) {setEditMode(window.siyuan.mobile.editor.protyle, "wysiwyg");@@ -46,32 +48,41 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_showMessage(data.msg);return;}+ const protyleOptions: IOptions = {+ blockId: id,+ rootId: data.data.rootID,+ action,+ render: {+ scroll: true,+ background: true,+ gutter: true,+ },+ typewriterMode: true,+ preview: {+ actions: ["mp-wechat", "zhihu"]+ }+ }if (window.siyuan.mobile.editor) {pushBack();addLoading(window.siyuan.mobile.editor.protyle);- fetchPost("/api/filetree/getDoc", {- id,- size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,- mode: action.includes(Constants.CB_GET_CONTEXT) ? 3 : 0,- }, getResponse => {- onGet({data: getResponse, protyle: window.siyuan.mobile.editor.protyle, action});- });+ if (action.includes(Constants.CB_GET_SCROLL)) {+ getDocByScroll({+ protyle: window.siyuan.mobile.editor.protyle,+ scrollAttr: window.siyuan.storage[Constants.LOCAL_FILEPOSITION][data.data.rootID],+ mergedOptions: protyleOptions+ });+ } else {+ fetchPost("/api/filetree/getDoc", {+ id,+ size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,+ mode: action.includes(Constants.CB_GET_CONTEXT) ? 3 : 0,+ }, getResponse => {+ onGet({data: getResponse, protyle: window.siyuan.mobile.editor.protyle, action});+ });+ }window.siyuan.mobile.editor.protyle.undo.clear();} else {- window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), {- blockId: id,- rootId: data.data.rootID,- action,- render: {- scroll: true,- background: true,- gutter: true,- },- typewriterMode: true,- preview: {- actions: ["mp-wechat", "zhihu"]- }- });+ window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), protyleOptions);}(document.getElementById("toolbarName") as HTMLInputElement).value = data.data.rootTitle === "Untitled" ? "" : data.data.rootTitle;setEditor();diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.tsindex 38ff8811b2..762acf15fd 100644--- a/app/src/mobile/index.ts+++ b/app/src/mobile/index.ts@@ -152,7 +152,7 @@ window.hideKeyboardToolbar = hideKeyboardToolbar;window.openFileByURL = (openURL) => {if (openURL && isSYProtocol(openURL)) {openMobileFileById(siyuanApp, getIdFromSYProtocol(openURL),- getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);+ getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);return true;}return false;diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex 9c11fb1c31..d977c10544 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -170,7 +170,7 @@ export const initFramework = (app: App, isStart: boolean) => {const idZoomIn = getIdZoomInByPath();if (idZoomIn.id) {openMobileFileById(app, idZoomIn.id,- idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);+ idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);return;}if (window.siyuan.config.fileTree.closeTabsOnStart && isStart) {diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.tsindex f613bdcb32..7ad4b5b3d6 100644--- a/app/src/mobile/util/onMessage.ts+++ b/app/src/mobile/util/onMessage.ts@@ -25,7 +25,7 @@ export const onMessage = (app: App, data: IWebSocketData) => {}break;case "openFileById":- openMobileFileById(app, data.data.id, [Constants.CB_GET_FOCUS]);+ openMobileFileById(app, data.data.id, [Constants.CB_GET_HL]);break;case"txerr":transactionError();