Prepare LaySite 1.5.0 canvas and publishing improvements
This commit is contained in:
@@ -6,6 +6,7 @@ $e = View::escape(...);
|
||||
<a class="back-link" href="/admin/articles">返回文章列表</a>
|
||||
<header class="admin-heading"><h1>文章分类</h1></header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<?php if ($deleted): ?><p class="feedback success" data-save-confirmation role="status">分类已删除。</p><?php endif ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/article-categories">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<div class="form-grid">
|
||||
@@ -14,8 +15,19 @@ $e = View::escape(...);
|
||||
</div>
|
||||
<div class="form-submit"><button class="button button-primary" type="submit">创建分类</button></div>
|
||||
</form>
|
||||
<nav class="filter-nav" aria-label="查看分类">
|
||||
<?php foreach ($categories as $key => $label): ?>
|
||||
<a href="/admin/articles?category=<?= $e($key) ?>"><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<section class="admin-panel">
|
||||
<h2>已有分类</h2>
|
||||
<?php if (!$categories): ?><p class="field-note">暂无文章分类。</p><?php endif ?>
|
||||
<ul class="admin-list">
|
||||
<?php foreach ($categories as $key => $label): ?>
|
||||
<li>
|
||||
<a href="/admin/articles?category=<?= $e($key) ?>"><?= $e($label) ?></a>
|
||||
<form method="post" action="/admin/article-categories/<?= $e($key) ?>/delete">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<button type="submit" class="button button-outline destructive-action"
|
||||
data-confirm="<?= $e('删除「' . $label . '」后,文章会保留,引用该分类的动态组件将移除这个分类。') ?>"><?= View::fragment('studio-icon', ['icon' => 'delete']) ?>删除分类</button>
|
||||
</form>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
@@ -6,6 +6,7 @@ $checked = array_fill_keys($selected, true);
|
||||
?>
|
||||
<fieldset class="category-checks">
|
||||
<legend><?= $e($legend) ?></legend>
|
||||
<?php if (!$categories): ?><p class="field-note">暂无分类。</p><?php endif ?>
|
||||
<div>
|
||||
<?php foreach ($categories as $key => $label): ?>
|
||||
<label><input type="checkbox" name="<?= $e($name) ?>[]" value="<?= $e($key) ?>" <?= isset($checked[$key]) ? 'checked' : '' ?>> <?= $e($label) ?></label>
|
||||
|
||||
@@ -22,6 +22,7 @@ foreach (['header', 'footer'] as $kind) {
|
||||
<a class="button button-outline" href="/admin/articles/new"><?= View::fragment('studio-icon', ['icon' => 'edit']) ?>写文章</a>
|
||||
</div>
|
||||
</header>
|
||||
<?php if ($deleted): ?><p class="feedback success" data-save-confirmation role="status">页面已删除。</p><?php endif ?>
|
||||
<div class="dashboard-grid">
|
||||
<section class="admin-panel dashboard-pages" aria-labelledby="pages-title" data-page-list>
|
||||
<div class="admin-heading compact">
|
||||
@@ -64,6 +65,14 @@ foreach (['header', 'footer'] as $kind) {
|
||||
'icon' => $public ? 'external' : 'preview',
|
||||
'label' => ($public ? '查看公开页面' : '预览页面') . ' · ' . $page['name'],
|
||||
]) ?>
|
||||
<?php if ($page['slug'] !== 'home'): ?>
|
||||
<form method="post" action="/admin/pages/<?= $e($page['slug']) ?>/delete">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($page['version']) ?>">
|
||||
<button class="button button-outline admin-view-link destructive-action" type="submit"
|
||||
title="删除页面" aria-label="删除页面" data-confirm="<?= $e('确定删除「' . $page['name'] . '」?此操作不可撤销。') ?>"><?= View::fragment('studio-icon', ['icon' => 'delete']) ?></button>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
|
||||
@@ -16,7 +16,9 @@ $e = View::escape(...);
|
||||
<?php if (!$items): ?><p class="field-note">暂无自定义配色。</p><?php endif ?>
|
||||
<ul class="admin-list">
|
||||
<?php foreach ($items as $item): ?>
|
||||
<li><strong><?= $e($item['name']) ?></strong>
|
||||
<li><div class="palette-name"><strong><?= $e($item['name']) ?></strong>
|
||||
<?= View::fragment('palette-swatches', ['colors' => $item['colors']]) ?>
|
||||
</div>
|
||||
<a class="button button-outline" href="/admin/design/palette/<?= $e($item['id']) ?>"><?= View::fragment('studio-icon', ['icon' => 'edit']) ?>编辑</a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
|
||||
@@ -20,10 +20,10 @@ $active = match (true) {
|
||||
<link rel="icon" href="<?= $e(Assets::DEFAULT_ICON) ?>" type="image/webp">
|
||||
<title><?= $e($title) ?> CMS</title>
|
||||
<link rel="stylesheet" href="/assets/site.css">
|
||||
<link rel="stylesheet" href="/assets/admin.css">
|
||||
<link rel="stylesheet" href="/assets/admin.css?v=<?= $e($laysiteVersion) ?>">
|
||||
<script src="<?= $e(Assets::JQUERY) ?>" defer></script>
|
||||
<script src="/assets/admin.js" defer></script>
|
||||
<script src="/assets/studio.js" defer></script>
|
||||
<script src="/assets/admin.js?v=<?= $e($laysiteVersion) ?>" defer></script>
|
||||
<script src="/assets/studio.js?v=<?= $e($laysiteVersion) ?>" defer></script>
|
||||
<?php if ($adminPath === '/admin/about'): ?>
|
||||
<script src="/assets/admin-about.js" defer></script>
|
||||
<?php endif ?>
|
||||
@@ -66,7 +66,7 @@ $active = match (true) {
|
||||
<a href="/admin/design"<?= $active === 'settings' ? ' aria-current="page"' : '' ?>>站点设计</a>
|
||||
</nav>
|
||||
<div class="admin-utility">
|
||||
<?= View::fragment('admin-view-link', ['href' => '/', 'icon' => 'globe']) ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => '/', 'icon' => 'website', 'label' => '访问网站']) ?>
|
||||
<details class="admin-account">
|
||||
<summary><?= View::fragment('studio-icon', ['icon' => 'account']) ?>账户<?= View::fragment('studio-icon', ['icon' => 'chevron']) ?></summary>
|
||||
<div class="admin-account-menu">
|
||||
@@ -81,7 +81,7 @@ $active = match (true) {
|
||||
</details>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => '/', 'icon' => 'globe', 'label' => '返回网站']) ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => '/', 'icon' => 'website', 'label' => '返回网站']) ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
+102
-65
@@ -10,6 +10,9 @@ use App\Content\View;
|
||||
$e = View::escape(...);
|
||||
$slug = $page['slug'];
|
||||
$path = $slug === 'home' ? '/' : '/' . $slug;
|
||||
$published = $page['status'] === 'published';
|
||||
$publicPage = !$page['layout_kind'] && $page['page_type'] === 'page';
|
||||
$paletteOptions = [['id' => '', 'name' => '页面原有配色', 'colors' => []], ...$palettes];
|
||||
$previewUrl = '/admin/pages/' . $slug . '/preview';
|
||||
$systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
$fontSizes = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120, 144];
|
||||
@@ -17,9 +20,9 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
?>
|
||||
<a class="back-link" href="/admin">返回页面</a>
|
||||
<header class="admin-heading">
|
||||
<div><h1><?= $e($title) ?></h1><p class="studio-page-meta">
|
||||
<div><h1 data-page-editor-title><?= $e($title) ?></h1><p class="studio-page-meta">
|
||||
<?php if ($layout): ?><span class="dashboard-page-state"><?= $e(LayoutPage::TYPES[$layout['kind']]) ?></span>
|
||||
<?php else: ?><?php if ($systemLabel): ?><span><?= $e($systemLabel) ?></span><?php else: ?><code><?= $e($path) ?></code><?php endif ?><span class="dashboard-page-state" data-published="<?= $page['status'] === 'published' ? 'true' : 'false' ?>"><?= $page['status'] === 'draft' ? '草稿' : '已发布' ?></span><?php endif ?>
|
||||
<?php else: ?><?php if ($systemLabel): ?><span><?= $e($systemLabel) ?></span><?php else: ?><code><?= $e($path) ?></code><?php endif ?><span class="dashboard-page-state" data-page-publication data-published="<?= $published ? 'true' : 'false' ?>"><?= $page['status'] === 'draft' ? '草稿' : '已发布' ?></span><?php endif ?>
|
||||
</p></div>
|
||||
<div class="actions">
|
||||
<a class="button button-outline" href="#studio-page-settings"><?= View::fragment('studio-icon', ['icon' => 'settings']) ?>页面设置</a>
|
||||
@@ -31,11 +34,14 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<?php endforeach ?>
|
||||
<button type="button" class="button button-outline" data-open-page-templates hidden><?= View::fragment('studio-icon', ['icon' => 'templates']) ?>整页模板</button>
|
||||
<?php if ($systemLabel): ?><a class="button button-outline" href="/admin/settings"><?= View::fragment('studio-icon', ['icon' => 'settings']) ?>站点设置</a>
|
||||
<?php elseif ($page['status'] === 'published'): ?><?= View::fragment('admin-view-link', ['href' => $path, 'icon' => 'external']) ?><?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php if ($layout || $systemLabel || $page['status'] !== 'published'): ?>
|
||||
<?php if ($publicPage): ?>
|
||||
<span data-page-public<?= $published ? '' : ' hidden' ?>><?= View::fragment('admin-view-link', ['href' => $path, 'icon' => 'external']) ?></span>
|
||||
<?php endif ?>
|
||||
<span data-page-preview<?= $publicPage && $published ? ' hidden' : '' ?>>
|
||||
<?= View::fragment('admin-view-link', ['href' => $previewUrl, 'icon' => 'preview', 'label' => '预览已保存内容']) ?>
|
||||
<?php endif ?>
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
@@ -57,14 +63,17 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor-toolbar studio-canvas-toolbar" data-canvas-toolbar hidden aria-label="正文工具">
|
||||
<div>
|
||||
<button type="button" data-canvas-command="heading">小标题</button>
|
||||
<button type="button" data-canvas-command="paragraph" title="换段(Ctrl/⌘+Enter)" aria-keyshortcuts="Control+Enter Meta+Enter">换段</button>
|
||||
<button type="button" data-canvas-command="list">列表</button>
|
||||
<button type="button" data-canvas-command="link">插入链接</button>
|
||||
<button type="button" data-canvas-command="media">插入媒体</button>
|
||||
<div data-canvas-text-commands role="group" aria-label="插入文本结构" hidden>
|
||||
<?php foreach (['heading' => '小标题', 'paragraph' => '换段', 'list' => '列表', 'link' => '插入链接'] as $command => $label): ?>
|
||||
<button type="button" data-canvas-command="<?= $command ?>" aria-label="<?= $label ?>"
|
||||
title="<?= $label ?><?= $command === 'paragraph' ? '(Ctrl/⌘+Enter)' : '' ?>"<?= $command === 'paragraph' ? ' aria-keyshortcuts="Control+Enter Meta+Enter"' : '' ?>><?= View::fragment('studio-icon', ['icon' => $command]) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<div class="canvas-format-tools" role="group" aria-label="文字格式">
|
||||
<div role="group" aria-label="插入与填充" data-canvas-insert hidden>
|
||||
<button type="button" data-canvas-command="media" aria-label="插入媒体" title="插入媒体" hidden><?= View::fragment('studio-icon', ['icon' => 'media']) ?></button>
|
||||
<button type="button" data-canvas-background aria-label="背景填充" title="背景填充" hidden><?= View::fragment('studio-icon', ['icon' => 'fill']) ?></button>
|
||||
</div>
|
||||
<div class="canvas-format-tools" role="group" aria-label="文字格式" data-canvas-text-tools hidden>
|
||||
<div class="canvas-font-picker">
|
||||
<label for="canvas-font-size">字号</label>
|
||||
<div class="canvas-font-combo">
|
||||
@@ -75,18 +84,25 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<label>文字颜色 <input type="color" aria-label="文字颜色" data-canvas-color disabled></label>
|
||||
<button type="button" data-clear-color title="恢复默认文字颜色" aria-label="恢复默认文字颜色" disabled><?= View::fragment('studio-icon', ['icon' => 'refresh']) ?></button>
|
||||
<label>字距 <input type="number" data-canvas-letter min="-5" max="24" step="1" placeholder="px" aria-label="字距(px)"></label>
|
||||
<label>行距 <input type="number" data-canvas-line min="0.8" max="3" step="0.1" placeholder="倍" aria-label="行距(倍)"></label>
|
||||
<button type="button" data-canvas-color title="文字颜色" aria-label="文字颜色"><span aria-hidden="true">A</span><svg viewBox="0 0 16 4" aria-hidden="true"><rect width="16" height="4" rx="1" fill="currentColor"/></svg></button>
|
||||
<button type="button" data-canvas-format="weight" aria-label="加粗" title="加粗" aria-pressed="false" disabled><strong>B</strong></button>
|
||||
<button type="button" data-canvas-format="slant" aria-label="斜体" title="斜体" aria-pressed="false" disabled><em>I</em></button>
|
||||
<button type="button" data-canvas-format="strike" aria-label="删除线" title="删除线" aria-pressed="false" disabled><s>S</s></button>
|
||||
</div>
|
||||
<label class="canvas-image-display">图片布局 <select data-canvas-image-display disabled>
|
||||
<label class="canvas-image-display" hidden>图片布局 <select data-canvas-image-display disabled>
|
||||
<option value="">随模板</option><option value="block">块级</option><option value="inline">行内</option><option value="inline-block">行内块</option>
|
||||
</select></label>
|
||||
<div class="studio-media-sizing" data-media-sizing hidden>
|
||||
<output data-media-size aria-hidden="true"></output>
|
||||
<button class="button button-outline" type="button" data-reset-media>原始尺寸</button>
|
||||
<button class="button button-outline" type="button" data-replace-media>替换媒体</button>
|
||||
</div>
|
||||
<div role="group" aria-label="画布历史">
|
||||
<button type="button" data-canvas-history="undo" title="撤销(Ctrl/⌘ Z)" disabled>撤销</button>
|
||||
<button type="button" data-canvas-history="redo" title="重做(Ctrl/⌘ Shift Z)" disabled>重做</button>
|
||||
<?php foreach (['undo' => ['撤销', 'Ctrl/⌘+Z'], 'redo' => ['重做', 'Ctrl/⌘+Shift+Z']] as $direction => [$label, $shortcut]): ?>
|
||||
<button type="button" data-canvas-history="<?= $direction ?>" aria-label="<?= $label ?>" title="<?= $label ?>(<?= $shortcut ?>)" disabled><?= View::fragment('studio-icon', ['icon' => $direction]) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<button class="button button-primary" form="studio-page-settings" type="submit"><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存页面</button>
|
||||
</div>
|
||||
@@ -103,13 +119,10 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<button class="studio-media-handle" type="button" role="slider" aria-label="媒体宽度" aria-valuemin="<?= CanvasStyle::MIN_MEDIA_SCALE ?>" aria-valuemax="100" aria-valuenow="100" data-media-handle hidden></button>
|
||||
<div class="studio-media-sizing" data-media-sizing hidden>
|
||||
<output data-media-size aria-hidden="true"></output>
|
||||
<button class="button button-outline" type="button" data-reset-media>原始尺寸</button>
|
||||
<button class="button button-outline" type="button" data-replace-media>替换媒体</button>
|
||||
</div>
|
||||
</div>
|
||||
<?= View::fragment('studio-fill') ?>
|
||||
<p class="field-note studio-canvas-status" data-canvas-status role="status"></p>
|
||||
<p class="feedback success" data-page-save-feedback role="status" hidden></p>
|
||||
<dialog class="media-picker canvas-source" data-canvas-source aria-labelledby="canvas-source-heading">
|
||||
<div class="admin-heading compact"><h2 id="canvas-source-heading">编辑区块 HTML</h2></div>
|
||||
<form class="admin-form" method="dialog">
|
||||
@@ -197,7 +210,7 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
</dialog>
|
||||
</section>
|
||||
</div>
|
||||
<form id="studio-page-settings" class="admin-form admin-panel studio-inspector" method="post" action="/admin/pages/<?= $e($slug) ?>">
|
||||
<form id="studio-page-settings" class="admin-form admin-panel studio-inspector" data-save-inline data-public-page="<?= $publicPage ? '1' : '0' ?>" method="post" action="/admin/pages/<?= $e($slug) ?>">
|
||||
<h2>页面设置</h2>
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($page['version']) ?>">
|
||||
@@ -219,44 +232,60 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<?php if (!$layout && !$systemLabel && $slug !== 'home'): ?><button class="button button-outline" type="button" disabled data-hero-control="breadcrumbs">面包屑路径</button><?php endif ?>
|
||||
</div>
|
||||
</details>
|
||||
<label>页面名称<input name="name" value="<?= $e($page['name']) ?>" required maxlength="100"></label>
|
||||
<?php if ($layout): ?>
|
||||
<input type="hidden" name="title" value="<?= $e($page['title']) ?>">
|
||||
<?php if ($layoutDefault && $layoutBase): ?>
|
||||
<p class="field-note">当前站点默认<?= $e(LayoutPage::TYPES[$layout['kind']]) ?></p>
|
||||
<?php else: ?>
|
||||
<label><input type="checkbox" name="make_default" value="1"<?= $layoutDefault ? ' checked' : '' ?>> 用作站点默认<?= $e(LayoutPage::TYPES[$layout['kind']]) ?></label>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<label>SEO 标题<input name="title" value="<?= $e($page['title']) ?>" required maxlength="160"></label>
|
||||
<label>SEO 描述<textarea name="description" rows="2" maxlength="300"><?= $e($page['description']) ?></textarea></label>
|
||||
<?php endif ?>
|
||||
<fieldset class="admin-options form-grid">
|
||||
<legend>页面显示</legend>
|
||||
<?php $heroVisible = $page['visibility']['hero'] ?? true; ?>
|
||||
<label>首屏<select name="show_hero"><option value="1"<?= $heroVisible ? ' selected' : '' ?>>显示</option>
|
||||
<option value="0"<?= !$heroVisible ? ' selected' : '' ?>>隐藏</option></select></label>
|
||||
<?php if (!$layout): ?>
|
||||
<?php foreach (['header' => '页头', 'footer' => '页脚'] as $kind => $label): ?>
|
||||
<?php $visible = $page['visibility'][$kind] ?? true; ?>
|
||||
<label><?= $e($label) ?><select name="<?= $e($kind) ?>_choice">
|
||||
<option value="hidden"<?= !$visible ? ' selected' : '' ?>>隐藏</option>
|
||||
<option value=""<?= $visible && $page[$kind . '_id'] === null ? ' selected' : '' ?>>站点默认</option>
|
||||
<?php foreach ($designs as $item): ?>
|
||||
<?php if ($item['kind'] !== $kind) continue; ?>
|
||||
<option value="<?= $e($item['id']) ?>"<?= $visible && $page[$kind . '_id'] === $item['id'] ? ' selected' : '' ?>><?= $e($item['name']) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<?php endforeach ?>
|
||||
<label>配色方案<select name="palette_id">
|
||||
<option value="">页面原有配色</option>
|
||||
<?php foreach ($designs as $item): ?>
|
||||
<?php if ($item['kind'] !== 'palette') continue; ?>
|
||||
<option value="<?= $e($item['id']) ?>"<?= $page['palette_id'] === $item['id'] ? ' selected' : '' ?>><?= $e($item['name']) ?></option>
|
||||
<div class="studio-settings-grid">
|
||||
<div class="studio-settings-content">
|
||||
<label>页面名称<input name="name" value="<?= $e($page['name']) ?>" required maxlength="100"></label>
|
||||
<?php if ($layout): ?>
|
||||
<input type="hidden" name="title" value="<?= $e($page['title']) ?>">
|
||||
<?php if ($layoutDefault && $layoutBase): ?>
|
||||
<p class="field-note">当前站点默认<?= $e(LayoutPage::TYPES[$layout['kind']]) ?></p>
|
||||
<?php else: ?>
|
||||
<label><input type="checkbox" name="make_default" value="1"<?= $layoutDefault ? ' checked' : '' ?>> 用作站点默认<?= $e(LayoutPage::TYPES[$layout['kind']]) ?></label>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<label>SEO 标题<input name="title" value="<?= $e($page['title']) ?>" required maxlength="160"></label>
|
||||
<label>SEO 描述<textarea name="description" rows="2" maxlength="300"><?= $e($page['description']) ?></textarea></label>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<fieldset class="admin-options form-grid">
|
||||
<legend>页面显示</legend>
|
||||
<?php $heroVisible = $page['visibility']['hero'] ?? true; ?>
|
||||
<label>首屏<select name="show_hero"><option value="1"<?= $heroVisible ? ' selected' : '' ?>>显示</option>
|
||||
<option value="0"<?= !$heroVisible ? ' selected' : '' ?>>隐藏</option></select></label>
|
||||
<?php if (!$layout): ?>
|
||||
<?php foreach (['header' => '页头', 'footer' => '页脚'] as $kind => $label): ?>
|
||||
<?php $visible = $page['visibility'][$kind] ?? true; ?>
|
||||
<label><?= $e($label) ?><select name="<?= $e($kind) ?>_choice">
|
||||
<option value="hidden"<?= !$visible ? ' selected' : '' ?>>隐藏</option>
|
||||
<option value=""<?= $visible && $page[$kind . '_id'] === null ? ' selected' : '' ?>>站点默认</option>
|
||||
<?php foreach ($designs as $item): ?>
|
||||
<?php if ($item['kind'] !== $kind) continue; ?>
|
||||
<option value="<?= $e($item['id']) ?>"<?= $visible && $page[$kind . '_id'] === $item['id'] ? ' selected' : '' ?>><?= $e($item['name']) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<?php endif ?>
|
||||
</fieldset>
|
||||
<div data-palette-picker>
|
||||
<label for="page-palette">配色方案</label>
|
||||
<select id="page-palette" name="palette_id">
|
||||
<?php foreach ($paletteOptions as $option): ?>
|
||||
<option value="<?= $e($option['id']) ?>"<?= (string) $page['palette_id'] === (string) $option['id'] ? ' selected' : '' ?>><?= $e($option['name']) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
<details class="palette-picker" hidden>
|
||||
<summary aria-label="选择配色方案"><span data-palette-current></span><?= View::fragment('studio-icon', ['icon' => 'chevron']) ?></summary>
|
||||
<div class="palette-picker-options">
|
||||
<?php foreach ($paletteOptions as $option): ?>
|
||||
<button type="button" data-palette-option="<?= $e($option['id']) ?>"
|
||||
aria-pressed="<?= (string) $page['palette_id'] === (string) $option['id'] ? 'true' : 'false' ?>">
|
||||
<span class="palette-name"><?= $e($option['name']) ?><?= $option['colors'] ? View::fragment('palette-swatches', ['colors' => $option['colors']]) : '' ?></span>
|
||||
</button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php if (($layout['kind'] ?? '') === 'header'): ?>
|
||||
<details class="admin-options" data-shared-auth<?= $layoutHasMember ? '' : ' hidden' ?>>
|
||||
<summary>会员登录设置</summary>
|
||||
@@ -278,16 +307,24 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<input type="hidden" name="<?= $e($field) ?>" value="<?= $e($value) ?>">
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<?php if (!$layout && $slug !== 'home'): ?>
|
||||
<label>发布状态<select name="status"><option value="draft" <?= $page['status'] === 'draft' ? 'selected' : '' ?>>草稿</option>
|
||||
<option value="published" <?= $page['status'] === 'published' ? 'selected' : '' ?>>已发布</option></select></label>
|
||||
<?php endif ?>
|
||||
<?php if ($headEditor): ?>
|
||||
<?= View::fragment('head-settings', ['label' => '本页 Head', 'head' => $page['head_html']]) ?>
|
||||
<?php elseif (!$layout): ?>
|
||||
<p class="field-note">本页 Head 尚不可用。<?= $e(Database::MIGRATION_REQUIRED) ?></p>
|
||||
<?php endif ?>
|
||||
<div class="form-submit"><button class="button button-primary" type="submit"><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存页面</button></div>
|
||||
<div class="form-submit studio-settings-actions">
|
||||
<button class="button button-primary" type="submit"><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存页面</button>
|
||||
<?php if (!$layout && $slug !== 'home'): ?>
|
||||
<div class="studio-publication">
|
||||
<span>发布状态</span><span class="dashboard-page-state" data-page-publication data-published="<?= $published ? 'true' : 'false' ?>"><?= $published ? '已发布' : '草稿' ?></span>
|
||||
<button class="button button-outline" type="submit" name="status" value="<?= $published ? 'draft' : 'published' ?>" data-publish-button>
|
||||
<span data-publication-action="published"<?= $published ? ' hidden' : '' ?>><?= View::fragment('studio-icon', ['icon' => 'publish']) ?>发布</span>
|
||||
<span data-publication-action="draft"<?= $published ? '' : ' hidden' ?>><?= View::fragment('studio-icon', ['icon' => 'unpublish']) ?>转为草稿</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<p class="feedback success" data-page-save-feedback role="status" hidden></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php if (!$layout): ?><?= View::fragment('studio-page-templates', compact('token')) ?><?php endif ?>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
use App\Content\DesignLibrary;
|
||||
use App\Content\View;
|
||||
|
||||
$previewKeys = ['accent', 'ink', 'muted', 'paper', 'white', 'line', 'accent-deep', 'accent-light', 'button-ink'];
|
||||
?>
|
||||
<svg class="palette-swatches" viewBox="0 0 133 14" aria-hidden="true" focusable="false">
|
||||
<?php foreach ($previewKeys as $index => $key): ?>
|
||||
<circle cx="<?= 7 + 15 * $index ?>" cy="7" r="6" data-color-key="<?= View::escape($key) ?>" fill="<?= View::escape($colors[$key] ?? DesignLibrary::COLORS[$key][1]) ?>"/>
|
||||
<?php endforeach ?>
|
||||
</svg>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
use App\Content\DesignLibrary;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<dialog class="media-picker canvas-fill" data-canvas-fill aria-labelledby="canvas-fill-title" data-color-labels="<?= $e(json_encode(array_map(static fn (array $color): string => $color[0], DesignLibrary::COLORS), JSON_THROW_ON_ERROR)) ?>">
|
||||
<div class="admin-heading compact"><h2 id="canvas-fill-title" data-fill-title>背景填充</h2></div>
|
||||
<form method="dialog" class="admin-form">
|
||||
<div class="preview-selector" role="tablist" aria-label="背景填充类型" data-fill-tabs>
|
||||
<?php foreach (['solid' => '纯色', 'gradient' => '渐变色', 'image' => '背景图'] as $mode => $label): ?>
|
||||
<button class="button button-outline" type="button" role="tab" id="fill-tab-<?= $mode ?>" aria-selected="false"
|
||||
aria-controls="fill-panel-<?= $mode ?>" data-fill-tab="<?= $mode ?>"><?= $label ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<div id="fill-panel-solid" role="tabpanel" aria-labelledby="fill-tab-solid" data-fill-panel="solid">
|
||||
<label>颜色<input type="color" name="solid" value="#ffffff"></label>
|
||||
<div class="canvas-color-swatches" data-fill-swatches="solid" role="group" aria-label="当前配色方案"></div>
|
||||
</div>
|
||||
<div id="fill-panel-gradient" role="tabpanel" aria-labelledby="fill-tab-gradient" data-fill-panel="gradient" hidden>
|
||||
<div class="form-grid">
|
||||
<div>
|
||||
<label>起始色<input type="color" name="start" value="#ffffff"></label>
|
||||
<div class="canvas-color-swatches" data-fill-swatches="start" role="group" aria-label="起始色 · 当前配色方案"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label>结束色<input type="color" name="end" value="#214ed7"></label>
|
||||
<div class="canvas-color-swatches" data-fill-swatches="end" role="group" aria-label="结束色 · 当前配色方案"></div>
|
||||
</div>
|
||||
</div>
|
||||
<label>角度(°)<input type="number" name="angle" min="0" max="360" step="1" value="90"></label>
|
||||
</div>
|
||||
<div id="fill-panel-image" role="tabpanel" aria-labelledby="fill-tab-image" data-fill-panel="image" hidden>
|
||||
<label>图片链接<input type="text" name="image" maxlength="1000" placeholder="/assets/uploads/… 或 https://…"></label>
|
||||
<button class="button button-outline" type="button" data-fill-media><?= View::fragment('studio-icon', ['icon' => 'media']) ?>从媒体库选择</button>
|
||||
</div>
|
||||
<p class="feedback error" data-fill-error role="alert" hidden></p>
|
||||
<div class="actions">
|
||||
<button class="button button-primary" type="submit">应用</button>
|
||||
<button class="button button-outline" type="button" data-fill-reset>恢复默认</button>
|
||||
<button class="button button-outline" type="button" data-fill-close>取消</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -11,6 +11,16 @@ $paths = [
|
||||
'delete' => '<path d="M4 7h16M9 7V4h6v3m3 0-.8 13H6.8L6 7m4 4v5m4-5v5"/>',
|
||||
'external' => '<path d="M13 5h6v6m0-6-8 8m6 0v5a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"/>',
|
||||
'preview' => '<path d="M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"/><circle cx="12" cy="12" r="2.5"/>',
|
||||
'website' => '<rect x="3" y="4.5" width="18" height="15" rx="2"/><path d="M3 9h18m-7 3h4v4m0-4-5 5"/>',
|
||||
'heading' => '<path d="M5 5v14M15 5v14M5 12h10m4-3h2m-2 6h2"/>',
|
||||
'paragraph' => '<path d="M14 4h6m-3 0v16m-4 0V4h-2a4.5 4.5 0 0 0 0 9h2"/>',
|
||||
'list' => '<path d="M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01"/>',
|
||||
'link' => '<path d="m10 14 4-4m-6 6-1 1a3.5 3.5 0 0 1-5-5l4-4a3.5 3.5 0 0 1 5 0m2 8a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-1 1"/>',
|
||||
'undo' => '<path d="M4 4v6h6m-6 0 2-2a8 8 0 1 1 0 12"/>',
|
||||
'redo' => '<path d="M20 4v6h-6m6 0-2-2a8 8 0 1 0 0 12"/>',
|
||||
'publish' => '<path d="M12 16V4m-4 4 4-4 4 4M4 15v5h16v-5"/>',
|
||||
'unpublish' => '<path d="M12 4v12m-4-4 4 4 4-4M4 15v5h16v-5"/>',
|
||||
'fill' => '<path d="m8 3 8 8m-6-5 7 7-7 7-7-7 7-7Zm-5 7h12m3 1s-2 2.7-2 4a2 2 0 0 0 4 0c0-1.3-2-4-2-4Z"/>',
|
||||
'globe' => '<circle cx="12" cy="12" r="9"/><ellipse cx="12" cy="12" rx="4" ry="9"/><path d="M3 12h18"/>',
|
||||
'account' => '<circle cx="12" cy="8" r="3.2"/><path d="M5 20v-2a7 7 0 0 1 14 0v2"/>',
|
||||
'chevron' => '<path d="m6 9 6 6 6-6"/>',
|
||||
|
||||
Reference in New Issue
Block a user