Ghost형 툴바·초안 자동 저장·발행 모달, private 제거, 미디어 모달 통합, 발행일·수정일 표시 설정과 DB 마이그레이션 025·026을 반영한다. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
/** @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())
|