- Fix SyntaxError in viewer.js line 2868 (.bind(this) issue in setTimeout) - Resolve Alpine.js 'Can't find variable' errors (documentViewer, goBack, etc.) - Fix backlink rendering and persistence during temporary highlights - Add backlink protection and restoration mechanism in highlightAndScrollToText - Implement Note Management System with hierarchical notebooks - Add note highlights and memos functionality - Update cache version to force browser refresh (v=2025012641) - Add comprehensive logging for debugging backlink issues
93 lines
2.8 KiB
JavaScript
93 lines
2.8 KiB
JavaScript
/**
|
|
* 간단한 테스트용 documentViewer
|
|
*/
|
|
window.documentViewer = () => ({
|
|
// 기본 상태
|
|
loading: false,
|
|
error: null,
|
|
|
|
// 네비게이션
|
|
navigation: null,
|
|
|
|
// 검색
|
|
searchQuery: '',
|
|
|
|
// 데이터
|
|
notes: [],
|
|
bookmarks: [],
|
|
documentLinks: [],
|
|
backlinks: [],
|
|
|
|
// UI 상태
|
|
activeFeatureMenu: null,
|
|
selectedHighlightColor: '#FFFF00',
|
|
|
|
// 모달 상태
|
|
showLinksModal: false,
|
|
showLinkModal: false,
|
|
showNotesModal: false,
|
|
showBookmarksModal: false,
|
|
showBacklinksModal: false,
|
|
|
|
// 폼 데이터
|
|
linkForm: {
|
|
target_document_id: '',
|
|
selected_text: '',
|
|
book_scope: 'same',
|
|
target_book_id: '',
|
|
link_type: 'document',
|
|
target_text: '',
|
|
description: ''
|
|
},
|
|
|
|
// 기타 데이터
|
|
availableBooks: [],
|
|
filteredDocuments: [],
|
|
|
|
// 초기화
|
|
init() {
|
|
console.log('🔧 간단한 documentViewer 로드됨');
|
|
this.documentId = new URLSearchParams(window.location.search).get('id');
|
|
console.log('📋 문서 ID:', this.documentId);
|
|
},
|
|
|
|
// 뒤로가기
|
|
goBack() {
|
|
console.log('🔙 뒤로가기 클릭됨');
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const fromPage = urlParams.get('from');
|
|
|
|
if (fromPage === 'index') {
|
|
window.location.href = '/index.html';
|
|
} else if (fromPage === 'hierarchy') {
|
|
window.location.href = '/hierarchy.html';
|
|
} else {
|
|
window.location.href = '/index.html';
|
|
}
|
|
},
|
|
|
|
// 기본 함수들
|
|
toggleFeatureMenu(feature) {
|
|
console.log('🎯 기능 메뉴 토글:', feature);
|
|
this.activeFeatureMenu = this.activeFeatureMenu === feature ? null : feature;
|
|
},
|
|
|
|
searchInDocument() {
|
|
console.log('🔍 문서 검색:', this.searchQuery);
|
|
},
|
|
|
|
// 빈 함수들 (오류 방지용)
|
|
navigateToDocument() { console.log('네비게이션 함수 호출됨'); },
|
|
goToBookContents() { console.log('목차로 이동 함수 호출됨'); },
|
|
createHighlightWithColor() { console.log('하이라이트 생성 함수 호출됨'); },
|
|
resetTargetSelection() { console.log('타겟 선택 리셋 함수 호출됨'); },
|
|
loadDocumentsFromBook() { console.log('서적 문서 로드 함수 호출됨'); },
|
|
onTargetDocumentChange() { console.log('타겟 문서 변경 함수 호출됨'); },
|
|
openTargetDocumentSelector() { console.log('타겟 문서 선택기 열기 함수 호출됨'); },
|
|
saveDocumentLink() { console.log('문서 링크 저장 함수 호출됨'); },
|
|
closeLinkModal() { console.log('링크 모달 닫기 함수 호출됨'); },
|
|
getSelectedBookTitle() { return '테스트 서적'; }
|
|
});
|
|
|
|
console.log('✅ 테스트용 documentViewer 정의됨');
|