Skip to content

Task #420: 문서 전환 시 글꼴 드롭다운 초기화 — 이전 문서 폰트 잔존 정정#742

Closed
oksure wants to merge 1 commit into
edwardkim:develfrom
oksure:contrib/font-dropdown-reset
Closed

Task #420: 문서 전환 시 글꼴 드롭다운 초기화 — 이전 문서 폰트 잔존 정정#742
oksure wants to merge 1 commit into
edwardkim:develfrom
oksure:contrib/font-dropdown-reset

Conversation

@oksure

@oksure oksure commented May 9, 2026

Copy link
Copy Markdown
Contributor

문제

문서를 열고 텍스트를 복사한 뒤 새 문서를 생성하면, 이전 문서에서 사용하던 폰트(예: HY헤드라인M)가 새 문서의 글꼴 드롭다운에 잔존합니다. 스타일 드롭다운은 initStyleDropdown()으로 문서 전환 시 초기화되지만, 글꼴 드롭다운에는 대응하는 초기화 메서드가 없어 폰트 옵션이 누적됩니다.

수정 내용

  • Toolbar.initFontDropdown(docFonts?: string[]) 메서드 추가
    • #font-name select 요소를 replaceChildren()으로 완전 초기화
    • 기본 7개 글꼴(함초롬바탕/돋움, 맑은 고딕, 나눔고딕, 바탕, 돋움, 궁서) 재등록
    • 현재 문서의 fontsUsed 배열에서 중복 없이 문서 고유 폰트 추가
    • populateFontSetOptions() + populateLocalFontOptions() 재호출로 대표/로컬 글꼴 복원
  • initializeDocument()에서 initStyleDropdown() 직전에 initFontDropdown(docInfo.fontsUsed) 호출

테스트

  • cargo test 전체 통과
  • cargo clippy -- -D warnings 경고 없음

Closes #420

감사합니다.

