Unify modals

This commit is contained in:
2026-04-22 18:26:31 +02:00
parent 7c0d856081
commit 093b5c2ef0
6 changed files with 337 additions and 49 deletions
+8 -11
View File
@@ -1,10 +1,3 @@
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;
@@ -12,11 +5,15 @@ function newPage() {
case 'E':
e.preventDefault();
window.location.href = window.location.pathname + '?edit';
break;
break;
case 'N':
e.preventDefault();
newPage();
break;
e.preventDefault();
if (typeof newPage === 'function') newPage();
break;
case 'M':
e.preventDefault();
if (window.location.pathname !== '/' && typeof movePage === 'function') movePage();
break;
}
});
})();