diff --git a/shared/editor/components/Image.tsx b/shared/editor/components/Image.tsx index e231c6c4ce..d4017db883 100644 --- a/shared/editor/components/Image.tsx +++ b/shared/editor/components/Image.tsx @@ -24,6 +24,7 @@ const Image = ( const [contentWidth, setContentWidth] = React.useState( () => document.body.querySelector("#full-width-container")?.clientWidth || 0 ); + const [loaded, setLoaded] = React.useState(false); const [naturalWidth, setNaturalWidth] = React.useState(node.attrs.width); const [naturalHeight, setNaturalHeight] = React.useState(node.attrs.height); const [size, setSize] = React.useState({ @@ -175,7 +176,10 @@ const Image = ( )} ) => { // For some SVG's Firefox does not provide the naturalWidth, in this @@ -185,6 +189,7 @@ const Image = ( const nh = (ev.target as HTMLImageElement).naturalHeight; setNaturalWidth(nw); setNaturalHeight(nh); + setLoaded(true); if (!node.attrs.width) { setSize((state) => ({ @@ -194,6 +199,15 @@ const Image = ( } }} /> + {isEditable && !isFullWidth && isResizable && ( <> @@ -215,6 +229,10 @@ const Image = ( ); }; +function getPlaceholder(width: number, height: number) { + return ``; +} + export const Caption = styled.p` border: 0; display: block;