Allow editing of individual sections

This commit is contained in:
2026-04-15 12:14:40 +02:00
parent b3ca714597
commit 02fa19272d
7 changed files with 104 additions and 2 deletions

16
assets/sections.js Normal file
View File

@@ -0,0 +1,16 @@
(function () {
var content = document.querySelector('.content');
if (!content) return;
var headings = content.querySelectorAll('h1, h2, h3, h4, h5, h6');
if (!headings.length) return;
// Section 0 is pre-heading content, editable via full-page edit.
// Sections 1..N each start at a heading; that is the index sent to the server.
headings.forEach(function (h, i) {
var a = document.createElement('a');
a.href = '?edit&section=' + (i + 1);
a.className = 'btn btn-small section-edit';
a.textContent = 'edit';
h.appendChild(a);
});
}());