Wiki Links support

This commit is contained in:
2026-04-21 19:50:16 +02:00
parent 9639a70572
commit e0d2fb0b41
7 changed files with 478 additions and 5 deletions
+25
View File
@@ -0,0 +1,25 @@
function movePage() {
const current = window.location.pathname;
const target = prompt('Move this page to (absolute path):', current);
if (target === null) return;
const clean = target.trim();
if (!clean || !clean.startsWith('/')) {
alert('Move target must be an absolute path starting with /');
return;
}
const form = document.createElement('form');
form.method = 'POST';
form.action = current + '?move=' + encodeURIComponent(clean);
document.body.appendChild(form);
form.submit();
}
function deletePage() {
const current = window.location.pathname;
if (!confirm('Delete ' + current + ' and everything inside it?')) return;
const form = document.createElement('form');
form.method = 'POST';
form.action = current + '?delete=1';
document.body.appendChild(form);
form.submit();
}
+5
View File
@@ -9,6 +9,7 @@
<link rel="preload" href="/_/fonts/IosevkaSlab.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="/_/style.css" />
<script src="/_/global-shortcuts.js"></script>
<script src="/_/page-actions.js"></script>
</head>
<body>
<header>
@@ -24,6 +25,10 @@
{{else if .CanEdit}}
<button class="btn" onclick="newPage()" title="New page (N)">NEW</button>
<a class="btn" href="?edit" title="Edit page (E)">EDIT</a>
{{if not .IsRoot}}
<button class="btn" onclick="movePage()" title="Move page">MOVE</button>
<button class="btn danger" onclick="deletePage()" title="Delete page">DELETE</button>
{{end}}
{{end}}
</header>
<main>
+17
View File
@@ -59,6 +59,15 @@ a:hover {
color: var(--link-hover);
}
/* Broken wiki link: target folder does not exist */
.content a.broken {
color: var(--primary-hover);
text-decoration: line-through;
}
.content a.broken:hover {
color: var(--link-hover);
}
/* === Header === */
header {
padding: 0.75rem 1rem;
@@ -124,6 +133,14 @@ header {
padding: 0 0.15rem;
}
/* Destructive action */
.danger {
color: var(--primary-hover);
}
.danger:hover {
color: var(--link-hover);
}
/* === Main === */
main {
max-width: 860px;