Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Nov 18, 2020
1 parent fe7c694 commit d252207
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,14 @@ class Editor extends React.Component {
return this.context.image(encodedState)
}

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

if (type === 'blob') {
return domtoimage.toBlob(node, config)
}

// Twitter needs regular dataurls
return domtoimage.toPng(node, config)
}
Expand All @@ -193,7 +197,7 @@ class Editor extends React.Component {

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

return this.getCarbonImage({ format, type: 'blob' }).then(url => {
return this.getCarbonImage({ format, type: 'objectURL' }).then(url => {
if (format !== 'open') {
link.download = `${prefix}.${format}`
}
Expand Down

0 comments on commit d252207

Please sign in to comment.