UI 개선 — 모바일 사진 업로드 카메라/갤러리 버튼 분리, 에러코드 차트 단순화

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
byun
2026-06-01 16:25:48 +09:00
parent d75bd5f358
commit e52e916dc8
5 changed files with 70 additions and 99 deletions

View File

@@ -170,5 +170,26 @@ const ImageCompressor = (() => {
: (bytes / (1024 * 1024)).toFixed(1) + ' MB';
}
return { compressAll, setupPreview, loadConfig };
/**
* 카메라 input(capture)이 찍은 사진을 갤러리 input에 병합 후 change 이벤트 발생
* → setupPreview는 갤러리 input 하나만 바라보면 됨
* @param {string} cameraId - capture="environment" input id
* @param {string} galleryId - 기존 multiple input id (setupPreview 대상)
*/
function setupCameraAppend(cameraId, galleryId) {
const cam = document.getElementById(cameraId);
const main = document.getElementById(galleryId);
if (!cam || !main) return;
cam.addEventListener('change', function () {
if (!this.files.length) return;
const dt = new DataTransfer();
Array.from(main.files).forEach(f => dt.items.add(f)); // 기존 파일 유지
Array.from(this.files).forEach(f => dt.items.add(f)); // 새 사진 추가
main.files = dt.files;
main.dispatchEvent(new Event('change')); // setupPreview 재실행
this.value = '';
});
}
return { compressAll, setupPreview, loadConfig, setupCameraAppend };
})();