From 855cb06018d22dadb819e14a58c30dc3813e5e31 Mon Sep 17 00:00:00 2001 From: ChaoLiu Date: Mon, 18 Aug 2025 18:07:46 +0800 Subject: [PATCH] fix: improve tag insertion position in memo editor - Add scroll to cursor functionality after tag insertion - Enhance user experience by showing newly added tags Signed-off-by: ChaoLiu --- web/src/components/MemoEditor/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index 06ecbd1f5..0dca58f3b 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -488,6 +488,9 @@ const MemoEditor = observer((props: Props) => { editorRef.current.insertText("\n"); editorRef.current.insertText(`#${tag} `); + // Scroll to the bottom to show the newly added tag + editorRef.current.scrollToCursor(); + // Remove the tag from recommendations after adding it setState((prevState) => ({ ...prevState, @@ -514,6 +517,9 @@ const MemoEditor = observer((props: Props) => { const tagsText = state.recommendedTags.map((tagSuggestion) => `#${tagSuggestion.tag}`).join(" ") + " "; editorRef.current.insertText(tagsText); + // Scroll to the bottom to show the newly added tags + editorRef.current.scrollToCursor(); + // Clear recommendations setState((prevState) => ({ ...prevState,