From c7b99adb6a1c594fda8bbde06bab67d78cd376fb Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Mar 2025 04:20:43 +0200 Subject: [PATCH 1/4] feat(template): duplicate content for mermaid diagrams --- src/public/app/services/note_create.ts | 2 +- src/services/handlers.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/public/app/services/note_create.ts b/src/public/app/services/note_create.ts index 47cf02bb6..14299ba4f 100644 --- a/src/public/app/services/note_create.ts +++ b/src/public/app/services/note_create.ts @@ -62,7 +62,7 @@ async function createNote(parentNotePath: string | undefined, options: CreateNot const parentNoteId = treeService.getNoteIdFromUrl(parentNotePath); - if (options.type === "mermaid" && !options.content) { + if (options.type === "mermaid" && !options.content && !options.templateNoteId) { options.content = `graph TD; A-->B; A-->C; diff --git a/src/services/handlers.ts b/src/services/handlers.ts index 2630e2519..5c65c8a49 100644 --- a/src/services/handlers.ts +++ b/src/services/handlers.ts @@ -102,7 +102,7 @@ eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) => const content = note.getContent(); if ( - ["text", "code"].includes(note.type) && + ["text", "code", "mermaid"].includes(note.type) && typeof content === "string" && // if the note has already content we're not going to overwrite it with template's one (!content || content.trim().length === 0) && From 5d9bea898758e98ae5ee4945c99569ca81055a94 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Mar 2025 04:24:09 +0200 Subject: [PATCH 2/4] feat(template): duplicate content for canvas --- src/services/handlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/handlers.ts b/src/services/handlers.ts index 5c65c8a49..a5580c5b1 100644 --- a/src/services/handlers.ts +++ b/src/services/handlers.ts @@ -102,7 +102,7 @@ eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) => const content = note.getContent(); if ( - ["text", "code", "mermaid"].includes(note.type) && + ["text", "code", "mermaid", "canvas"].includes(note.type) && typeof content === "string" && // if the note has already content we're not going to overwrite it with template's one (!content || content.trim().length === 0) && From ed06a3ee974dc1a491c30bcd698fe40239926a8a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Mar 2025 04:26:30 +0200 Subject: [PATCH 3/4] feat(template): duplicate content for relation map --- src/services/handlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/handlers.ts b/src/services/handlers.ts index a5580c5b1..19d77fe9c 100644 --- a/src/services/handlers.ts +++ b/src/services/handlers.ts @@ -102,7 +102,7 @@ eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) => const content = note.getContent(); if ( - ["text", "code", "mermaid", "canvas"].includes(note.type) && + ["text", "code", "mermaid", "canvas", "relationMap"].includes(note.type) && typeof content === "string" && // if the note has already content we're not going to overwrite it with template's one (!content || content.trim().length === 0) && From 268b666d523e705d3b261528eb61df57aba3e603 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Mar 2025 04:28:24 +0200 Subject: [PATCH 4/4] feat(template): duplicate content for geomap & mindmap (closes #357) --- src/services/handlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/handlers.ts b/src/services/handlers.ts index 19d77fe9c..9d64b8303 100644 --- a/src/services/handlers.ts +++ b/src/services/handlers.ts @@ -102,7 +102,7 @@ eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) => const content = note.getContent(); if ( - ["text", "code", "mermaid", "canvas", "relationMap"].includes(note.type) && + ["text", "code", "mermaid", "canvas", "relationMap", "mindMap", "geoMap"].includes(note.type) && typeof content === "string" && // if the note has already content we're not going to overwrite it with template's one (!content || content.trim().length === 0) &&