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 <noreply@anthropic.com>
This commit is contained in:
Bin-Home 2026-04-30 11:42:25 +08:00
parent 32b76c6d88
commit ca0b078d0f
4 changed files with 6 additions and 6 deletions

View file

@ -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",

4
package-lock.json generated
View file

@ -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",

View file

@ -1,6 +1,6 @@
{
"name": "smart-note-agent",
"version": "0.3.3",
"version": "0.3.4",
"main": "index.js",
"directories": {
"doc": "docs"

View file

@ -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;