fix(composer): preserve send-button sync under scheduled resize (#4042)

This commit is contained in:
Rod Boev
2026-06-12 08:18:04 -04:00
parent 768ea5ee87
commit 7795f29946
3 changed files with 13 additions and 3 deletions

View File

@@ -1288,6 +1288,7 @@ $('modelSelect').onchange=async()=>{
}
};
$('msg').addEventListener('input',()=>{
updateSendBtn();
scheduleComposerAutoResize();
// Persist composer draft to server (debounced in _saveComposerDraft).
const sid = S && S.session && S.session.session_id;

View File

@@ -3869,9 +3869,17 @@ function transcript(){
}
let _composerAutoResizeRaf=0;
function autoResize(){const el=$('msg');el.style.height='auto';el.style.height=Math.min(el.scrollHeight,200)+'px';updateSendBtn();}
function scheduleComposerAutoResize(){
function autoResize(){
if(_composerAutoResizeRaf && typeof cancelAnimationFrame==='function'){
cancelAnimationFrame(_composerAutoResizeRaf);
_composerAutoResizeRaf=0;
}
const el=$('msg');
el.style.height='auto';
el.style.height=Math.min(el.scrollHeight,200)+'px';
updateSendBtn();
}
function scheduleComposerAutoResize(){
if(typeof requestAnimationFrame!=='function'){autoResize();return;}
if(_composerAutoResizeRaf) return;
_composerAutoResizeRaf=requestAnimationFrame(()=>{