🐛 Fix Alpine.js SyntaxError and backlink visibility issues

- 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
This commit is contained in:
Hyungi Ahn
2025-08-26 23:50:48 +09:00
parent 8d7f4c04bb
commit 3e0a03f149
31 changed files with 5176 additions and 567 deletions

View File

@@ -3,12 +3,12 @@
*/
class DocumentServerAPI {
constructor() {
// 도커 백엔드 API (24102 포트)
this.baseURL = 'http://localhost:24102/api';
// nginx를 통한 프록시 API (24100 포트)
this.baseURL = 'http://localhost:24100/api';
this.token = localStorage.getItem('access_token');
console.log('🐳 API Base URL (DOCKER BACKEND):', this.baseURL);
console.log('🔧 도커 환경 설정 완료 - 버전 2025012415');
console.log('🌐 API Base URL (NGINX PROXY):', this.baseURL);
console.log('🔧 nginx 프록시 환경 설정 완료 - 버전 2025012607');
}
// 토큰 설정
@@ -221,7 +221,8 @@ class DocumentServerAPI {
return await this.delete(`/highlights/${highlightId}`);
}
// 메모 관련 API
// === 하이라이트 메모 (Highlight Memo) 관련 API ===
// 용어 정의: 하이라이트에 달리는 짧은 코멘트
async createNote(noteData) {
return await this.post('/notes/', noteData);
}
@@ -230,6 +231,8 @@ class DocumentServerAPI {
return await this.get('/notes/', params);
}
// === 문서 메모 조회 ===
// 용어 정의: 특정 문서의 모든 하이라이트 메모 조회
async getDocumentNotes(documentId) {
return await this.get(`/notes/document/${documentId}`);
}
@@ -319,6 +322,8 @@ class DocumentServerAPI {
}
// === 메모 관련 API ===
// === 문서 메모 조회 ===
// 용어 정의: 특정 문서의 모든 하이라이트 메모 조회
async getDocumentNotes(documentId) {
return await this.get(`/notes/document/${documentId}`);
}
@@ -441,6 +446,8 @@ class DocumentServerAPI {
}
// === 메모 관련 API ===
// === 문서 메모 조회 ===
// 용어 정의: 특정 문서의 모든 하이라이트 메모 조회
async getDocumentNotes(documentId) {
return await this.get(`/notes/document/${documentId}`);
}
@@ -553,6 +560,96 @@ class DocumentServerAPI {
async getDocumentLinkFragments(documentId) {
return await this.get(`/documents/${documentId}/link-fragments`);
}
// ===== 노트 문서 관련 API =====
// 모든 노트 조회
async getNoteDocuments(params = {}) {
return await this.get('/note-documents/', params);
}
// 특정 노트 조회
async getNoteDocument(noteId) {
return await this.get(`/note-documents/${noteId}`);
}
// === 노트 문서 (Note Document) 관련 API ===
// 용어 정의: 독립적인 문서 작성 (HTML 기반)
async createNoteDocument(noteData) {
return await this.post('/note-documents/', noteData);
}
// 노트 업데이트
async updateNoteDocument(noteId, noteData) {
return await this.put(`/note-documents/${noteId}`, noteData);
}
// 노트 삭제
async deleteNoteDocument(noteId) {
return await this.delete(`/note-documents/${noteId}`);
}
// 노트 HTML 내보내기
async exportNoteAsHTML(noteId) {
const response = await fetch(`${this.baseURL}/note-documents/${noteId}/export/html`, {
method: 'GET',
headers: this.getHeaders(),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.blob();
}
// ===== 노트북 관련 API =====
// 모든 노트북 조회
async getNotebooks(params = {}) {
return await this.get('/notebooks/', params);
}
// 특정 노트북 조회
async getNotebook(notebookId) {
return await this.get(`/notebooks/${notebookId}`);
}
// === 노트북 (Notebook) 관련 API ===
// 용어 정의: 노트 문서들을 그룹화하는 폴더
async createNotebook(notebookData) {
return await this.post('/notebooks/', notebookData);
}
// 노트북 업데이트
async updateNotebook(notebookId, notebookData) {
return await this.put(`/notebooks/${notebookId}`, notebookData);
}
// 노트북 삭제
async deleteNotebook(notebookId, force = false) {
return await this.delete(`/notebooks/${notebookId}?force=${force}`);
}
// 노트북 통계
async getNotebookStats() {
return await this.get('/notebooks/stats');
}
// 노트북의 노트들 조회
async getNotebookNotes(notebookId, params = {}) {
return await this.get(`/notebooks/${notebookId}/notes`, params);
}
// 노트를 노트북에 추가
async addNoteToNotebook(notebookId, noteId) {
return await this.post(`/notebooks/${notebookId}/notes/${noteId}`);
}
// 노트를 노트북에서 제거
async removeNoteFromNotebook(notebookId, noteId) {
return await this.delete(`/notebooks/${notebookId}/notes/${noteId}`);
}
}
// 전역 API 인스턴스