forked from laysense/laysite
Add page publication history and reusable blocks
This commit is contained in:
@@ -49,7 +49,7 @@ $live = count(array_filter($regular, static fn (array $page): bool => $page['sta
|
||||
$deleteNote .= '删除后,此页面将从首页候选中移除。';
|
||||
}
|
||||
$published = $page['status'] === 'published';
|
||||
$public = ($kind === null || $home) && $published;
|
||||
$public = $page['public_slug'] !== null;
|
||||
?>
|
||||
<li data-page-item="<?= $e($kind ?? $page['status']) ?>" data-page-public-status="<?= $e($kind === null || $home ? $page['status'] : '') ?>" data-page-label="<?= $e($page['name'] . ' ' . $page['title'] . ' ' . ($kind ? $label : $path)) ?>">
|
||||
<div class="dashboard-page-label"><strong><?= $e($page['name']) ?></strong>
|
||||
@@ -61,10 +61,11 @@ $live = count(array_filter($regular, static fn (array $page): bool => $page['sta
|
||||
<div class="dashboard-page-actions">
|
||||
<a class="button button-outline" href="/admin/pages/<?= $e($page['slug']) ?>"><?= View::fragment('studio-icon', ['icon' => 'edit']) ?>编辑页面</a>
|
||||
<?= View::fragment('admin-view-link', [
|
||||
'href' => $public ? $path : '/admin/pages/' . $page['slug'] . '/preview',
|
||||
'href' => $public ? '/' . $page['public_slug'] : '/admin/pages/' . $page['slug'] . '/preview',
|
||||
'icon' => $public ? 'external' : 'preview',
|
||||
'label' => ($public ? '查看公开页面' : '预览页面') . ' · ' . $page['name'],
|
||||
]) ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => '/admin/copy-page/' . $page['slug'], 'icon' => 'copy', 'label' => '复制页面 · ' . $page['name'], 'newTab' => false]) ?>
|
||||
<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']) ?>">
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<a class="back-link" href="/admin/pages/<?= $e($page['slug']) ?>">返回页面编辑</a>
|
||||
<header class="admin-heading"><h1>复制页面</h1></header>
|
||||
<?= View::fragment('admin-feedback', ['error' => $error, 'saved' => false]) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/copy-page/<?= $e($page['slug']) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($page['version']) ?>">
|
||||
<p class="field-note">从「<?= $e($page['name']) ?>」已保存的草稿创建独立副本。镜像区块会复制为普通区块。</p>
|
||||
<label>页面名称<input name="name" required maxlength="100" value="<?= $e($name) ?>"></label>
|
||||
<label>网址标识<input name="slug" required maxlength="70" pattern="[a-z0-9]+(-[a-z0-9]+)*" value="<?= $e($target) ?>"></label>
|
||||
<div class="actions"><button class="button button-primary" type="submit"><?= View::fragment('studio-icon', ['icon' => 'copy']) ?>创建副本</button></div>
|
||||
</form>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$url = '/admin/page-history/' . $page['slug'];
|
||||
$labels = ['saved' => '保存草稿', 'published' => '发布快照', 'unpublished' => '撤下公开版本',
|
||||
'restored' => '恢复历史版本', 'copied' => '创建副本', 'initial' => '初始草稿'];
|
||||
?>
|
||||
<a class="back-link" href="/admin/pages/<?= $e($page['slug']) ?>">返回页面编辑</a>
|
||||
<header class="admin-heading"><div><h1>版本历史</h1><p><?= $e($page['name']) ?></p></div></header>
|
||||
<section class="admin-panel">
|
||||
<p class="field-note">恢复会把选中版本的内容写入草稿。网址标识、页面类型与当前发布状态会保留。</p>
|
||||
<ul class="admin-list revision-list">
|
||||
<?php foreach ($revisions as $revision): ?>
|
||||
<li>
|
||||
<div><strong><?= $e($labels[$revision['kind']]) ?></strong>
|
||||
<time datetime="<?= $e($revision['created_at']) ?>"><?= $e(View::date($revision['created_at'], 'Y-m-d H:i:s')) ?></time>
|
||||
<?php if ($revision['live']): ?><span class="dashboard-page-state" data-published="true">当前公开版本</span><?php endif ?>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<?= View::fragment('admin-view-link', ['href' => $url . '?revision=' . $revision['id'], 'icon' => 'preview', 'label' => '预览历史版本']) ?>
|
||||
<form method="post" action="<?= $e($url) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($page['version']) ?>">
|
||||
<input type="hidden" name="revision" value="<?= $e($revision['id']) ?>">
|
||||
<button class="button button-outline" type="submit" data-confirm="把此版本的内容恢复到当前草稿?"><?= View::fragment('studio-icon', ['icon' => 'undo']) ?>恢复为草稿</button>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</section>
|
||||
+22
-22
@@ -14,8 +14,9 @@ $path = '/' . $slug;
|
||||
$home = $page['page_type'] === 'home';
|
||||
$pageTypes = LayoutPage::TYPES + SystemPage::TYPES;
|
||||
$layoutSlugs = array_column($designs, 'slug', 'id');
|
||||
$published = $page['status'] === 'published';
|
||||
$publicPage = !$page['layout_kind'] && in_array($page['page_type'], ['page', 'home'], true);
|
||||
$published = $publication !== null;
|
||||
$publicPage = $published && $publication['layout_kind'] === null && in_array($publication['page_type'], ['page', 'home'], true);
|
||||
$publicationLabel = !$published ? '草稿' : ($publication['version'] === $page['version'] ? '已发布' : '已发布 · 草稿有更新');
|
||||
$usesSitePalette = empty($page['theme']);
|
||||
$defaultPalette = $usesSitePalette && $defaultPaletteId !== null
|
||||
? (array_column($palettes, null, 'id')[$defaultPaletteId] ?? null) : null;
|
||||
@@ -45,7 +46,7 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<header class="admin-heading">
|
||||
<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 || $home): ?><span><?= $e($home ? '首页' : $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 ?>
|
||||
<?php else: ?><?php if ($systemLabel || $home): ?><span><?= $e($home ? '首页' : $systemLabel) ?></span><?php else: ?><code><?= $e($path) ?></code><?php endif ?><span class="dashboard-page-state" data-page-publication data-published="<?= $published ? 'true' : 'false' ?>"><?= $e($publicationLabel) ?></span><?php endif ?>
|
||||
</p></div>
|
||||
<div class="actions">
|
||||
<a class="button button-outline" href="#studio-page-settings"><?= View::fragment('studio-icon', ['icon' => 'settings']) ?>页面设置</a>
|
||||
@@ -62,12 +63,10 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<?php if ($systemLabel): ?><a class="button button-outline" href="/admin/settings"><?= View::fragment('studio-icon', ['icon' => 'settings']) ?>站点设置</a>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?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' => '预览已保存内容']) ?>
|
||||
</span>
|
||||
<a class="button button-outline" href="/admin/copy-page/<?= $e($slug) ?>"><?= View::fragment('studio-icon', ['icon' => 'copy']) ?>复制页面</a>
|
||||
<a class="button button-outline" href="/admin/page-history/<?= $e($slug) ?>"><?= View::fragment('studio-icon', ['icon' => 'history']) ?>版本历史</a>
|
||||
<span data-page-public<?= $publicPage ? '' : ' hidden' ?>><?= View::fragment('admin-view-link', ['href' => $publicPage ? '/' . $publication['slug'] : $path, 'icon' => 'external', 'label' => '查看公开页面']) ?></span>
|
||||
<?= View::fragment('admin-view-link', ['href' => $previewUrl, 'icon' => 'preview', 'label' => '预览已保存草稿']) ?>
|
||||
</div>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
@@ -76,7 +75,7 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<h2 id="studio-library-title">页面编辑</h2>
|
||||
<?= View::fragment('studio-templates', [
|
||||
'layers' => View::fragment('studio-layers', compact('page', 'slug', 'token')),
|
||||
'layoutKind' => $page['layout_kind'], 'slug' => $slug, 'token' => $token,
|
||||
'layoutKind' => $page['layout_kind'], 'slug' => $slug, 'token' => $token, 'reusableBlocks' => $reusableBlocks,
|
||||
]) ?>
|
||||
</aside>
|
||||
<div class="studio-workspace">
|
||||
@@ -133,7 +132,7 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<button class="button button-primary" form="studio-page-settings" type="submit"><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存页面</button>
|
||||
</div>
|
||||
<div class="studio-frame-window">
|
||||
<iframe title="可编辑页面画布" src="<?= $e($previewUrl) ?>?canvas=1" sandbox="allow-same-origin"></iframe>
|
||||
<iframe title="可编辑页面画布" src="<?= $e($previewUrl) ?>?canvas=1" sandbox="allow-same-origin allow-popups allow-popups-to-escape-sandbox"></iframe>
|
||||
<div class="studio-element-tools" data-element-tools role="group" aria-label="所选元素" hidden>
|
||||
<div class="studio-element-align" data-element-align role="group" aria-label="对齐">
|
||||
<?php foreach (['left' => '居左', 'center' => '居中', 'right' => '居右'] as $value => $label): ?>
|
||||
@@ -237,7 +236,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" data-save-inline data-public-page="<?= $publicPage ? '1' : '0' ?>" method="post" action="/admin/pages/<?= $e($slug) ?>">
|
||||
<form id="studio-page-settings" class="admin-form admin-panel studio-inspector" data-save-inline 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']) ?>">
|
||||
@@ -314,6 +313,7 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<details class="admin-options" data-shared-auth<?= $layoutHasMember ? '' : ' hidden' ?>>
|
||||
<summary>会员登录设置</summary>
|
||||
<?= View::fragment('design-provider-fields', ['item' => $layout, 'provider' => $layout['payload']['provider'], 'layoutHasMember' => $layoutHasMember]) ?>
|
||||
<?php if ($layoutSecretPending): ?><p class="field-note">客户端密钥已暂存,将在发布时生效。</p><?php endif ?>
|
||||
</details>
|
||||
<?php endif ?>
|
||||
<textarea name="hero_actions" hidden><?= $e(Database::json(Buttons::validate($page['actions']))) ?></textarea>
|
||||
@@ -337,16 +337,16 @@ $spacingPresets = [0, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128];
|
||||
<p class="field-note">本页 Head 尚不可用。<?= $e(Database::MIGRATION_REQUIRED) ?></p>
|
||||
<?php endif ?>
|
||||
<div class="form-submit studio-settings-actions">
|
||||
<button class="button button-primary" type="submit"><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存页面</button>
|
||||
<?php if (!$layout): ?>
|
||||
<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 ?>
|
||||
<button class="button button-primary" type="submit" data-save-draft><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存草稿</button>
|
||||
<div class="studio-publication">
|
||||
<span>发布状态</span><span class="dashboard-page-state" data-page-publication data-published="<?= $published ? 'true' : 'false' ?>"><?= $e($publicationLabel) ?></span>
|
||||
<button class="button button-outline" type="submit" name="status" value="published" data-publish-button>
|
||||
<?= View::fragment('studio-icon', ['icon' => 'publish']) ?><span data-publish-label><?= $published ? '发布更新' : '发布' ?></span>
|
||||
</button>
|
||||
<button class="button button-outline" type="submit" name="status" value="draft" data-unpublish-button data-confirm="撤下此页面的公开版本?"<?= $published ? '' : ' hidden' ?>>
|
||||
<?= View::fragment('studio-icon', ['icon' => 'unpublish']) ?>撤下发布
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="feedback success" data-page-save-feedback role="status" hidden></p>
|
||||
</form>
|
||||
|
||||
@@ -9,9 +9,10 @@ $label ??= match ($icon) {
|
||||
default => '打开链接',
|
||||
};
|
||||
$showLabel ??= false;
|
||||
$hint = $e($label . '(在新标签页打开)');
|
||||
$newTab ??= true;
|
||||
$hint = $e($label . ($newTab ? '(在新标签页打开)' : ''));
|
||||
?>
|
||||
<a class="button button-outline admin-view-link admin-view-link-<?= $e($icon) ?><?= $showLabel ? ' admin-view-link-labelled' : '' ?>"
|
||||
href="<?= $e($href) ?>" target="_blank" rel="noopener noreferrer" aria-label="<?= $hint ?>" title="<?= $hint ?>">
|
||||
href="<?= $e($href) ?>"<?= $newTab ? ' target="_blank" rel="noopener noreferrer"' : '' ?> aria-label="<?= $hint ?>" title="<?= $hint ?>">
|
||||
<?= View::fragment('studio-icon', compact('icon')) ?><?php if ($showLabel): ?><span><?= $e($label) ?></span><?php endif ?>
|
||||
</a>
|
||||
|
||||
@@ -5,6 +5,26 @@ use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$canvas ??= false;
|
||||
if ($canvas && isset($section['mirror_id'])) {
|
||||
$source = $section['mirror_source'] ?? null;
|
||||
?>
|
||||
<section class="studio-mirror-block" data-studio-mirror data-studio-section="<?= $e($section['version']) ?>"
|
||||
data-studio-key="<?= $e($section['key']) ?>" data-studio-type="镜像区块" data-studio-mirror-title="<?= $e($section['title']) ?>">
|
||||
<div inert aria-hidden="true"><?= View::fragment('section', ['section' => $section, 'canvas' => false, 'moment' => false, 'pageSlug' => $pageSlug]) ?></div>
|
||||
<div class="studio-mirror-overlay">
|
||||
<div class="studio-mirror-note">
|
||||
<span><?= $source ? '镜像区块 · 修改请前往主区块' : '主区块已移除 · 可取消关联后编辑' ?></span>
|
||||
<?php if ($source): ?>
|
||||
<a href="/admin/pages/<?= $e($source['page_slug']) ?>?block=<?= $e(rawurlencode($source['section_key'])) ?>#blocks"
|
||||
target="_blank" rel="noopener noreferrer" data-studio-mirror-open>前往主区块 ↗</a>
|
||||
<?php endif ?>
|
||||
<button type="button" data-studio-mirror-detach>取消关联</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
$body = $section['body'];
|
||||
$dynamic = !empty($section['feed']);
|
||||
$presentation = json_decode($section['presentation'] ?? '{}', true, flags: JSON_THROW_ON_ERROR);
|
||||
@@ -13,6 +33,9 @@ $text = static fn (string $role): string => CanvasStyle::text($presentation, $ro
|
||||
$id = static fn (string $role, string $fallback = ''): string => CanvasStyle::idAttributes($presentation, $role, $canvas, $fallback);
|
||||
$anchor = CanvasStyle::originalAnchor($presentation, 'section', $section['key']);
|
||||
$studio = $canvas ? ' data-studio-section="' . $e($section['version']) . '" data-studio-key="' . $e($section['key']) . '" data-studio-template="' . $e($presentation['template'] ?? '') . '" data-studio-type="' . $e(BlockTemplates::sectionType($section, $presentation)) . '" data-studio-source="' . $e(base64_encode($section['body'])) . '"' : '';
|
||||
if ($canvas && isset($section['main_id'])) {
|
||||
$studio .= ' data-studio-main';
|
||||
}
|
||||
if ($canvas && $dynamic) {
|
||||
$studio .= ' data-studio-dynamic data-studio-feed="' . $e($section['feed']) . '" tabindex="0"';
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ $paths = [
|
||||
'target' => '<circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/><path d="M12 2v4m0 12v4M2 12h4m12 0h4"/>',
|
||||
'up' => '<path d="M12 20V4m-5 5 5-5 5 5"/>',
|
||||
'down' => '<path d="M12 4v16m-5-5 5 5 5-5"/>',
|
||||
'history' => '<path d="M4 5v5h5M4 10a8 8 0 1 1 .5 7M12 8v5l3 2"/>',
|
||||
'chain-break' => '<path d="m6 12-2 2a3.5 3.5 0 0 0 5 5l2-2m2-10 2-2a3.5 3.5 0 0 1 5 5l-2 2M8 8 5 5m11 11 3 3M12 4v3m-8 5h3m10 0h3m-8 5v3"/>',
|
||||
'refresh' => '<path d="M20 7v5h-5M4 17v-5h5"/><path d="M5.6 8a7.5 7.5 0 0 1 12.3-2.1L20 8.5M4 15.5l2.1 2.6A7.5 7.5 0 0 0 18.4 16"/>',
|
||||
];
|
||||
?>
|
||||
|
||||
@@ -7,7 +7,7 @@ $e = View::escape(...);
|
||||
?>
|
||||
<details class="studio-layers" id="blocks" open>
|
||||
<summary>页面图层</summary>
|
||||
<?php foreach (['target', 'up', 'down', 'copy', 'delete', 'anchor', 'code', 'settings'] as $icon): ?>
|
||||
<?php foreach (['target', 'up', 'down', 'copy', 'delete', 'anchor', 'code', 'settings', 'link', 'chain-break'] as $icon): ?>
|
||||
<template data-layer-icon="<?= $icon ?>"><?= View::fragment('studio-icon', compact('icon')) ?></template>
|
||||
<?php endforeach ?>
|
||||
<p class="field-note" data-layers-empty<?= $page['sections'] ? ' hidden' : '' ?>>添加组件后,可展开标签,拖拽或用箭头调整顺序。</p>
|
||||
@@ -22,7 +22,7 @@ $e = View::escape(...);
|
||||
</div>
|
||||
</div>
|
||||
<div class="studio-layer-actions">
|
||||
<a class="button button-outline" href="/admin/pages/<?= $e($slug) ?>/<?= $e($item['key']) ?>" title="区块设置" aria-label="区块设置"><?= View::fragment('studio-icon', ['icon' => 'settings']) ?></a>
|
||||
<?php if (empty($item['mirror_id'])): ?><a class="button button-outline" href="/admin/pages/<?= $e($slug) ?>/<?= $e($item['key']) ?>" title="区块设置" aria-label="区块设置"><?= View::fragment('studio-icon', ['icon' => 'settings']) ?></a><?php endif ?>
|
||||
<form method="post" action="/admin/page-blocks/<?= $e($slug) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="key" value="<?= $e($item['key']) ?>">
|
||||
|
||||
@@ -11,6 +11,9 @@ $previews = $modules ? [
|
||||
] : ['text-elements' => 'list', 'link-elements' => 'two-actions', 'media-elements' => 'gallery', 'structure-elements' => 'table'];
|
||||
?>
|
||||
<section role="tabpanel" id="studio-panel-<?= $kind ?>" aria-labelledby="studio-tab-<?= $kind ?>" data-library-panel="<?= $kind ?>" hidden>
|
||||
<?php if ($modules): ?>
|
||||
<button class="button button-outline studio-reuse-add" type="button" data-reuse-open><?= View::fragment('studio-icon', ['icon' => 'link']) ?>插入镜像区块</button>
|
||||
<?php endif ?>
|
||||
<ul class="studio-library-categories" data-library-index>
|
||||
<?php foreach ($groups as $group => [$category, $items]): ?>
|
||||
<li><button type="button" data-library-category="<?= $e($group) ?>" data-library-label="<?= $e($category) ?>">
|
||||
|
||||
@@ -18,8 +18,9 @@ $previewRoot = '/assets/page-templates/';
|
||||
<h3 id="page-template-groups" tabindex="-1">选择套系</h3>
|
||||
<div class="page-template-groups">
|
||||
<?php foreach ($groups as $key => $group): ?>
|
||||
<?php $thumbnail = count($group['pages']) === 1 ? array_key_first($group['pages']) : $key; ?>
|
||||
<button type="button" class="page-template-card" data-template-group="<?= $e($key) ?>">
|
||||
<span class="page-template-image"><img src="<?= $e($previewRoot . $key . '.webp') ?>" width="768" height="480" alt="" loading="lazy"></span>
|
||||
<span class="page-template-image"><img src="<?= $e($previewRoot . $thumbnail . '.webp') ?>" width="768" height="480" alt="" loading="lazy"></span>
|
||||
<span class="page-template-card-copy"><strong><?= $e($group['name']) ?></strong><small><?= $e($group['description']) ?></small></span>
|
||||
</button>
|
||||
<?php endforeach ?>
|
||||
|
||||
@@ -19,12 +19,28 @@ $anchorForm = View::fragment('studio-anchor-form', ['groups' => $modules, 'slug'
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php foreach (['modules' => $modules, 'elements' => BlockTemplates::ELEMENT_GROUPS] as $kind => $groups): ?>
|
||||
<?= View::fragment('studio-library-panel', compact('kind', 'groups', 'anchorForm')) ?>
|
||||
<?= View::fragment('studio-library-panel', compact('kind', 'groups', 'anchorForm', 'reusableBlocks')) ?>
|
||||
<?php endforeach ?>
|
||||
<section role="tabpanel" id="studio-panel-layers" aria-labelledby="studio-tab-layers" data-library-panel="layers">
|
||||
<?= $layers ?>
|
||||
</section>
|
||||
|
||||
<dialog class="media-picker" data-reuse-dialog aria-labelledby="reuse-dialog-title">
|
||||
<header class="admin-heading compact"><h2 id="reuse-dialog-title">插入镜像区块</h2></header>
|
||||
<form data-reuse-picker>
|
||||
<?php if ($reusableBlocks): ?>
|
||||
<label>主区块 <select name="source" required>
|
||||
<?php foreach ($reusableBlocks as $block): ?>
|
||||
<option value="<?= $e($block['main_id']) ?>"><?= $e($block['name'] . ' · ' . ($block['title'] ?: $block['key'])) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<?php else: ?><p class="field-note">先在任意页面的图层中将一个区块设为主区块。</p><?php endif ?>
|
||||
<div class="actions">
|
||||
<?php if ($reusableBlocks): ?><button class="button button-primary" type="submit">添加镜像</button><?php endif ?>
|
||||
<button class="button button-outline" type="button" data-reuse-close>关闭</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
<div class="studio-template-peek" data-template-peek aria-hidden="true" hidden>
|
||||
<img alt="">
|
||||
<p></p>
|
||||
|
||||
Reference in New Issue
Block a user