Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(ImgViewer): Set the cursor style to zoom-in for images that can be opened in ImgViewer

haitaoo5e133c2bbac4
diff --git a/ui/src/hooks/useImgViewer/index.tsx b/ui/src/hooks/useImgViewer/index.tsx
index 0457694e..6fa94b17 100644
--- a/ui/src/hooks/useImgViewer/index.tsx
+++ b/ui/src/hooks/useImgViewer/index.tsx
@@ -37,6 +37,7 @@ const useImgViewer = () => {
}
const img = target as HTMLImageElement;
if (!img.naturalWidth || !img.naturalHeight) {
+ img.classList.add('broken');
return;
}
const src = img.currentSrc || img.src;
diff --git a/ui/src/index.scss b/ui/src/index.scss
index 61d7a47a..f98c1a16 100644
--- a/ui/src/index.scss
+++ b/ui/src/index.scss
@@ -124,6 +124,10 @@ a {
cursor: zoom-out;
}
+img:not(a img, img.broken) {
+ cursor: zoom-in;
+}
+
.resize-none {
resize: none;
}