From 5f6f19d54a3911a8ace41734bf77cb67bed1fc2f Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 8 Feb 2023 00:18:37 +0800 Subject: [PATCH] stop prompting for meta.name use getCVTitle instead --- src/editor/main.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/editor/main.js b/src/editor/main.js index 9198a47..127d6bd 100644 --- a/src/editor/main.js +++ b/src/editor/main.js @@ -19,6 +19,7 @@ import { propertiesToObject, traverseDownObject, } from '../lib/utils'; +import { getCVTitle } from '../themes/data'; import { registerIconLib } from './je-iconlib'; import { registerTheme } from './je-theme'; @@ -205,22 +206,17 @@ $inputUploadData.on('change', () => { function downloadCV(contentType) { const data = editor.getValue() const meta = data.meta || (data.meta = {}) - let name = meta.name - if (!name) { - name = prompt(`Please enter a name for your CV's data`) - } - if (!name) return + const title = getCVTitle(data) // update data - meta.name = name meta.lastModified = dayjs().format('YYYY-MM-DDTHH:mm:ssZ[Z]') // download if (contentType === 'json') { - let filename = `${name}.json` + let filename = `${title}.json` downloadContent(filename, JSON.stringify(data, null, 2)) } else if (contentType === 'html') { - let filename = `${name}.html` + let filename = `${title}.html` downloadIframeHTML(filename, $outputHTML.get(0)) }