관리자 글쓰기·목록 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:
41
lib/admin-post-title.js
Normal file
41
lib/admin-post-title.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/** @type {string} DB/API에만 쓰는 제목 없음 표시(폼·목록에는 빈 문자열로 노출) */
|
||||
export const ADMIN_POST_PLACEHOLDER_TITLE = '(제목 없음)'
|
||||
|
||||
/**
|
||||
* 제목 없음 플레이스홀더 여부
|
||||
* @param {string | null | undefined} title - 제목
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const isAdminPostPlaceholderTitle = (title) => {
|
||||
const t = String(title ?? '').trim()
|
||||
return !t || t === ADMIN_POST_PLACEHOLDER_TITLE
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자 폼·목록에 표시할 제목(플레이스홀더는 빈 문자열)
|
||||
* @param {string | null | undefined} title - DB/API 제목
|
||||
* @returns {string}
|
||||
*/
|
||||
export const toAdminPostFormTitle = (title) => {
|
||||
if (isAdminPostPlaceholderTitle(title)) {
|
||||
return ''
|
||||
}
|
||||
return String(title).trim()
|
||||
}
|
||||
|
||||
/**
|
||||
* API 저장용 제목(비어 있으면 플레이스홀더)
|
||||
* @param {string | null | undefined} title - 폼 제목
|
||||
* @returns {string}
|
||||
*/
|
||||
export const toAdminPostStoredTitle = (title) => {
|
||||
const t = String(title ?? '').trim()
|
||||
return t.length ? t : ADMIN_POST_PLACEHOLDER_TITLE
|
||||
}
|
||||
|
||||
/**
|
||||
* 임시 슬러그 여부(d + 24~25자리 hex)
|
||||
* @param {string | null | undefined} slug - 슬러그
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const isAdminPostDraftPlaceholderSlug = (slug) => /^d[0-9a-f]{24,25}$/i.test(String(slug ?? '').trim())
|
||||
Reference in New Issue
Block a user