From 8554804ae2c23eb94863019908029bc73aee7a33 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 31 Mar 2025 23:35:17 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14469 --- app/src/menus/tag.ts | 11 ++++++++++- app/src/util/noRelyPCFunction.ts | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/src/menus/tag.ts b/app/src/menus/tag.ts index 0105ec09b..e217aca5e 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} ${escapeHtml(labelName)}?`, () => { - 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 6aa4eead8..f9e751595 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 + }); }); };