v1.2.4: 이미지 캡션 표시 수정 및 미리보기 갤러리 드래그 정렬

파일명 alt와 캡션을 분리해 공개·미리보기에 캡션이 보이도록 하고, 관리자 미리보기에서 갤러리 순서를 드래그로 바꿀 수 있게 했다.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-15 18:44:56 +09:00
parent a867269d9b
commit c9b484e4c8
7 changed files with 224 additions and 40 deletions

View File

@@ -20,6 +20,25 @@ const escapeImageCaption = (value) => String(value || '').replace(/"/g, '\\"')
* @param {string} url - 이미지 URL
* @returns {string} 파일명 기반 라벨
*/
/**
* 파일명·대괄호 라벨 비교용 정규화
* @param {string} value - 원본 문자열
* @returns {string} 정규화된 문자열
*/
const normalizeFilenameLabel = (value) => {
const raw = String(value || '').trim()
if (!raw) {
return ''
}
try {
return decodeURIComponent(raw)
} catch {
return raw
}
}
export const getImageDefaultAltLabel = (url) => {
const raw = String(url || '').trim()
@@ -53,7 +72,8 @@ export const parseImageMarkdownLine = (line) => {
const quotedCaption = unescapeImageCaption(match[3])
const filenameAlt = getImageDefaultAltLabel(url)
/** 대괄호 안 문자열이 URL 파일명과 같을 때만 파일명 대체 텍스트 모드 */
const useAlt = altBracket !== '' && altBracket === filenameAlt
const useAlt = altBracket !== ''
&& normalizeFilenameLabel(altBracket) === normalizeFilenameLabel(filenameAlt)
return {
url,
@@ -117,3 +137,10 @@ export const getImageCaption = (image) => {
return String(image?.legacyBracketLabel || '').trim()
}
/**
* 표시용 캡션(단일·갤러리 공통)
* @param {Object} image - 이미지 블록 데이터
* @returns {string} figcaption 텍스트
*/
export const getImageDisplayCaption = (image) => getImageCaption(image)