Skip to content

fix: 도구 모음 클릭 시 마우스 드래그 선택 보존 (closes #780)#787

Closed
oksure wants to merge 1 commit into
edwardkim:develfrom
oksure:contrib/toolbar-selection-preserve
Closed

fix: 도구 모음 클릭 시 마우스 드래그 선택 보존 (closes #780)#787
oksure wants to merge 1 commit into
edwardkim:develfrom
oksure:contrib/toolbar-selection-preserve

Conversation

@oksure

@oksure oksure commented May 10, 2026

Copy link
Copy Markdown
Contributor

요약

마우스 드래그로 텍스트 블럭 선택 후 서식 도구 모음(style-bar) 또는 도구 상자(icon-toolbar) 버튼 클릭 시 폰트 크기 변경 등 서식 적용이 동작하지 않는 문제 수정.

원인

개별 버튼에 mousedownpreventDefault() 처리가 되어 있으나, 버튼 간 빈 영역/라벨 클릭 시 브라우저 기본 동작(focus 이동)으로 hidden textarea가 blur → cursor.hasSelection() false 반환 → format-char / adjustFontSize 조기 종료.

수정 내용

#icon-toolbar, #style-bar 컨테이너에 mousedown preventDefault 추가:

  • <input>, <select> 요소는 제외 (글꼴명/크기 입력 필드는 사용자 포커스 필요)
  • 그 외 모든 mousedown 이벤트에서 preventDefault() 호출

검증

  • tsc --noEmit ✅ (기존 @wasm 모듈 에러 외 신규 없음)
  • 키보드 선택 (Shift+Arrow) 경로: 변경 사항 영향 없음 (기존 동작 유지)

감사합니다.

마우스 드래그로 텍스트 블럭 선택 후 서식 도구 모음/도구 상자 버튼 클릭 시
focus 이동으로 cursor.hasSelection()이 false 반환 → 서식 미적용.

#icon-toolbar, #style-bar 컨테이너에 mousedown preventDefault 추가.
INPUT/SELECT 요소는 제외 (글꼴/크기 입력 필드는 포커스 필요).
Copilot AI review requested due to automatic review settings May 10, 2026 09:48

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 editor UX bug where applying formatting via the style bar / icon toolbar fails after a mouse-drag text selection, due to focus moving away from the editor (hidden textarea blur) on toolbar mousedown.

Changes:

  • Adds mousedown preventDefault() on #icon-toolbar and #style-bar container elements to prevent focus shifts that clear the current selection.
  • Exempts <input> and <select> targets so user-focusable fields (font name/size, etc.) still work as expected.

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

edwardkim added a commit that referenced this pull request May 10, 2026
마우스 드래그로 텍스트 블럭 선택 후 서식 도구 모음 / 도구 상자 영역 영역 빈 영역 / 라벨 클릭 시 브라우저 기본 동작 (focus 이동) 영역 영역 hidden textarea blur → cursor.hasSelection() false → 서식 적용 미동작.

정정 (main.ts +11/-0): #icon-toolbar / #style-bar 컨테이너 영역 영역 mousedown preventDefault — input/select 만 제외 (글꼴명/크기 입력 사용자 포커스 보존).

검증:
- tsc --noEmit ✅
- cargo test --release ALL GREEN
- 광범위 sweep 170/170 same
- WASM 4.68 MB 재빌드
- 작업지시자 웹 에디터 인터랙션 검증 ✅ 통과 (마우스 드래그 선택 + 도구 모음 클릭 + input/select 보존 + 키보드 선택 회귀 부재)

closes #780
@edwardkim

Copy link
Copy Markdown
Owner

@oksure 검토 완료했습니다. 감사합니다.

처리 결과

Merge commit: 51712958 (devel)

본질

컨테이너 (#icon-toolbar / #style-bar) 영역 영역 mousedown preventDefault — input/select 제외 영역 영역 사용자 포커스 보존 정합. 마우스 드래그 선택 후 도구 모음 빈 영역 / 라벨 클릭 시 textarea blur 차단.

검증

  • TypeScript / cargo test ALL GREEN
  • 광범위 sweep 170/170 same
  • WASM 4.68 MB 재빌드
  • 웹 에디터 인터랙션 검증 통과

closes #780.

5/11 사이클 2번째 PR — 수고하셨습니다.

@edwardkim

Copy link
Copy Markdown
Owner

Merged. Merge commit: 5171295

@edwardkim edwardkim closed this May 10, 2026
edwardkim added a commit that referenced this pull request May 10, 2026
PR #787 (closes #780) — 도구 모음 mousedown preventDefault 영역 영역 마우스 드래그 선택 보존.
인프라 재사용 (컨테이너 레벨 mousedown listener) 영역 영역 신규 인프라 도입 부재.

Merge commit: 5171295
Cherry-pick: 644f92e
edwardkim added a commit that referenced this pull request May 10, 2026
5/10 + 5/11 사이클 누적 — 외부 기여자 다수 PR 30+ 머지.

Cargo.toml + rhwp-vscode/package.json + npm/editor/package.json + rhwp-studio/package.json: 0.7.10 → 0.7.11
rhwp-vscode/CHANGELOG.md: [0.7.11] 항목 추가

핵심 변경:
- Skia native raster P8 (#761) + P9 (#769) — Layer IR contract hardening + text replay parity
- HWP3 native 렌더링 (#753) — hwp3-sample10 8 단계 정정 + Git LFS pdf-large/ 신규
- 페이지네이션 정정 (#778) — Task #703 다단 컬럼 분배 회귀 정정
- rhwp-studio 인터랙션 (PR #781/#786/#787/#788) — scrollbar/수식/표 셀/도구 모음 결함 정정
- rhwp-studio editor 신규 기능 (PR #728/#748/#750/#760 등) — 표 편집 Undo/Redo + 다단 설정 + 다수 단축키
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