Fix post detail TOC, code block injection, and admin attachments - #263
Merged
Conversation
…deblocks [codex] Fix post detail TOC and code block injection
[codex] Update Elevate Web README links
…pload fix: support additional admin attachment formats
…content [codex] Fix legacy post table of contents
There was a problem hiding this comment.
Pull request overview
이 PR은 게시글 상세 화면에서 TOC(목차) 앵커 안정성을 높이고(heading id 주입/추출 동기화), 코드 블록 후처리 안정화, 관리자 첨부파일 지원 확장(.ppt/.hwp/.hwpx) 및 첨부 메타데이터(ttl/expiresAt) 정리를 함께 개선합니다.
Changes:
- (Web) 렌더링 전 HTML을 sanitize + heading id 주입하는
preparePostHtml추가 및 TOC 추출을 본문 컨테이너 기준으로 안정화 - (Admin/Server) 첨부 MIME/확장자 지원 확장과 업로드 오류 메시지 개선, draft 첨부에만 ttl/expiresAt 저장 및 게시글 연결 시 필드 제거
- (Docs/Tests) 배포/문서 안내 갱신 및 첨부 관련 테스트 보강
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Elevate.Web/src/utils/html.js | 렌더 전 HTML 준비(소독+heading id) 및 본문 heading 추출 유틸 추가, 코드블록 주입 안정화 |
| Elevate.Web/src/pages/PostDetail.jsx | preparePostHtml 적용 및 렌더 후 후처리를 useLayoutEffect로 조정 |
| Elevate.Web/src/components/posts/TableOfContents.jsx | TOC heading 추출/감지 대상을 .post-content로 좁혀 안정화 |
| Elevate.Web/README.md | 운영 배포 환경 및 문서 링크 정리 |
| Elevate.Server/tests/admin-attachments.test.js | 신규 첨부 포맷 및 ttl/expiresAt 처리에 대한 테스트 추가/수정 |
| Elevate.Server/src/controllers/adminController.js | 첨부 MIME 타입 확장, draft 첨부에만 ttl/expiresAt 포함 및 연결 시 삭제 |
| Elevate.Admin/src/components/editor/AttachUploader.jsx | 첨부 확장자/타입 확장, accept/에러 메시지 동적화, 업로드 오류 메시지 개선 |
Comment on lines
+37
to
+45
| export function preparePostHtml(html) { | ||
| const sanitized = sanitizeHtml(html); | ||
| if (!sanitized || typeof document === 'undefined') return sanitized; | ||
|
|
||
| const template = document.createElement('template'); | ||
| template.innerHTML = sanitized; | ||
| injectHeadingIds(template.content); | ||
| return template.innerHTML; | ||
| } |
Comment on lines
19
to
+31
| ## 문서 | ||
|
|
||
| 모든 상세 문서는 저장소 루트 `documents/` 폴더에 있습니다. | ||
|
|
||
| | 문서 | 위치 | | ||
| |------|------| | ||
| | 인수인계 시작점 | [documents/00-handover/README.md](../documents/00-handover/README.md) | | ||
| | 프로젝트 전체 계획 | [documents/01-getting-started/PLAN.md](../documents/01-getting-started/PLAN.md) | | ||
| | Elevate.Web 아키텍처 | [documents/04-application/ELEVATE_WEB_ARCHITECTURE.md](../documents/04-application/ELEVATE_WEB_ARCHITECTURE.md) | | ||
| | 컴포넌트 가이드 | [documents/04-application/ELEVATE_WEB_COMPONENTS.md](../documents/04-application/ELEVATE_WEB_COMPONENTS.md) | | ||
| | API 계약 | [documents/04-application/DATA_MODEL_AND_API_CONTRACT.md](../documents/04-application/DATA_MODEL_AND_API_CONTRACT.md) | | ||
| | 게시글 관리 가이드 | [documents/04-application/POSTS_GUIDE.md](../documents/04-application/POSTS_GUIDE.md) | | ||
| | Microsoft Clarity 가이드 | [documents/04-application/CLARITY_INTEGRATION_GUIDE.md](../documents/04-application/CLARITY_INTEGRATION_GUIDE.md) | | ||
| | Elevate.Web 아키텍처 | [documents/Elevate.Web/ARCHITECTURE.md](../documents/Elevate.Web/ARCHITECTURE.md) | | ||
| | Elevate.Admin 아키텍처 | [documents/Elevate.Admin/ARCHITECTURE.md](../documents/Elevate.Admin/ARCHITECTURE.md) | | ||
| | Elevate.Server 아키텍처 | [documents/Elevate.Server/ARCHITECTURE.md](../documents/Elevate.Server/ARCHITECTURE.md) | | ||
| | 배포 및 운영 | [documents/06-operations/DEPLOYMENT_AND_RUNBOOK.md](../documents/06-operations/DEPLOYMENT_AND_RUNBOOK.md) | | ||
|
|
||
|
|
||
| | Microsoft Clarity 가이드 | [documents/04-application/CLARITY_INTEGRATION_GUIDE.md](../documents/04-application/CLARITY_INTEGRATION_GUIDE.md) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and fixes across the admin and web applications, primarily focused on attachment support and table of contents (TOC) stability. The main changes include expanding supported file types (notably PowerPoint and Hangul formats), improving error handling and user feedback for uploads, and making the TOC extraction more robust and consistent by synchronizing heading ID injection between rendering and TOC generation. Documentation and test coverage have also been updated to reflect these changes.
Attachment Support and Validation
.ppt,.hwp, and.hwpxfile types in both the client (AttachUploader.jsx) and server (adminController.js), including updates to MIME type validation and the accepted file extensions list. [1] [2]Attachment Expiry and Metadata Handling
ttlandexpiresAtfields for draft attachments, and to remove these fields when linking attachments to posts, ensuring clean metadata. [1] [2]Table of Contents (TOC) Extraction and Stability
getPostContentHeadingsutility, which operates on the actual rendered content container, making TOC updates more reliable and less dependent on effect timing. [1] [2] [3]preparePostHtmlfunction, so TOC links and content are always in sync. [1] [2] [3] [4] [5] [6]Documentation
README.mdto clarify deployment environments and improve the organization of architecture and operations documentation links. [1] [2]These changes collectively improve user experience, maintainability, and correctness for both file uploads and post navigation.