mirror of https://github.com/usememos/memos.git
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 <chaoliu719@gmail.com>
This commit is contained in:
parent
30202db710
commit
855cb06018
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue