remove timestamp (#583)

Clean up
main
Michael Fix 6 years ago committed by GitHub
parent 737cb979ae
commit 5badd2fbbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -200,14 +200,11 @@ class Editor extends React.Component {
export(format = 'png') { export(format = 'png') {
const link = document.createElement('a') const link = document.createElement('a')
const timestamp = this.state.timestamp ? `_${formatTimestamp()}` : ''
const prefix = this.state.filename || 'carbon' const prefix = this.state.filename || 'carbon'
return this.getCarbonImage({ format, type: 'blob' }).then(url => { return this.getCarbonImage({ format, type: 'blob' }).then(url => {
if (format === 'open') { if (format !== 'open') {
link.target = '_blank' link.download = `${prefix}.${format}`
} else {
link.download = `${prefix}${timestamp}.${format}`
} }
link.href = url link.href = url
document.body.appendChild(link) document.body.appendChild(link)
@ -386,17 +383,6 @@ class Editor extends React.Component {
} }
} }
function formatTimestamp() {
const timezoneOffset = new Date().getTimezoneOffset() * 60000
const timeString = new Date(Date.now() - timezoneOffset)
.toISOString()
.slice(0, 19)
.replace(/:/g, '-')
.replace('T', '_')
return timeString
}
function isImage(file) { function isImage(file) {
return file.type.split('/')[0] === 'image' return file.type.split('/')[0] === 'image'
} }

@ -533,6 +533,5 @@ export const DEFAULT_SETTINGS = {
exportSize: '2x', exportSize: '2x',
titleBar: '', titleBar: '',
watermark: false, watermark: false,
squaredImage: false, squaredImage: false
timestamp: false
} }

@ -30,7 +30,6 @@ const mappings = [
{ field: 'code:code' }, { field: 'code:code' },
{ field: 'es:exportSize' }, { field: 'es:exportSize' },
{ field: 'wm:watermark', type: 'bool' }, { field: 'wm:watermark', type: 'bool' },
{ field: 'ts:timestamp', type: 'bool' },
{ field: 'copy', type: 'bool' }, { field: 'copy', type: 'bool' },
{ field: 'readonly', type: 'bool' } { field: 'readonly', type: 'bool' }
] ]

Loading…
Cancel
Save