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();