only include tranparent row on Twitter upload (#797)

main
Michael Fix 5 years ago committed by GitHub
parent e4be377552
commit ae35f83d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -122,7 +122,8 @@ class Editor extends React.Component {
format, format,
type, type,
squared = this.state.squaredImage, squared = this.state.squaredImage,
exportSize = (EXPORT_SIZES_HASH[this.state.exportSize] || DEFAULT_EXPORT_SIZE).value exportSize = (EXPORT_SIZES_HASH[this.state.exportSize] || DEFAULT_EXPORT_SIZE).value,
includeTransparentRow = false
} = { format: 'png' } } = { format: 'png' }
) { ) {
// if safari, get image from api // if safari, get image from api
@ -167,7 +168,12 @@ class Editor extends React.Component {
}, },
filter: n => { filter: n => {
if (n.className) { if (n.className) {
return String(n.className).indexOf('eliminateOnRender') < 0 if (String(n.className).indexOf('eliminateOnRender') > -1) {
return false
}
if (String(n.className).indexOf('twitter-png-fix') > -1) {
return includeTransparentRow
}
} }
return true return true
}, },
@ -245,7 +251,7 @@ class Editor extends React.Component {
} }
upload() { upload() {
this.getCarbonImage({ format: 'png' }).then( this.getCarbonImage({ format: 'png', includeTransparentRow: true }).then(
this.context.tweet.bind(null, this.state.code || DEFAULT_CODE) this.context.tweet.bind(null, this.state.code || DEFAULT_CODE)
) )
} }

Loading…
Cancel
Save