diff --git a/xian_favor/api.py b/xian_favor/api.py index ede87fc..96b6ead 100644 --- a/xian_favor/api.py +++ b/xian_favor/api.py @@ -1087,18 +1087,38 @@ INDEX_TEMPLATE = ''' .folder-list a i { margin-right: 5px; } .folder-list .folder-item { display: flex; + align-items: center; padding: 6px 10px; + position: relative; } .folder-list .folder-item a { - padding: 0 10px; + padding: 6px 10px; flex-grow: 1; + display: flex; + align-items: center; } .folder-list .folder-actions { + position: absolute; + right: 10px; display: none; + gap: 4px; + background: #343a40; + padding: 4px 8px; + border-radius: 4px; } .folder-list .folder-item:hover .folder-actions { display: flex; - gap: 2px; + } + .folder-list .folder-actions .btn { + padding: 2px 6px; + font-size: 12px; + line-height: 1; + } + .folder-list .folder-item:hover { + background: #495057; + } + .folder-list .folder-item:hover a { + color: #fff; } .folder-action { font-size: 12px; @@ -2664,6 +2684,9 @@ function showAddModal(type) { // 设置类型 document.getElementById('addType').value = type; + // 重置文件夹ID(从顶部按钮添加时不指定文件夹) + currentAddFolderId = null; + // 只有不是编辑草稿时才重置 // currentDraftId 在 editDraft 中已设置,不要覆盖 @@ -2720,7 +2743,8 @@ async function addItem() { due_date: type === 'todo' ? document.getElementById('addDueDate').value : null, note: document.getElementById('addNote').value, tags: document.getElementById('addTags').value.split(',').map(t => t.trim()).filter(t => t), - is_starred: document.getElementById('addStarred').checked + is_starred: document.getElementById('addStarred').checked, + folder_id: currentAddFolderId // 如果从文件夹添加,带上文件夹ID }; const res = await fetch(`${API_BASE}/items`, { @@ -2741,6 +2765,7 @@ async function addItem() { stopAutoSave(); hideDraftIndicator(); + currentAddFolderId = null; // 重置文件夹ID refreshData(); } } @@ -4194,10 +4219,13 @@ function renderFolderList(type) { ${f.name} (${f.item_count || 0})