mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
child: prefix now copies attributes on new note creation
This commit is contained in:
parent
171877ce08
commit
71e687ad8e
1
db/migrations/0112__rename_inheritAttributes.sql
Normal file
1
db/migrations/0112__rename_inheritAttributes.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
UPDATE attributes SET name = 'template' WHERE name = 'inheritAttributes';
|
@ -3,7 +3,7 @@
|
|||||||
const build = require('./build');
|
const build = require('./build');
|
||||||
const packageJson = require('../../package');
|
const packageJson = require('../../package');
|
||||||
|
|
||||||
const APP_DB_VERSION = 111;
|
const APP_DB_VERSION = 112;
|
||||||
const SYNC_VERSION = 1;
|
const SYNC_VERSION = 1;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -9,6 +9,7 @@ const Note = require('../entities/note');
|
|||||||
const NoteImage = require('../entities/note_image');
|
const NoteImage = require('../entities/note_image');
|
||||||
const NoteRevision = require('../entities/note_revision');
|
const NoteRevision = require('../entities/note_revision');
|
||||||
const Branch = require('../entities/branch');
|
const Branch = require('../entities/branch');
|
||||||
|
const Attribute = require('../entities/attribute');
|
||||||
|
|
||||||
async function getNewNotePosition(parentNoteId, noteData) {
|
async function getNewNotePosition(parentNoteId, noteData) {
|
||||||
let newNotePos = 0;
|
let newNotePos = 0;
|
||||||
@ -70,6 +71,19 @@ async function createNewNote(parentNoteId, noteData) {
|
|||||||
await triggerNoteTitleChanged(note);
|
await triggerNoteTitleChanged(note);
|
||||||
await triggerChildNoteCreated(note, parentNote);
|
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 {
|
return {
|
||||||
note,
|
note,
|
||||||
branch
|
branch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user