An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: rm hasContext
Vanessad2a6c03d522a
diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.tsindex 066084a7fc..0bbcbd4ce3 100644--- a/app/src/block/Panel.ts+++ b/app/src/block/Panel.ts@@ -190,7 +190,6 @@ export class BlockPanel {const index = parseInt(editorElement.getAttribute("data-index"));const editor = new Protyle(editorElement, {blockId: this.nodeIds[index],- hasContext: false,defId: this.defIds[index] ||this.defIds[0] || "",action: [Constants.CB_GET_ALL],render: {diff --git a/app/src/editor/index.ts b/app/src/editor/index.tsindex 8b7896ea7e..2263cfbff7 100644--- a/app/src/editor/index.ts+++ b/app/src/editor/index.ts@@ -14,7 +14,6 @@ export class Editor extends Model {tab: Tab,blockId: string,mode?: TEditorMode,- hasContext?: booleanaction?: string[]}) {super({@@ -30,7 +29,6 @@ export class Editor extends Model {private initProtyle(options: {blockId: string,- hasContext?: booleanaction?: string[]mode?: TEditorMode,}) {@@ -38,7 +36,6 @@ export class Editor extends Model {action: options.action,blockId: options.blockId,mode: options.mode,- hasContext: options.hasContext,render: {title: true,background: true,diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex 0dbf3532dd..7764ec1ef1 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -32,7 +32,6 @@ export const openFileById = (options: {id: string,position?: string,mode?: TEditorMode,- hasContext?: boolean,action?: string[]keepCursor?: booleanzoomIn?: boolean@@ -50,7 +49,6 @@ export const openFileById = (options: {rootID: data.data.rootID,position: options.position,mode: options.mode,- hasContext: options.hasContext,action: options.action,zoomIn: options.zoomIn,keepCursor: options.keepCursor@@ -200,7 +198,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IModif ((!nodeElement || nodeElement?.clientHeight === 0) && options.id !== options.rootID) {fetchPost("/api/filetree/getDoc", {id: options.id,- mode: options.hasContext ? 3 : 0,+ mode: (options.action && !options.action.includes(Constants.CB_GET_ALL)) ? 3 : 0,size: Constants.SIZE_GET,}, getResponse => {onGet(getResponse, editor.editor.protyle, options.action);@@ -274,7 +272,6 @@ const newTab = (options: IOpenFileOptions) => {tab,blockId: options.id,mode: options.mode,- hasContext: options.hasContext,action: options.action,});}diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.tsindex 1fdf57216f..2a00c5999c 100644--- a/app/src/layout/Wnd.ts+++ b/app/src/layout/Wnd.ts@@ -333,7 +333,6 @@ export class Wnd {} else {openFileById({id: keepCursorId,- hasContext: true,action: [Constants.CB_GET_FOCUS]});}diff --git a/app/src/layout/dock/Backlinks.ts b/app/src/layout/dock/Backlinks.tsindex fe873d221d..d7096412b8 100644--- a/app/src/layout/dock/Backlinks.ts+++ b/app/src/layout/dock/Backlinks.ts@@ -137,14 +137,12 @@ export class Backlinks extends Model {click(element: HTMLElement) {openFileById({id: element.getAttribute("data-node-id"),- hasContext: true,action: [Constants.CB_GET_FOCUS]});},ctrlClick(element: HTMLElement) {openFileById({id: element.getAttribute("data-node-id"),- hasContext: true,keepCursor: true,});},@@ -152,7 +150,6 @@ export class Backlinks extends Model {openFileById({id: element.getAttribute("data-node-id"),position: "right",- hasContext: true,action: [Constants.CB_GET_FOCUS]});},@@ -160,7 +157,6 @@ export class Backlinks extends Model {openFileById({id: element.getAttribute("data-node-id"),position: "bottom",- hasContext: true,action: [Constants.CB_GET_FOCUS]});}@@ -191,7 +187,6 @@ export class Backlinks extends Model {} else {openFileById({id: element.getAttribute("data-node-id"),- hasContext: true,action: [Constants.CB_GET_FOCUS]});}@@ -199,7 +194,6 @@ export class Backlinks extends Model {ctrlClick(element: HTMLElement) {openFileById({id: element.getAttribute("data-node-id"),- hasContext: true,keepCursor: true,});},@@ -207,7 +201,6 @@ export class Backlinks extends Model {openFileById({id: element.getAttribute("data-node-id"),position: "right",- hasContext: true,action: [Constants.CB_GET_FOCUS]});},@@ -215,7 +208,6 @@ export class Backlinks extends Model {openFileById({id: element.getAttribute("data-node-id"),position: "bottom",- hasContext: true,action: [Constants.CB_GET_FOCUS]});},diff --git a/app/src/layout/dock/Bookmark.ts b/app/src/layout/dock/Bookmark.tsindex e951c5969f..06917c4b64 100644--- a/app/src/layout/dock/Bookmark.ts+++ b/app/src/layout/dock/Bookmark.ts@@ -80,7 +80,6 @@ export class Bookmark extends Model {fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {openFileById({id,- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],});});@@ -152,7 +151,6 @@ export class Bookmark extends Model {ctrlClick(element: HTMLElement) {openFileById({id: element.getAttribute("data-node-id"),- hasContext: true,keepCursor: true,});},@@ -160,7 +158,6 @@ export class Bookmark extends Model {openFileById({id: element.getAttribute("data-node-id"),position: "right",- hasContext: true,action: [Constants.CB_GET_FOCUS]});},@@ -168,7 +165,6 @@ export class Bookmark extends Model {openFileById({id: element.getAttribute("data-node-id"),position: "bottom",- hasContext: true,action: [Constants.CB_GET_FOCUS]});}diff --git a/app/src/layout/dock/Graph.ts b/app/src/layout/dock/Graph.tsindex d612227fe0..49edc6f7ee 100644--- a/app/src/layout/dock/Graph.ts+++ b/app/src/layout/dock/Graph.ts@@ -598,14 +598,12 @@ export class Graph extends Model {openFileById({id: node.id,position: "bottom",- hasContext: true,action: [Constants.CB_GET_FOCUS]});} else if (window.siyuan.altIsPressed) {openFileById({id: node.id,position: "right",- hasContext: true,action: [Constants.CB_GET_FOCUS]});} else if (window.siyuan.ctrlIsPressed) {@@ -614,7 +612,7 @@ export class Graph extends Model {nodeIds: [node.id],}));} else {- openFileById({id: node.id, hasContext: true, action: [Constants.CB_GET_FOCUS]});+ openFileById({id: node.id, action: [Constants.CB_GET_FOCUS]});}});}, 1000);diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.tsindex fbdbed8bc8..51e793b0aa 100644--- a/app/src/layout/dock/Outline.ts+++ b/app/src/layout/dock/Outline.ts@@ -98,7 +98,6 @@ export class Outline extends Model {fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {openFileById({id,- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID],});});diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex b646cdc291..653f89ca33 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -89,7 +89,6 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {fetchPost("/api/block/checkBlockFold", {id: refBlockId}, (foldResponse) => {openFileById({id: refBlockId,- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],keepCursor: true,zoomIn: foldResponse.data@@ -106,7 +105,6 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {openFileById({id: refBlockId,position: "right",- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});@@ -122,7 +120,6 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {openFileById({id: refBlockId,position: "bottom",- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});@@ -357,14 +354,12 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushBif (window.siyuan.mobileEditor) {window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id,- hasContext: id === protyle.block.rootID,action: id === protyle.block.rootID ? [Constants.CB_GET_HL] : [Constants.CB_GET_ALL]}));window.siyuan.backStack.push({id: protyle.block.id,scrollTop: protyle.contentElement.scrollTop,callback: id === protyle.block.rootID ? [Constants.CB_GET_HL] : [Constants.CB_GET_ALL],- hasContext: false});}fetchPost("/api/filetree/getDoc", {diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.tsindex 5f7b5c4fdd..ad7a349eb2 100644--- a/app/src/mobile/editor.ts+++ b/app/src/mobile/editor.ts@@ -12,8 +12,8 @@ import {hasClosestByAttribute} from "../protyle/util/hasClosest";import {setEditMode} from "../protyle/util/setEditMode";import {hideElements} from "../protyle/ui/hideElements";-export const openMobileFileById = (id: string, hasContext?: boolean, action = [Constants.CB_GET_HL], pushStack = true) => {- window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, hasContext, action}));+export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL], pushStack = true) => {+ window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, action}));if (window.siyuan.mobileEditor) {hideElements(["toolbar", "hint", "util"], window.siyuan.mobileEditor.protyle);if (window.siyuan.mobileEditor.protyle.contentElement.classList.contains("fn__none")) {@@ -32,7 +32,7 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [Cwindow.siyuan.backStack.push({id,scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,- hasContext+ callback: action,});}focusBlock(blockElement);@@ -53,7 +53,7 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [CfetchPost("/api/filetree/getDoc", {id,size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,- mode: hasContext ? 3 : 0,+ mode: !action.includes(Constants.CB_GET_ALL) ? 3 : 0,}, getResponse => {onGet(getResponse, window.siyuan.mobileEditor.protyle, action);window.siyuan.mobileEditor.protyle.breadcrumb.render(window.siyuan.mobileEditor.protyle);@@ -63,7 +63,6 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [Cwindow.siyuan.mobileEditor = new Protyle(document.getElementById("editor"), {blockId: id,action,- hasContext: hasContext,render: {background: true,gutter: true,@@ -89,8 +88,7 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [Cwindow.siyuan.backStack.push({id,scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,- callback: [Constants.CB_GET_HL],- hasContext+ callback: action,});}});diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.tsindex 96a14784d7..8b62e4bd4f 100644--- a/app/src/mobile/index.ts+++ b/app/src/mobile/index.ts@@ -83,7 +83,7 @@ window.goBack = () => {}previousBackStack = window.siyuan.backStack.pop();const item = window.siyuan.backStack[window.siyuan.backStack.length - 1];- openMobileFileById(item.id, item.hasContext, item.callback, false);+ openMobileFileById(item.id, item.callback, false);setTimeout(() => {window.siyuan.mobileEditor.protyle.contentElement.scrollTo({top: previousBackStack?.scrollTop || 0,diff --git a/app/src/mobile/util/MobileBacklinks.ts b/app/src/mobile/util/MobileBacklinks.tsindex bc20f7637a..0da41ac31f 100644--- a/app/src/mobile/util/MobileBacklinks.ts+++ b/app/src/mobile/util/MobileBacklinks.ts@@ -46,7 +46,7 @@ export class MobileBacklinks {element: this.element.querySelector(".backlinkList") as HTMLElement,data: null,click(element: HTMLElement) {- openMobileFileById(element.getAttribute("data-node-id"), true, [Constants.CB_GET_FOCUS]);+ openMobileFileById(element.getAttribute("data-node-id"), [Constants.CB_GET_FOCUS]);}});this.mTree = new Tree({@@ -73,7 +73,7 @@ export class MobileBacklinks {}).element);window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});} else {- openMobileFileById(element.getAttribute("data-node-id"), true, [Constants.CB_GET_FOCUS]);+ openMobileFileById(element.getAttribute("data-node-id"), [Constants.CB_GET_FOCUS]);}},blockExtHTML: '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>'diff --git a/app/src/mobile/util/MobileBookmarks.ts b/app/src/mobile/util/MobileBookmarks.tsindex 7d86bc4d45..c557cdb221 100644--- a/app/src/mobile/util/MobileBookmarks.ts+++ b/app/src/mobile/util/MobileBookmarks.ts@@ -83,7 +83,7 @@ export class MobileBookmarks {});}} else {- openMobileFileById(id, true, [Constants.CB_GET_FOCUS]);+ openMobileFileById(id, [Constants.CB_GET_FOCUS]);}},blockExtHTML: '<span class="b3-list-item__action" data-type="remove"><svg><use xlink:href="#iconTrashcan"></use></svg></span>',diff --git a/app/src/mobile/util/MobileOutline.ts b/app/src/mobile/util/MobileOutline.tsindex 2f96de306a..39c4f5d01e 100644--- a/app/src/mobile/util/MobileOutline.ts+++ b/app/src/mobile/util/MobileOutline.ts@@ -28,20 +28,9 @@ export class MobileOutline {data: null,click: (element: HTMLElement) => {const id = element.getAttribute("data-node-id");- const targetElement = window.siyuan.mobileEditor.protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`);- if (targetElement) {- targetElement.scrollIntoView();- focusBlock(targetElement);- window.siyuan.backStack.push({- id,- scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,- hasContext: true- });- } else {- fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {- openMobileFileById(id, !foldResponse.data, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID]);- });- }+ fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {+ openMobileFileById(id,foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID]);+ });}});this.element.firstElementChild.querySelector('[data-type="collapse"]').addEventListener(getEventName(), () => {diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex 704f8aac61..9b7e2993d9 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -114,11 +114,11 @@ export const initFramework = () => {const localDoc = JSON.parse(window.localStorage.getItem(Constants.LOCAL_DOCINFO) || '{"id": ""}');fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {if (existResponse.data) {- openMobileFileById(localDoc.id, localDoc.hasContext, localDoc.action);+ openMobileFileById(localDoc.id, localDoc.action);} else {fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {if (response.data.length !== 0) {- openMobileFileById(response.data[0].id, true);+ openMobileFileById(response.data[0].id);} else {setEmpty();}diff --git a/app/src/mobile/util/search.ts b/app/src/mobile/util/search.tsindex c302202c9e..febe4b4d77 100644--- a/app/src/mobile/util/search.ts+++ b/app/src/mobile/util/search.ts@@ -80,7 +80,7 @@ export const popSearch = (modelElement: HTMLElement, modelMainElement: HTMLElemepreventScroll(window.siyuan.mobileEditor.protyle);}fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {- openMobileFileById(id, !foldResponse.data, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);+ openMobileFileById(id,foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);});closePanel();event.preventDefault();diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.tsindex 6c0fcd487f..1aa090be24 100644--- a/app/src/mobile/util/touch.ts+++ b/app/src/mobile/util/touch.ts@@ -29,7 +29,7 @@ export const handleTouchEnd = () => {const item = forwardStack.pop();item.scrollTop = window.siyuan.mobileEditor.protyle.contentElement.scrollTop;window.siyuan.backStack.push(item);- openMobileFileById(item.id, item.hasContext, item.callback, false);+ openMobileFileById(item.id, item.callback, false);setTimeout(() => {window.siyuan.mobileEditor.protyle.contentElement.scrollTo({top: window.siyuan.backStack[window.siyuan.backStack.length - 2]?.scrollTop || 0,@@ -49,7 +49,7 @@ export const handleTouchEnd = () => {const item = window.siyuan.backStack.pop();item.scrollTop = window.siyuan.mobileEditor.protyle.contentElement.scrollTop;forwardStack.push(item);- openMobileFileById(item.id, item.hasContext, item.callback, false);+ openMobileFileById(item.id, item.callback, false);setTimeout(() => {window.siyuan.mobileEditor.protyle.contentElement.scrollTo({top: forwardStack[forwardStack.length - 2]?.scrollTop || 0,diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.tsindex 9d069b21f2..aa0acb8202 100644--- a/app/src/protyle/hint/index.ts+++ b/app/src/protyle/hint/index.ts@@ -506,11 +506,10 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;}, () => {insertHTML(genEmptyBlock(false, false, `<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`), protyle);/// #if MOBILE- openMobileFileById(newSubDocId, true);+ openMobileFileById(newSubDocId);/// #elseopenFileById({id: newSubDocId,- hasContext: true,action: [Constants.CB_GET_HL]});/// #endifdiff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 3a3ea4a9ea..77a3abf68f 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -157,7 +157,7 @@ class Protyle {fetchPost("/api/filetree/getDoc", {id: options.blockId,k: options.key || "",- mode: options.hasContext ? 3 : 0, // 0: 仅当前 ID,1:向上 2:向下,3:上下都加载,4:加载最后+ mode: (options.action && !options.action.includes(Constants.CB_GET_ALL)) ? 3 : 0, // 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后size: options.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,}, getResponse => {onGet(getResponse, this.protyle, options.action);diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 5e76dc252d..9d514050de 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1357,13 +1357,12 @@ export class WYSIWYG {fetchPost("/api/block/checkBlockFold", {id: refBlockId}, (foldResponse) => {/// #if MOBILE- openMobileFileById(refBlockId, !foldResponse.data, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);+ openMobileFileById(refBlockId, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);/// #elseif (window.siyuan.shiftIsPressed) {openFileById({id: refBlockId,position: "bottom",- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});@@ -1371,14 +1370,12 @@ export class WYSIWYG {openFileById({id: refBlockId,position: "right",- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});} else if (window.siyuan.ctrlIsPressed) {openFileById({id: refBlockId,- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],keepCursor: true,zoomIn: foldResponse.data@@ -1386,7 +1383,6 @@ export class WYSIWYG {} else {openFileById({id: refBlockId,- hasContext: !foldResponse.data,action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});@@ -1488,13 +1484,12 @@ export class WYSIWYG {if (embedItemElement) {const embedId = embedItemElement.getAttribute("data-id");/// #if MOBILE- openMobileFileById(embedId, false, [Constants.CB_GET_ALL]);+ openMobileFileById(embedId, [Constants.CB_GET_ALL]);/// #elseif (window.siyuan.shiftIsPressed) {openFileById({id: embedId,position: "bottom",- hasContext: false,action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],zoomIn: true});@@ -1502,14 +1497,12 @@ export class WYSIWYG {openFileById({id: embedId,position: "right",- hasContext: false,action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],zoomIn: true});} else if (window.siyuan.ctrlIsPressed) {openFileById({id: embedId,- hasContext: false,action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],keepCursor: true,zoomIn: truediff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 231a0127a4..b1bdd58883 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1532,7 +1532,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {// 打开块引和编辑器中引用、反链、书签中点击事件需保持一致,都加载上下文openFileById({id,- hasContext: true,keepCursor: true,});event.preventDefault();@@ -1542,7 +1541,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {openFileById({id,position: "right",- hasContext: true,action: [Constants.CB_GET_FOCUS]});event.preventDefault();@@ -1552,7 +1550,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {openFileById({id,position: "bottom",- hasContext: true,action: [Constants.CB_GET_FOCUS]});event.preventDefault();diff --git a/app/src/search/index.ts b/app/src/search/index.tsindex 874c79a719..8f66e9256e 100644--- a/app/src/search/index.ts+++ b/app/src/search/index.ts@@ -116,8 +116,7 @@ export class Search extends Model {fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {openFileById({id,- hasContext: !foldResponse.data,- action: [Constants.CB_GET_FOCUS],+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data,position: "right",});@@ -136,8 +135,7 @@ export class Search extends Model {fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {openFileById({id,- hasContext: !foldResponse.data,- action: [Constants.CB_GET_FOCUS],+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});});@@ -198,7 +196,7 @@ export class Search extends Model {} else {this.protyle = new Protyle(this.element.querySelector("#searchPreview") as HTMLElement, {blockId: id,- hasContext: !foldResponse.data,+ action: foldResponse.data ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],key: value,render: {gutter: true,diff --git a/app/src/search/spread.ts b/app/src/search/spread.tsindex 6a90e91c7d..71c5f2a65f 100644--- a/app/src/search/spread.ts+++ b/app/src/search/spread.ts@@ -468,8 +468,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: strifetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {openFileById({id,- hasContext: !foldResponse.data,- action: [Constants.CB_GET_FOCUS],+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});dialog.destroy();@@ -592,8 +591,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: strifetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {openFileById({id,- hasContext: !foldResponse.data,- action: [Constants.CB_GET_FOCUS],+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data,position: "right"});@@ -616,8 +614,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: strifetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {openFileById({id,- hasContext: !foldResponse.data,- action: [Constants.CB_GET_FOCUS],+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],zoomIn: foldResponse.data});dialog.destroy();@@ -646,7 +643,7 @@ const getArticle = (options: {if (!protyle) {protyle = new Protyle(options.dialog.element.querySelector("#searchPreview") as HTMLElement, {blockId: options.id,- hasContext: !foldResponse.data,+ action: foldResponse.data ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],key: options.k,render: {gutter: true,diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 196cc8ff26..76249e5769 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -48,7 +48,6 @@ interface IPdfAnno {interface IBackStack {id: string,scrollTop?: number,- hasContext?: boolean,callback?: string[],position?: { start: number, end: number }protyle?: IProtyle,@@ -157,7 +156,6 @@ declare interface IOpenFileOptions {position?: string, // file 或者 asset,打开位置page?: number | string, // assetmode?: TEditorMode // file- hasContext?: boolean // file,是否带上下文action?: string[]keepCursor?: boolean // file,是否跳转到新 tab 上zoomIn?: boolean // 是否缩放diff --git a/app/src/types/protyle.d.ts b/app/src/types/protyle.d.tsindex 7803ea06c2..52b885ec29 100644--- a/app/src/types/protyle.d.ts+++ b/app/src/types/protyle.d.ts@@ -345,7 +345,6 @@ interface IOptions {action?: string[],mode?: TEditorMode,blockId: string- hasContext?: booleankey?: stringdefId?: stringrender?: {diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.tsindex 8330bb59bf..1be551c513 100644--- a/app/src/util/newFile.ts+++ b/app/src/util/newFile.ts@@ -67,7 +67,7 @@ export const newFile = (notebookId?: string, currentPath?: string, open?: boolea}, () => {/// #if !MOBILEif (open) {- openFileById({id, hasContext: true, action: [Constants.CB_GET_HL]});+ openFileById({id, action: [Constants.CB_GET_HL]});}/// #endif});diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.tsindex 00f9db53a6..f05e962cce 100644--- a/app/src/util/onGetConfig.ts+++ b/app/src/util/onGetConfig.ts@@ -342,7 +342,6 @@ const initWindow = () => {}openFileById({id: url.substr(16, 22),- hasContext: true,action: [Constants.CB_GET_FOCUS],zoomIn: getSearch("focus", url) === "1"});