Fix background image CSS application in editor
[MAILPOET-2880]
This commit is contained in:
committed by
Veljko V
parent
f452da10bc
commit
800197c6cb
@@ -32,44 +32,45 @@ const FormStylingBackground = ({ children }) => {
|
||||
textAlign = alignment;
|
||||
}
|
||||
|
||||
let backgroundSize;
|
||||
let backgroundPosition;
|
||||
let backgroundRepeat;
|
||||
let style = {
|
||||
backgroundColor,
|
||||
color: fontColor,
|
||||
fontSize: font,
|
||||
lineHeight: 1.2,
|
||||
borderRadius: radius,
|
||||
borderWidth: borderSize,
|
||||
borderColor,
|
||||
borderStyle,
|
||||
textAlign,
|
||||
padding,
|
||||
width: 700,
|
||||
margin: '0 auto',
|
||||
};
|
||||
|
||||
if (backgroundImageUrl !== undefined) {
|
||||
backgroundPosition = 'center';
|
||||
backgroundRepeat = 'no-repeat';
|
||||
backgroundSize = 'cover';
|
||||
}
|
||||
if (backgroundImageDisplay === 'fit') {
|
||||
backgroundSize = 'auto';
|
||||
backgroundPosition = 'center top';
|
||||
}
|
||||
if (backgroundImageDisplay === 'tile') {
|
||||
backgroundRepeat = 'repeat';
|
||||
backgroundSize = 'auto';
|
||||
let backgroundPosition = 'center';
|
||||
let backgroundRepeat = 'no-repeat';
|
||||
let backgroundSize = 'cover';
|
||||
|
||||
if (backgroundImageDisplay === 'fit') {
|
||||
backgroundSize = 'auto';
|
||||
backgroundPosition = 'center top';
|
||||
}
|
||||
if (backgroundImageDisplay === 'tile') {
|
||||
backgroundRepeat = 'repeat';
|
||||
backgroundSize = 'auto';
|
||||
}
|
||||
style = {
|
||||
...style,
|
||||
backgroundRepeat,
|
||||
backgroundPosition,
|
||||
backgroundSize,
|
||||
backgroundImage: `url(${backgroundImageUrl})`,
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="mailpoet-form-background"
|
||||
style={{
|
||||
backgroundColor,
|
||||
color: fontColor,
|
||||
fontSize: font,
|
||||
lineHeight: 1.2,
|
||||
borderRadius: radius,
|
||||
borderWidth: borderSize,
|
||||
borderColor,
|
||||
borderStyle,
|
||||
textAlign,
|
||||
padding,
|
||||
width: 700,
|
||||
margin: '0 auto',
|
||||
backgroundImage: `url(${backgroundImageUrl})`,
|
||||
backgroundRepeat,
|
||||
backgroundPosition,
|
||||
backgroundSize,
|
||||
}}
|
||||
>
|
||||
<div className="mailpoet-form-background" style={style}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user