From 7e7e7d10e5e39bfed4f7b564784af71f22ff44e0 Mon Sep 17 00:00:00 2001 From: ylhan Date: Mon, 21 Sep 2026 21:43:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BC=96=E8=BE=91=E4=BF=9D=E5=AD=98/?= =?UTF-8?q?=E5=8F=96=E6=B6=88/=E8=BF=94=E5=9B=9E=E5=9D=87=E5=9B=9E?= =?UTF-8?q?=E5=88=B0=E5=88=97=E8=A1=A8=E9=A1=B5,=20=E6=94=BE=E5=A4=A7?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A1=86(min-height:60vh)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xinquan/app.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/xinquan/app.py b/xinquan/app.py index f3c246f..eb5aad3 100644 --- a/xinquan/app.py +++ b/xinquan/app.py @@ -125,7 +125,7 @@ INDEX_HTML = r""" .editor label{display:block;font-weight:600;margin-bottom:6px} .editor input[type=text]{width:100%;padding:10px 12px;border-radius:10px;border:1px solid var(--border); background:var(--card);color:var(--text);font-size:15px} - .editor textarea{width:100%;min-height:320px;padding:12px;border-radius:10px;border:1px solid var(--border); + .editor textarea{width:100%;min-height:60vh;padding:12px;border-radius:10px;border:1px solid var(--border); background:var(--card);color:var(--text);font-size:14px;font-family:ui-monospace,Consolas,monospace;line-height:1.6} .drop{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px} .bar-row{display:flex;gap:8px;flex-wrap:wrap} @@ -167,7 +167,8 @@ function fmt(ts){ if(!ts)return ''; try{return new Date(ts).toLocaleString('zh-C async function loadPages(){ state.pages = await api('/api/pages'); - if(state.mode==='list') renderList(); + state.mode='list'; + renderList(); } function renderList(){ $('#topActions').innerHTML = ``; @@ -194,11 +195,8 @@ async function openPage(id){ }catch(e){ toast('打开失败: '+e.message); } } let editingId=null; -function newPage(){ editingId=null; state.content=''; startEdit(''); } -function editPage(id){ editingId=id; openPage(id).then(()=>{ state.content=''; startEdit(''); }); } -function startEdit(_){ // placeholder - beginEdit(editingId); -} +function newPage(){ editingId=null; beginEdit(null); } +function editPage(id){ editingId=id; beginEdit(id); } function beginEdit(id){ (id? api('/api/pages/'+encodeURIComponent(id)):Promise.resolve({title:'',content:''})).then(p=>{ $('#topActions').innerHTML=` @@ -253,7 +251,7 @@ async function delPage(id){ try{ await api('/api/pages/'+encodeURIComponent(id),{method:'DELETE'}); toast('已删除'); loadPages(); } catch(e){ toast('删除失败: '+e.message); } } -function cancelEdit(){ state.mode='view'; loadPages().then(()=>{ /* keep list */ }); } +function cancelEdit(){ loadPages(); } if(umarked){ document.addEventListener('DOMContentLoaded',()=>toast('Markdown 渲染库加载失败,回退为纯文本')); } loadPages();