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: Improve context switching in floating windows https://github.com/siyuan-note/siyuan/issues/14961
Daniel6be35eb57bd3
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex 5a6ae198b8..1239b8df09 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -938,7 +938,8 @@ export const zoomOut = (options: {focusId?: string,isPushBack?: boolean,callback?: () => void,- reload?: boolean+ reload?: boolean,+ dataDocType?: string}) => {if (options.protyle.options.backlinkData) {return;@@ -1007,6 +1008,7 @@ export const zoomOut = (options: {} : undefined,scrollPosition: options.focusId ? "start" : undefined,afterCB: options.callback,+ dataDocType: options.dataDocType,});// https://github.com/siyuan-note/siyuan/issues/4874if (options.focusId) {@@ -1042,6 +1044,7 @@ export const zoomOut = (options: {data: getFocusResponse,protyle: options.protyle,action: options.isPushBack ? [Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO],+ dataDocType: options.dataDocType,});});return;@@ -1062,7 +1065,8 @@ export const zoomOut = (options: {scrollAttr: {rootId: options.id,focusId: options.focusId- }+ },+ dataDocType: options.dataDocType,});});return;diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.tsindex 0526baaa76..cf0bcd45ba 100644--- a/app/src/protyle/breadcrumb/index.ts+++ b/app/src/protyle/breadcrumb/index.ts@@ -148,7 +148,15 @@ ${padHTML}event.preventDefault();break;} else if (type === "exit-focus") {- zoomOut({protyle, id: protyle.block.rootID, focusId: protyle.block.id});+ zoomOut({+ protyle,+ id: protyle.block.rootID,+ focusId: protyle.block.id,+ dataDocType: "NodeDocument",+ callback: () => {+ element.querySelector('[data-type="context"]').classList.add("block__icon--active");+ }+ });event.stopPropagation();event.preventDefault();break;@@ -168,9 +176,16 @@ ${padHTML}getDocParam.notebook = protyle.notebookId;}fetchPost("/api/filetree/getDoc", getDocParam, getResponse => {- onGet({data: getResponse, protyle, action: [Constants.CB_GET_HL]});+ onGet({+ data: getResponse,+ protyle,+ action: [Constants.CB_GET_HL],+ dataDocType: "NodeDocument",+ afterCB: () => {+ target.classList.add("block__icon--active");+ }+ });});- target.classList.add("block__icon--active");}break;} else if (type === "undo") {diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex b76cbb286c..1fd775aeb9 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -36,7 +36,8 @@ export const onGet = (options: {scrollAttr?: IScrollAttrupdateReadonly?: boolean,scrollPosition?: ScrollLogicalPosition,- afterCB?: () => void+ afterCB?: () => void,+ dataDocType?: string}) => {if (!options.action) {options.action = [];@@ -93,7 +94,7 @@ export const onGet = (options: {options.protyle.block.id = options.data.data.id; // 非缩放情况时不一定是 rootID(搜索打开页签);缩放时必为缩放 id,否则需查看代码options.protyle.scroll.lastScrollTop = 0;options.protyle.contentElement.scrollTop = 0;- options.protyle.wysiwyg.element.setAttribute("data-doc-type", options.data.data.type);+ options.protyle.wysiwyg.element.setAttribute("data-doc-type", options.dataDocType || options.data.data.type);}if (options.protyle.options.render.title && options.protyle.title.element.getAttribute("data-render") !== "true") {