mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
fix exporting storage's notes as PDFs
This commit is contained in:
@@ -5,8 +5,7 @@ import filenamify from 'filenamify'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import exportNote from './exportNote'
|
import exportNote from './exportNote'
|
||||||
import formatMarkdown from './formatMarkdown'
|
import getContentFormatter from './getContentFormatter'
|
||||||
import formatHTML from './formatHTML'
|
|
||||||
import getFilename from './getFilename'
|
import getFilename from './getFilename'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,31 +42,7 @@ function exportStorage(storageKey, fileType, exportDir, config) {
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
.then(({ storage, notes }) => {
|
.then(({ storage, notes }) => {
|
||||||
let contentFormatter = null
|
const contentFormatter = getContentFormatter(storage, fileType, config)
|
||||||
if (fileType === 'md') {
|
|
||||||
contentFormatter = formatMarkdown({
|
|
||||||
storagePath: storage.path,
|
|
||||||
export: config.export
|
|
||||||
})
|
|
||||||
} else if (fileType === 'html') {
|
|
||||||
contentFormatter = formatHTML({
|
|
||||||
theme: config.ui.theme,
|
|
||||||
fontSize: config.preview.fontSize,
|
|
||||||
fontFamily: config.preview.fontFamily,
|
|
||||||
codeBlockTheme: config.preview.codeBlockTheme,
|
|
||||||
codeBlockFontFamily: config.editor.fontFamily,
|
|
||||||
lineNumber: config.preview.lineNumber,
|
|
||||||
indentSize: config.editor.indentSize,
|
|
||||||
scrollPastEnd: config.preview.scrollPastEnd,
|
|
||||||
smartQuotes: config.preview.smartQuotes,
|
|
||||||
breaks: config.preview.breaks,
|
|
||||||
sanitize: config.preview.sanitize,
|
|
||||||
customCSS: config.preview.customCSS,
|
|
||||||
allowCustomCSS: config.preview.allowCustomCSS,
|
|
||||||
storagePath: storage.path,
|
|
||||||
export: config.export
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const folderNamesMapping = {}
|
const folderNamesMapping = {}
|
||||||
storage.folders.forEach(folder => {
|
storage.folders.forEach(folder => {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import formatPDF from './formatPDF'
|
|||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default function getContentFormatterr(storage, fileType, config) {
|
export default function getContentFormatter(storage, fileType, config) {
|
||||||
if (fileType === 'md') {
|
if (fileType === 'md') {
|
||||||
return formatMarkdown({
|
return formatMarkdown({
|
||||||
storagePath: storage.path,
|
storagePath: storage.path,
|
||||||
|
|||||||
Reference in New Issue
Block a user