From 7170e629128974a86185d4cafeb14567abd7b474 Mon Sep 17 00:00:00 2001 From: Spencer Gouw Date: Fri, 14 Apr 2023 13:11:29 -0700 Subject: [PATCH] refac: use activeEditor, not getActiveViewOfType --- main.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.ts b/main.ts index de20d11..cccc47e 100644 --- a/main.ts +++ b/main.ts @@ -71,9 +71,9 @@ export default class JellySnippets extends Plugin { (!evt.shiftKey) // TODO: add function to determine when not to trigger. don't trigger if shift is pressed down as well e.g. ) { // TODO: Add a dropdown setting so that users can control which modifier key cancels things out, or if any does at all. - const view = this.app.workspace.getActiveViewOfType(MarkdownView); - if (view) { - this.triggerSearchSnippetAutomatically(view.editor, evt); + const mdFile = this.app.workspace.activeEditor; + if (mdFile?.editor) { + this.triggerSearchSnippetAutomatically(mdFile.editor, evt); } } };