${highlight(formatBody(n.body))}
+ ${highlight(renderBody(n.body))}
${extra.length ? `${extra.map((t) => ``).join('')}
` : ''}
${att ? `${att}
` : ''}
@@ -815,6 +951,7 @@ function noteHtml(n, compact = false) {
${n._queued ? 'waiting to sync' : ''}
${n.pinned ? `${ICON.pin}` : ''}
${n.archived_at ? 'archived' : ''}
+ ${progressLabel(n.body)}
@@ -831,7 +968,7 @@ function noteHtml(n, compact = false) {
function renderFeed() {
const feed = $('#feed');
if (!state.notes.length) {
- const filtered = state.tag || state.pinned || state.query;
+ const filtered = state.tag || state.pinned || state.todo || state.query;
feed.innerHTML = state.loading ? '' : state.archived && !filtered
? '
`;
}).join('') + 'No archived notesUse the box icon on a note to archive it. It leaves your feed but stays searchable.
'
: `${filtered ? 'Nothing matches' : 'Your feed is empty'}${filtered ? 'Try a different search or tag.' : 'Type a thought above and hit Enter. Add #tags to file it.'}
`;
@@ -842,7 +979,7 @@ function renderFeed() {
if (d !== lastDay) { html += `${esc(d)}
`; lastDay = d; }
html += noteHtml(n);
}
- feed.innerHTML = html;
+ withAddFocus(() => { feed.innerHTML = html; });
hydrateAttachments(feed);
}
$('#load-more').classList.toggle('hidden', !state.hasMore);
@@ -858,6 +995,7 @@ function renderStatus(loading) {
if (q) bits.push(`${q} note${q > 1 ? 's' : ''} waiting to sync`);
if (state.tag) bits.push(`Showing `);
else if (state.pinned) bits.push('Showing pinned notes ');
+ else if (state.todo) bits.push('Showing notes with open checklist items ');
else if (state.archived) bits.push('Showing archived notes ');
if (state.query && !loading) bits.push(`${state.notes.length}${state.hasMore ? '+' : ''} result${state.notes.length === 1 ? '' : 's'}`);
el.innerHTML = bits.join(' ');
@@ -866,8 +1004,9 @@ function renderStatus(loading) {
function renderTags() {
const total = state.tags.reduce((a, t) => a + Number(t.count), 0);
- let html = ``;
+ let html = ``;
html += ``;
+ html += ``;
html += ``;
for (const t of state.tags) {
html += ``;
@@ -883,8 +1022,18 @@ const compose = $('#compose');
function autosize() { compose.style.height = 'auto'; compose.style.height = Math.min(compose.scrollHeight, 320) + 'px'; }
compose.addEventListener('input', autosize);
compose.addEventListener('keydown', (e) => {
+ if (continueChecklist(compose, e)) return;
+ if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) { e.preventDefault(); submitCompose(); return; }
if (e.key === 'Enter' && !e.shiftKey && !e.isComposing && !matchMedia('(hover: none)').matches) { e.preventDefault(); submitCompose(); }
});
+$('#list-btn').onclick = () => {
+ const v = compose.value;
+ const prefix = !v ? '- [ ] ' : (v.endsWith('\n') ? '' : '\n') + '- [ ] ';
+ compose.value = v + prefix;
+ compose.focus();
+ compose.setSelectionRange(compose.value.length, compose.value.length);
+ autosize();
+};
if (matchMedia('(hover: none)').matches) $('#compose-hint').classList.add('hidden');
$('#send-btn').onclick = submitCompose;
$('#attach-btn').onclick = () => $('#file-input').click();
@@ -954,7 +1103,7 @@ document.addEventListener('click', async (e) => {
const tagBtn = e.target.closest('[data-tag]');
if (tagBtn && !e.target.closest('.board-picker')) { setFilter({ tag: tagBtn.dataset.tag }); return; }
const f = e.target.closest('[data-filter]');
- if (f) { setFilter(f.dataset.filter === 'pinned' ? { pinned: true } : f.dataset.filter === 'archived' ? { archived: true } : {}); return; }
+ if (f) { setFilter(f.dataset.filter === 'pinned' ? { pinned: true } : f.dataset.filter === 'archived' ? { archived: true } : f.dataset.filter === 'todo' ? { todo: true } : {}); return; }
const actEl = e.target.closest('[data-act]');
if (!actEl) return;
const act = actEl.dataset.act;
@@ -1012,6 +1161,7 @@ async function archiveNote(note, archive, quiet = false) {
document.addEventListener('keydown', (e) => {
if (e.target.id === 'edit-text') {
+ if (continueChecklist(e.target, e)) return;
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) { e.preventDefault(); const n = findNote(state.editing); if (n) saveEdit(n); }
if (e.key === 'Escape') { state.editing = null; rerender(); }
}
@@ -1063,8 +1213,8 @@ function openLightbox(src) {
// ------------------------------------------------------------------
// Filters, search, views
// ------------------------------------------------------------------
-function setFilter({ tag = null, pinned = false, archived = false }) {
- state.tag = tag; state.pinned = pinned; state.archived = archived;
+function setFilter({ tag = null, pinned = false, archived = false, todo = false }) {
+ state.tag = tag; state.pinned = pinned; state.archived = archived; state.todo = todo;
if (state.view !== 'feed') switchView('feed');
renderTags(); loadNotes(true);
window.scrollTo({ top: 0, behavior: 'smooth' });
@@ -1160,7 +1310,7 @@ function renderBoard() {
${notes.map((n) => noteHtml(n, true)).join('') || '
Empty
'}