Fix background image CSS application in editor
[MAILPOET-2880]
This commit is contained in:
committed by
Veljko V
parent
f452da10bc
commit
800197c6cb
@@ -32,26 +32,7 @@ const FormStylingBackground = ({ children }) => {
|
|||||||
textAlign = alignment;
|
textAlign = alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
let backgroundSize;
|
let style = {
|
||||||
let backgroundPosition;
|
|
||||||
let backgroundRepeat;
|
|
||||||
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';
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="mailpoet-form-background"
|
|
||||||
style={{
|
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
color: fontColor,
|
color: fontColor,
|
||||||
fontSize: font,
|
fontSize: font,
|
||||||
@@ -64,12 +45,32 @@ const FormStylingBackground = ({ children }) => {
|
|||||||
padding,
|
padding,
|
||||||
width: 700,
|
width: 700,
|
||||||
margin: '0 auto',
|
margin: '0 auto',
|
||||||
backgroundImage: `url(${backgroundImageUrl})`,
|
};
|
||||||
|
|
||||||
|
if (backgroundImageUrl !== undefined) {
|
||||||
|
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,
|
backgroundRepeat,
|
||||||
backgroundPosition,
|
backgroundPosition,
|
||||||
backgroundSize,
|
backgroundSize,
|
||||||
}}
|
backgroundImage: `url(${backgroundImageUrl})`,
|
||||||
>
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mailpoet-form-background" style={style}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user