@bizapps/design-system-testing 1.8.0 → 1.8.1

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/editor.js CHANGED
@@ -861,20 +861,21 @@ function ResizableImageView({ node, updateAttributes, selected, extension }) {
861
861
  if (sizeRef.current.width > 0 || fittedSrcRef.current === src) return;
862
862
  const fit = () => {
863
863
  const available = img.closest(".ProseMirror")?.clientWidth ?? 0;
864
- if (!img.naturalWidth || !img.naturalHeight || available <= 0) return;
864
+ if (!img.naturalWidth || !img.naturalHeight || available <= 0) return false;
865
865
  fittedSrcRef.current = src;
866
866
  const nextWidth = Math.min(img.naturalWidth, available);
867
867
  updateAttributes({
868
868
  width: nextWidth,
869
869
  height: Math.round(nextWidth / (img.naturalWidth / img.naturalHeight))
870
870
  });
871
+ return true;
871
872
  };
872
- if (img.complete) {
873
- fit();
874
- return;
875
- }
876
- img.addEventListener("load", fit, { once: true });
877
- return () => img.removeEventListener("load", fit);
873
+ if (img.complete && fit()) return;
874
+ const onLoad = () => {
875
+ if (fit()) img.removeEventListener("load", onLoad);
876
+ };
877
+ img.addEventListener("load", onLoad);
878
+ return () => img.removeEventListener("load", onLoad);
878
879
  }, [src, updateAttributes]);
879
880
  const onPointerDown = useCallback(
880
881
  (event) => {