+ {tab.loading && (
+
+ {t("loading")}
+
+ )}
+ {!tab.loading && tab.content && (
+ <>
+ {/* Toolbar */}
+
+
+
+
+
+
+
+ {naturalWidth > 0 && naturalHeight > 0 && (
+
+ {naturalWidth} x {naturalHeight}
+
+ )}
+ {fileSize > 0 && {formatFileSize(fileSize)}}
+
+
+
+ {/* Image */}
+
+
+ {/* eslint-disable-next-line @next/next/no-img-element */}
+

+
+
+ >
+ )}
+
+ )
+}
diff --git a/src/contexts/workspace-context.tsx b/src/contexts/workspace-context.tsx
index 91da3f4..32cb8bb 100644
--- a/src/contexts/workspace-context.tsx
+++ b/src/contexts/workspace-context.tsx
@@ -18,6 +18,7 @@ import {
gitIsTracked,
gitShowDiff,
gitShowFile,
+ readFileBase64,
readFileForEdit,
readFilePreview,
saveFileContent,
@@ -127,6 +128,33 @@ function isDirtyFileTab(tab: FileWorkspaceTab): boolean {
return tab.kind === "file" && Boolean(tab.isDirty)
}
+const IMAGE_EXTENSIONS = new Set([
+ "png",
+ "jpg",
+ "jpeg",
+ "gif",
+ "svg",
+ "webp",
+ "bmp",
+ "ico",
+])
+
+const IMAGE_MIME: Record