mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
added ImportContext
This commit is contained in:
@@ -4,7 +4,7 @@ const noteService = require('../../services/notes');
|
||||
const commonmark = require('commonmark');
|
||||
const path = require('path');
|
||||
|
||||
async function importMarkdown(file, parentNote) {
|
||||
async function importMarkdown(importContext, file, parentNote) {
|
||||
const markdownContent = file.buffer.toString("UTF-8");
|
||||
|
||||
const reader = new commonmark.Parser();
|
||||
@@ -20,10 +20,13 @@ async function importMarkdown(file, parentNote) {
|
||||
mime: 'text/html'
|
||||
});
|
||||
|
||||
importContext.increaseCount();
|
||||
importContext.importFinished(note.noteId);
|
||||
|
||||
return note;
|
||||
}
|
||||
|
||||
async function importHtml(file, parentNote) {
|
||||
async function importHtml(importContext, file, parentNote) {
|
||||
const title = getFileNameWithoutExtension(file.originalname);
|
||||
const content = file.buffer.toString("UTF-8");
|
||||
|
||||
@@ -32,6 +35,9 @@ async function importHtml(file, parentNote) {
|
||||
mime: 'text/html'
|
||||
});
|
||||
|
||||
importContext.increaseCount();
|
||||
importContext.importFinished(note.noteId);
|
||||
|
||||
return note;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user