mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 18:50:41 +01:00
improvs
This commit is contained in:
@@ -68,8 +68,6 @@ function updateNoteAttribute(req) {
|
||||
attribute.markAsDeleted();
|
||||
}
|
||||
|
||||
console.log(attribute);
|
||||
|
||||
attribute.save();
|
||||
|
||||
return {
|
||||
|
||||
@@ -568,8 +568,9 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
* @param {string} noteId
|
||||
* @param {string} format - either 'html' or 'markdown'
|
||||
* @param {string} zipFilePath
|
||||
* @returns {Promise}
|
||||
*/
|
||||
this.exportSubtreeToZipFile = (noteId, format, zipFilePath) => exportService.exportToZipFile(noteId, format, zipFilePath);
|
||||
this.exportSubtreeToZipFile = async (noteId, format, zipFilePath) => await exportService.exportToZipFile(noteId, format, zipFilePath);
|
||||
|
||||
/**
|
||||
* This object contains "at your risk" and "no BC guarantees" objects for advanced use cases.
|
||||
|
||||
@@ -22,7 +22,7 @@ const ValidationError = require("../../errors/validation_error");
|
||||
* @param {Branch} branch
|
||||
* @param {string} format - 'html' or 'markdown'
|
||||
*/
|
||||
function exportToZip(taskContext, branch, format, res, setHeaders = true) {
|
||||
async function exportToZip(taskContext, branch, format, res, setHeaders = true) {
|
||||
if (!['html', 'markdown'].includes(format)) {
|
||||
throw new ValidationError(`Only 'html' and 'markdown' allowed as export format, '${format}' given`);
|
||||
}
|
||||
@@ -478,12 +478,12 @@ ${markdownContent}`;
|
||||
}
|
||||
|
||||
archive.pipe(res);
|
||||
archive.finalize();
|
||||
await archive.finalize();
|
||||
|
||||
taskContext.taskSucceeded();
|
||||
}
|
||||
|
||||
function exportToZipFile(noteId, format, zipFilePath) {
|
||||
async function exportToZipFile(noteId, format, zipFilePath) {
|
||||
const fileOutputStream = fs.createWriteStream(zipFilePath);
|
||||
const taskContext = new TaskContext('no-progress-reporting');
|
||||
|
||||
@@ -493,7 +493,9 @@ function exportToZipFile(noteId, format, zipFilePath) {
|
||||
throw new ValidationError(`Note ${noteId} not found.`);
|
||||
}
|
||||
|
||||
exportToZip(taskContext, note.getParentBranches()[0], format, fileOutputStream, false);
|
||||
await exportToZip(taskContext, note.getParentBranches()[0], format, fileOutputStream, false);
|
||||
|
||||
log.info(`Exported '${noteId}' with format '${format}' to '${zipFilePath}'`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user