diff --git a/main.js b/main.js index 3f38382b..bfea8471 100644 --- a/main.js +++ b/main.js @@ -52003,13 +52003,12 @@ class BCPlugin extends require$$0.Plugin { splits[1]; await app.vault.modify(currFile, content); } - if (settings.threadIntoNewPane) { - const splitLeaf = app.workspace.splitActiveLeaf(); - app.workspace.setActiveLeaf(splitLeaf, false, false); - splitLeaf.openFile(newFile); - } - else - app.workspace.activeLeaf.openFile(newFile); + const leaf = settings.threadIntoNewPane + ? app.workspace.splitActiveLeaf() + : app.workspace.activeLeaf; + await leaf.openFile(newFile, { active: true, mode: "source" }); + const { editor } = leaf.view; + editor.setCursor(editor.getValue().length); }, }); }); diff --git a/src/main.ts b/src/main.ts index 1ce9e936..9e637849 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,6 +5,7 @@ import { cloneDeep } from "lodash"; import { debug, error, info, warn } from "loglevel"; import { addIcon, + Editor, EventRef, MarkdownView, moment, @@ -490,11 +491,13 @@ export default class BCPlugin extends Plugin { await app.vault.modify(currFile, content); } - if (settings.threadIntoNewPane) { - const splitLeaf = app.workspace.splitActiveLeaf(); - app.workspace.setActiveLeaf(splitLeaf, false, false); - splitLeaf.openFile(newFile); - } else app.workspace.activeLeaf.openFile(newFile); + const leaf = settings.threadIntoNewPane + ? app.workspace.splitActiveLeaf() + : app.workspace.activeLeaf; + + await leaf.openFile(newFile, { active: true, mode: "source" }); + const { editor }: { editor: Editor } = leaf.view; + editor.setCursor(editor.getValue().length); }, }); });