Skip to content

Fix post detail TOC, code block injection, and admin attachments - #263

Merged
YoonKeumJae merged 9 commits into
mainfrom
develop
Jun 22, 2026
Merged

Fix post detail TOC, code block injection, and admin attachments#263
YoonKeumJae merged 9 commits into
mainfrom
develop

Conversation

@YoonKeumJae

Copy link
Copy Markdown
Collaborator

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

  • Added support for .ppt, .hwp, and .hwpx file 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]
  • Updated error messages and UI to dynamically reflect supported attachment types, ensuring users see accurate, up-to-date information. [1] [2] [3]
  • Improved upload error handling by providing more informative messages based on the actual error, and updated the relevant UI accordingly. [1] [2]

Attachment Expiry and Metadata Handling

  • Refactored server logic to only include ttl and expiresAt fields for draft attachments, and to remove these fields when linking attachments to posts, ensuring clean metadata. [1] [2]
  • Updated and expanded tests to verify correct handling of new attachment types and metadata fields. [1] [2]

Table of Contents (TOC) Extraction and Stability

  • Refactored TOC extraction to use a new getPostContentHeadings utility, which operates on the actual rendered content container, making TOC updates more reliable and less dependent on effect timing. [1] [2] [3]
  • Ensured heading IDs are injected into the HTML before rendering via a new preparePostHtml function, so TOC links and content are always in sync. [1] [2] [3] [4] [5] [6]

Documentation

  • Updated README.md to 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.

@YoonKeumJae
YoonKeumJae requested a review from Copilot June 22, 2026 04:52
@YoonKeumJae
YoonKeumJae merged commit 6dde960 into main Jun 22, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread Elevate.Web/README.md
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) |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants