diff --git a/frontend/obsidian-plugin/src/obsidian-file-system.ts b/frontend/obsidian-plugin/src/obsidian-file-system.ts index 55388e05..24e06af9 100644 --- a/frontend/obsidian-plugin/src/obsidian-file-system.ts +++ b/frontend/obsidian-plugin/src/obsidian-file-system.ts @@ -27,7 +27,9 @@ export class ObsidianFileSystemOperations implements FileSystemOperations { const view = this.workspace.getActiveViewOfType(MarkdownView); if (view?.file?.path === path) { + const position = view.editor.getCursor(); view.editor.setValue(new TextDecoder().decode(content)); + view.editor.setCursor(position); return; } @@ -47,7 +49,9 @@ export class ObsidianFileSystemOperations implements FileSystemOperations { const view = this.workspace.getActiveViewOfType(MarkdownView); if (view?.file?.path === path) { const result = updater(view.editor.getValue()); + const position = view.editor.getCursor(); view.editor.setValue(result); + view.editor.setCursor(position); return result; } diff --git a/frontend/obsidian-plugin/src/vault-link-plugin.ts b/frontend/obsidian-plugin/src/vault-link-plugin.ts index 4995d03c..40b9ed57 100644 --- a/frontend/obsidian-plugin/src/vault-link-plugin.ts +++ b/frontend/obsidian-plugin/src/vault-link-plugin.ts @@ -167,6 +167,6 @@ export default class VaultLinkPlugin extends Plugin { ) ); } - await this.rateLimitedUpdatesPerFile.get(path)(); + await this.rateLimitedUpdatesPerFile.get(path)?.(); } }