Skip to content

Commit

Permalink
don't show size ui for image with no natural sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Mar 23, 2020
1 parent 9491bf5 commit c6d973e
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -173,7 +173,7 @@ public PanmirrorEditImageDialog(PanmirrorImageProps props,
// (i.e. not an insert operation) and there aren't width or height attributes
// within props.keyvalue (which is an indicator that they use units unsupported
// by our sizing UI (e.g. ch, em, etc.)
if (editAttributes && dims_ != null && !hasSizeKeyvalue(props.keyvalue))
if (editAttributes && dims_ != null && hasNaturalSizes(dims) && !hasSizeKeyvalue(props.keyvalue))
{
imageTab.add(sizePanel);
}
Expand Down Expand Up @@ -404,6 +404,11 @@ private static boolean hasSizeKeyvalue(String[][] keyvalue)
return false;
}

private static boolean hasNaturalSizes(PanmirrorImageDimensions dims)
{
return dims.naturalWidth != null && dims.naturalHeight != null;
}

// resources
private static PanmirrorDialogsResources RES = PanmirrorDialogsResources.INSTANCE;

Expand Down

0 comments on commit c6d973e

Please sign in to comment.