From a144a74356975b5b69b228abf4b25626febf6dd9 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Mon, 6 Jan 2025 00:43:13 +0100 Subject: [PATCH] fix: insert template after cursor line fix: #1248 --- src/modules/template/picker.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/template/picker.ts b/src/modules/template/picker.ts index 06d1e08..e21bea3 100644 --- a/src/modules/template/picker.ts +++ b/src/modules/template/picker.ts @@ -68,11 +68,12 @@ async function insertTemplateCallback(name: string) { targetNoteId: targetNoteItem.id, }); } - await addLineToNote( - targetNoteItem, - html, - addon.data.template.picker.data.lineIndex, - ); + let lineIndex = addon.data.template.picker.data.lineIndex; + // Insert to the end of the line + if (lineIndex >= 0) { + lineIndex += 1; + } + await addLineToNote(targetNoteItem, html, lineIndex); } async function createTemplateNoteCallback(name: string) {