관리자 글쓰기·목록 UX 개선 및 POST 설정 추가(v1.1.14~v1.1.18)
Ghost형 툴바·초안 자동 저장·발행 모달, private 제거, 미디어 모달 통합, 발행일·수정일 표시 설정과 DB 마이그레이션 025·026을 반영한다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { z } from 'zod'
|
||||
import { ADMIN_POST_PLACEHOLDER_TITLE } from '../../lib/admin-post-title.js'
|
||||
import { normalizeMarkdownContent } from '../../lib/markdown-content-normalizer.js'
|
||||
import { postStatusSchema } from './content-schema.js'
|
||||
|
||||
export const adminPostInputSchema = z.object({
|
||||
title: z.string().trim().min(1),
|
||||
title: z.preprocess((val) => {
|
||||
const t = String(val ?? '').trim()
|
||||
return t.length ? t : ADMIN_POST_PLACEHOLDER_TITLE
|
||||
}, z.string().min(1)),
|
||||
slug: z.string().trim().min(1).regex(/^[a-z0-9가-힣]+(?:-[a-z0-9가-힣]+)*$/),
|
||||
content: z.preprocess(normalizeMarkdownContent, z.string()).default(''),
|
||||
excerpt: z.string().default(''),
|
||||
@@ -14,7 +18,7 @@ export const adminPostInputSchema = z.object({
|
||||
canonicalUrl: z.string().trim().url().or(z.literal('')).default(''),
|
||||
noindex: z.boolean().default(false),
|
||||
ogImage: z.string().trim().nullable().default(null),
|
||||
status: postStatusSchema.default('draft'),
|
||||
status: z.preprocess((val) => (val === 'private' ? 'draft' : val), postStatusSchema).default('draft'),
|
||||
publishedAt: z.string().datetime().nullable().default(null),
|
||||
tags: z.array(z.string().trim().min(1)).default([])
|
||||
})
|
||||
|
||||
@@ -7,7 +7,8 @@ export const adminSiteSettingsInputSchema = z.object({
|
||||
logoText: z.string().trim().max(8).optional().default('井'),
|
||||
logoUrl: z.string().trim().max(500).optional().default(''),
|
||||
faviconUrl: z.string().trim().max(500).optional().default(''),
|
||||
copyrightText: z.string().trim().min(1)
|
||||
copyrightText: z.string().trim().min(1),
|
||||
showPostUpdatedAt: z.boolean().optional().default(false)
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const postStatusSchema = z.enum(['published', 'draft', 'private'])
|
||||
export const postStatusSchema = z.enum(['published', 'draft'])
|
||||
|
||||
export const postSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
|
||||
@@ -14,6 +14,7 @@ export const getDefaultSiteSettings = () => {
|
||||
logoUrl: '',
|
||||
faviconUrl: '',
|
||||
copyrightText: `©${new Date().getFullYear()} ${title}`,
|
||||
showPostUpdatedAt: false,
|
||||
updatedAt: null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user