From ca62f6e231aa0fdd04ca182b7cddeb08b1d09957 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:50:38 -0700 Subject: [PATCH] Do not show image viewer for SVGs (cherry-pick #10435) (#10447) Cherry-picked Do not show image viewer for SVGs (#10435) Absent some ability to toggle between viewing and editing a file, I think it would be best to get a fix out quick for people to edit SVGs as text files. Release Notes: - Fixed editing of SVG images by disabling it from the image viewer ([#10403](https://github.com/zed-industries/zed/issues/10403)). Co-authored-by: Kyle Kelley --- crates/image_viewer/src/image_viewer.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/image_viewer/src/image_viewer.rs b/crates/image_viewer/src/image_viewer.rs index 86383163a7f9082b3f22bec955d6dba0f0164340..22dc3fb5d6a6423bdaabf599acf5687890b2f0eb 100644 --- a/crates/image_viewer/src/image_viewer.rs +++ b/crates/image_viewer/src/image_viewer.rs @@ -37,7 +37,9 @@ impl project::Item for ImageItem { .and_then(OsStr::to_str) .unwrap_or_default(); - if Img::extensions().contains(&ext) { + // Only open the item if it's a binary image (no SVGs, etc.) + // Since we do not have a way to toggle to an editor + if Img::extensions().contains(&ext) && !ext.contains("svg") { Some(cx.spawn(|mut cx| async move { let abs_path = project .read_with(&cx, |project, cx| project.absolute_path(&path, cx))?