mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
fixes in opml export and note content loading
This commit is contained in:
@@ -67,6 +67,10 @@ class Note extends Entity {
|
||||
if (!this.noteContent) {
|
||||
throw new Error("Note content not found for noteId=" + this.noteId);
|
||||
}
|
||||
|
||||
if (this.isStringNote()) {
|
||||
this.noteContent.content = this.noteContent.content.toString("UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
return this.noteContent;
|
||||
@@ -126,6 +130,11 @@ class Note extends Entity {
|
||||
return (this.type === "code" || this.type === "file" || this.type === "render") && this.mime === "text/html";
|
||||
}
|
||||
|
||||
/** @returns {boolean} true if the note has string content (not binary) */
|
||||
isStringNote() {
|
||||
return ["text", "code", "relation-map"].includes(this.type) || this.mime.startsWith('text/');
|
||||
}
|
||||
|
||||
/** @returns {string} JS script environment - either "frontend" or "backend" */
|
||||
getScriptEnv() {
|
||||
if (this.isHtml() || (this.isJavaScript() && this.mime.endsWith('env=frontend'))) {
|
||||
|
||||
Reference in New Issue
Block a user