feat(save): add "copy" button (#441)

* feat(save): add "copy" button

add a button to the save menu called "copy", which opens the raw image data in the window so users
can directly copy it for easy pasting into a variety of apps

#49

* feat(save): open in a new window

update the action to open in a new window and rename it to "open"

* simplify open logic
main
Vince Speelman 6 years ago committed by Michael Fix
parent fd9de34410
commit a7159f87c2

@ -36,7 +36,7 @@ const saveButtonOptions = {
button: true,
color: '#c198fb',
selected: { id: 'SAVE_IMAGE', name: 'Save Image' },
list: ['png', 'svg'].map(id => ({ id, name: id.toUpperCase() }))
list: ['png', 'svg', 'open ↗'].map(id => ({ id, name: id.toUpperCase() }))
}
class Editor extends React.Component {
@ -147,7 +147,9 @@ class Editor extends React.Component {
const timestamp = this.state.timestamp ? `_${formatTimestamp()}` : ''
return this.getCarbonImage({ format, type: 'blob' }).then(url => {
if (format !== 'open ↗') {
link.download = `carbon${timestamp}.${format}`
}
link.href = url
document.body.appendChild(link)
link.click()

Loading…
Cancel
Save