rename page

This commit is contained in:
2026-05-18 12:45:57 +08:00
parent 18fc9849a3
commit f3527c889b
12 changed files with 1212 additions and 18 deletions

View File

@@ -402,12 +402,21 @@ async function openSettings(slug) {
listEl.innerHTML = '<li class="no-pages">尚無頁面</li>';
} else {
listEl.innerHTML = pages.map(p => `
<li class="page-item">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
${escHtml(p)}
<li class="page-item" style="justify-content: space-between; display: flex; align-items: center; margin-bottom: 0.4rem;">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="color: var(--accent);">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
<span>${escHtml(p)}</span>
</div>
<a href="/editor/${slug}?page=${escHtml(p)}" class="btn btn-primary btn-sm" style="padding: 0.2rem 0.6rem; font-size: 0.75rem; gap: 0.25rem; border-radius: var(--radius-sm);">
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<path d="M11 4H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
編輯
</a>
</li>`).join('');
}
} catch(e) {

View File

@@ -2165,8 +2165,8 @@
<!-- media gallery -->
<link href="/static/Vvvebjs/libs/media/media.css" rel="stylesheet">
<script>
window.mediaPath = '../../media';
Vvveb.themeBaseUrl = 'demo/landing/';
window.mediaPath = '/static/Vvvebjs/media/';
Vvveb.themeBaseUrl = '/static/Vvvebjs/demo/landing/';
</script>
<script src="/static/Vvvebjs/libs/media/media.js"></script>
<!--
@@ -2262,6 +2262,14 @@ let defaultPages = {% endraw %}{{ pages_json | safe }}{% raw %};
let pages = defaultPages;
let firstPage = Object.keys(pages)[0];
const urlParams = new URLSearchParams(window.location.search);
const requestedPage = urlParams.get('page');
if (requestedPage) {
let pageKey = requestedPage.replace(".html", "");
if (pages[pageKey]) {
firstPage = pageKey;
}
}
Vvveb.Builder.init(pages[firstPage]["url"], function () {
//load code after page is loaded here
});
@@ -2313,7 +2321,7 @@ Vvveb.Breadcrumb.init();
// Inject project slug for save bridge
window.VVVEB_PROJECT_SLUG = "{% endraw %}{{ slug | safe }}{% raw %}";
</script>
<script src="/static/js/my-editor.js"></script>
<script src="/static/js/my-editor.js?v={% endraw %}{{ range(1, 100000) | random }}{% raw %}"></script>
</body>