From febc98c10150cbd167839904ce88a6c5af88dadc Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Fri, 12 Jun 2020 16:51:35 +0200 Subject: [PATCH] fix exporting storage's notes as PDFs --- browser/main/lib/dataApi/exportStorage.js | 29 ++----------------- .../main/lib/dataApi/getContentFormatter.js | 2 +- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/browser/main/lib/dataApi/exportStorage.js b/browser/main/lib/dataApi/exportStorage.js index 14f581dd..6cd80565 100644 --- a/browser/main/lib/dataApi/exportStorage.js +++ b/browser/main/lib/dataApi/exportStorage.js @@ -5,8 +5,7 @@ import filenamify from 'filenamify' import path from 'path' import fs from 'fs' import exportNote from './exportNote' -import formatMarkdown from './formatMarkdown' -import formatHTML from './formatHTML' +import getContentFormatter from './getContentFormatter' import getFilename from './getFilename' /** @@ -43,31 +42,7 @@ function exportStorage(storageKey, fileType, exportDir, config) { })) }) .then(({ storage, notes }) => { - let contentFormatter = null - 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 contentFormatter = getContentFormatter(storage, fileType, config) const folderNamesMapping = {} storage.folders.forEach(folder => { diff --git a/browser/main/lib/dataApi/getContentFormatter.js b/browser/main/lib/dataApi/getContentFormatter.js index afc1662e..b39b681c 100644 --- a/browser/main/lib/dataApi/getContentFormatter.js +++ b/browser/main/lib/dataApi/getContentFormatter.js @@ -8,7 +8,7 @@ import formatPDF from './formatPDF' * @param {Object} config */ -export default function getContentFormatterr(storage, fileType, config) { +export default function getContentFormatter(storage, fileType, config) { if (fileType === 'md') { return formatMarkdown({ storagePath: storage.path,