mirror of
https://github.com/hyeonseonam/auto-classifier.git
synced 2026-07-22 07:40:29 +00:00
Edit view-manager: add insertAtTitle
This commit is contained in:
parent
a8cf928692
commit
8a8bd49aa1
1 changed files with 13 additions and 0 deletions
|
|
@ -83,6 +83,19 @@ export class ViewManager {
|
|||
}
|
||||
}
|
||||
|
||||
async insertAtTitle(value: string, overwrite = false): Promise<void> {
|
||||
const file = this.app.workspace.getActiveFile();
|
||||
let newName = file.basename;
|
||||
if (overwrite) {
|
||||
newName = `${value}`;
|
||||
} else {
|
||||
newName = `${newName} ${value}`;
|
||||
}
|
||||
// @ts-ignore
|
||||
const newPath = file.getNewPathAfterRename(newName)
|
||||
await this.app.fileManager.renameFile(file, newPath);
|
||||
}
|
||||
|
||||
async insertAtCursor(value: string, overwrite = false): Promise<void> {
|
||||
const activeView = this.app.workspace.getActiveViewOfType(MarkdownView);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue