#14 follow-up: keep in-progress edit text as a draft when leaving a chat mid-edit
persistCurrentDraft() no longer skips while editing — leaving a chat mid-edit abandons the edit (openConvo clears editTarget) but now keeps whatever's in the composer as that chat's draft, so your typing isn't lost. It returns as a normal draft (sending posts a new message, not an edit). The edit-cancel (X) path still restores the pre-edit draft, unchanged. Verified with puppeteer: edit "hi bob" -> "hi bob EDITED" -> switch chats -> back -> composer holds "hi bob EDITED" (PASS). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3423,8 +3423,10 @@ function setDraft(kind,id,val){ try{ if(val&&val.trim()) localStorage.setItem(dr
|
||||
// #14: GUARANTEED save of the currently-open chat's draft — called the instant we leave it (switching chats
|
||||
// OR going back to the list). The per-keystroke 'input' save can be missed on mobile (predictive text / a
|
||||
// fast tap-away fires no final input event), which lost the whole draft on switch-and-return. Snapshotting
|
||||
// the composer value at leave-time makes it reliable regardless. Skipped while editing (that's not a draft).
|
||||
function persistCurrentDraft(){ try{ if(selected && !editTarget){ const inp=document.getElementById('msgInput'); if(inp) setDraft(selected.kind, selected.id, inp.value); } }catch(_){} }
|
||||
// the composer value at leave-time makes it reliable regardless. This ALSO covers leaving mid-EDIT: the edit
|
||||
// is abandoned (openConvo clears editTarget), and whatever's in the composer is kept as that chat's draft so
|
||||
// your typing isn't lost — it just returns as a normal draft (sending it posts a new message, not an edit).
|
||||
function persistCurrentDraft(){ try{ if(selected){ const inp=document.getElementById('msgInput'); if(inp) setDraft(selected.kind, selected.id, inp.value); } }catch(_){} }
|
||||
// Compositor-only open slide (workflow-verified). armOpenSlide() runs AFTER openConvo's synchronous
|
||||
// render: it pins the pane off-screen (chat-opening), lets a frame paint it, then adds .chat-anim on a
|
||||
// double-rAF so the compositor runs the 300ms transform with the main thread idle. All scrollTop/innerHTML
|
||||
|
||||
Reference in New Issue
Block a user