-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export note with local images #1306
Conversation
Looks through the note and searches for local images. Copies them to ‘images’ folder in the export path and replaces affected links. BoostIO#1261
Be sure to be changed |
@kazup01 any news? |
@nlopin Thanks for your support! We will review it at sometime soon. |
Sorry for the long absence. Could you fix some conflicts? |
Sure |
@kazup01 it will be an issue with html export (#1256). There is a code to receive an HTML for export:
As you can see, the whole HTML of the preview window is fetched and exported then. But, it contains relative links to local styles and fonts. For example, all of those styles will be lost after user copy the exported HTML to another computer:
It is not a good idea to export content like this because it does not provide consistent view on different machines. We do have
|
|
@Rokt33r thanks for your response. Looks like you didn't catch the issue in the first question. The question is not about where should we put styles. The issue is: We'll have to export those css files along with html. Otherwise it won't work properly. If it's ok I'll do this. |
@nlopin It makes sense. I've realized now that it is just like what Chrome does. Yea, we should export multiple files, style sheet, images and any other static stuff, including fonts if url is available. |
@nlopin ping. |
1 similar comment
@nlopin ping. |
@Rokt33r hi. Sorry for delay. I'm working on it right now. |
# Conflicts: # browser/components/MarkdownPreview.js
@Rokt33r @kazup01 I've finished. Export is divided by two parts:
Additional files are exported via copy tasks. Task is an object If all additional files are exported, the content will be exported at the end. If an error happened during export, boostnote remove all already exported files and folders. Feel free to ask questions here or at Slack. |
@nlopin Great work! 👍 I'll review this tomorrow! |
Will u also include CSS ? |
@tatoosh yes. If you export to HTML two additional folders will be exported – |
THX @nlopin! |
No, it will export the same styles you see on preview. Create feature request if you need it |
function saveToFile (data, filename) { | ||
return new Promise((resolve, reject) => { | ||
fs.writeFile(filename, data, (err) => { | ||
if (err) throw err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this makes the error go limbo. return reject(err)
should be right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@Rokt33r done! Thank you |
Now we need to implement UI. I'm going to create another PR against this branch about tomorrow. Let me know if you want to finish it by yourself! |
Could you explain what do you mean? |
@nlopin sorry for my late answer. Everything looks great. I'll merge this today! |
Merged! |
This is the fundamental issue. Some styles applies directly to Preview HTML in I add class to the |
@nlopin Could you create another PR? I can review it now! |
Done #1531 |
Looks through the note and searches for local images. Copies them to ‘images’ folder in the export path and replaces affected links.
#1261