fix(webui): focus restored drafts before setting mention selection

This commit is contained in:
Xubin Ren committed 2026-09-13 13:53:20 +08:00
1 parent 78ae5ff94f
commit 3a14935eb1
2 files changed
+14 -2

No files matched your search

+4 -1
View File
@@ -44,7 +44,10 @@ export function useComposerMentionInput({
}, [inputRef]);
const selectRaw = useCallback((start: number, end = start) => {
inputRef.current?.setSelectionRange(
const el = inputRef.current;
// Focus first: removing a queued prompt's edit button can reset a blurred selection.
el?.focus();
el?.setSelectionRange(
mentionTextOffset(textRef.current, start, "toDisplay", "start"),
mentionTextOffset(textRef.current, end, "toDisplay", "end"),
);