feat: 이미지 파일 드래그 앤 드롭 삽입 (#307)#830
Open
oksure wants to merge 2 commits into
Open
Conversation
- scroll-container 영역에 이미지 파일(png, jpg, gif, bmp, webp) 드롭 시 기존 insert:image와 동일한 이미지 배치 모드로 진입 - 기존 HWP/HWPX 파일 드롭 동작은 그대로 유지 - 문서가 열려있지 않으면 드롭 무시
Contributor
There was a problem hiding this comment.
Pull request overview
Adds drag-and-drop image insertion into the editor area (scroll-container) so that dropping a supported image file enters the same interactive placement mode as the existing insert:image command (Issue #307).
Changes:
- Detects common image extensions on drop and enters image placement mode when a document is open.
- Loads dropped image bytes and measures intrinsic dimensions before calling
enterImagePlacementMode(...). - Updates the unsupported-drop alert message to include image files.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+260
to
+263
| img.src = URL.createObjectURL(file); | ||
| await new Promise<void>(r => { img.onload = () => r(); }); | ||
| URL.revokeObjectURL(img.src); | ||
| inputHandler.enterImagePlacementMode(data, ext, img.naturalWidth, img.naturalHeight, file.name); |
Copilot 리뷰 반영: img.onload 대신 img.decode()로 디코딩 실패 감지, URL.revokeObjectURL을 finally 블록에서 호출하여 에러 시에도 정리.
Contributor
Author
|
Copilot 리뷰 반영 (b2462e6): try/finally로 blob URL 누수 방지 + img.decode()로 디코딩 실패 처리 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 내용
Closes #307
편집 영역(scroll-container)에 이미지 파일을 드래그 앤 드롭하면 기존
insert:image커맨드와 동일한 이미지 배치 모드로 진입합니다.동작
enterImagePlacementMode()호출 → 마우스로 삽입 위치/크기 지정변경 파일
main.ts기존 HWP/HWPX 파일 드롭 동작은 그대로 유지됩니다. 문서가 열려있지 않으면 이미지 드롭은 무시됩니다.
테스트
cargo test통과cargo clippy -- -D warnings경고 없음감사합니다.