Fix page creation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user