Compare commits

...

3 Commits

Author SHA1 Message Date
mac
a2f009f986 v2.1.30 — 修复备注保存丢失:row引用改用全局变量 2026-07-28 16:42:14 +08:00
mac
30904723d2 v2.1.29 — 备注弹窗放大到720px/300px 2026-07-28 16:40:20 +08:00
mac
07fa69478f v2.1.28 — 备注按钮常规模式也显示 2026-07-28 16:39:06 +08:00
3 changed files with 14 additions and 12 deletions

View File

@@ -372,31 +372,34 @@
renumberMorning();
}
var noteModalRow = null;
window.openNoteModal = function(btn) {
var row = btn.closest('.item-row');
var noteEl = row.querySelector('.item-note-val');
var input = row.querySelector('input[type="text"]');
noteModalRow = btn.closest('.item-row');
var noteEl = noteModalRow.querySelector('.item-note-val');
var input = noteModalRow.querySelector('input[type="text"]');
var title = input ? input.value.trim() || '未命名任务' : '备注';
document.getElementById('note-modal-title').textContent = title;
document.getElementById('note-modal-textarea').value = noteEl ? noteEl.value : '';
document.getElementById('note-modal').style.display = 'flex';
document.getElementById('note-modal').dataset.rowIndex = Array.prototype.indexOf.call(row.parentElement.children, row);
};
window.saveNoteModal = function() {
var modal = document.getElementById('note-modal');
var row = document.querySelectorAll('#morning-list .item-row')[parseInt(modal.dataset.rowIndex)];
var noteEl = row.querySelector('.item-note-val');
var btn = row.querySelector('.btn-note-toggle');
if (!noteModalRow) return;
var noteEl = noteModalRow.querySelector('.item-note-val');
var btn = noteModalRow.querySelector('.btn-note-toggle');
var val = document.getElementById('note-modal-textarea').value.trim();
if (noteEl) noteEl.value = val;
if (val) { btn.classList.add('has-note'); } else { btn.classList.remove('has-note'); }
if (btn) { if (val) { btn.classList.add('has-note'); } else { btn.classList.remove('has-note'); } }
modal.style.display = 'none';
noteModalRow = null;
triggerAutoSave();
};
window.closeNoteModal = function() {
document.getElementById('note-modal').style.display = 'none';
noteModalRow = null;
};
function renumberMorning() {

View File

@@ -1819,8 +1819,7 @@ body {
.evening-drag { position: absolute; left: 6px; top: 8px; }
/* 任务备注 */
.btn-note-toggle { display: none; background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; transition: all 0.15s; flex-shrink: 0; }
.card.editing .btn-note-toggle { display: inline-flex; }
.btn-note-toggle { display: inline-flex; background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; transition: all 0.15s; flex-shrink: 0; }
.btn-note-toggle:hover { background: var(--bg); }
.btn-note-toggle.has-note { color: var(--primary); }
.item-note { display: none; width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-family: inherit; color: var(--text); background: var(--bg); resize: vertical; min-height: 28px; box-sizing: border-box; margin-top: 6px; }

View File

@@ -36,13 +36,13 @@
<!-- 备注编辑弹窗 -->
<div class="sync-modal-overlay" id="note-modal" style="display:none">
<div class="sync-modal" style="max-width:420px">
<div class="sync-modal" style="max-width:720px">
<div class="sync-modal-header">
<h3 id="note-modal-title">备注</h3>
<button class="sync-modal-close" onclick="closeNoteModal()">&times;</button>
</div>
<div style="padding:16px">
<textarea id="note-modal-textarea" style="width:100%; min-height:120px; padding:10px; border:1px solid var(--border); border-radius:8px; font-size:14px; font-family:inherit; resize:vertical; box-sizing:border-box" placeholder="写点备注…"></textarea>
<textarea id="note-modal-textarea" style="width:100%; min-height:300px; padding:12px; border:1px solid var(--border); border-radius:8px; font-size:14px; font-family:inherit; line-height:1.6; resize:vertical; box-sizing:border-box" placeholder="写点备注…"></textarea>
</div>
<div class="sync-modal-footer">
<button class="btn-wish-cancel" onclick="closeNoteModal()">取消</button>