에디터 미디어 적용 버튼 상태 분리
This commit is contained in:
@@ -241,6 +241,27 @@ export const buildMediaPickerEmptyMessage = (searchQuery) => {
|
||||
return '선택할 미디어가 없습니다. 업로드 탭에서 파일을 추가할 수 있습니다.'
|
||||
}
|
||||
|
||||
/**
|
||||
* 미디어 선택 적용 버튼 상태를 만든다.
|
||||
* @param {Object} options - 적용 버튼 상태 옵션
|
||||
* @param {string[]} options.selectedUrls - 선택된 URL 목록
|
||||
* @param {boolean} options.isUploading - 업로드 중 여부
|
||||
* @param {boolean} options.isGallery - 갤러리 다중 선택 여부
|
||||
* @returns {{ disabled: boolean, label: string }} 적용 버튼 상태
|
||||
*/
|
||||
export const buildMediaPickerApplyState = ({
|
||||
selectedUrls,
|
||||
isUploading,
|
||||
isGallery
|
||||
}) => {
|
||||
const selectedCount = Array.isArray(selectedUrls) ? selectedUrls.length : 0
|
||||
|
||||
return {
|
||||
disabled: Boolean(isUploading) || selectedCount <= 0,
|
||||
label: isGallery && selectedCount > 0 ? `${selectedCount}개 삽입` : '삽입'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 미디어 항목으로 Prose 미디어 블록을 만든다.
|
||||
* @param {'video'|'audio'|'file'} blockType - 블록 유형
|
||||
|
||||
Reference in New Issue
Block a user