Skip to content

Commit

Permalink
remove createObjectURL change
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Nov 18, 2020
1 parent 2fd1a73 commit fe7c694
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class Editor extends React.Component {
)
.then(uri => uri.slice(uri.indexOf(',') + 1))
.then(data => new Blob([data], { type: 'image/svg+xml' }))
.then(blob => window.URL.createObjectURL(blob))
}

// if safari, get image from api
Expand All @@ -174,7 +175,7 @@ class Editor extends React.Component {
}

if (type === 'blob') {
return domtoimage.toBlob(node, config)
return domtoimage.toBlob(node, config).then(blob => window.URL.createObjectURL(blob))
}

// Twitter needs regular dataurls
Expand All @@ -192,20 +193,18 @@ class Editor extends React.Component {

const prefix = options.filename || this.state.name || 'carbon'

return this.getCarbonImage({ format, type: 'blob' })
.then(data => window.URL.createObjectURL(data))
.then(url => {
if (format !== 'open') {
link.download = `${prefix}.${format}`
}
if (this.isFirefox) {
link.target = '_blank'
}
link.href = url
document.body.appendChild(link)
link.click()
link.remove()
})
return this.getCarbonImage({ format, type: 'blob' }).then(url => {
if (format !== 'open') {
link.download = `${prefix}.${format}`
}
if (this.isFirefox) {
link.target = '_blank'
}
link.href = url
document.body.appendChild(link)
link.click()
link.remove()
})
}

copyImage = () =>
Expand Down

0 comments on commit fe7c694

Please sign in to comment.