pb-sxp-ui 1.0.66 → 1.0.67
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.
- package/dist/index.cjs +27 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -25
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +27 -25
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +1 -1
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/FormatImage.js +3 -20
- package/lib/core/components/SxpPageRender/FormatImage.js +3 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -8366,7 +8366,7 @@ var ExpandableText$1 = memo(ExpandableText);
|
|
8366
8366
|
* @Author: binruan@chatlabs.com
|
8367
8367
|
* @Date: 2024-03-20 10:27:31
|
8368
8368
|
* @LastEditors: binruan@chatlabs.com
|
8369
|
-
* @LastEditTime: 2024-05-
|
8369
|
+
* @LastEditTime: 2024-05-20 15:53:04
|
8370
8370
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
|
8371
8371
|
*
|
8372
8372
|
*/
|
@@ -8378,32 +8378,34 @@ const FormatImage = forwardRef((props, ref) => {
|
|
8378
8378
|
setImgSrc(v);
|
8379
8379
|
}
|
8380
8380
|
}));
|
8381
|
-
// useEffect(() => {
|
8382
|
-
// setImgSrc(src);
|
8383
|
-
// }, [src]);
|
8384
|
-
const imgRef = useRef(null);
|
8385
8381
|
useEffect(() => {
|
8386
|
-
|
8387
|
-
const { current } = imgRef;
|
8388
|
-
if (current) {
|
8389
|
-
observer = new IntersectionObserver((entries) => {
|
8390
|
-
entries.forEach((entry) => {
|
8391
|
-
if (entry.isIntersecting) {
|
8392
|
-
setImgSrc(src);
|
8393
|
-
observer.unobserve(current);
|
8394
|
-
}
|
8395
|
-
});
|
8396
|
-
}, { threshold: 0.1 } // 触发阈值,可根据需要调整
|
8397
|
-
);
|
8398
|
-
observer.observe(current);
|
8399
|
-
}
|
8400
|
-
return () => {
|
8401
|
-
if (observer && current) {
|
8402
|
-
observer.unobserve(current);
|
8403
|
-
}
|
8404
|
-
};
|
8382
|
+
setImgSrc(src);
|
8405
8383
|
}, [src]);
|
8406
|
-
|
8384
|
+
useRef(null);
|
8385
|
+
// useEffect(() => {
|
8386
|
+
// let observer: any = null;
|
8387
|
+
// const { current } = imgRef;
|
8388
|
+
// if (current) {
|
8389
|
+
// observer = new IntersectionObserver(
|
8390
|
+
// (entries) => {
|
8391
|
+
// entries.forEach((entry) => {
|
8392
|
+
// if (entry.isIntersecting) {
|
8393
|
+
// setImgSrc(src);
|
8394
|
+
// observer.unobserve(current);
|
8395
|
+
// }
|
8396
|
+
// });
|
8397
|
+
// },
|
8398
|
+
// { threshold: 0.1 } // 触发阈值,可根据需要调整
|
8399
|
+
// );
|
8400
|
+
// observer.observe(current);
|
8401
|
+
// }
|
8402
|
+
// return () => {
|
8403
|
+
// if (observer && current) {
|
8404
|
+
// observer.unobserve(current);
|
8405
|
+
// }
|
8406
|
+
// };
|
8407
|
+
// }, [src]);
|
8408
|
+
return (React.createElement(React.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
|
8407
8409
|
React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
8408
8410
|
React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
|
8409
8411
|
React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
|