image viewer: Allow dropping images on pane (#21803)
Partially addresses #21484 https://github.com/user-attachments/assets/777da5de-15c3-4af3-a597-1835c0155326 Release Notes: - Support opening images by dropping them onto a pane
This commit is contained in:
parent
96499b7b25
commit
58f9301253
2 changed files with 16 additions and 7 deletions
|
@ -123,9 +123,17 @@ impl ProjectItem for ImageItem {
|
|||
let path = path.clone();
|
||||
let project = project.clone();
|
||||
|
||||
let ext = path
|
||||
.path
|
||||
let worktree_abs_path = project
|
||||
.read(cx)
|
||||
.worktree_for_id(path.worktree_id, cx)?
|
||||
.read(cx)
|
||||
.abs_path();
|
||||
|
||||
// Resolve the file extension from either the worktree path (if it's a single file)
|
||||
// or from the project path's subpath.
|
||||
let ext = worktree_abs_path
|
||||
.extension()
|
||||
.or_else(|| path.path.extension())
|
||||
.and_then(OsStr::to_str)
|
||||
.map(str::to_lowercase)
|
||||
.unwrap_or_default();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue