parent
2058f72ba2
commit
5f6f19d54a
|
|
@ -19,6 +19,7 @@ import {
|
||||||
propertiesToObject,
|
propertiesToObject,
|
||||||
traverseDownObject,
|
traverseDownObject,
|
||||||
} from '../lib/utils';
|
} from '../lib/utils';
|
||||||
|
import { getCVTitle } from '../themes/data';
|
||||||
import { registerIconLib } from './je-iconlib';
|
import { registerIconLib } from './je-iconlib';
|
||||||
import { registerTheme } from './je-theme';
|
import { registerTheme } from './je-theme';
|
||||||
|
|
||||||
|
|
@ -205,22 +206,17 @@ $inputUploadData.on('change', () => {
|
||||||
function downloadCV(contentType) {
|
function downloadCV(contentType) {
|
||||||
const data = editor.getValue()
|
const data = editor.getValue()
|
||||||
const meta = data.meta || (data.meta = {})
|
const meta = data.meta || (data.meta = {})
|
||||||
let name = meta.name
|
const title = getCVTitle(data)
|
||||||
if (!name) {
|
|
||||||
name = prompt(`Please enter a name for your CV's data`)
|
|
||||||
}
|
|
||||||
if (!name) return
|
|
||||||
|
|
||||||
// update data
|
// update data
|
||||||
meta.name = name
|
|
||||||
meta.lastModified = dayjs().format('YYYY-MM-DDTHH:mm:ssZ[Z]')
|
meta.lastModified = dayjs().format('YYYY-MM-DDTHH:mm:ssZ[Z]')
|
||||||
|
|
||||||
// download
|
// download
|
||||||
if (contentType === 'json') {
|
if (contentType === 'json') {
|
||||||
let filename = `${name}.json`
|
let filename = `${title}.json`
|
||||||
downloadContent(filename, JSON.stringify(data, null, 2))
|
downloadContent(filename, JSON.stringify(data, null, 2))
|
||||||
} else if (contentType === 'html') {
|
} else if (contentType === 'html') {
|
||||||
let filename = `${name}.html`
|
let filename = `${title}.html`
|
||||||
downloadIframeHTML(filename, $outputHTML.get(0))
|
downloadIframeHTML(filename, $outputHTML.get(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue