forked from laysense/laysite
Add page publication history and reusable blocks
This commit is contained in:
@@ -182,7 +182,7 @@ final class McpController
|
||||
|
||||
private function readSource(Repository $repo, string $slug): array
|
||||
{
|
||||
$page = $this->read($repo, $slug);
|
||||
$page = $repo->resolveDraft($this->read($repo, $slug));
|
||||
|
||||
return $page + ['raw_html' => PageDraft::rawHtml($page)];
|
||||
}
|
||||
@@ -192,8 +192,8 @@ final class McpController
|
||||
$slug = PageDraft::slug($args['slug'] ?? null);
|
||||
$page = $this->read($repo, $slug);
|
||||
$version = $args['version'] ?? null;
|
||||
if ($page['status'] !== 'draft' || !is_int($version) || $version !== $page['version']) {
|
||||
throw new RuntimeException('只能编辑匹配当前版本的草稿。请重新读取页面。');
|
||||
if (!is_int($version) || $version !== $page['version']) {
|
||||
throw new RuntimeException('只能编辑匹配当前修订号的草稿。请重新读取页面。');
|
||||
}
|
||||
$page = PageDraft::content($args, $page);
|
||||
$replace = array_key_exists('sections', $args);
|
||||
|
||||
Reference in New Issue
Block a user