Fix potential background issue

main
Mike Fix 7 years ago
parent 71e535e9e2
commit ba7da58f2b

@ -34,6 +34,18 @@ class BackgroundSelect extends React.Component {
} }
render() { render() {
let background = this.props.config.backgroundColor || config.backgroundColor
background =
typeof background === 'string'
? background
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#x27;')
.replace(/\//g, '&#x2F;')
: background
return ( return (
<div className="bg-select-container"> <div className="bg-select-container">
<div className="bg-select-display"> <div className="bg-select-display">
@ -116,15 +128,7 @@ class BackgroundSelect extends React.Component {
? `background: url(${this.props.config.backgroundImage}); ? `background: url(${this.props.config.backgroundImage});
background-size: cover; background-size: cover;
background-repeat: no-repeat;` background-repeat: no-repeat;`
: `background: ${(this.props.config.backgroundColor || config.backgroundColor) : `background: ${background};`};
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#x27;')
.replace(/\//g, '&#x2F;')};
background-size: auto;
background-repeat: repeat;`};
} }
.bg-color-alpha { .bg-color-alpha {

Loading…
Cancel
Save