Skip to content

fix(studio): retain file handle on Ctrl+S for opened documents#189

Merged
edwardkim merged 1 commit into
edwardkim:develfrom
ahnbu:pr/task179
Apr 19, 2026
Merged

fix(studio): retain file handle on Ctrl+S for opened documents#189
edwardkim merged 1 commit into
edwardkim:develfrom
ahnbu:pr/task179

Conversation

@ahnbu

@ahnbu ahnbu commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • prefer showOpenFilePicker() when opening a document so rhwp-studio can retain the original file handle
  • reuse the existing file handle on Ctrl+S and only fall back to save picker or download when no handle exists
  • add focused tests for the new file-system access helper

Root Cause

The previous open flow used <input type="file">, which only exposes File.name and not the original writable handle. As a result, Ctrl+S always had to open a save dialog and the browser defaulted to its own last-used folder.

Verification

  • docker compose --env-file .env.docker run --rm wasm
  • npm run build
  • node --experimental-strip-types --test tests/file-system-access.test.ts
  • Browser smoke check on http://127.0.0.1:7700
    • opened a real .hwp file via showOpenFilePicker
    • Ctrl+S saved back to the same file
    • a new document still opened the save picker as fallback

Note

This is a clean replacement for the previously closed #180, scoped strictly to Ctrl+S file handle retention.

Closes #179.

- showOpenFilePicker로 연 파일 handle을 보관하고 Ctrl+S 시 같은 파일에 바로 덮어쓰기
- handle이 없는 input 파일 열기 경로는 save picker와 download fallback 유지
- file-system-access 유틸과 단위 테스트 추가

Co-Authored-By: Codex <noreply@openai.com>

# Conflicts:
#	rhwp-studio/src/command/commands/file.ts

@edwardkim edwardkim left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM ✅

검증

  • 로컬 머지 시뮬 (devel + pr-189): 자동 머지 성공, 충돌 0
  • TypeScript 컴파일: 에러 0
  • Rust lib 회귀: 891 테스트 그린
  • 단위 테스트 (4개): 작성자 환경 (Node 22+) 통과 보고 확인. 우리 메인테이너 환경 (Node 20) 에서는 `--experimental-strip-types` 미지원이라 직접 미실행, 빌드/타입 통과로 갈음

코드 검토

강점:

  • `file-system-access.ts` 헬퍼 분리 — Chrome API 접근 격리, mock 가능
  • `current-handle → save-picker → fallback` 분기 명확
  • `loadDocument` / `createBlankDocument` 시 `currentFileHandle = null` 회귀 안전장치
  • 단위 테스트로 분기별 동작 검증

좋은 기여 감사합니다. 머지 진행합니다.

@edwardkim edwardkim merged commit afb9b54 into edwardkim:devel Apr 19, 2026
edwardkim added a commit that referenced this pull request Apr 19, 2026
본 v0.5.0 → v0.7.3 (라이브러리) / 0.2.0 (확장) 배포 주기에
머지된 외부 기여자 6명을 README 3개 변경 이력에 추가:

- @ahnbu — Ctrl+S file handle (PR #189, 기명시)
- @bapdodi — 회전 도형 리사이즈 + Flip (PR #192)
- @dreamworker0 — Windows CFB 경로 (PR #152)
- @marsimon — HWP 그림 효과 SVG (PR #149)
- @postmelee — 썸네일 + options CSP (PR #168)
- @seunghan91 — HWPX Serializer + 다수 (PR #170, #161, #163, #153, #154)

각 README 끝에 "기여자 감사" 섹션 추가 — 6명 일괄 인정.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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