@blocklet/editor 2.4.79 → 2.4.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -359,10 +359,11 @@ function formatFileSize(size) {
359
359
  function SimpleImageComponent({ src, altText = '', width, height, }) {
360
360
  const [loaded, setLoaded] = useState(false);
361
361
  const imageRef = useRef(null);
362
+ const hasFixedSize = typeof width === 'number' && typeof height === 'number' && width > 0 && height > 0;
362
363
  useMediumZoom(imageRef);
363
364
  const renderSkeleton = () => {
364
- if (typeof width === 'number' && typeof height === 'number' && width > 0 && height > 0) {
365
- return (_jsx(Box, { sx: { position: 'relative', height: 0, pt: `${100 / (width / height)}%` }, children: _jsx(Skeleton, { variant: "rectangular", animation: "wave", sx: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', borderRadius: 1 } }) }));
365
+ if (hasFixedSize) {
366
+ return (_jsx(Box, { sx: { position: 'relative', height: 0, pt: `${100 / (width / height)}%`, maxWidth: width }, children: _jsx(Skeleton, { variant: "rectangular", animation: "wave", sx: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', borderRadius: 1 } }) }));
366
367
  }
367
368
  return _jsx(Skeleton, { variant: "rectangular", animation: "wave", sx: { width: 300, height: 200, borderRadius: 1 } });
368
369
  };
@@ -372,6 +373,7 @@ function SimpleImageComponent({ src, altText = '', width, height, }) {
372
373
  borderColor: 'divider',
373
374
  borderRadius: 2,
374
375
  visibility: loaded ? 'visible' : 'hidden',
376
+ ...(hasFixedSize && { maxWidth: width }),
375
377
  }, children: _jsx(Box, { component: "img", src: src, alt: altText || '', onLoad: () => {
376
378
  setLoaded(true);
377
379
  }, sx: { width, height }, ref: imageRef }) })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.4.79",
3
+ "version": "2.4.81",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -71,7 +71,7 @@
71
71
  "ufo": "^1.5.4",
72
72
  "url-join": "^4.0.1",
73
73
  "zustand": "^4.5.5",
74
- "@blocklet/pdf": "2.4.79"
74
+ "@blocklet/pdf": "2.4.81"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@babel/core": "^7.25.2",