From 807c33e6ad4a40ad75465774c094897f571bd926 Mon Sep 17 00:00:00 2001 From: Southpaw Date: Wed, 27 Sep 2023 20:44:08 +0100 Subject: [PATCH] MarkdownView type is handled correctly --- src/main.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index 1cf76d0..796a14d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import { MarkdownView, Notice, Plugin } from "obsidian"; +import { MarkdownFileInfo, MarkdownView, Notice, Plugin } from "obsidian"; import { DEFAULT_SETTINGS, SettingsProp } from "./types/index"; import { SettingTab } from "./settingTab"; @@ -28,17 +28,18 @@ export default class GhostPublish extends Plugin { this.addCommand({ id: "publish", name: "Send to Ghost", - editorCallback: (_, view: MarkdownView) => { - if (!view) { + editorCallback: (_, view: MarkdownView | MarkdownFileInfo) => { + if (!(view instanceof MarkdownView)) { new Notice( - "You must open the note that you want to send to Ghost" + "You must open the note that you want to send to Ghostt" ); return; } - publishPost(view, this.settings); }, - }); + + }, + ); // This adds a settings tab so the user can configure various aspects of the plugin this.addSettingTab(new SettingTab(this.app, this));