@emailmaker/filemanager 0.10.81 → 0.10.82

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.
@@ -1,2 +1,2 @@
1
- export{B as FileContent,H as FileManagerApiError,A as FileManagerApp,v as FileManagerAppWithContext,C as FileModals,D as FolderSidebar,P as PixieOnlyApp,z as default,q as init,y as initFileManager,w as initPixieEditor,E as installResizeObserverErrorHandler,I as mapHttpStatusToErrorCode,G as uninstallResizeObserverErrorHandler,t as unmount,x as unmountPixieEditor}from"./file-manager-index-C27hSl1b.js";import"react/jsx-runtime";import"react";import"react-dom/client";import"antd";import"antd/es/alert/ErrorBoundary";import"@ant-design/icons";import"react-dom";
1
+ export{B as FileContent,H as FileManagerApiError,A as FileManagerApp,v as FileManagerAppWithContext,C as FileModals,D as FolderSidebar,P as PixieOnlyApp,z as default,q as init,y as initFileManager,w as initPixieEditor,E as installResizeObserverErrorHandler,I as mapHttpStatusToErrorCode,G as uninstallResizeObserverErrorHandler,t as unmount,x as unmountPixieEditor}from"./file-manager-index-S_eK0A-M.js";import"react/jsx-runtime";import"react";import"react-dom/client";import"antd";import"antd/es/alert/ErrorBoundary";import"@ant-design/icons";import"react-dom";
2
2
  //# sourceMappingURL=file-manager.esm.js.map
package/file-manager.js CHANGED
@@ -42651,18 +42651,52 @@ const SafeImage = ({ thumbnailSrc, previewSrc, lightboxSrc, alt, className, widt
42651
42651
  const lightboxSources = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => [lightboxSrc, previewSrc, thumbnailSrc], [lightboxSrc, previewSrc, thumbnailSrc]);
42652
42652
  const displayImage = (0,hooks/* useProxyDisplayFallback */.iy)(displaySources);
42653
42653
  const lightboxImage = (0,hooks/* useProxyDisplayFallback */.iy)(lightboxSources);
42654
+ const { handleError: lightboxHandleError, handleLoad: lightboxHandleLoad } = lightboxImage;
42654
42655
  const finalDisplaySrc = (_a = displayImage.src) !== null && _a !== void 0 ? _a : constants/* FALLBACK_SRC */.oq;
42655
42656
  const previewImageSrc = (_b = lightboxImage.src) !== null && _b !== void 0 ? _b : displayImage.src;
42656
- const previewConfig = preview && previewImageSrc
42657
+ /** One in-flight `handleError` per broken URL — rc-image can signal failure twice (`isImageValid` + native `onError`). */
42658
+ const previewErrorInFlightRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
42659
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
42660
+ previewErrorInFlightRef.current = false;
42661
+ }, [previewImageSrc]);
42662
+ /**
42663
+ * Preview uses rc-image's internal `useStatus({ fallback })`; it never calls our hook on failure.
42664
+ * Strip `fallback`, bind `onError` → proxy chain, and `key` so the next candidate remounts a fresh `<img>`.
42665
+ */
42666
+ const previewImageRender = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((originalNode) => external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(originalNode, {
42667
+ key: previewImageSrc !== null && previewImageSrc !== void 0 ? previewImageSrc : constants/* FALLBACK_SRC */.oq,
42668
+ src: previewImageSrc !== null && previewImageSrc !== void 0 ? previewImageSrc : constants/* FALLBACK_SRC */.oq,
42669
+ fallback: undefined,
42670
+ onError: () => {
42671
+ if (previewErrorInFlightRef.current) {
42672
+ return;
42673
+ }
42674
+ previewErrorInFlightRef.current = true;
42675
+ lightboxHandleError()
42676
+ .finally(() => {
42677
+ previewErrorInFlightRef.current = false;
42678
+ })
42679
+ .catch(() => {
42680
+ /* handleError should not reject; guard for eslint / runtime */
42681
+ });
42682
+ },
42683
+ onLoad: () => {
42684
+ lightboxHandleLoad();
42685
+ },
42686
+ }), [previewImageSrc, lightboxHandleError, lightboxHandleLoad]);
42687
+ const previewConfig = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => preview && previewImageSrc
42657
42688
  ? {
42658
42689
  src: previewImageSrc,
42659
42690
  toolbarRender: () => null,
42660
42691
  destroyOnHidden: true,
42661
42692
  mask: (0,jsx_runtime.jsx)(icons_EyeOutlined, { style: { fontSize: '20px' } }),
42693
+ imageRender: previewImageRender,
42662
42694
  }
42663
- : false;
42695
+ : false, [preview, previewImageSrc, previewImageRender]);
42664
42696
  return ((0,jsx_runtime.jsx)(external_root_antd_commonjs2_antd_commonjs_antd_amd_antd_.Image, { className: className, src: finalDisplaySrc, alt: alt, width: width, height: height, preview: previewConfig, onLoad: displayImage.handleLoad, onError: () => {
42665
- void displayImage.handleError();
42697
+ displayImage.handleError().catch(() => {
42698
+ /* best-effort fallback chain */
42699
+ });
42666
42700
  }, fallback: constants/* FALLBACK_SRC */.oq }));
42667
42701
  };
42668
42702
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailmaker/filemanager",
3
- "version": "0.10.81",
3
+ "version": "0.10.82",
4
4
  "main": "./file-manager.js",
5
5
  "module": "./file-manager.esm.js",
6
6
  "types": "./index.d.ts",