mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
new note inherits type and mime from parent note, closes #20
This commit is contained in:
parent
0da13994a6
commit
b2ff97ccf2
@ -71,7 +71,7 @@ const noteEditor = (function() {
|
||||
|
||||
// if content is only tags/whitespace (typically <p> </p>), then just make it empty
|
||||
// this is important when setting new note to code
|
||||
if ($(note.detail.note_text).text().trim() === '') {
|
||||
if (jQuery(note.detail.note_text).text().trim() === '') {
|
||||
note.detail.note_text = ''
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,18 @@ async function createNewNote(parentNoteId, note, sourceId) {
|
||||
throw new Error('Unknown target: ' + note.target);
|
||||
}
|
||||
|
||||
if (parentNoteId !== 'root') {
|
||||
const parent = await sql.getFirst("SELECT * FROM notes WHERE note_id = ?", [parentNoteId]);
|
||||
|
||||
if (!note.type) {
|
||||
note.type = parent.type;
|
||||
}
|
||||
|
||||
if (!note.mime) {
|
||||
note.mime = parent.mime;
|
||||
}
|
||||
}
|
||||
|
||||
const now = utils.nowDate();
|
||||
|
||||
await sql.insert("notes", {
|
||||
|
Loading…
x
Reference in New Issue
Block a user