diff --git a/frontend/editor-poc.html b/frontend/editor-poc.html
index 62ad454..33d18e3 100644
--- a/frontend/editor-poc.html
+++ b/frontend/editor-poc.html
@@ -455,15 +455,19 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
return;
}
statFile.textContent = 'Loading...';
- fetch('/api/file/' + encodeURIComponent(fileVault) + '?path=' + encodeURIComponent(filePath))
+ fetch('/api/file/' + encodeURIComponent(fileVault) + '/raw?path=' + encodeURIComponent(filePath))
.then(function(r) {
if (!r.ok) throw new Error('HTTP ' + r.status);
return r.json();
})
.then(function(data) {
- ta.value = data.content || data.raw || '';
+ ta.value = data.raw || '';
originalContent = ta.value;
- document.getElementById('poc-title').value = data.title || filePath.split('/').pop().replace(/\.md$/, '');
+ // Extract title from first # heading or filename
+ var title = filePath.split('/').pop().replace(/\.md$/, '');
+ var m = ta.value.match(/^#\s+(.+)/m);
+ if (m) title = m[1];
+ document.getElementById('poc-title').value = title;
statFile.textContent = fileVault + '/' + filePath;
updateStats();
schedulePreview();