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: fix https://github.com/siyuan-note/siyuan/issues/7726
Vanessafb7566a4cbf1
diff --git a/app/src/constants.ts b/app/src/constants.tsindex ea39d41842..5fce363d65 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -46,7 +46,7 @@ export abstract class Constants {public static readonly SIZE_ZOOM = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3];// ws callback- public static readonly CB_MOUNT_HELP = "cb-mount-help";+ public static readonly CB_MOVE_NOLIST = "cb-move-nolist";public static readonly CB_MOUNT_REMOVE = "cb-mount-remove";public static readonly CB_GET_APPEND = "cb-get-append"; // 向下滚动加载public static readonly CB_GET_BEFORE = "cb-get-before"; // 向上滚动加载diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.tsindex c59c7ff471..2ca818c473 100644--- a/app/src/layout/dock/Files.ts+++ b/app/src/layout/dock/Files.ts@@ -32,7 +32,7 @@ export class Files extends Model {if (data) {switch (data.cmd) {case "moveDoc":- this.onMove(data.data);+ this.onMove(data);break;case "mount":this.onMount(data);@@ -466,8 +466,8 @@ export class Files extends Model {selectRootElements.push(item);} else {const dataPath = item.getAttribute("data-path");- const isChild = fromPaths.find(item => {- if (dataPath.startsWith(item.replace(".sy", ""))) {+ const isChild = fromPaths.find(itemPath => {+ if (dataPath.startsWith(itemPath.replace(".sy", ""))) {return true;}});@@ -478,11 +478,13 @@ export class Files extends Model {}});if (newElement.classList.contains("dragover")) {- await fetchPost("/api/filetree/moveDocs", {+ fetchPost("/api/filetree/moveDocs", {toNotebook: toURL,fromPaths,toPath,});+ newElement.classList.remove("dragover", "dragover__bottom", "dragover__top");+ return;}const ulSort = newUlElement.getAttribute("data-sortmode");if ((newElement.classList.contains("dragover__bottom") || newElement.classList.contains("dragover__top")) &&@@ -513,6 +515,7 @@ export class Files extends Model {toNotebook: toURL,fromPaths,toPath: toDir === "/" ? "/" : toDir + ".sy",+ callback: Constants.CB_MOVE_NOLIST,});selectFileElements.forEach(item => {item.setAttribute("data-path", pathPosix().join(toDir, item.getAttribute("data-node-id") + ".sy"));@@ -775,13 +778,8 @@ export class Files extends Model {fileItemElement.querySelector(".b3-list-item__text").innerHTML = escapeHtml(data.title);}- private onMove(data: {- fromNotebook: string,- toNotebook: string,- fromPath: string- toPath: string- }) {- const sourceElement = this.element.querySelector(`ul[data-url="${data.fromNotebook}"] li[data-path="${data.fromPath}"]`) as HTMLElement;+ private onMove(response: IWebSocketData) {+ const sourceElement = this.element.querySelector(`ul[data-url="${response.data.fromNotebook}"] li[data-path="${response.data.fromPath}"]`) as HTMLElement;if (sourceElement) {if (sourceElement.nextElementSibling && sourceElement.nextElementSibling.tagName === "UL") {sourceElement.nextElementSibling.remove();@@ -800,7 +798,7 @@ export class Files extends Model {sourceElement.remove();}}- const newElement = this.element.querySelector(`[data-url="${data.toNotebook}"] li[data-path="${data.toPath}"]`) as HTMLElement;+ const newElement = this.element.querySelector(`[data-url="${response.data.toNotebook}"] li[data-path="${response.data.toPath}"]`) as HTMLElement;// 更新移动到的新文件夹if (newElement) {newElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");@@ -814,7 +812,9 @@ export class Files extends Model {if (newElement.nextElementSibling && newElement.nextElementSibling.tagName === "UL") {newElement.nextElementSibling.remove();}- this.getLeaf(newElement, data.toNotebook);+ if (response.callback !== Constants.CB_MOVE_NOLIST) {+ this.getLeaf(newElement, response.data.toNotebook);+ }}}}diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.tsindex 657773291f..57c3b939bd 100644--- a/app/src/mobile/util/onMessage.ts+++ b/app/src/mobile/util/onMessage.ts@@ -38,7 +38,7 @@ export const onMessage = (data: IWebSocketData) => {openMobileFileById(data.data.id, [Constants.CB_GET_FOCUS]);break;case"txerr":- transactionError(data);+ transactionError();break;case"statusbar":progressStatus(data);diff --git a/app/src/util/mount.ts b/app/src/util/mount.tsindex 9dffcf7054..865636c970 100644--- a/app/src/util/mount.ts+++ b/app/src/util/mount.ts@@ -82,7 +82,6 @@ export const mountHelp = () => {const notebookId = Constants.HELP_PATH[window.siyuan.config.appearance.lang as "zh_CN" | "en_US"];fetchPost("/api/notebook/removeNotebook", {notebook: notebookId, callback: Constants.CB_MOUNT_REMOVE}, () => {fetchPost("/api/notebook/openNotebook", {- callback: Constants.CB_MOUNT_HELP,notebook: notebookId});});diff --git a/app/src/window/index.ts b/app/src/window/index.tsindex 3a9897216b..3ff7275f52 100644--- a/app/src/window/index.ts+++ b/app/src/window/index.ts@@ -90,7 +90,7 @@ class App {progressStatus(data);break;case "txerr":- transactionError(data);+ transactionError();break;case "syncing":processSync(data);