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: https://github.com/siyuan-note/siyuan/pull/6820
Vanessa28957d3ba67c
diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex 3e00e91af9..98b9da7e58 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -103,7 +103,7 @@ const openFile = (options: IOpenFileOptions) => {return true;}// 没有初始化的页签无法检测到- const hasEditor = getUnInitTab(options);+ const hasEditor = getUnInitTab(options);if (hasEditor) {return;}@@ -345,8 +345,11 @@ export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackSt}if (window.siyuan.config.fileTree.alwaysSelectOpenedFile && protyle) {const fileModel = getDockByType("file")?.data.file;- if (fileModel instanceof Files && !fileModel.isSelected(protyle.path)) {- fileModel.selectItem(protyle.notebookId, protyle.path);+ if (fileModel instanceof Files) {+ const target = fileModel.element.querySelector(`li[data-path="${protyle.path}"]`);+ if (!target || (target && !target.classList.contains("b3-list-item--focus"))) {+ fileModel.selectItem(protyle.notebookId, protyle.path);+ }}}}diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.tsindex f0e13c590e..393be58306 100644--- a/app/src/layout/dock/Files.ts+++ b/app/src/layout/dock/Files.ts@@ -852,21 +852,6 @@ export class Files extends Model {liElement.insertAdjacentHTML("afterend", `<ul>${fileHTML}</ul>`);this.setCurrent(this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${filePath}"]`));}- /**- * 判断文件树中当前选中的是否是此文件- * @param filePath 要判断的文件路径- * @returns- */- public isSelected(filePath: string): boolean {- if(!filePath) {- return false;- }- const target = this.element.querySelector(`li[data-path="${filePath}"]`);- if(target) {- return target.classList.contains("b3-list-item--focus");- }- return false;- }private setCurrent(target: HTMLElement, isScroll = true) {if (!target) {diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.tsindex fc4218d793..6961403f58 100644--- a/app/src/util/globalShortcut.ts+++ b/app/src/util/globalShortcut.ts@@ -432,7 +432,7 @@ export const globalShortcut = () => {<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general[item.hotkeyLangId].custom)}</span></li>`;});- let range: Range+ let range: Range;if (getSelection().rangeCount > 0) {range = getSelection().getRangeAt(0).cloneRange();}@@ -450,7 +450,7 @@ export const globalShortcut = () => {transparent: true,destroyCallback: () => {if (range && range.getBoundingClientRect().height !== 0) {- focusByRange(range)+ focusByRange(range);}}});@@ -1260,7 +1260,7 @@ const panelTreeKeydown = (event: KeyboardEvent) => {if (nextElement.nextElementSibling.tagName === "UL") {if (nextElement.nextElementSibling.classList.contains("fn__none")) { // 遇到折叠内容if (nextElement.nextElementSibling.nextElementSibling) {- nextElement = nextElement.nextElementSibling.nextElementSibling+ nextElement = nextElement.nextElementSibling.nextElementSibling;}} else {nextElement = nextElement.nextElementSibling.firstElementChild;