Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2f009f986 | ||
|
|
30904723d2 |
@@ -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() {
|
||||
|
||||
@@ -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()">×</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>
|
||||
|
||||
Reference in New Issue
Block a user