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/14469

Vanessa8554804ae2c2
diff --git a/app/src/menus/tag.ts b/app/src/menus/tag.ts
index 0105ec09b7..e217aca5ee 100644
--- a/app/src/menus/tag.ts
+++ b/app/src/menus/tag.ts
@@ -3,6 +3,8 @@ import {fetchPost} from "../util/fetch";
import {confirmDialog} from "../dialog/confirmDialog";
import {escapeHtml} from "../util/escape";
import {renameTag} from "../util/noRelyPCFunction";
+import {getDockByType} from "../layout/tabUtil";
+import {Tag} from "../layout/dock/Tag";
export const openTagMenu = (element: HTMLElement, event: MouseEvent, labelName: string) => {
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
@@ -23,7 +25,14 @@ export const openTagMenu = (element: HTMLElement, event: MouseEvent, labelName:
label: window.siyuan.languages.remove,
click: () => {
confirmDialog(window.siyuan.languages.deleteOpConfirm, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(labelName)}</b>?`, () => {
- fetchPost("/api/tag/removeTag", {label: labelName});
+ fetchPost("/api/tag/removeTag", {label: labelName}, () => {
+ /// #if MOBILE
+ window.siyuan.mobile.docks.tag.update();
+ /// #else
+ const dockTag = getDockByType("tag");
+ (dockTag.data.tag as Tag).update();
+ /// #endif
+ });
}, undefined, true);
}
}).element);
diff --git a/app/src/util/noRelyPCFunction.ts b/app/src/util/noRelyPCFunction.ts
index 6aa4eead82..f9e751595d 100644
--- a/app/src/util/noRelyPCFunction.ts
+++ b/app/src/util/noRelyPCFunction.ts
@@ -6,6 +6,7 @@ import {pathPosix} from "./pathName";
/// #if !MOBILE
import {getDockByType} from "../layout/tabUtil";
import {Files} from "../layout/dock/Files";
+import {Tag} from "../layout/dock/Tag";
/// #endif
// 需独立出来,否则移动端引用的时候会引入 pc 端大量无用代码
@@ -31,7 +32,15 @@ export const renameTag = (labelName: string) => {
inputElement.focus();
inputElement.select();
btnsElement[1].addEventListener("click", () => {
- fetchPost("/api/tag/renameTag", {oldLabel: labelName, newLabel: inputElement.value});
+ fetchPost("/api/tag/renameTag", {oldLabel: labelName, newLabel: inputElement.value}, () => {
+ dialog.destroy();
+ /// #if MOBILE
+ window.siyuan.mobile.docks.tag.update();
+ /// #else
+ const dockTag = getDockByType("tag");
+ (dockTag.data.tag as Tag).update();
+ /// #endif
+ });
});
};