From ca0b078d0f6bd4d36da71aeda99ba2e0067bbbbb Mon Sep 17 00:00:00 2001 From: Bin-Home Date: Thu, 30 Apr 2026 11:42:25 +0800 Subject: [PATCH] fix: restore this-binding in openSettings, bump to v0.3.4 Detaching a method via `const fn = obj.method` loses its `this` context. Replaced with Reflect.apply(fn, s, args) so the Obsidian Settings object's internal `this.app` reference stays intact. Co-Authored-By: Claude Sonnet 4 --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/ui/ChatView.svelte | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index c3f19b1..15829c8 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "smart-note-agent", "name": "Smart Note Agent", - "version": "0.3.3", + "version": "0.3.4", "minAppVersion": "1.7.2", "description": "Agentic AI assistant for reading and editing vault notes.", "author": "Bin Hong", diff --git a/package-lock.json b/package-lock.json index 8bca2dc..d81e6c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "smart-note-agent", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "smart-note-agent", - "version": "0.3.3", + "version": "0.3.4", "license": "ISC", "devDependencies": { "@eslint/js": "^9.39.4", diff --git a/package.json b/package.json index 2539c98..2ffce83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smart-note-agent", - "version": "0.3.3", + "version": "0.3.4", "main": "index.js", "directories": { "doc": "docs" diff --git a/src/ui/ChatView.svelte b/src/ui/ChatView.svelte index ce0c9a1..2a5067c 100644 --- a/src/ui/ChatView.svelte +++ b/src/ui/ChatView.svelte @@ -91,8 +91,8 @@ if (!s) return; const openFn = s["open"]; const openByIdFn = s["openTabById"]; - if (typeof openFn === "function") openFn(); - if (typeof openByIdFn === "function") openByIdFn(plugin.manifest.id); + if (typeof openFn === "function") Reflect.apply(openFn, s, []); + if (typeof openByIdFn === "function") Reflect.apply(openByIdFn, s, [plugin.manifest.id]); } $: providerLabel = (settingsTick, `${plugin.i18n.t(`provider.${plugin.settings.providerId}`)}:${activeProfile(plugin.settings).model}`); $: charCount = input.length;