|
|
|
|
@ -12,6 +12,7 @@ import { getNoteTitle, processStringOrBuffer } from "../../services/utils.js";
|
|
|
|
|
import importUtils from "./utils.js";
|
|
|
|
|
import htmlSanitizer from "../html_sanitizer.js";
|
|
|
|
|
import type { File } from "./common.js";
|
|
|
|
|
import type { NoteType } from "../../becca/entities/rows.js";
|
|
|
|
|
|
|
|
|
|
function importSingleFile(taskContext: TaskContext, file: File, parentNote: BNote) {
|
|
|
|
|
const mime = mimeService.getMime(file.originalname) || file.mimetype;
|
|
|
|
|
@ -73,11 +74,16 @@ function importCodeNote(taskContext: TaskContext, file: File, parentNote: BNote)
|
|
|
|
|
const detectedMime = mimeService.getMime(file.originalname) || file.mimetype;
|
|
|
|
|
const mime = mimeService.normalizeMimeType(detectedMime);
|
|
|
|
|
|
|
|
|
|
let type: NoteType = "code";
|
|
|
|
|
if (file.originalname.endsWith(".excalidraw")) {
|
|
|
|
|
type = "canvas";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { note } = noteService.createNewNote({
|
|
|
|
|
parentNoteId: parentNote.noteId,
|
|
|
|
|
title,
|
|
|
|
|
content,
|
|
|
|
|
type: "code",
|
|
|
|
|
type,
|
|
|
|
|
mime: mime,
|
|
|
|
|
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable()
|
|
|
|
|
});
|
|
|
|
|
|