Major UI overhaul and upload system improvements

- Removed hierarchy view and integrated functionality into index.html
- Added book-based document grouping with dedicated book-documents.html page
- Implemented comprehensive multi-file upload system with drag-and-drop reordering
- Added HTML-PDF matching functionality with download capability
- Enhanced upload workflow with 3-step process (File Selection, Book Settings, Order & Match)
- Added book conflict resolution (existing book vs new edition)
- Improved document order adjustment with one-click sort options
- Added modular header component system
- Updated API connectivity for Docker environment
- Enhanced viewer.html with PDF download functionality
- Fixed browser caching issues with version management
- Improved mobile responsiveness and modern UI design
This commit is contained in:
Hyungi Ahn
2025-08-25 15:58:30 +09:00
parent f95f67364a
commit 4038040faa
21 changed files with 3875 additions and 2603 deletions

View File

@@ -28,6 +28,9 @@ window.documentViewer = () => ({
noteSearchQuery: '',
filteredNotes: [],
// 언어 전환
isKorean: false,
// 모달
showNoteModal: false,
showBookmarkModal: false,
@@ -783,9 +786,31 @@ window.documentViewer = () => ({
});
},
// 뒤로가기
// 뒤로가기 - 문서 관리 페이지로 이동
goBack() {
window.history.back();
// 1. URL 파라미터에서 from 확인
const urlParams = new URLSearchParams(window.location.search);
const fromPage = urlParams.get('from');
// 2. 세션 스토리지에서 이전 페이지 확인
const previousPage = sessionStorage.getItem('previousPage');
// 3. referrer 확인
const referrer = document.referrer;
let targetPage = 'index.html'; // 기본값: 그리드 뷰
// 우선순위: URL 파라미터 > 세션 스토리지 > referrer
if (fromPage === 'hierarchy') {
targetPage = 'hierarchy.html';
} else if (previousPage === 'hierarchy.html') {
targetPage = 'hierarchy.html';
} else if (referrer && referrer.includes('hierarchy.html')) {
targetPage = 'hierarchy.html';
}
console.log(`🔙 뒤로가기: ${targetPage}로 이동`);
window.location.href = targetPage;
},
// 날짜 포맷팅
@@ -1025,5 +1050,79 @@ window.documentViewer = () => ({
console.error('Failed to delete highlight:', error);
alert('하이라이트 삭제에 실패했습니다');
}
},
// 언어 전환 함수
toggleLanguage() {
this.isKorean = !this.isKorean;
// 문서 내 언어별 요소 토글 (더 범용적으로)
const primaryLangElements = document.querySelectorAll('[lang="ko"], .korean, .kr, .primary-lang');
const secondaryLangElements = document.querySelectorAll('[lang="en"], .english, .en, [lang="ja"], .japanese, .jp, [lang="zh"], .chinese, .cn, .secondary-lang');
primaryLangElements.forEach(el => {
el.style.display = this.isKorean ? 'block' : 'none';
});
secondaryLangElements.forEach(el => {
el.style.display = this.isKorean ? 'none' : 'block';
});
console.log(`🌐 언어 전환됨 (Primary: ${this.isKorean ? '표시' : '숨김'})`);
},
// 매칭된 PDF 다운로드
async downloadMatchedPDF() {
if (!this.document.matched_pdf_id) {
console.warn('매칭된 PDF가 없습니다');
return;
}
try {
console.log('📕 PDF 다운로드 시작:', this.document.matched_pdf_id);
// PDF 문서 정보 가져오기
const pdfDocument = await window.api.getDocument(this.document.matched_pdf_id);
if (!pdfDocument) {
throw new Error('PDF 문서를 찾을 수 없습니다');
}
// PDF 파일 다운로드 URL 생성
const downloadUrl = `/api/documents/${this.document.matched_pdf_id}/download`;
// 인증 헤더 추가를 위해 fetch 사용
const response = await fetch(downloadUrl, {
method: 'GET',
headers: {
'Authorization': `Bearer ${localStorage.getItem('token')}`
}
});
if (!response.ok) {
throw new Error('PDF 다운로드에 실패했습니다');
}
// Blob으로 변환하여 다운로드
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
// 다운로드 링크 생성 및 클릭
const link = document.createElement('a');
link.href = url;
link.download = pdfDocument.original_filename || `${pdfDocument.title}.pdf`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// URL 정리
window.URL.revokeObjectURL(url);
console.log('✅ PDF 다운로드 완료');
} catch (error) {
console.error('❌ PDF 다운로드 실패:', error);
alert('PDF 다운로드에 실패했습니다: ' + error.message);
}
}
});