-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add targetDir parameter to outputFormatter
- Loading branch information
1 parent
4d727b0
commit bc24acd
Showing
2 changed files
with
7 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,7 +295,7 @@ export default class MarkdownPreview extends React.Component { | |
this.exportAsDocument('md') | ||
} | ||
|
||
htmlContentFormatter (noteContent, exportTasks) { | ||
htmlContentFormatter (noteContent, exportTasks, targetDir) { | ||
const { | ||
fontFamily, | ||
fontSize, | ||
|
@@ -339,6 +339,7 @@ export default class MarkdownPreview extends React.Component { | |
|
||
return `<html> | ||
<head> | ||
<base href="file://${targetDir}/"> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
shmolf
Contributor
|
||
<meta charset="UTF-8"> | ||
<meta name = "viewport" content = "width = device-width, initial-scale = 1, maximum-scale = 1"> | ||
<style id="style">${inlineStyles}</style> | ||
|
@@ -349,13 +350,13 @@ export default class MarkdownPreview extends React.Component { | |
} | ||
|
||
handleSaveAsHtml () { | ||
this.exportAsDocument('html', (noteContent, exportTasks) => Promise.resolve(this.htmlContentFormatter(noteContent, exportTasks))) | ||
this.exportAsDocument('html', (noteContent, exportTasks, targetDir) => Promise.resolve(this.htmlContentFormatter(noteContent, exportTasks, targetDir))) | ||
} | ||
|
||
handleSaveAsPdf () { | ||
this.exportAsDocument('pdf', (noteContent, exportTasks) => { | ||
const printout = new remote.BrowserWindow({show: false}) | ||
printout.loadURL('data:text/html;charset=UTF-8,' + this.htmlContentFormatter(noteContent, exportTasks)) | ||
this.exportAsDocument('pdf', (noteContent, exportTasks, targetDir) => { | ||
const printout = new remote.BrowserWindow({show: true}) | ||
printout.loadURL('data:text/html;charset=UTF-8,' + this.htmlContentFormatter(noteContent, exportTasks, targetDir)) | ||
return new Promise((resolve, reject) => { | ||
printout.webContents.on('did-finish-load', () => { | ||
printout.webContents.printToPDF({}, (err, data) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AgentEpsilon May I ask, was there a reason for declaring the base? I'm wondering if it'd harm anything, or resurface an old bug, to remove it.
By removing it, I believe it'll fix ID links from the Table of Contents for Exported HTML files.
And may also help when referencing assets relative to the HTML file's current directory, rather than relative to the
base href
.Your thoughts?