mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
note content refactoring, WIP
This commit is contained in:
parent
c487a95bc7
commit
6952b643ae
@ -74,6 +74,13 @@ class Note extends Entity {
|
|||||||
return noteContent.content;
|
return noteContent.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @returns {Promise<*>} */
|
||||||
|
async getJsonContent() {
|
||||||
|
const content = await this.getContent();
|
||||||
|
|
||||||
|
return JSON.parse(content);
|
||||||
|
}
|
||||||
|
|
||||||
/** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
|
/** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
|
||||||
isRoot() {
|
isRoot() {
|
||||||
return this.noteId === 'root';
|
return this.noteId === 'root';
|
||||||
|
@ -99,7 +99,7 @@ body {
|
|||||||
font-family: var(--main-font-family);
|
font-family: var(--main-font-family);
|
||||||
}
|
}
|
||||||
|
|
||||||
input, select {
|
input, select, textarea {
|
||||||
color: var(--input-text-color) !important;
|
color: var(--input-text-color) !important;
|
||||||
background: var(--input-background-color) !important;
|
background: var(--input-background-color) !important;
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,14 @@ async function getNote(req) {
|
|||||||
return [404, "Note " + noteId + " has not been found."];
|
return [404, "Note " + noteId + " has not been found."];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.mime.startsWith('text/')) {
|
if (["text", "code", "relation-map"].includes(note.type) || note.mime.startsWith('text/')) {
|
||||||
const noteContent = await note.getNoteContent();
|
const noteContent = await note.getNoteContent();
|
||||||
|
|
||||||
noteContent.content = noteContent.content.toString("UTF-8");
|
noteContent.content = noteContent.content.toString("UTF-8");
|
||||||
|
|
||||||
|
if (note.type === 'file') {
|
||||||
|
noteContent.content = noteContent.content.substr(0, 10000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return note;
|
return note;
|
||||||
|
@ -52,7 +52,7 @@ function decryptNote(note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (note.title) {
|
if (note.title) {
|
||||||
note.title = decryptNoteTitle(note.noteId)
|
note.title = decryptNoteTitle(note.noteId, note.title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user