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: 已选中的文件再次选中时,不会在文件树中跳转 (#6820)
meteor2e15fbf09861
diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex 085b815689..3e00e91af9 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -345,7 +345,7 @@ 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) {+ if (fileModel instanceof Files && !fileModel.isSelected(protyle.path)) {fileModel.selectItem(protyle.notebookId, protyle.path);}}diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.tsindex 393be58306..f0e13c590e 100644--- a/app/src/layout/dock/Files.ts+++ b/app/src/layout/dock/Files.ts@@ -852,6 +852,21 @@ 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) {