1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Fixes #2324: Apply userstyle again when exporting to PDF or printing

This commit is contained in:
Laurent Cozic
2020-01-24 21:46:48 +00:00
parent 5456dbbf16
commit 18c46851fd
5 changed files with 26 additions and 11 deletions

View File

@@ -331,7 +331,7 @@ class InteropService {
}
const exporter = this.newModuleFromPath_('exporter', options);// this.newModuleByFormat_('exporter', exportFormat);
await exporter.init(exportPath);
await exporter.init(exportPath, options);
const typeOrder = [BaseModel.TYPE_FOLDER, BaseModel.TYPE_RESOURCE, BaseModel.TYPE_NOTE, BaseModel.TYPE_TAG, BaseModel.TYPE_NOTE_TAG];
const context = {

View File

@@ -7,7 +7,7 @@ class InteropService_Exporter_Base {
this.context_ = {};
}
async init(destDir) {}
async init(destDir, options = {}) {}
async prepareForProcessingItemType(type, itemsToExport) {}
async processItem(ItemClass, item) {}
async processResource(resource, filePath) {}

View File

@@ -13,7 +13,9 @@ const { assetsToHeaders } = require('joplin-renderer');
class InteropService_Exporter_Html extends InteropService_Exporter_Base {
async init(path) {
async init(path, options = {}) {
this.customCss_ = options.customCss ? options.customCss : '';
if (this.metadata().target === 'file') {
this.destDir_ = dirname(path);
this.filePath_ = path;
@@ -88,7 +90,11 @@ class InteropService_Exporter_Html extends InteropService_Exporter_Base {
}
const bodyMd = await this.processNoteResources_(item);
const result = await this.markupToHtml_.render(item.markup_language, bodyMd, this.style_, { resources: this.resources_, plainResourceRendering: true });
const result = await this.markupToHtml_.render(item.markup_language, bodyMd, this.style_, {
resources: this.resources_,
plainResourceRendering: true,
userCss: this.customCss_,
});
const noteContent = [];
if (item.title) noteContent.push(`<div class="exported-note-title">${escapeHtml(item.title)}</div>`);
if (result.html) noteContent.push(result.html);