Fix jumping cursor
This commit is contained in:
parent
3bbc5c61e9
commit
52bda89764
2 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,6 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
)
|
||||
);
|
||||
}
|
||||
await this.rateLimitedUpdatesPerFile.get(path)();
|
||||
await this.rateLimitedUpdatesPerFile.get(path)?.();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue