Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/11889

Vanessa414f57a7e17d
diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.ts
index d51c2eb6f6..392e44d10d 100644
--- a/app/src/editor/rename.ts
+++ b/app/src/editor/rename.ts
@@ -8,6 +8,7 @@ import {getAssetName, getDisplayName, pathPosix, setNotebookName} from "../util/
import {fetchPost} from "../util/fetch";
import {Constants} from "../constants";
import {showTooltip} from "../dialog/tooltip";
+import {getAllEditor, getAllModels} from "../layout/getAll";
export const validateName = (name: string, targetElement?: HTMLElement) => {
if (/\r\n|\r|\n|\u2028|\u2029|\t|\//.test(name)) {
@@ -132,7 +133,17 @@ export const renameAsset = (assetPath: string) => {
dialog.destroy();
return false;
}
- fetchPost("/api/asset/renameAsset", {oldPath: assetPath, newName: inputElement.value});
+
+ fetchPost("/api/asset/renameAsset", {oldPath: assetPath, newName: inputElement.value}, (response) => {
+ getAllModels().asset.forEach(item => {
+ if (item.path === assetPath) {
+ item.parent.updateTitle(getDisplayName(response.data.newPath));
+ }
+ })
+ getAllEditor().forEach(item => {
+ item.reload(false);
+ })
+ });
});
};