diff --git a/browse/js/preview-markdown.js b/browse/js/preview-markdown.js index 30a665d..bd22c82 100644 --- a/browse/js/preview-markdown.js +++ b/browse/js/preview-markdown.js @@ -450,11 +450,14 @@ // discarding the value. Populated by renderIdentityCue(). var fmWarn = document.createElement('div'); fmWarn.className = 'md-fm__warn'; - fmWarn.hidden = true; + // Visibility is controlled via style.display (toggled in + // renderIdentityCue), NOT the `hidden` attribute: an inline + // display:flex outranks [hidden]{display:none}, which would leave an + // empty box on screen whenever the cue has nothing to say. fmWarn.style.cssText = 'color:#92400e;background:#fffbeb;border:1px solid ' + '#fcd34d;border-radius:4px;padding:6px 8px;margin:0 0 4px;font-size:' - + '0.78rem;line-height:1.5;display:flex;flex-wrap:wrap;align-items:' - + 'center;gap:6px;'; + + '0.78rem;line-height:1.5;flex-wrap:wrap;align-items:center;gap:6px;' + + 'display:none;'; fmSection.appendChild(fmHeader); fmSection.appendChild(fmWarn); fmSection.appendChild(fmBody); @@ -822,7 +825,7 @@ function renderIdentityCue() { while (fmWarn.firstChild) fmWarn.removeChild(fmWarn.firstChild); var fid = filenameIdentity(node.name); - if (!fid || !canSave(node)) { fmWarn.hidden = true; return; } + if (!fid || !canSave(node)) { fmWarn.style.display = 'none'; return; } var data = parseFrontMatter('---\n' + fmTextarea.value + '\n---\n').data || {}; var edits = []; IDENTITY_FIELDS.forEach(function (f) { @@ -831,7 +834,7 @@ var want = String(fid[f.fm] == null ? '' : fid[f.fm]).trim(); if (got !== '' && got !== want) edits.push(f.label + ' → “' + got + '”'); }); - if (!edits.length) { fmWarn.hidden = true; return; } + if (!edits.length) { fmWarn.style.display = 'none'; return; } var msg = document.createElement('span'); msg.textContent = '✎ Identity comes from the filename. You changed ' + edits.join(', ') + '. '; @@ -846,7 +849,7 @@ btn.addEventListener('click', function () { renameToMatch(newName); }); fmWarn.appendChild(btn); } - fmWarn.hidden = false; + fmWarn.style.display = 'flex'; } // Rename action: persist the current buffer (so body edits aren't @@ -911,8 +914,12 @@ renderIdentityCue(); // initial state on load (clean after sync-on-open) // If sync-on-open corrected the front matter, open the buffer dirty so - // a save bakes the filename-derived identity in. - if (writableMode && fmTextarea.value !== onDiskFM) markDirty(true); + // a save bakes the filename-derived identity in — and say so, since the + // change is otherwise silent (the values just match the filename now). + if (writableMode && fmTextarea.value !== onDiskFM) { + markDirty(true); + statusEl.textContent = 'Front matter synced to filename — review and save'; + } // ── Save ─────────────────────────────────────────────────────────── // Mark a successful write: adopt the new server ETag (so the next