파일 업로드 기능 구현 및 상세설정 연동
- 템플릿 파일첨부 컴포넌트와 FileComponentConfigPanel 실시간 동기화 - FileUpload 위젯에 전역 파일 상태 관리 기능 추가 - 파일 업로드/삭제 시 전역 상태 및 localStorage 동기화 - RealtimePreview에서 전역 상태 우선 읽기 및 파일 개수 표시 - 한컴오피스, Apple iWork 파일 형식 지원 추가 - 파일 뷰어 모달 및 미리보기 기능 구현 - 업로드된 파일 디렉토리 .gitignore 추가
This commit is contained in:
@@ -4,3 +4,14 @@ import { twMerge } from "tailwind-merge";
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 크기를 사람이 읽기 쉬운 형태로 포맷팅
|
||||
*/
|
||||
export function formatFileSize(bytes: number): string {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
const k = 1024;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user