mirror of
https://github.com/zadam/trilium.git
synced 2025-02-01 12:00:17 +08:00
fix exporting huge text notes (export would get stuck on HTML pretty printing)
This commit is contained in:
parent
d6016f9b81
commit
23daaa2387
1 changed files with 7 additions and 2 deletions
|
@ -13,6 +13,7 @@ const fs = require("fs");
|
|||
const becca = require("../../becca/becca");
|
||||
const RESOURCE_DIR = require('../../services/resource_dir').RESOURCE_DIR;
|
||||
const archiver = require('archiver');
|
||||
const log = require("../log");
|
||||
|
||||
/**
|
||||
* @param {TaskContext} taskContext
|
||||
|
@ -54,7 +55,7 @@ function exportToZip(taskContext, branch, format, res) {
|
|||
|
||||
let existingExtension = path.extname(fileName).toLowerCase();
|
||||
let newExtension;
|
||||
|
||||
|
||||
if (fileName.length > 30) {
|
||||
fileName = fileName.substr(0, 30);
|
||||
}
|
||||
|
@ -254,7 +255,9 @@ ${content}
|
|||
</html>`;
|
||||
}
|
||||
|
||||
return html.prettyPrint(content, {indent_size: 2});
|
||||
return content.length < 100000
|
||||
? html.prettyPrint(content, {indent_size: 2})
|
||||
: content;
|
||||
}
|
||||
else if (noteMeta.format === 'markdown') {
|
||||
let markdownContent = mdService.toMarkdown(content);
|
||||
|
@ -274,6 +277,8 @@ ${content}
|
|||
const notePaths = {};
|
||||
|
||||
function saveNote(noteMeta, filePathPrefix) {
|
||||
log.info(`Exporting note ${noteMeta.noteId}`);
|
||||
|
||||
if (noteMeta.isClone) {
|
||||
const targetUrl = getTargetUrl(noteMeta.noteId, noteMeta);
|
||||
|
||||
|
|
Loading…
Reference in a new issue