Release LaySite 1.4.0 canvas editing and layers
This commit is contained in:
+31
-3
@@ -31,7 +31,9 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<?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 ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => $previewUrl, 'icon' => 'preview', 'label' => '打开预览', 'showLabel' => true]) ?>
|
||||
<?php if ($layout || $systemLabel || $page['status'] !== 'published'): ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => $previewUrl, 'icon' => 'preview', 'label' => '预览已保存内容']) ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
@@ -62,10 +64,15 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
</div>
|
||||
<div class="canvas-format-tools" role="group" aria-label="文字格式">
|
||||
<label>字号 <input type="number" data-canvas-font-size min="8" max="144" step="1" placeholder="px" disabled></label>
|
||||
<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>
|
||||
<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>
|
||||
<option value="">随模板</option><option value="block">块级</option><option value="inline">行内</option><option value="inline-block">行内块</option>
|
||||
</select></label>
|
||||
<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>
|
||||
@@ -80,7 +87,7 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<button type="button" data-align="<?= $value ?>" aria-pressed="false" aria-label="<?= $label ?>" title="<?= $label ?>"><?= View::fragment('studio-icon', ['icon' => $value]) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php foreach (['module-settings' => ['settings', '模块设置'], 'properties' => ['edit', '属性'], 'parent' => ['parent', '选择父元素'], 'spacing' => ['spacing', '内外边距'], 'copy' => ['copy', '复制'], 'delete' => ['delete', '删除']] as $action => [$icon, $label]): ?>
|
||||
<?php foreach (['module-settings' => ['settings', '模块设置'], 'properties' => ['edit', '属性'], 'parent' => ['parent', '选择父元素'], 'spacing' => ['spacing', '内外边距'], 'source' => ['code', '编辑 HTML'], 'copy' => ['copy', '复制'], 'delete' => ['delete', '删除']] as $action => [$icon, $label]): ?>
|
||||
<button type="button" data-element-<?= $action ?> aria-label="<?= $label ?>" title="<?= $label ?>"><?= View::fragment('studio-icon', compact('icon')) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
@@ -92,6 +99,20 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
</div>
|
||||
</div>
|
||||
<p class="field-note studio-canvas-status" data-canvas-status role="status"></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">
|
||||
<label>源代码区域<select data-source-part></select></label>
|
||||
<label>HTML<textarea data-source-code rows="15" spellcheck="false" autocapitalize="off" maxlength="300000"></textarea></label>
|
||||
<p class="field-note" data-source-hint></p>
|
||||
<p class="feedback error" data-source-error role="alert" hidden></p>
|
||||
<div class="actions">
|
||||
<button class="button button-primary" type="submit">应用 HTML</button>
|
||||
<button class="button button-outline" type="button" data-source-reset hidden>恢复模板首屏</button>
|
||||
<button class="button button-outline" type="button" data-source-close>取消</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
<dialog class="media-picker" data-canvas-spacing aria-labelledby="canvas-spacing-title">
|
||||
<div class="admin-heading compact"><h2 id="canvas-spacing-title">元素间距</h2></div>
|
||||
<form class="admin-form" method="dialog">
|
||||
@@ -119,6 +140,7 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
</select></label>
|
||||
<label data-property-row="newTab">打开方式<select name="newTab"><option value="0">当前标签页</option><option value="1">新标签页</option></select></label>
|
||||
<label data-property-row="alt">图片替代文本<input name="alt" maxlength="200"></label>
|
||||
<label data-property-row="breadcrumbs">面包屑路径<textarea name="breadcrumbs" rows="5" placeholder="首页 | /"></textarea><small>每行填写「文案 | 链接」。清空后隐藏面包屑。</small></label>
|
||||
<label data-property-row="quicklinks">目录链接<textarea name="quicklinks" rows="5" placeholder="概览 | #overview"></textarea><small>每行填写「文案 | 链接」。</small></label>
|
||||
<label data-property-row="value">当前值<input name="value" inputmode="numeric"></label>
|
||||
<label data-property-row="max">最大值<input name="max" inputmode="numeric"></label>
|
||||
@@ -137,7 +159,7 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<dialog class="media-picker canvas-module-settings" data-module-dialog aria-labelledby="module-settings-title">
|
||||
<div class="admin-heading compact"><h2 id="module-settings-title">模块设置</h2></div>
|
||||
<form class="admin-form" method="dialog">
|
||||
<label>模块标题<input name="module_title" maxlength="100" required></label>
|
||||
<label>模块标题<textarea name="module_title" rows="2" maxlength="100" required></textarea></label>
|
||||
<label>模块简介<textarea name="module_lead" rows="2" maxlength="500"></textarea></label>
|
||||
<?= View::fragment('studio-feed-fields', ['categories' => $categories, 'feed' => [], 'allowOff' => false]) ?>
|
||||
<p class="feedback error" role="alert" data-module-error hidden></p>
|
||||
@@ -156,6 +178,11 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<input type="hidden" name="canvas_sections" value="">
|
||||
<input type="hidden" name="canvas_order" value="">
|
||||
<input type="hidden" name="canvas_presentation" value="<?= $e(CanvasStyle::encode($page['presentation'])) ?>">
|
||||
<input type="hidden" name="canvas_breadcrumbs" value="<?= $e($page['presentation']['breadcrumbLinks'] ?? SiteDesign::linkText([['/', '首页'], [$path, $page['name']]])) ?>">
|
||||
<input type="hidden" name="canvas_breadcrumbs_custom" value="<?= array_key_exists('breadcrumbLinks', $page['presentation']) ? '1' : '0' ?>">
|
||||
<input type="hidden" name="canvas_hero_custom" value="<?= array_key_exists('heroHtml', $page['presentation']) ? '1' : '0' ?>">
|
||||
<input type="hidden" name="eyebrow" value="<?= $e($page['presentation']['heroEyebrow'] ?? $siteName) ?>">
|
||||
<input type="hidden" name="canvas_eyebrow_custom" value="<?= array_key_exists('heroEyebrow', $page['presentation']) ? '1' : '0' ?>">
|
||||
<input type="hidden" name="alignments" value="<?= $e(Database::json($page['alignments'])) ?>">
|
||||
<details class="studio-hero-settings">
|
||||
<summary>首屏与目录</summary>
|
||||
@@ -163,6 +190,7 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<button class="button button-outline" type="button" disabled data-hero-control="image">首屏图片</button>
|
||||
<button class="button button-outline" type="button" disabled data-hero-control="add-action">添加首屏按钮</button>
|
||||
<button class="button button-outline" type="button" disabled data-hero-control="navigation">本页目录</button>
|
||||
<?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>
|
||||
|
||||
+3
-1
@@ -14,6 +14,7 @@ $theme = $page['theme'] ?? '';
|
||||
$palette = DesignLibrary::find((int) ($page['palette_id'] ?? 0), 'palette');
|
||||
$showHeader = $page['visibility']['header'] ?? true;
|
||||
$showFooter = $page['visibility']['footer'] ?? true;
|
||||
$canvasStyles = $content . ($headerMarkup ?? '') . ($footerMarkup ?? '');
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
@@ -44,7 +45,8 @@ $showFooter = $page['visibility']['footer'] ?? true;
|
||||
<?php endif ?>
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<link rel="stylesheet" href="/assets/site.css">
|
||||
<?php if (!empty($canvas) || str_contains($content . ($headerMarkup ?? '') . ($footerMarkup ?? ''), 'studio-style-')): ?><link rel="stylesheet" href="<?= $e(CanvasStyle::stylesheetUrl()) ?>"><?php endif ?>
|
||||
<?php if (!empty($canvas) || str_contains($canvasStyles, 'studio-style-') || str_contains($canvasStyles, 'studio-media-')): ?><link rel="stylesheet" href="<?= $e(CanvasStyle::stylesheetUrl()) ?>"><?php endif ?>
|
||||
<?php if (!empty($styleNonce)): ?><style nonce="<?= $e($styleNonce) ?>" data-canvas-colors><?= $canvasColors ?></style><?php endif ?>
|
||||
<?php if ($theme !== ''): ?><link rel="stylesheet" href="/assets/page-themes.css"><?php endif ?>
|
||||
<?php if ($palette): ?><link rel="stylesheet" data-page-palette href="/palette/<?= $e($palette['id']) ?>.css?v=<?= $e($palette['version']) ?>"><?php endif ?>
|
||||
<script src="<?= $e(Assets::JQUERY) ?>" defer></script>
|
||||
|
||||
+26
-15
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use App\Content\Buttons;
|
||||
use App\Content\CanvasStyle;
|
||||
use App\Content\SiteDesign;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
@@ -11,6 +12,12 @@ $showHero = $page['visibility']['hero'] ?? true;
|
||||
$heroLinks = array_filter($page['sections'], static fn (array $section): bool => $section['style'] === 'hero-links');
|
||||
$alignments = $page['alignments'];
|
||||
$presentation = $page['presentation'] ?? [];
|
||||
$showBreadcrumbs = !$home && !$shared && !$system;
|
||||
$customCrumbs = array_key_exists('breadcrumbLinks', $presentation);
|
||||
$crumbs = !$showBreadcrumbs ? [] : ($customCrumbs
|
||||
? SiteDesign::parseLinks($presentation['breadcrumbLinks']) : [['/', '首页'], ['/' . $page['slug'], $page['name']]]);
|
||||
$customHero = array_key_exists('heroHtml', $presentation);
|
||||
$renderManagedHero = !$customHero || $canvas;
|
||||
$style = static fn (string $role): string => CanvasStyle::classes($presentation, $role);
|
||||
$text = static fn (string $role, string $value): string => CanvasStyle::text($presentation, $role, $value);
|
||||
$styleField = static fn (string $role): string => $canvas ? ' data-studio-style-field="' . $role . '"' : '';
|
||||
@@ -21,24 +28,27 @@ $field = static fn (string $name): string => $canvas ? ' data-studio-field="' .
|
||||
<?php if ($showHero || $canvas || $heroLinks): ?>
|
||||
<section class="hero hero-<?= $e($page['slug']) ?><?= $style('hero') ?>" id="home" data-enter<?= $canvas ? ' data-studio-hero' : '' ?><?= $styleField('hero') ?>>
|
||||
<?php if ($showHero || $canvas): ?>
|
||||
<div class="wrap hero-inner<?= $page['image'] === '' ? ' hero-text-only' : '' ?>"<?= $canvas ? ' data-studio-hero-content' : '' ?><?= $showHero ? '' : ' hidden' ?>>
|
||||
<?php if ($customHero || $canvas): ?>
|
||||
<div class="studio-hero-html rich"<?= $canvas ? ' data-studio-hero-source data-studio-part="body"' : '' ?><?= !$customHero || !$showHero ? ' hidden' : '' ?>><?= $presentation['heroHtml'] ?? '' ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($renderManagedHero): ?>
|
||||
<div class="wrap hero-inner<?= $page['image'] === '' ? ' hero-text-only' : '' ?>"<?= $canvas ? ' data-studio-hero-content' : '' ?><?= $showHero && !$customHero ? '' : ' hidden' ?>>
|
||||
<div class="hero-copy">
|
||||
<?php if (!$home && !$shared && !$system): ?>
|
||||
<nav class="breadcrumbs" aria-label="面包屑" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a itemprop="item" href="/"><span itemprop="name">首页</span></a>
|
||||
<meta itemprop="position" content="1">
|
||||
</span>
|
||||
<span class="crumb-divider" aria-hidden="true">/</span>
|
||||
<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a itemprop="item" href="/<?= $e($page['slug']) ?>" aria-current="page"><span itemprop="name"<?= $field('name') ?>><?= $e($page['name']) ?></span></a>
|
||||
<meta itemprop="position" content="2">
|
||||
</span>
|
||||
<?php if ($showBreadcrumbs && ($crumbs || $canvas)): ?>
|
||||
<nav class="breadcrumbs<?= $style('breadcrumbs') ?>" aria-label="面包屑" itemscope itemtype="https://schema.org/BreadcrumbList"<?= $canvas ? ' data-studio-breadcrumbs' : '' ?><?= $styleField('breadcrumbs') ?><?= $crumbs ? '' : ' hidden' ?>>
|
||||
<?php foreach ($crumbs as $index => [$url, $label]): ?>
|
||||
<?php $role = 'crumb-' . $index; ?>
|
||||
<?php if ($index > 0): ?><span class="crumb-divider" aria-hidden="true">/</span><?php endif ?>
|
||||
<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a itemprop="item" href="<?= $e($url) ?>"<?= $index === count($crumbs) - 1 ? ' aria-current="page"' : '' ?><?= $styleField($role) ?> class="<?= trim($style($role)) ?>"><span itemprop="name"><?= $text($role, $label) ?></span></a>
|
||||
<meta itemprop="position" content="<?= $index + 1 ?>">
|
||||
</span>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<?php else: ?>
|
||||
<p class="overline hero-label"><?= $e($site['name']) ?></p>
|
||||
<?php elseif (!$showBreadcrumbs): ?>
|
||||
<p class="overline hero-label"<?= $field('eyebrow') ?><?= $styleField('eyebrow') ?>><?= $text('eyebrow', $presentation['heroEyebrow'] ?? $site['name']) ?></p>
|
||||
<?php endif ?>
|
||||
<h1<?= isset($alignments['heading']) ? ' class="' . trim(View::alignmentClass($alignments['heading'])) . '"' : '' ?><?= $alignField('heading') ?>><span class="hero-heading-primary<?= $style('heading') ?>"<?= $field('heading') ?><?= $styleField('heading') ?>><?= $text('heading', $page['heading']) ?></span><?php if ($canvas): ?><span class="studio-accent<?= $style('accent') ?>"<?= $field('accent') ?><?= $styleField('accent') ?>><?= $text('accent', $page['accent']) ?></span><?php elseif ($page['accent'] !== ''): ?><br><span class="<?= trim($style('accent')) ?>"><?= $text('accent', $page['accent']) ?></span><?php endif ?></h1>
|
||||
<h1<?= isset($alignments['heading']) ? ' class="' . trim(View::alignmentClass($alignments['heading'])) . '"' : '' ?><?= $alignField('heading') ?>><span class="hero-heading-primary<?= $style('heading') ?>"<?= $field('heading') ?><?= $styleField('heading') ?>><?= $text('heading', $page['heading']) ?></span><?php if ($canvas || $page['accent'] !== ''): ?><span class="hero-accent<?= $style('accent') ?>"<?= $field('accent') ?><?= $styleField('accent') ?>><?= $text('accent', $page['accent']) ?></span><?php endif ?></h1>
|
||||
<p class="hero-lead<?= View::alignmentClass($alignments['lead'] ?? null) ?><?= $style('lead') ?>"<?= $field('lead') ?><?= $alignField('lead') ?><?= $styleField('lead') ?>><?= $text('lead', $page['lead']) ?></p>
|
||||
<div class="actions hero-actions<?= View::alignmentClass($alignments['actions'] ?? null) ?><?= $style('actions') ?>"<?= $alignField('actions') ?><?= $styleField('actions') ?>>
|
||||
<?php foreach (Buttons::validate($page['actions']) as $index => [$url, $label, $buttonStyle, $blank]): ?>
|
||||
@@ -54,6 +64,7 @@ $field = static fn (string $name): string => $canvas ? ' data-studio-field="' .
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php foreach ($heroLinks as $section): ?>
|
||||
<?= View::fragment('section', ['section' => $section, 'moment' => false, 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
|
||||
<?php endforeach ?>
|
||||
|
||||
@@ -5,7 +5,7 @@ use App\Content\View;
|
||||
$e = View::escape(...);
|
||||
$canvas ??= false;
|
||||
$body = $section['body'];
|
||||
$dynamic = isset($section['feed']);
|
||||
$dynamic = !empty($section['feed']);
|
||||
$presentation = json_decode($section['presentation'] ?? '{}', true, flags: JSON_THROW_ON_ERROR);
|
||||
$style = static fn (string $role): string => CanvasStyle::classes($presentation, $role);
|
||||
$text = static fn (string $role): string => CanvasStyle::text($presentation, $role, $section[$role]);
|
||||
|
||||
@@ -26,6 +26,10 @@ $paths = [
|
||||
'desktop' => '<rect x="3" y="4.5" width="18" height="12" rx="2"/><path d="M12 16.5v4m-4 0h8"/>',
|
||||
'phone' => '<rect x="7" y="3" width="10" height="18" rx="2"/><path d="M11 17.5h2"/>',
|
||||
'archive' => '<rect x="4" y="4" width="16" height="4" rx="1"/><path d="M5 8v12h14V8m-9 4h4"/>',
|
||||
'code' => '<path d="m8 6-6 6 6 6m8-12 6 6-6 6m-3-15-2 18"/>',
|
||||
'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"/>',
|
||||
'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"/>',
|
||||
];
|
||||
?>
|
||||
|
||||
@@ -5,29 +5,32 @@ use App\Content\View;
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<details class="studio-layers" id="blocks" open>
|
||||
<summary>区块顺序</summary>
|
||||
<p class="field-note" data-layers-empty<?= $page['sections'] ? ' hidden' : '' ?>>添加的独立区块会显示在这里。</p>
|
||||
<ul class="admin-list studio-blocks" data-canvas-layers>
|
||||
<summary>页面图层</summary>
|
||||
<?php foreach (['target', 'up', 'down', 'delete', 'code', 'settings'] 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>
|
||||
<ul class="studio-layer-tree" data-canvas-layers>
|
||||
<?php foreach ($page['sections'] as $index => $item): ?>
|
||||
<?php $fixedSlot = $item['style'] === 'hero-links'; ?>
|
||||
<li>
|
||||
<div>
|
||||
<div class="studio-component-label">
|
||||
<strong><?= $e($item['title']) ?></strong>
|
||||
<?php if (isset($item['feed'])): ?><span class="studio-dynamic-badge">动态</span><?php endif ?>
|
||||
<?php if (!empty($item['feed'])): ?><span class="studio-dynamic-badge">动态</span><?php endif ?>
|
||||
</div>
|
||||
<small>#<?= $e($item['key']) ?></small>
|
||||
</div>
|
||||
<div class="actions studio-block-actions">
|
||||
<a class="button button-outline" href="/admin/pages/<?= $e($slug) ?>/<?= $e($item['key']) ?>">区块设置</a>
|
||||
<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>
|
||||
<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']) ?>">
|
||||
<input type="hidden" name="page_version" value="<?= $e($page['version']) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($item['version']) ?>">
|
||||
<button class="button button-outline" name="operation" value="up" type="submit" <?= $fixedSlot || $index === 0 || $page['sections'][$index - 1]['style'] === 'hero-links' ? 'disabled' : '' ?>>上移</button>
|
||||
<button class="button button-outline" name="operation" value="down" type="submit" <?= $fixedSlot || $index === count($page['sections']) - 1 ? 'disabled' : '' ?>>下移</button>
|
||||
<button class="button button-outline" name="operation" value="delete" type="submit" data-confirm="删除这个区块?">删除</button>
|
||||
<button class="button button-outline" aria-label="上移" title="上移" name="operation" value="up" type="submit" <?= $fixedSlot || $index === 0 || $page['sections'][$index - 1]['style'] === 'hero-links' ? 'disabled' : '' ?>><?= View::fragment('studio-icon', ['icon' => 'up']) ?></button>
|
||||
<button class="button button-outline" aria-label="下移" title="下移" name="operation" value="down" type="submit" <?= $fixedSlot || $index === count($page['sections']) - 1 ? 'disabled' : '' ?>><?= View::fragment('studio-icon', ['icon' => 'down']) ?></button>
|
||||
<button class="button button-outline" aria-label="删除" title="删除" name="operation" value="delete" type="submit" data-confirm="删除这个区块?"><?= View::fragment('studio-icon', ['icon' => 'delete']) ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -27,9 +27,9 @@ $modules = $kind === 'modules';
|
||||
<?php foreach ($groups as $group => [$category, $items]): ?>
|
||||
<div class="<?= $modules ? 'studio-template-cards' : 'studio-element-items' ?>" data-template-group="<?= $e($group) ?>" hidden>
|
||||
<?php foreach ($items as $key => $item): ?>
|
||||
<?php [$label, $markup, $option, $feed] = array_pad($item, 4, null); ?>
|
||||
<?php [$label, $markup, $option, $feed] = array_pad($item, 4, null); $dynamic = is_string($feed) && $feed !== ''; ?>
|
||||
<?php if ($modules): ?>
|
||||
<article class="studio-template-card" data-template-card data-library-item data-template-search-text="<?= $e($label . ' ' . $key . ($feed !== null ? ' 动态' : '')) ?>">
|
||||
<article class="studio-template-card" data-template-card data-library-item data-template-search-text="<?= $e($label . ' ' . $key . ($dynamic ? ' 动态' : '')) ?>">
|
||||
<?php if (($item[4] ?? '') === 'layout'): ?>
|
||||
<?php [$previewKind, $previewPreset] = explode('-', $key, 2); ?>
|
||||
<div class="studio-layout-card-preview">
|
||||
@@ -45,11 +45,11 @@ $modules = $kind === 'modules';
|
||||
<div class="studio-template-meta">
|
||||
<div class="studio-component-label">
|
||||
<span><?= $e($label) ?></span>
|
||||
<?php if ($feed !== null): ?><span class="studio-dynamic-badge">动态</span><?php endif ?>
|
||||
<?php if ($dynamic): ?><span class="studio-dynamic-badge">动态</span><?php endif ?>
|
||||
</div>
|
||||
<button type="button" class="button button-outline" disabled data-canvas-template="<?= $e($key) ?>"
|
||||
data-template-title="<?= $e($label) ?>" data-template-lead="<?= $e($option) ?>" data-template-style="<?= $e($item[4] ?? 'plain') ?>"
|
||||
<?= $feed !== null ? 'data-template-feed="' . $e($feed) . '"' : '' ?> aria-label="添加<?= $e($label) ?>组件">添加</button>
|
||||
<?= $dynamic ? 'data-template-feed="' . $e($feed) . '"' : '' ?> aria-label="添加<?= $e($label) ?>组件">添加</button>
|
||||
</div>
|
||||
<template data-preset="<?= $e($key) ?>"><?= $markup ?></template>
|
||||
</article>
|
||||
|
||||
@@ -7,7 +7,7 @@ $e = View::escape(...);
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/media" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<div class="form-grid">
|
||||
<div class="form-grid media-upload-fields">
|
||||
<label>文件<input type="file" name="file" accept="image/*,video/*,audio/*,.pdf,.woff,.woff2" required>
|
||||
<small>支持常见图片、SVG 图标、音视频、PDF、WOFF/WOFF2,单文件最大 64 MB。</small>
|
||||
</label>
|
||||
@@ -17,7 +17,7 @@ $e = View::escape(...);
|
||||
</form>
|
||||
<section class="admin-panel media-library" data-media-library aria-labelledby="library-heading">
|
||||
<h2 id="library-heading">资源列表</h2>
|
||||
<div class="form-grid">
|
||||
<div class="form-grid admin-form media-filters">
|
||||
<label>搜索<input type="search" data-library-query placeholder="搜索名称或路径"></label>
|
||||
<label>类型<select data-library-type><option value="">全部资源</option><option value="image/">图片与图标</option><option value="video/">视频</option><option value="audio/">音频</option><option value="other">其他文件</option></select></label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user