diff --git a/config/preset/yazi.toml b/config/preset/yazi.toml index 12f9483c..1b2d1f91 100644 --- a/config/preset/yazi.toml +++ b/config/preset/yazi.toml @@ -49,7 +49,9 @@ rules = [ { mime = "video/*", use = "video" }, { mime = "audio/*", use = "audio" }, { mime = "inode/x-empty", use = "text" }, + { mime = "application/json", use = "text" }, + { mime = "*/javascript", use = "text" }, { mime = "application/zip", use = "archive" }, { mime = "application/gzip", use = "archive" }, diff --git a/shared/src/mime.rs b/shared/src/mime.rs index 534949d7..cdbedb26 100644 --- a/shared/src/mime.rs +++ b/shared/src/mime.rs @@ -18,7 +18,7 @@ pub enum MimeKind { impl MimeKind { pub fn new(s: &str) -> Self { - if s.starts_with("text/") || s.ends_with("/xml") { + if s.starts_with("text/") || s.ends_with("/xml") || s.ends_with("/javascript") { Self::Text } else if s.starts_with("image/") { Self::Image