From b27d4f2069467887cf54b582de422c7fbfdbfc40 Mon Sep 17 00:00:00 2001 From: Codebuddy Date: Mon, 7 Sep 2026 17:35:09 +0800 Subject: [PATCH] =?utf8?q?fix(frontend):=20=E7=BC=96=E8=BE=91=E4=BB=BB?= =?utf8?q?=E5=8A=A1=E5=90=8D=E7=A7=B0=E6=97=B6=E6=9A=82=E5=81=9C=E5=88=97?= =?utf8?q?=E8=A1=A8=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0=EF=BC=8C=E9=81=BF?= =?utf8?q?=E5=85=8D=E8=BE=93=E5=85=A5=E6=A1=86=E8=A2=AB=E5=88=B7=E6=96=B0?= =?utf8?q?=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- frontend/index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/index.html b/frontend/index.html index 9f9b250..46c2a3d 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -638,6 +638,7 @@ body { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; heigh // 列表页自动刷新:进入时启动,离开/退出时停止 let pickerTimer = null; let pickerRefreshing = false; + let editingTaskId = null; // 正在内联编辑的任务 id;非 null 时暂停自动刷新重建,避免打断输入 function startPickerRefresh() { stopPickerRefresh(); pickerTimer = setInterval(refreshTasks, 5000); @@ -647,6 +648,7 @@ body { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; heigh } async function refreshTasks() { if (pickerRefreshing) return; + if (editingTaskId) return; // 正在编辑任务名称/描述/分组,跳过本轮重建,避免输入框被刷新清空 pickerRefreshing = true; try { await renderTasks(); @@ -887,6 +889,7 @@ body { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; heigh // 进入卡片内联编辑模式:编辑名称、描述与所属分组 function enterEditMode(card, t) { + editingTaskId = t.id; const curGroup = t.group || ''; const groupOpts = '' + groupsCache.map(g => @@ -911,7 +914,7 @@ body { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; heigh descInput.addEventListener('input', updateCounter); nameInput.focus(); nameInput.select(); - card.querySelector('.tc-cancel').onclick = () => renderTasks(); + card.querySelector('.tc-cancel').onclick = () => { editingTaskId = null; renderTasks(); }; card.querySelector('.tc-save').onclick = async () => { const newName = nameInput.value.trim(); const newDesc = descInput.value; @@ -922,6 +925,7 @@ body { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; heigh body: JSON.stringify({ name: newName, description: newDesc, group: newGroup }), }); if (!res.ok) { const d = await res.json().catch(()=>({})); alert(d.error || '保存失败'); return; } + editingTaskId = null; await renderTasks(); }; } -- 2.43.0