Fix page creation

This commit is contained in:
2026-04-13 13:07:20 +02:00
parent 95ca30509c
commit 19017bf136
4 changed files with 44 additions and 3 deletions

View File

@@ -1,3 +1,10 @@
function newPage() {
const name = prompt('New page name:');
if (!name || !name.trim()) return;
const slug = name.trim().replace(/\s+/g, '-');
window.location.href = window.location.pathname + slug + '/?edit';
}
(function () {
document.addEventListener('keydown', function (e) {
if (!e.altKey || !e.shiftKey) return;
@@ -5,7 +12,11 @@
case 'E':
e.preventDefault();
window.location.href = window.location.pathname + '?edit';
break;
break;
case 'N':
e.preventDefault();
newPage();
break;
}
});
})();