From 6957463aac7aa017fefce6e907bdad489275abbe Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 11 Apr 2025 22:10:04 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14532 --- app/src/protyle/header/Background.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.ts index f5f9be572..7b370f587 100644 --- a/app/src/protyle/header/Background.ts +++ b/app/src/protyle/header/Background.ts @@ -543,8 +543,10 @@ export class Background { } upDownHint(listElement, event); if (event.key === "Enter") { - const currentElement = listElement.querySelector(".b3-list-item--focus"); - this.addTags(currentElement ? currentElement.textContent.trim() : inputElement.value.trim(), protyle, () => { + const currentElement = listElement.querySelector(".b3-list-item--focus") as HTMLElement; + this.addTags(currentElement ? + (currentElement.dataset.type === "new" ? currentElement.querySelector("mark").textContent.trim() : currentElement.textContent.trim()) : + inputElement.value.trim(), protyle, () => { inputElement.value = ""; inputElement.dispatchEvent(new CustomEvent("input")); }); @@ -585,6 +587,7 @@ export class Background { protyle, () => { inputElement.value = ""; inputElement.dispatchEvent(new CustomEvent("input")); + inputElement.focus(); }); }); }