mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
support saving files and images in markdown tar export
This commit is contained in:
parent
00ce379962
commit
d6b5cd6ead
@ -25,7 +25,7 @@ async function exportToMarkdown(branch, res) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveDataFile(childFileName, note);
|
saveNote(childFileName, note);
|
||||||
|
|
||||||
const childNotes = await note.getChildNotes();
|
const childNotes = await note.getChildNotes();
|
||||||
|
|
||||||
@ -40,11 +40,7 @@ async function exportToMarkdown(branch, res) {
|
|||||||
return childFileName;
|
return childFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveDataFile(childFileName, note) {
|
function saveTextNote(childFileName, note) {
|
||||||
if (note.type !== 'text' && note.type !== 'code') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (note.content.trim().length === 0) {
|
if (note.content.trim().length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -65,6 +61,19 @@ async function exportToMarkdown(branch, res) {
|
|||||||
pack.entry({name: childFileName + ".md", size: markdown.length}, markdown);
|
pack.entry({name: childFileName + ".md", size: markdown.length}, markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveFileNote(childFileName, note) {
|
||||||
|
pack.entry({name: childFileName, size: note.content.length}, note.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNote(childFileName, note) {
|
||||||
|
if (note.type === 'text' || note.type === 'code') {
|
||||||
|
saveTextNote(childFileName, note);
|
||||||
|
}
|
||||||
|
else if (note.type === 'image' || note.type === 'file') {
|
||||||
|
saveFileNote(childFileName, note);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function saveDirectory(childFileName) {
|
function saveDirectory(childFileName) {
|
||||||
pack.entry({name: childFileName, type: 'directory'});
|
pack.entry({name: childFileName, type: 'directory'});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user