From 4cd6d1570c4822a78a396cfffd36ede81ed01c9a Mon Sep 17 00:00:00 2001 From: David Hurley Date: Mon, 12 Aug 2024 09:59:07 -0500 Subject: [PATCH] Fix handle leaf error from invalid command --- manifest.json | 4 ++-- package.json | 2 +- src/index.ts | 12 ------------ versions.json | 5 +++-- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/manifest.json b/manifest.json index 1d6a9af..4bee18b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "id": "giphy-insert", "name": "Giphy Insert", - "version": "1.1.3", + "version": "1.1.4", "minAppVersion": "0.15.0", "description": "This is a Giphy plugin for Obsidian. This plugin helps users insert Gifs from the Giphy API.", "author": "drhurley94", "authorUrl": "https://github.com/dhurley94", "isDesktopOnly": false -} \ No newline at end of file +} diff --git a/package.json b/package.json index dddd936..81b34b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-giphy-plugin", - "version": "1.1.3", + "version": "1.1.4", "description": "This is a plugin for Obsidian that help you insert Giphy images (https://obsidian.md)", "main": "main.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index 2828a5a..51ce904 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,8 +38,6 @@ export default class GiphyPlugin extends ObsidianPlugin { this.giphyClient = new GiphyApiClient(this.settings.apiKey); this.giphyService = new GiphyService(this.giphyClient); - this.registerEvent(this.app.workspace.on('active-leaf-change', this.handleActiveLeafChange.bind(this))); - this.addCommand({ id: 'search-giphy', name: 'Search Giphy for GIFs', @@ -88,16 +86,6 @@ export default class GiphyPlugin extends ObsidianPlugin { }); } - private handleActiveLeafChange(): void { - const activeLeaf = this.app.workspace.getLeaf(); - if (activeLeaf?.view instanceof MarkdownView) { - const editor = activeLeaf.view.editor; - if (editor) { - editor.exec(this.handleEditorChange.bind(this)); - } - } - } - private handleEditorChange(cm: any, change: any): void { const insertedText: string = change?.text?.join('') || ''; if (DEFAULT_SETTINGS.slashCommands.filter((command) => insertedText.includes(`/${command}`))) { diff --git a/versions.json b/versions.json index cbbc478..dc12176 100644 --- a/versions.json +++ b/versions.json @@ -4,5 +4,6 @@ "1.1.0": "0.15.0", "1.1.1": "0.15.0", "1.1.2": "0.15.0", - "1.1.3": "0.15.0" -} \ No newline at end of file + "1.1.3": "0.15.0", + "1.1.4": "0.15.0" +}