From 4467c23332a82fc97a9ed201b9825a980a18b180 Mon Sep 17 00:00:00 2001 From: quorafind <951011105@qq.com> Date: Sun, 21 Jan 2024 15:50:53 +0800 Subject: [PATCH] fix: cannot focus on search bar after init --- manifest.json | 2 +- package.json | 2 +- src/floatSearchIndex.ts | 7 +++++-- versions.json | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index 885816e..44130be 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "float-search", "name": "Floating Search", - "version": "3.4.6", + "version": "3.4.7", "minAppVersion": "0.15.0", "description": "You can use search view in modal/leaf/popout window now.", "author": "Boninall", diff --git a/package.json b/package.json index b4454a4..e3b6697 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "float-search", - "version": "3.4.6", + "version": "3.4.7", "description": "You can use search view in modal/leaf/popout window now.", "main": "main.js", "scripts": { diff --git a/src/floatSearchIndex.ts b/src/floatSearchIndex.ts index e25bf1f..5938653 100644 --- a/src/floatSearchIndex.ts +++ b/src/floatSearchIndex.ts @@ -81,8 +81,6 @@ const initSearchViewWithLeaf = async (app: App, type: PaneType | 'sidebar', stat state: state }); - console.log(leaf.view); - setTimeout(() => { const inputEl = leaf.containerEl.getElementsByTagName("input")[0]; inputEl.focus(); @@ -503,6 +501,11 @@ export default class FloatSearchPlugin extends Plugin { console.log(isExistingLeaf); if (isExistingLeaf) { this.app.workspace.revealLeaf(isExistingLeaf); + isExistingLeaf.setViewState({ + type: "search", + active: true, + state: this.state + }); return; } await initSearchViewWithLeaf(this.app, type); diff --git a/versions.json b/versions.json index 09ed13a..82f58ce 100644 --- a/versions.json +++ b/versions.json @@ -23,5 +23,6 @@ "3.4.3": "0.15.0", "3.4.4": "0.15.0", "3.4.5": "0.15.0", - "3.4.6": "0.15.0" + "3.4.6": "0.15.0", + "3.4.7": "0.15.0" } \ No newline at end of file