feat: edit:delete (지우기) 커맨드 구현#752
Conversation
- InputHandler에 performDelete() 공통 메서드 추가 (그림/표 개체 선택 → snapshot 삭제, 텍스트 선택 → deleteSelection) - edit:delete 커맨드 스텁을 실제 구현으로 교체 - Ctrl+E 단축키 바인딩 추가 - performCut()과 동일 로직에서 클립보드 복사만 제거한 형태 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Implements the previously stubbed Edit → Delete (edit:delete) command so that users can delete the current selection (text) or selected objects (picture/shape/table) from the menu/command system.
Changes:
- Added
InputHandler.performDelete()to delete text selections or selected picture/table objects with undo snapshot support. - Enabled
edit:deleteby implementingcanExecute/executein the edit command registry. - Added default shortcut mapping Ctrl+E →
edit:delete.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rhwp-studio/src/engine/input-handler.ts | Adds performDelete() to route delete behavior for object selections and text selections. |
| rhwp-studio/src/command/shortcut-map.ts | Maps Ctrl+E to edit:delete in default shortcuts. |
| rhwp-studio/src/command/commands/edit.ts | Implements edit:delete command execution and enables it via canExecute. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.executeOperation({ kind: 'snapshot', operationType: 'deleteObject', operation: (wasm: WasmBridge) => { | ||
| if (ref.type === 'image') { | ||
| wasm.deletePictureControl(ref.sec, ref.ppi, ref.ci); | ||
| } else { | ||
| wasm.deleteShapeControl(ref.sec, ref.ppi, ref.ci); | ||
| } |
| if (this.cursor.isInTableObjectSelection()) { | ||
| const ref = this.cursor.getSelectedTableRef(); | ||
| if (ref) { | ||
| this.cursor.moveOutOfSelectedTable(); | ||
| this.eventBus.emit('table-object-selection-changed', false); | ||
| this.executeOperation({ kind: 'snapshot', operationType: 'deleteTable', operation: (wasm: WasmBridge) => { | ||
| wasm.deleteTableControl(ref.sec, ref.ppi, ref.ci); | ||
| return this.cursor.getPosition(); | ||
| }}); |
- deleteObjectControl() 공용 헬퍼 사용으로 equation/group/line 타입 올바른 삭제 API 호출 (image/equation→deletePictureControl, shape/group/line→deleteShapeControl) - 중첩 표(cellPath.length > 1) 삭제 시도 차단 — 선택 해제만 수행 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Copilot 리뷰 피드백을 d31b4512에서 반영했습니다:
|
PR #752 의 performDelete 가 this.deleteObjectControl(ref) 호출 → ref.type 영역 영역 'line' 가능 (getSelectedPictureRef 시그니처) 영역 영역 래퍼 시그니처 영역 영역 'image|shape|equation|group' 만 정의 영역 영역 tsc 오류 발생. input-handler-picture.ts 의 실제 구현 영역 영역 이미 'line' 포함 영역 영역, input-handler.ts 의 래퍼 3개 (getObjectProperties / setObjectProperties / deleteObjectControl) 영역 영역 'line' 추가 영역 영역 정합. devel HEAD 영역 영역 잠재 결함 (PR #752 와 무관, performDelete 신규 호출 영역 영역 노출됨) — PR #740 자기 정정 패턴 정합.
performCut 패턴 정합 — 클립보드 복사만 제외한 동일 구조. 인프라 재사용: executeOperation snapshot (PR #728) + deleteSelection + deleteObjectControl + EditorContext 가드. 자기 정정 commit 2aafebc 포함 — devel HEAD 영역 영역 deleteObjectControl 래퍼 시그니처 영역 영역 'line' 타입 누락 (PR #752 와 무관, 신규 performDelete 호출 영역 영역 노출). 검증: - tsc --noEmit ✅ (자기 정정 후) - cargo test --release ALL GREEN - 광범위 sweep 170/170 same - WASM 4.66 MB - 웹 에디터 인터랙션 검증 ✅ 통과 (텍스트 / 그림 / 표 / 중첩 표 + Undo)
|
@oksure 검토 완료했습니다. 감사합니다. 처리 결과Merge commit: 본질
인프라 재사용
자기 정정 commit (
|
|
Merged. Merge commit: 3eb10f4 |
문제
편집 > 지우기 (edit:delete) 커맨드가
canExecute: () => false스텁으로 남아 있어 메뉴에서 비활성 상태입니다.수정 내용
InputHandler에
performDelete()메서드 추가performCut()과 동일한 구조에서 클립보드 복사를 제거한 형태입니다:deletePictureControl/deleteShapeControldeleteTableControldeleteSelection()(기존 private 메서드 활용)커맨드 및 단축키
edit:delete커맨드의canExecute를edit:cut과 동일한 조건으로 변경Ctrl+E단축키 바인딩 추가 (기존 shortcutLabel과 일치)테스트
cargo test통과cargo clippy -- -D warnings경고 없음감사합니다.