editor: add Print the preview button

This commit is contained in:
Reorx 2023-02-11 23:38:54 +08:00
parent baf369d05e
commit b136495a5c
2 changed files with 8 additions and 1 deletions

View File

@ -40,6 +40,8 @@
<p>You can first click "Download HTML", then open the HTML in a browser and choose "Print" from the menu (or press ⌘+P), it will open a modal where you should find the option to save it as a PDF.</p>
<p>For best compatibility, I recommend using Firefox rather than Chrome to complete this process.</p>
<button>OK</button>
<p>Click the button below to open the print dialog for the preview.</p>
<button id="fn-print-preview">Print the preview</button>
</form>
</dialog>

View File

@ -23,7 +23,7 @@ import { getCVTitle } from '../themes/data';
import { registerIconLib } from './je-iconlib';
import { registerTheme } from './je-theme';
const propertiesInOrder = ['basics', 'education', 'work', 'projects', 'sideProjects', 'skills', 'languages', 'interests', 'references', 'awards', 'publications', 'volunteer', 'meta']
const propertiesInOrder = ['basics', 'education', 'work', 'projects', 'sideProjects', 'skills', 'languages', 'interests', 'references', 'awards', 'publications', 'volunteer', 'certificates', 'meta']
const basicsPropertiesInOrder = ['name', 'label', 'email', 'phone', 'url', 'summary', 'image', 'location', 'profiles']
// toc elements
@ -160,6 +160,7 @@ const $inputUploadData = $('input[name=upload-data]')
const $btnDownloadJSON = $('#fn-download-json')
const $btnDownloadHTML = $('#fn-download-html')
const $btnLoadSample = $('#fn-load-sample')
const $btnPrintPreview = $('#fn-print-preview')
$btnShowPreview.on('click', () => {
$outputJSON.hide()
@ -238,3 +239,7 @@ $btnLoadSample.on('click', () => {
editor.setValue(sampleModule.default)
})
$btnPrintPreview.on('click', () => {
$outputHTML.get(0).contentWindow.print()
})