import type { LexicalEditor, NodeKey } from 'lexical'; import * as React from 'react'; import { Suspense, useRef } from 'react'; const imageCache = new Set(); function useSuspenseImage(src: string) { if (!imageCache.has(src)) { throw new Promise((resolve) => { const img = new Image(); img.src = src; img.onload = () => { imageCache.add(src); resolve(null); }; }); } } function LazyImage({ altText, className, imageRef, src, width, height, maxWidth, }: { altText: string; className: string | null; height: 'inherit' | number; imageRef: { current: null | HTMLImageElement }; maxWidth: number; src: string; width: 'inherit' | number; }): JSX.Element { useSuspenseImage(src); return ( {altText} ); } export default function ImageComponent({ src, altText, width, height, maxWidth, }: { altText: string; caption: LexicalEditor; height: 'inherit' | number; maxWidth: number; nodeKey: NodeKey; resizable: boolean; showCaption: boolean; src: string; width: 'inherit' | number; captionsEnabled: boolean; }): JSX.Element { const imageRef = useRef(null); return ( <>
); }