feat: 완전한 문서 관리 시스템 구현

 주요 기능:
- 문서 사라짐 문제 해결: API limit 제한으로 인한 문서 누락 해결
- 서적별 문서 관리: HTML과 PDF 통합 관리 시스템
- PDF 뷰어 개선: 인증, 네비게이션, 에러 처리 강화
- 서적 편집/삭제: 완전한 서적 관리 기능

🔧 기술적 개선:
- /api/documents/all 엔드포인트 추가 (모든 문서 조회)
- HTML/PDF 문서 타입별 아이콘 및 필터링
- 서적별 뷰에서 편집/삭제 버튼 추가
- PDF Manager와 서적 편집 페이지 연동

🎨 UI/UX 개선:
- Devonthink 스타일 서적 그룹화
- HTML 문서 순서 관리와 PDF 관리 섹션 분리
- 문서 타입별 시각적 구분 (HTML: 파란색, PDF: 빨간색)
- 2단계 확인을 통한 안전한 서적 삭제

�� 버그 수정:
- PDF 삭제 시 undefined ID 전달 문제 해결
- 서적 편집 페이지 422 오류 해결 (URL 파라미터 문제)
- PDF.js 워커 설정 및 인증 토큰 처리 개선
This commit is contained in:
hyungi
2025-09-05 11:00:17 +09:00
parent cfb9485d4f
commit 6a537008db
85 changed files with 375 additions and 28 deletions

View File

@@ -134,7 +134,10 @@ window.documentApp = () => ({
this.error = '';
try {
const allDocuments = await window.api.getDocuments();
const allDocuments = await window.api.getAllDocuments();
// 디버깅: API 응답 원본 확인
console.log('🔍 API 응답 원본 (첫 3개):', JSON.stringify(allDocuments.slice(0, 3), null, 2));
// HTML 문서만 필터링 (PDF 파일 제외)
this.documents = allDocuments.filter(doc =>
@@ -146,6 +149,19 @@ window.documentApp = () => ({
console.log('📄 HTML 문서:', this.documents.length, '개');
console.log('📄 PDF 파일:', allDocuments.length - this.documents.length, '개 (제외됨)');
// 디버깅: 사라진 문서 찾기
console.log('🔍 HTML 경로가 있는 문서들:');
allDocuments.forEach(doc => {
if (doc.html_path) {
console.log(` - ${doc.title}: ${doc.html_path}`);
}
});
console.log('🔍 필터링된 문서들:');
this.documents.forEach(doc => {
console.log(` - ${doc.title}: ${doc.html_path}`);
});
this.updateAvailableTags();
this.filterDocuments();
this.syncUIState(); // UI 상태 동기화
@@ -206,6 +222,32 @@ window.documentApp = () => ({
this.filterDocuments();
},
// 서적 삭제
async deleteBook(book) {
if (!book || !book.id) {
alert('서적 정보가 올바르지 않습니다.');
return;
}
const confirmMessage = `"${book.title}" 서적을 삭제하시겠습니까?\n\n⚠️ 주의: 이 서적에 속한 모든 문서들이 '서적 미분류'로 이동됩니다.`;
if (!confirm(confirmMessage)) {
return;
}
try {
await window.api.deleteBook(book.id);
// 문서 목록 다시 로드
await this.loadDocuments();
alert('서적이 삭제되었습니다.');
} catch (error) {
console.error('서적 삭제 실패:', error);
alert('서적 삭제에 실패했습니다: ' + error.message);
}
},
// 필터 초기화
clearFilters() {
this.searchQuery = '';