fix: cannot focus on search bar after init

This commit is contained in:
quorafind 2024-01-21 15:50:53 +08:00
parent dc5d25f2b7
commit 4467c23332
4 changed files with 9 additions and 5 deletions

View file

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

View file

@ -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": {

View file

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

View file

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