v1.2.4: 이미지 캡션 표시 수정 및 미리보기 갤러리 드래그 정렬
파일명 alt와 캡션을 분리해 공개·미리보기에 캡션이 보이도록 하고, 관리자 미리보기에서 갤러리 순서를 드래그로 바꿀 수 있게 했다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import { normalizeMarkdownContent } from '../../lib/markdown-content-normalizer.js'
|
||||
import { resolveActiveBlockContext } from '../../lib/markdown-block-context.js'
|
||||
import { serializeImageMarkdown } from '../../lib/markdown-image.js'
|
||||
import { getImageDefaultAltLabel, serializeImageMarkdown } from '../../lib/markdown-image.js'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@@ -629,7 +629,41 @@ const updateActiveMediaImage = (imageIndex, patch) => {
|
||||
* @returns {void}
|
||||
*/
|
||||
const setActiveMediaUseAlt = (imageIndex, enabled) => {
|
||||
updateActiveMediaImage(imageIndex, { useAlt: enabled })
|
||||
const image = activeMediaBlock.value?.images[imageIndex]
|
||||
|
||||
if (!image) {
|
||||
return
|
||||
}
|
||||
|
||||
const patch = { useAlt: enabled }
|
||||
|
||||
if (enabled && !String(image.caption || '').trim()) {
|
||||
const legacy = String(image.legacyBracketLabel || '').trim()
|
||||
const filename = getImageDefaultAltLabel(image.url)
|
||||
|
||||
if (legacy && legacy !== filename) {
|
||||
patch.caption = legacy
|
||||
}
|
||||
}
|
||||
|
||||
updateActiveMediaImage(imageIndex, patch)
|
||||
}
|
||||
|
||||
/**
|
||||
* 미리보기에서 갤러리 순서 변경
|
||||
* @param {{ startLine: number, endLine: number, images: Array<Object> }} payload - 갤러리 줄 범위·이미지 목록
|
||||
* @returns {void}
|
||||
*/
|
||||
const onPreviewGalleryReorder = ({ startLine, endLine, images }) => {
|
||||
if (typeof startLine !== 'number' || typeof endLine !== 'number' || !Array.isArray(images)) {
|
||||
return
|
||||
}
|
||||
|
||||
replaceLineRange(startLine, endLine, [
|
||||
':::gallery',
|
||||
...images.map(createImageMarkdown),
|
||||
':::'
|
||||
], false)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1318,7 +1352,12 @@ const handleKeydown = (event) => {
|
||||
style="--site-text: #15171a; --site-muted: #6b7280; --site-panel: #f6f7f8; --site-line: #e3e6e8; --site-accent: #2eb6ea;"
|
||||
tabindex="0"
|
||||
>
|
||||
<ContentMarkdownRenderer v-if="markdownValue.trim()" :content="markdownValue" />
|
||||
<ContentMarkdownRenderer
|
||||
v-if="markdownValue.trim()"
|
||||
:content="markdownValue"
|
||||
interactive
|
||||
@gallery-reorder="onPreviewGalleryReorder"
|
||||
/>
|
||||
<p v-else class="admin-markdown-editor__preview-empty text-sm text-[#8e9cac]">
|
||||
미리보기할 본문이 없습니다.
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user