v1.2.2: 이미지 파일명 alt 판별 및 미리보기 캡션 분리 수정
대괄호 내용이 URL 파일명과 일치할 때만 useAlt로 처리해, 캡션과 대체 텍스트가 미리보기에서 혼동되지 않도록 했다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -165,7 +165,10 @@ const onPanelFocusOut = (event) => {
|
||||
v-if="image.useAlt"
|
||||
class="text-[11px] font-normal text-[#8e9cac]"
|
||||
>
|
||||
{{ getImageDefaultAltLabel(image.url) || '(파일명 없음)' }}
|
||||
대체 텍스트: {{ getImageDefaultAltLabel(image.url) || '(파일명 없음)' }} (미리보기 화면에는 보이지 않음)
|
||||
</p>
|
||||
<p class="text-[11px] font-normal text-[#8e9cac]">
|
||||
캡션은 이미지 아래에만 표시됩니다.
|
||||
</p>
|
||||
<label class="grid gap-1 text-xs font-semibold text-[#394047]">
|
||||
이미지 URL
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# 업데이트 이력
|
||||
|
||||
## v1.2.2
|
||||
|
||||
- 이미지 `useAlt` 판별: 대괄호 내용이 URL 파일명과 일치할 때만 파일명 대체 텍스트 모드로 처리(임의 문자열·레거시 표시문구와 분리).
|
||||
- 미리보기 figcaption: 따옴표 캡션 우선, 레거시 ``만 대괄호 문구를 표시용으로 유지.
|
||||
- 패키지 버전 `1.2.2`로 갱신.
|
||||
|
||||
## v1.2.1
|
||||
|
||||
- 관리자 블록 설정 패널: 게시물 설정 사이드바(420px) 오버레이 슬라이드, 이미지·갤러리·임베드 편집.
|
||||
|
||||
@@ -48,14 +48,21 @@ export const parseImageMarkdownLine = (line) => {
|
||||
return null
|
||||
}
|
||||
|
||||
const alt = match[1] || ''
|
||||
const url = match[2] || ''
|
||||
const altBracket = (match[1] || '').trim()
|
||||
const quotedCaption = unescapeImageCaption(match[3])
|
||||
const filenameAlt = getImageDefaultAltLabel(url)
|
||||
/** 대괄호 안 문자열이 URL 파일명과 같을 때만 파일명 대체 텍스트 모드 */
|
||||
const useAlt = altBracket !== '' && altBracket === filenameAlt
|
||||
|
||||
return {
|
||||
url: match[2] || '',
|
||||
caption: unescapeImageCaption(match[3]),
|
||||
url,
|
||||
/** `` 따옴표 캡션만 편집 필드에 반영 */
|
||||
caption: quotedCaption,
|
||||
/** 레거시 `` — 캡션 따옴표 없을 때 미리보기용 */
|
||||
legacyBracketLabel: !quotedCaption && altBracket && !useAlt ? altBracket : '',
|
||||
width: match[4] || 'regular',
|
||||
/** true이면 대체 텍스트로 URL 파일명을 사용한다 */
|
||||
useAlt: Boolean(alt)
|
||||
useAlt
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,4 +104,16 @@ export const getImageAltAttribute = (image) => {
|
||||
* @param {{ caption?: string }} image - 이미지 정보
|
||||
* @returns {string} 캡션
|
||||
*/
|
||||
export const getImageCaption = (image) => String(image?.caption || '').trim()
|
||||
export const getImageCaption = (image) => {
|
||||
const caption = String(image?.caption || '').trim()
|
||||
|
||||
if (caption) {
|
||||
return caption
|
||||
}
|
||||
|
||||
if (image?.useAlt) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return String(image?.legacyBracketLabel || '').trim()
|
||||
}
|
||||
|
||||
22
package-lock.json
generated
22
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "sori.studio",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sori.studio",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@nuxtjs/tailwindcss": "^6.14.0",
|
||||
@@ -615,7 +615,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
||||
"license": "MIT",
|
||||
@@ -6340,7 +6340,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/fast-string-truncated-width": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-1.2.1.tgz",
|
||||
"integrity": "sha512-Q9acT/+Uu3GwGj+5w/zsGuQjh9O1TyywhIwAxHudtWrgF09nHOPrvTLhQevPbttcxjr/SNN7mJmfOw/B1bXgow==",
|
||||
"license": "MIT"
|
||||
@@ -6885,7 +6885,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"funding": [
|
||||
@@ -6983,7 +6983,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/iron-webcrypto": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz",
|
||||
"integrity": "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==",
|
||||
"license": "MIT",
|
||||
@@ -7156,7 +7156,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-reference": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
|
||||
"integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==",
|
||||
"license": "MIT",
|
||||
@@ -7165,7 +7165,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-regex": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz",
|
||||
"integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==",
|
||||
"license": "MIT",
|
||||
@@ -9885,7 +9885,7 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"license": "MIT",
|
||||
@@ -10459,7 +10459,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
|
||||
"integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
|
||||
"license": "MIT",
|
||||
@@ -10693,7 +10693,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"license": "BSD-3-Clause",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sori.studio",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"imports": {
|
||||
|
||||
Reference in New Issue
Block a user