Add raw HTML draft editing to LaySite MCP

This commit is contained in:
2026-11-28 17:42:32 +08:00
parent 214098c2e1
commit 1c927d360c
7 changed files with 125 additions and 11 deletions
+4 -2
View File
@@ -61,14 +61,16 @@ final class Repository
public static function insertPage(PDO $pdo, string $slug, string $name, array $template = [], ?int $layoutId = null, string $type = 'page'): void
{
$query = $pdo->prepare("INSERT OR IGNORE INTO pages (slug, name, title, description, heading, accent,
lead, image, alt, actions, quicklinks, theme, visibility, header_id, footer_id, palette_id, layout_id, page_type, status, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
lead, image, alt, actions, quicklinks, theme, visibility, header_id, footer_id, palette_id, layout_id, page_type, status, updated_at,
presentation, head_html)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$query->execute([
$slug, $name, $template['title'] ?? $name, $template['description'] ?? '', $template['heading'] ?? $name,
$template['accent'] ?? '', $template['lead'] ?? '', $template['image'] ?? '', $template['alt'] ?? '',
Database::json($template['actions'] ?? []), Database::json($template['quicklinks'] ?? []),
$template['theme'] ?? '', Database::json($template['visibility'] ?? []), $template['header_id'] ?? null,
$template['footer_id'] ?? null, $template['palette_id'] ?? null, $layoutId, $type, $layoutId === null ? 'draft' : 'published', self::now(),
CanvasStyle::encode($template['presentation'] ?? []), $template['head_html'] ?? '',
]);
if ($query->rowCount() !== 1) {
throw new RuntimeException('此页面地址已存在。');