Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
child: prefix now copies attributes on new note creation
azivner71e687ad8e1f
diff --git a/db/migrations/0112__rename_inheritAttributes.sql b/db/migrations/0112__rename_inheritAttributes.sqlnew file mode 100644index 0000000000..5cb85978a1--- /dev/null+++ b/db/migrations/0112__rename_inheritAttributes.sql@@ -0,0 +1 @@+UPDATE attributes SET name = 'template' WHERE name = 'inheritAttributes';\ No newline at end of filediff --git a/src/services/app_info.js b/src/services/app_info.jsindex 22383c70a7..0e61c9b988 100644--- a/src/services/app_info.js+++ b/src/services/app_info.js@@ -3,7 +3,7 @@const build = require('./build');const packageJson = require('../../package');-const APP_DB_VERSION = 111;+const APP_DB_VERSION = 112;const SYNC_VERSION = 1;module.exports = {diff --git a/src/services/notes.js b/src/services/notes.jsindex 50f16cefe0..32a55d18ec 100644--- a/src/services/notes.js+++ b/src/services/notes.js@@ -9,6 +9,7 @@ const Note = require('../entities/note');const NoteImage = require('../entities/note_image');const NoteRevision = require('../entities/note_revision');const Branch = require('../entities/branch');+const Attribute = require('../entities/attribute');async function getNewNotePosition(parentNoteId, noteData) {let newNotePos = 0;@@ -70,6 +71,19 @@ async function createNewNote(parentNoteId, noteData) {await triggerNoteTitleChanged(note);await triggerChildNoteCreated(note, parentNote);+ for (const attr of await parentNote.getAttributes()) {+ if (attr.name.startsWith("child:")) {+ await new Attribute({+ noteId: note.noteId,+ type: attr.type,+ name: attr.name.substr(6),+ value: attr.value,+ position: attr.position,+ isInheritable: attr.isInheritable+ }).save();+ }+ }+return {note,branch