diff --git a/email-template-builder/src/main/java/io/rocketbase/mail/config/TbConfiguration.java b/email-template-builder/src/main/java/io/rocketbase/mail/config/TbConfiguration.java index 8e6b37a..718808f 100644 --- a/email-template-builder/src/main/java/io/rocketbase/mail/config/TbConfiguration.java +++ b/email-template-builder/src/main/java/io/rocketbase/mail/config/TbConfiguration.java @@ -11,6 +11,7 @@ public class TbConfiguration { static final TbConfiguration DEFAULT = new TbConfiguration(true, TbFontConfig.newInstance(), TbTextConfig.newInstance(), TbTextConfig.newInstanceSmall(), + TbSideImageLineConfig.newInstance(), TbButtonConfig.newInstance(), TbAttributeConfig.newInstance(), TbBoxConfig.newInstance(), @@ -28,6 +29,7 @@ public static final TbConfiguration newInstance() { private TbFontConfig font; private TbTextConfig text; private TbTextConfig imageText; + private TbSideImageLineConfig sideImageLine; private TbButtonConfig button; private TbAttributeConfig attribute; private TbBoxConfig box; @@ -41,6 +43,7 @@ public TbConfiguration(TbConfiguration other) { this.font = new TbFontConfig(other.font); this.text = new TbTextConfig(other.text); this.imageText = new TbTextConfig(other.imageText); + this.sideImageLine = new TbSideImageLineConfig(other.sideImageLine); this.button = new TbButtonConfig(other.button); this.attribute = new TbAttributeConfig(other.attribute); this.box = new TbBoxConfig(other.box); diff --git a/email-template-builder/src/main/java/io/rocketbase/mail/config/config/TbSideImageLineConfig.java b/email-template-builder/src/main/java/io/rocketbase/mail/config/config/TbSideImageLineConfig.java new file mode 100644 index 0000000..f5adfa5 --- /dev/null +++ b/email-template-builder/src/main/java/io/rocketbase/mail/config/config/TbSideImageLineConfig.java @@ -0,0 +1,22 @@ +package io.rocketbase.mail.config.config; + +import io.rocketbase.mail.styling.ObjectFit; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class TbSideImageLineConfig { + + static final TbSideImageLineConfig DEFAULT = new TbSideImageLineConfig(ObjectFit.NONE); + + private ObjectFit objectFit; + + public TbSideImageLineConfig(TbSideImageLineConfig other) { + this.objectFit = other.objectFit; + } + + public static TbSideImageLineConfig newInstance() { + return new TbSideImageLineConfig(DEFAULT); + } +} diff --git a/email-template-builder/src/main/java/io/rocketbase/mail/styling/ObjectFit.java b/email-template-builder/src/main/java/io/rocketbase/mail/styling/ObjectFit.java new file mode 100644 index 0000000..04ba4a6 --- /dev/null +++ b/email-template-builder/src/main/java/io/rocketbase/mail/styling/ObjectFit.java @@ -0,0 +1,23 @@ +package io.rocketbase.mail.styling; + +import lombok.Getter; + +public enum ObjectFit { + CONTAIN("contain"), + COVER("cover"), + FILL("fill"), + INHERENT("inherent"), + INITIAL("initial"), + NONE("none"), + REVERT("revert"), + REVERT_LAYER("revert-layer"), + SCALE_DOWN("scale-down"), + UNSET("unset"); + + @Getter + private String value; + + ObjectFit(String value) { + this.value = value; + } +} diff --git a/email-template-builder/src/main/resources/templates/email/layout.html b/email-template-builder/src/main/resources/templates/email/layout.html index 9e97c7b..0c99efa 100644 --- a/email-template-builder/src/main/resources/templates/email/layout.html +++ b/email-template-builder/src/main/resources/templates/email/layout.html @@ -261,6 +261,11 @@ line-height: {{ c.imageText.lineHeight | default('1.325') }}; } + .body-gallery img, + .body-side-image img { + object-fit: {{ c.sideImageLine.objectFit | default('none') }}; + } + .body-sub { margin-top: 25px; padding-top: 25px; @@ -387,6 +392,9 @@