Fix canvas formatting persistence and editor interactions
This commit is contained in:
@@ -31,6 +31,12 @@ $active = match (true) {
|
||||
<link rel="stylesheet" href="/assets/page-template-drawer.css">
|
||||
<script src="/assets/page-template-drawer.js" defer></script>
|
||||
<?php endif ?>
|
||||
<?php if (!empty($canvasSourceEditor)): ?>
|
||||
<link rel="stylesheet" href="/assets/vendor/codemirror/codemirror.min.css">
|
||||
<script src="/assets/vendor/codemirror/codemirror.min.js" defer></script>
|
||||
<script src="/assets/vendor/codemirror/xml.min.js" defer></script>
|
||||
<script src="/assets/vendor/js-beautify/beautify-html.min.js" defer></script>
|
||||
<?php endif ?>
|
||||
<?php if (!empty($articleEditor)): ?>
|
||||
<link rel="stylesheet" href="/assets/vendor/toastui/toastui-editor.min.css">
|
||||
<script src="<?= $e(Assets::TOAST_UI_EDITOR) ?>" defer></script>
|
||||
@@ -78,7 +84,21 @@ $active = match (true) {
|
||||
<label>查找资源<input type="search" data-media-query placeholder="搜索文件名或资源路径"></label>
|
||||
<p data-picker-status role="status"></p>
|
||||
<div class="picker-grid" data-picker-items></div>
|
||||
<a class="back-link" href="/admin/media" target="_blank" rel="noopener noreferrer">打开媒体库上传</a>
|
||||
<div class="actions picker-actions">
|
||||
<button class="button button-outline" type="button" data-refresh-picker><?= View::fragment('studio-icon', ['icon' => 'refresh']) ?>刷新资源</button>
|
||||
<a class="back-link" href="/admin/media" target="_blank" rel="noopener noreferrer">打开媒体库上传</a>
|
||||
</div>
|
||||
</dialog>
|
||||
<dialog class="media-picker admin-action-dialog" id="admin-action-dialog" aria-labelledby="admin-action-heading">
|
||||
<form class="admin-form" method="dialog">
|
||||
<h2 id="admin-action-heading" data-action-title></h2>
|
||||
<p data-action-message hidden></p>
|
||||
<label data-action-field hidden><span data-action-label></span><input data-action-value></label>
|
||||
<div class="actions">
|
||||
<button class="button button-primary" data-action-accept value="accept" type="submit">确定</button>
|
||||
<button class="button button-outline" data-action-cancel type="button">取消</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
<?php endif ?>
|
||||
</body>
|
||||
|
||||
+18
-4
@@ -91,7 +91,7 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<button type="button" data-element-<?= $action ?> aria-label="<?= $label ?>" title="<?= $label ?>"><?= View::fragment('studio-icon', compact('icon')) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<button class="studio-media-handle" type="button" role="slider" aria-label="媒体宽度" aria-valuemin="10" aria-valuemax="100" aria-valuenow="100" data-media-handle hidden></button>
|
||||
<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>
|
||||
@@ -103,7 +103,10 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<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>
|
||||
<div>
|
||||
<label for="canvas-source-code">HTML 源码</label>
|
||||
<textarea id="canvas-source-code" data-source-code rows="15" spellcheck="false" autocapitalize="off" maxlength="300000" wrap="off"></textarea>
|
||||
</div>
|
||||
<p class="field-note" data-source-hint></p>
|
||||
<p class="feedback error" data-source-error role="alert" hidden></p>
|
||||
<div class="actions">
|
||||
@@ -118,6 +121,17 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<form class="admin-form" method="dialog">
|
||||
<?php foreach (['p' => ['内边距', 0], 'm' => ['外边距', -128]] as $prefix => [$label, $min]): ?>
|
||||
<fieldset class="admin-options canvas-spacing-fields"><legend><?= $label ?>(px)</legend>
|
||||
<label class="canvas-spacing-preset">四边预设
|
||||
<select data-spacing-preset>
|
||||
<option value="">自定义</option>
|
||||
<option value="template">恢复默认</option>
|
||||
<option value="0">无间距 · 0 px</option>
|
||||
<option value="8">紧凑 · 8 px</option>
|
||||
<option value="16">常规 · 16 px</option>
|
||||
<option value="24">宽松 · 24 px</option>
|
||||
<option value="32">大间距 · 32 px</option>
|
||||
</select>
|
||||
</label>
|
||||
<?php foreach (['t' => '上', 'r' => '右', 'b' => '下', 'l' => '左'] as $side => $direction): ?>
|
||||
<label><?= $direction ?><input name="<?= $prefix . $side ?>" type="number" min="<?= $min ?>" max="128" step="1" placeholder="默认"></label>
|
||||
<?php endforeach ?>
|
||||
@@ -246,8 +260,8 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
];
|
||||
?>
|
||||
<?php foreach ($contentFields as $field => $value): ?>
|
||||
<?php if ($field === 'quicklinks'): ?>
|
||||
<textarea name="quicklinks" hidden><?= $e($value) ?></textarea>
|
||||
<?php if (in_array($field, ['heading', 'accent', 'lead', 'quicklinks'], true)): ?>
|
||||
<textarea name="<?= $e($field) ?>" hidden><?= $e($value) ?></textarea>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="<?= $e($field) ?>" value="<?= $e($value) ?>">
|
||||
<?php endif ?>
|
||||
|
||||
Reference in New Issue
Block a user