Skip to content

Commit

Permalink
feat(Threading): ✨ Move cursor to end of line in new note (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 2, 2022
1 parent df0b7eb commit 8e38bbf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 6 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});
});
Expand Down
13 changes: 8 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { cloneDeep } from "lodash";
import { debug, error, info, warn } from "loglevel";
import {
addIcon,
Editor,
EventRef,
MarkdownView,
moment,
Expand Down Expand Up @@ -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);
},
});
});
Expand Down

0 comments on commit 8e38bbf

Please sign in to comment.