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/11801
Vanessa487ded0a063b
diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.tsindex 222bca3c7c..6cb40fd1ff 100644--- a/app/src/block/Panel.ts+++ b/app/src/block/Panel.ts@@ -15,6 +15,8 @@ import {fetchPost} from "../util/fetch";import {showMessage} from "../dialog/message";import {App} from "../index";import {resize} from "../protyle/util/resize";+import {checkFold} from "../util/noRelyPCFunction";+import {updateHotkeyTip} from "../protyle/util/compatibility";export class BlockPanel {public element: HTMLElement;@@ -121,11 +123,16 @@ export class BlockPanel {openNewWindowById(this.refDefs[0].refID);/// #endif} else if (type === "stickTab") {- openFileById({- app: options.app,- id: this.refDefs[0].refID,- action: this.editors[0].protyle.block.rootID !== this.refDefs[0].refID ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_CONTEXT],+ checkFold(this.refDefs[0].refID, (zoomIn, action) => {+ openFileById({+ app:options.app,+ id:this.refDefs[0].refID,+ action,+ zoomIn,+ openNewTab: true+ });});+ this.destroy();}event.preventDefault();event.stopPropagation();@@ -233,7 +240,7 @@ export class BlockPanel {}let openHTML = "";if (this.refDefs.length === 1) {- openHTML = `<span data-type="stickTab" class="block__icon block__icon--show b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.openBy}"><svg><use xlink:href="#iconOpen"></use></svg></span>+ openHTML = `<span data-type="stickTab" class="block__icon block__icon--show b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.openInNewTab} ${updateHotkeyTip(window.siyuan.config.keymap.editor.general.openInNewTab.custom)}"><svg><use xlink:href="#iconOpen"></use></svg></span><span class="fn__space"></span>`;/// #if !BROWSERopenHTML += `<span data-type="open" class="block__icon block__icon--show b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.openByNewWindow}"><svg><use xlink:href="#iconOpenWindow"></use></svg></span>diff --git a/app/src/constants.ts b/app/src/constants.tsindex e595f9d0e6..8e9670491e 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -465,6 +465,7 @@ export abstract class Constants {rtl: {default: "", custom: ""},ltr: {default: "", custom: ""},aiWriting: {default: "", custom: ""},+ openInNewTab: {default: "", custom: ""},},insert: {appearance: {default: "⌥⌘X", custom: "⌥⌘X"},diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex c68cef1d54..7c358aa8bb 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -45,6 +45,7 @@ export const openFileById = async (options: {keepCursor?: booleanzoomIn?: booleanremoveCurrentTab?: boolean+ openNewTab?: booleanafterOpen?: (model: Model) => void}) => {const response = await fetchSyncPost("/api/block/getBlockInfo", {id: options.id});@@ -67,7 +68,8 @@ export const openFileById = async (options: {zoomIn: options.zoomIn,keepCursor: options.keepCursor,removeCurrentTab: options.removeCurrentTab,- afterOpen: options.afterOpen+ afterOpen: options.afterOpen,+ openNewTab: options.openNewTab});};@@ -155,7 +157,7 @@ export const openFile = async (options: IOpenFileOptions) => {if (search) {return search.parent;}- } else if (!options.position) {+ } else if (!options.position && !options.openNewTab) {let editor: Editor;let activeEditor: Editor;allModels.editor.find((item) => {diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex a28eabb086..df741e8162 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1712,6 +1712,28 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {return;}+ if (!event.repeat && matchHotKey(window.siyuan.config.keymap.editor.general.openInNewTab.custom, event)) {+ event.preventDefault();+ event.stopPropagation();+ const blockPanel = window.siyuan.blockPanels.find(item => {+ if (item.element.contains(nodeElement)) {+ return true;+ }+ })+ const id = nodeElement.getAttribute("data-node-id");+ checkFold(id, (zoomIn, action) => {+ openFileById({+ app: protyle.app,+ id,+ action,+ zoomIn,+ openNewTab: true+ });+ blockPanel.destroy();+ });+ return;+ }+// tab 需等待 list 和 table 处理完成if (event.key === "Tab" && isNotCtrl(event) && !event.altKey) {event.preventDefault();diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 6970314ef2..6491c39f12 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -592,6 +592,7 @@ interface IOpenFileOptions {keepCursor?: boolean // file,是否跳转到新 tab 上zoomIn?: boolean // 是否缩放removeCurrentTab?: boolean // 在当前页签打开时需移除原有页签+ openNewTab?: boolean // 使用新页签打开afterOpen?: (model?: import("../layout/Model").Model) => void // 打开后回调}