문서를 열거나 새 문서를 생성할 때 글꼴 드롭다운(#font-name)이 초기화되지 않아
이전 문서에서 사용한 폰트(예: HY헤드라인M)가 새 문서에서도 선택 가능했던 문제 수정.

- Toolbar에 initFontDropdown(docFonts) 메서드 추가: 기본 7개 글꼴 + 문서 글꼴 +
  대표 글꼴 + 로컬 글꼴로 드롭다운을 재구성
- initializeDocument()에서 initStyleDropdown()과 함께 initFontDropdown() 호출

Closes edwardkim#420

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 9, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes an issue where the font dropdown (#font-name) retains/accumulates fonts from previously opened documents when creating or switching to a new document in rhwp-studio.

Changes:

  • Added Toolbar.initFontDropdown(docFonts?: string[]) to fully reset and repopulate the font dropdown on document load.
  • Updated initializeDocument() to call initFontDropdown(docInfo.fontsUsed) before initStyleDropdown() so per-document fonts don’t persist across document switches.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
rhwp-studio/src/ui/toolbar.ts Adds a font dropdown initialization method that clears existing options, restores base fonts, adds document-specific fonts, and re-adds font set/local font optgroups.
rhwp-studio/src/main.ts Hooks the new font dropdown initialization into the document initialization flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +489 to +499
if (docFonts?.length) {
const seen = new Set(BASE_FONTS);
for (const name of docFonts) {
if (!seen.has(name)) {
const opt = document.createElement('option');
opt.value = name;
opt.textContent = name;
this.fontName.appendChild(opt);
seen.add(name);
}
}
edwardkim added a commit that referenced this pull request May 10, 2026
PR #742 (@oksure) 옵션 A 처리 — 1 commit cherry-pick + no-ff merge.

본질 정정 (2 files, +28/-1):
- rhwp-studio/src/ui/toolbar.ts (+26): initFontDropdown(docFonts?: string[]) 메서드 신규
  · replaceChildren() 통한 완전 초기화
  · BASE_FONTS 7개 재등록 (함초롬바탕/함초롬돋움/맑은 고딕/나눔고딕/바탕/돋움/궁서)
  · docFonts (현재 문서 fontsUsed) 중복 없이 추가
  · populateFontSetOptions() + populateLocalFontOptions() 재호출 — 대표/로컬 복원
- rhwp-studio/src/main.ts (+2/-1): initializeDocument() 영역 영역 initStyleDropdown() 직전 영역 영역 initFontDropdown(docInfo.fontsUsed) 호출 추가

결함 본질 (Issue #420):
- HY헤드라인M 사용 문서 → 텍스트 복사 → 새 문서 → 글꼴 드롭다운 영역 영역 HY헤드라인M 잔존
- 스타일 드롭다운 (initStyleDropdown 정합) 영역 영역 영역 글꼴 드롭다운 영역 영역 대응 메서드 부재

채택 접근:
- initStyleDropdown() 패턴 정합 — 인프라 재사용
- DocumentInfo.fontsUsed 기존 IR 활용
- populateFontSetOptions/populateLocalFontOptions 기존 메서드 재호출

자기 검증:
- cherry-pick 충돌 0건 (auto-merge 정합)
- tsc --noEmit ✅ 통과
- cargo test --release ✅ ALL GREEN
- 광범위 sweep 7 fixture / 170 페이지 / 회귀 0 ✅ (TypeScript 영역 영역 SVG 무영향)
- WASM 빌드 4.65 MB
- 작업지시자 웹 에디터 인터랙션 검증 ✅ 통과 (HY헤드라인M 문서 → 새 문서 → 글꼴 드롭다운 정합)

closes #420
edwardkim added a commit that referenced this pull request May 10, 2026
- mydocs/pr/archives/pr_742_review.md: 검토 문서 archives 이동
- mydocs/pr/archives/pr_742_report.md: 처리 보고서 작성
  · 문서 전환 시 글꼴 드롭다운 초기화 (Issue #420 closes)
  · initFontDropdown(docFonts) 신규 — initStyleDropdown 패턴 정합
  · 인프라 재사용 (populateFontSetOptions/LocalFontOptions + fontsUsed IR) 영역 영역 위험 좁힘
  · 작업지시자 웹 에디터 인터랙션 검증 ✅ 통과
- mydocs/orders/20260510.md: PR #742 항목 추가 (5/10 사이클 영역 영역 14건 처리)
@edwardkim

Copy link
Copy Markdown
Owner

@oksure 님, 검토 + 머지 완료했습니다.

처리 결과

옵션 A (1 commit cherry-pick + no-ff merge `0a7ea499`) 로 처리. 충돌 0건 (auto-merge 정합).

자기 검증

  • `tsc --noEmit` ✅ 통과
  • `cargo test --release` ✅ ALL GREEN
  • 광범위 sweep (7 fixture / 170 페이지) ✅ 170 same / 0 diff (TypeScript 영역 SVG 무영향 입증)
  • WASM 빌드 ✅ 4.65 MB

작업지시자 웹 에디터 인터랙션 검증 ✅ 통과

dev server 영역 영역 HY헤드라인M 사용 문서 → 새 문서 → 글꼴 드롭다운 정합 동작 검증 완료. BASE_FONTS 7개 + 대표/로컬 글꼴 정합 표시 + 이전 문서 폰트 잔존 부재 ✅.

인프라 재사용

  • `initStyleDropdown()` 패턴 정합
  • `populateFontSetOptions()` / `populateLocalFontOptions()` 기존 메서드 재호출
  • `DocumentInfo.fontsUsed` 기존 IR 활용

`feedback_process_must_follow` 정합 — 신규 인프라 도입 부재 영역 영역 위험 좁힘.

처리 보고서: `mydocs/pr/archives/pr_742_report.md`.

@oksure20+ 사이클 컨트리뷰션 영역 — 5/10 사이클 영역 영역 PR #720/#723/#725/#728/#729/#730/#732/#734/#735/#737/#738/#739/#740/#742 영역 14건 처리 완료 영역.

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.

3 participants