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/5066 openTab
Vanessae4b14a12c60f
diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex 02ee95bda6..477c3ecc8f 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -45,9 +45,6 @@ export const openFileById = async (options: {showMessage(data.msg);return;}- if (typeof options.removeCurrentTab === "undefined") {- options.removeCurrentTab = true;- }openFile({app: options.app,fileName: data.data.rootTitle,@@ -80,6 +77,9 @@ export const openAsset = (app: App, assetPath: string, page: number | string, po};export const openFile = (options: IOpenFileOptions) => {+ if (typeof options.removeCurrentTab === "undefined") {+ options.removeCurrentTab = true;+ }const allModels = getAllModels();// 文档已打开if (options.assetPath) {diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.tsindex 447ce2fb96..c0e2972571 100644--- a/app/src/layout/dock/Outline.ts+++ b/app/src/layout/dock/Outline.ts@@ -221,7 +221,7 @@ export class Outline extends Model {if (getSelection().rangeCount > 0) {const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer);if (blockElement && blockElement.getAttribute("data-type") === "NodeHeading") {- this.setCurrent(blockElement)+ this.setCurrent(blockElement);}}});diff --git a/app/src/layout/util.ts b/app/src/layout/util.tsindex 0e758cae38..b93c232a78 100644--- a/app/src/layout/util.ts+++ b/app/src/layout/util.ts@@ -584,43 +584,43 @@ export const resizeTopbar = () => {const dragElement = toolbarElement.querySelector("#drag") as HTMLElement;dragElement.style.padding = "";- const barMoreElement = toolbarElement.querySelector("#barMore")- barMoreElement.classList.remove("fn__none")- barMoreElement.removeAttribute("data-hideids")+ const barMoreElement = toolbarElement.querySelector("#barMore");+ barMoreElement.classList.remove("fn__none");+ barMoreElement.removeAttribute("data-hideids");Array.from(toolbarElement.querySelectorAll('[data-hide="true"]')).forEach((item) => {- item.classList.remove("fn__none")+ item.classList.remove("fn__none");item.removeAttribute("data-hide");- })+ });- let afterDragElement = dragElement.nextElementSibling- const hideIds: string[] = []+ let afterDragElement = dragElement.nextElementSibling;+ const hideIds: string[] = [];while (toolbarElement.scrollWidth > toolbarElement.clientWidth + 2) {- hideIds.push(afterDragElement.id)- afterDragElement.classList.add("fn__none")- afterDragElement.setAttribute("data-hide", "true")- afterDragElement = afterDragElement.nextElementSibling+ hideIds.push(afterDragElement.id);+ afterDragElement.classList.add("fn__none");+ afterDragElement.setAttribute("data-hide", "true");+ afterDragElement = afterDragElement.nextElementSibling;if (afterDragElement.id === "barMore") {break;}}- let beforeDragElement = dragElement.previousElementSibling+ let beforeDragElement = dragElement.previousElementSibling;while (toolbarElement.scrollWidth > toolbarElement.clientWidth + 2) {- hideIds.push(beforeDragElement.id)- beforeDragElement.classList.add("fn__none")- beforeDragElement.setAttribute("data-hide", "true")- beforeDragElement = beforeDragElement.previousElementSibling+ hideIds.push(beforeDragElement.id);+ beforeDragElement.classList.add("fn__none");+ beforeDragElement.setAttribute("data-hide", "true");+ beforeDragElement = beforeDragElement.previousElementSibling;if (beforeDragElement.id === "barWorkspace") {break;}}if (hideIds.length > 0) {- barMoreElement.classList.remove("fn__none")+ barMoreElement.classList.remove("fn__none");} else {- barMoreElement.classList.add("fn__none")+ barMoreElement.classList.add("fn__none");}- barMoreElement.setAttribute("data-hideids", hideIds.join(","))+ barMoreElement.setAttribute("data-hideids", hideIds.join(","));const width = dragElement.clientWidth;const dragRect = dragElement.getBoundingClientRect();diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex 03f3caebe1..233137239e 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -1190,16 +1190,16 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:}});}- const isPinHead = nodeElement.getAttribute("custom-pinthead")+ const isPinHead = nodeElement.getAttribute("custom-pinthead");menus.push({icon: "iconPin",label: isPinHead ? window.siyuan.languages.unpinTableHead : window.siyuan.languages.pinTableHead,click: () => {const html = nodeElement.outerHTML;if (isPinHead) {- nodeElement.removeAttribute("custom-pinthead")+ nodeElement.removeAttribute("custom-pinthead");} else {- nodeElement.setAttribute("custom-pinthead", "true")+ nodeElement.setAttribute("custom-pinthead", "true");}updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);}diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.tsindex b57cdf283c..4abe6deba6 100644--- a/app/src/plugin/API.ts+++ b/app/src/plugin/API.ts@@ -194,7 +194,7 @@ openTab = (options: {return;}-}+};/// #endifexport const API = {diff --git a/app/src/protyle/util/processCode.ts b/app/src/protyle/util/processCode.tsindex 31203b4e32..ba798607c5 100644--- a/app/src/protyle/util/processCode.ts+++ b/app/src/protyle/util/processCode.ts@@ -34,7 +34,7 @@ export const processPasteCode = (html: string, text: string) => {return `<div data-type="NodeCodeBlock" class="code-block" data-node-id="${Lute.NewNodeID()}"><div class="protyle-action"><span class="protyle-action--first protyle-action__language" contenteditable="false">${window.siyuan.storage[Constants.LOCAL_CODELANG]}</span><span class="fn__flex-1"></span><span class="protyle-icon protyle-icon--first protyle-action__copy"><svg><use xlink:href="#iconCopy"></use></svg></span><span class="protyle-icon protyle-icon--last protyle-action__menu"><svg><use xlink:href="#iconMore"></use></svg></span></div><div contenteditable="true" spellcheck="${window.siyuan.config.editor.spellcheck}">${code.replace(/&/g, "&").replace(/</g, "<")}<wbr></div><div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div></div>`;} else {// Paste code from IDE no longer escape `<` and `>` https://github.com/siyuan-note/siyuan/issues/8340- code = code.replace("<", "<").replace('>', ">");+ code = code.replace("<", "<").replace(">", ">");return "`" + code + "`";}}diff --git a/app/src/search/index.ts b/app/src/search/index.tsindex f63d682f2b..e1bcc779fb 100644--- a/app/src/search/index.ts+++ b/app/src/search/index.ts@@ -15,6 +15,9 @@ export class Search extends Model {app: options.app,id: options.tab.id,});+ if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {+ options.tab.headElement?.classList.add("item--unupdate");+ }this.element = options.tab.panelElement as HTMLElement;this.config = options.config;this.edit = genSearch(options.app, this.config, this.element);diff --git a/app/src/window/init.ts b/app/src/window/init.tsindex f8696bcafe..c2d4388231 100644--- a/app/src/window/init.ts+++ b/app/src/window/init.ts@@ -66,4 +66,4 @@ const afterLayout = (app:App) => {const tab = getInstanceById(item.getAttribute("data-id")) as Tab;tab.parent.switchTab(item, false, false);});-}+};