이미지 파생 파일 생성 안정화
This commit is contained in:
@@ -25,7 +25,11 @@ import {
|
||||
import { buildCalloutOpenerLine, CALLOUT_BACKGROUND_OPTIONS, QUOTE_BACKGROUND_OPTIONS } from '../../lib/markdown-callout.js'
|
||||
import { buildCodeFenceOpener } from '../../lib/markdown-code-block.js'
|
||||
import { buildToggleOpenerLine } from '../../lib/markdown-toggle.js'
|
||||
import { isPostCardThumbnailUrl } from '../../lib/post-card-thumbnail-url.js'
|
||||
import {
|
||||
isPageCoverThumbnailUrl,
|
||||
isPostBodyThumbnailUrl,
|
||||
isPostCardThumbnailUrl
|
||||
} from '../../lib/post-card-thumbnail-url.js'
|
||||
import { getTextareaCaretCoordinates } from '../../lib/textarea-caret-coordinates.js'
|
||||
import {
|
||||
buildDefaultUploadSizeLimits,
|
||||
@@ -1823,7 +1827,7 @@ const getMediaItemKind = (item) => {
|
||||
* @returns {boolean} 선택 가능 여부
|
||||
*/
|
||||
const isMediaItemSelectableForTarget = (item) => {
|
||||
if (isPostCardThumbnailUrl(item?.url)) {
|
||||
if (isPostCardThumbnailUrl(item?.url) || isPostBodyThumbnailUrl(item?.url) || isPageCoverThumbnailUrl(item?.url)) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,11 @@ import {
|
||||
toAdminPostStoredTitle
|
||||
} from '../../lib/admin-post-title.js'
|
||||
import { normalizeMarkdownContent } from '../../lib/markdown-content-normalizer.js'
|
||||
import { isPostCardThumbnailUrl } from '../../lib/post-card-thumbnail-url.js'
|
||||
import {
|
||||
isPageCoverThumbnailUrl,
|
||||
isPostBodyThumbnailUrl,
|
||||
isPostCardThumbnailUrl
|
||||
} from '../../lib/post-card-thumbnail-url.js'
|
||||
import { DEFAULT_POST_TAG_LIMIT, normalizePostTagLimit } from '../../lib/post-tag-limit.js'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -94,12 +98,21 @@ const defaultTagColor = '#15171a'
|
||||
/** @type {number} 한국어 본문 예상 읽기 속도(분당 공백 제외 문자 수) */
|
||||
const READING_CHARS_PER_MINUTE = 600
|
||||
|
||||
/**
|
||||
* 자동 생성 파생 이미지 URL인지 확인한다.
|
||||
* @param {string|null|undefined} imageUrl - 검사할 이미지 URL
|
||||
* @returns {boolean} 자동 생성 이미지이면 true
|
||||
*/
|
||||
const isGeneratedThumbnailUrl = (imageUrl) => isPostCardThumbnailUrl(imageUrl)
|
||||
|| isPostBodyThumbnailUrl(imageUrl)
|
||||
|| isPageCoverThumbnailUrl(imageUrl)
|
||||
|
||||
/**
|
||||
* 대표 이미지로 선택 가능한 원본 이미지 목록
|
||||
* @returns {Array<Object>} 카드 썸네일을 제외한 이미지 목록
|
||||
* @returns {Array<Object>} 자동 생성 이미지를 제외한 이미지 목록
|
||||
*/
|
||||
const featuredImageMediaItems = computed(() => mediaItems.value.filter((item) => (
|
||||
item?.kind === 'image' && !isPostCardThumbnailUrl(item.url)
|
||||
item?.kind === 'image' && !isGeneratedThumbnailUrl(item.url)
|
||||
)))
|
||||
|
||||
/**
|
||||
@@ -776,7 +789,7 @@ const fetchMediaItems = async () => {
|
||||
const openMediaPicker = async (target = 'featuredImage') => {
|
||||
mediaPickerTarget.value = target
|
||||
activeMediaPickerTab.value = 'upload'
|
||||
selectedMediaPickerUrl.value = isPostCardThumbnailUrl(form[target]) ? '' : form[target] || ''
|
||||
selectedMediaPickerUrl.value = isGeneratedThumbnailUrl(form[target]) ? '' : form[target] || ''
|
||||
isMediaPickerOpen.value = true
|
||||
await fetchMediaItems()
|
||||
}
|
||||
@@ -803,7 +816,7 @@ const selectPickedImage = (item) => {
|
||||
* @returns {void}
|
||||
*/
|
||||
const applyPickedImage = () => {
|
||||
if (!selectedMediaPickerUrl.value || isPostCardThumbnailUrl(selectedMediaPickerUrl.value)) {
|
||||
if (!selectedMediaPickerUrl.value || isGeneratedThumbnailUrl(selectedMediaPickerUrl.value)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user