mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-27 20:08:49 +01:00
This commit is contained in:
parent
dad9bc58d6
commit
8554804ae2
2 changed files with 20 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue