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 CHANGED
@@ -8389,7 +8389,7 @@ var ExpandableText$1 = React.memo(ExpandableText);
8389
8389
  * @Author: binruan@chatlabs.com
8390
8390
  * @Date: 2024-03-20 10:27:31
8391
8391
  * @LastEditors: binruan@chatlabs.com
8392
- * @LastEditTime: 2024-05-17 16:53:11
8392
+ * @LastEditTime: 2024-05-20 15:53:04
8393
8393
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
8394
8394
  *
8395
8395
  */
@@ -8401,32 +8401,34 @@ const FormatImage = React.forwardRef((props, ref) => {
8401
8401
  setImgSrc(v);
8402
8402
  }
8403
8403
  }));
8404
- // useEffect(() => {
8405
- // setImgSrc(src);
8406
- // }, [src]);
8407
- const imgRef = React.useRef(null);
8408
8404
  React.useEffect(() => {
8409
- let observer = null;
8410
- const { current } = imgRef;
8411
- if (current) {
8412
- observer = new IntersectionObserver((entries) => {
8413
- entries.forEach((entry) => {
8414
- if (entry.isIntersecting) {
8415
- setImgSrc(src);
8416
- observer.unobserve(current);
8417
- }
8418
- });
8419
- }, { threshold: 0.1 } // 触发阈值,可根据需要调整
8420
- );
8421
- observer.observe(current);
8422
- }
8423
- return () => {
8424
- if (observer && current) {
8425
- observer.unobserve(current);
8426
- }
8427
- };
8405
+ setImgSrc(src);
8428
8406
  }, [src]);
8429
- return (React.createElement("div", { ref: imgRef }, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
8407
+ React.useRef(null);
8408
+ // useEffect(() => {
8409
+ // let observer: any = null;
8410
+ // const { current } = imgRef;
8411
+ // if (current) {
8412
+ // observer = new IntersectionObserver(
8413
+ // (entries) => {
8414
+ // entries.forEach((entry) => {
8415
+ // if (entry.isIntersecting) {
8416
+ // setImgSrc(src);
8417
+ // observer.unobserve(current);
8418
+ // }
8419
+ // });
8420
+ // },
8421
+ // { threshold: 0.1 } // 触发阈值,可根据需要调整
8422
+ // );
8423
+ // observer.observe(current);
8424
+ // }
8425
+ // return () => {
8426
+ // if (observer && current) {
8427
+ // observer.unobserve(current);
8428
+ // }
8429
+ // };
8430
+ // }, [src]);
8431
+ return (React.createElement(React.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
8430
8432
  React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
8431
8433
  React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
8432
8434
  React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),