Merge pull request #254 from multica-ai/NevilleQingNY/sync-remote

fix(web): delay TitleEditor autofocus for Dialog animation
This commit is contained in:
Naiyuan Qing 2026-04-01 14:35:00 +08:00 committed by GitHub
commit fe963d672d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,11 +117,13 @@ const TitleEditor = forwardRef<TitleEditorRef, TitleEditorProps>(
},
});
// Auto-focus after mount
// Auto-focus after mount — delay to wait for Dialog open animation
useEffect(() => {
if (autoFocus && editor) {
// Move cursor to end
editor.commands.focus("end");
const timer = setTimeout(() => {
editor.commands.focus("end");
}, 50);
return () => clearTimeout(timer);
}
}, [autoFocus, editor]);