mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 07:15:51 +01:00
migrating canvas etc.
This commit is contained in:
@@ -1116,6 +1116,12 @@ class BNote extends AbstractBeccaEntity {
|
||||
.map(row => new BNoteAttachment(row));
|
||||
}
|
||||
|
||||
getNoteAttachmentByName(name) {
|
||||
return sql.getRows("SELECT * FROM note_attachments WHERE noteId = ? AND name = ? AND isDeleted = 0", [this.noteId, name])
|
||||
.map(row => new BNoteAttachment(row))
|
||||
[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string[][]} - array of notePaths (each represented by array of noteIds constituting the particular note path)
|
||||
*/
|
||||
@@ -1429,6 +1435,25 @@ class BNote extends AbstractBeccaEntity {
|
||||
return noteRevision;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {BNoteAttachment}
|
||||
*/
|
||||
saveNoteAttachment(name, mime, content) {
|
||||
this.getNoteAttachments()
|
||||
|
||||
const noteAttachment = new BNoteAttachment({
|
||||
name,
|
||||
mime,
|
||||
isProtected: this.isProtected
|
||||
});
|
||||
|
||||
noteAttachment.save();
|
||||
|
||||
noteAttachment.setContent(content);
|
||||
|
||||
return noteAttachment;
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
super.beforeSaving();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user