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
feat(markdown): move cursor at the end
Elian Doran9329f0ab2185
diff --git a/apps/client/src/widgets/type_widgets/code/Markdown.tsx b/apps/client/src/widgets/type_widgets/code/Markdown.tsxindex b13ec08b1b..bd751e4d04 100644--- a/apps/client/src/widgets/type_widgets/code/Markdown.tsx+++ b/apps/client/src/widgets/type_widgets/code/Markdown.tsx@@ -294,7 +294,8 @@ function useImageDrop(note: FNote, editorView: VanillaCodeMirror | null) {const insertPos = pos ?? editorView!.state.selection.main.head;const markdown = ``;editorView!.dispatch({- changes: { from: insertPos, insert: markdown }+ changes: { from: insertPos, insert: markdown },+ selection: { anchor: insertPos + markdown.length }});}@@ -327,8 +328,10 @@ function useImageDrop(note: FNote, editorView: VanillaCodeMirror | null) {const src = imgMatch[2];const alt = html.match(/<img[^>]+alt="([^"]*)"/)?.[1] ?? "image";const pos = editorView!.state.selection.main.head;+ const md = ``;editorView!.dispatch({- changes: { from: pos, insert: `` }+ changes: { from: pos, insert: md },+ selection: { anchor: pos + md.length }});return;}