mirror of
https://github.com/quorafind/Obsidian-Float-Search.git
synced 2026-07-22 07:30:25 +00:00
feat: support pass view state
This commit is contained in:
parent
4bb81fa23e
commit
e56db18fae
1 changed files with 12 additions and 5 deletions
|
|
@ -885,7 +885,7 @@ export default class FloatSearchPlugin extends Plugin {
|
||||||
callback: () => {
|
callback: () => {
|
||||||
const query = options.queryBuilder();
|
const query = options.queryBuilder();
|
||||||
const viewType = this.settings.defaultViewType;
|
const viewType = this.settings.defaultViewType;
|
||||||
|
|
||||||
if (viewType === "modal") {
|
if (viewType === "modal") {
|
||||||
this.initModal(
|
this.initModal(
|
||||||
{ ...this.state, query, current: true },
|
{ ...this.state, query, current: true },
|
||||||
|
|
@ -903,7 +903,7 @@ export default class FloatSearchPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
|
|
@ -919,7 +919,7 @@ export default class FloatSearchPlugin extends Plugin {
|
||||||
const currentFile = activeLeaf.view.file;
|
const currentFile = activeLeaf.view.file;
|
||||||
const query = options.queryBuilder(currentFile);
|
const query = options.queryBuilder(currentFile);
|
||||||
const viewType = this.settings.defaultViewType;
|
const viewType = this.settings.defaultViewType;
|
||||||
|
|
||||||
if (viewType === "modal") {
|
if (viewType === "modal") {
|
||||||
this.initModal(
|
this.initModal(
|
||||||
{ ...this.state, query, current: true },
|
{ ...this.state, query, current: true },
|
||||||
|
|
@ -1023,7 +1023,10 @@ export default class FloatSearchPlugin extends Plugin {
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await initSearchViewWithLeaf(this.app, type);
|
await initSearchViewWithLeaf(this.app, type, {
|
||||||
|
...this.state,
|
||||||
|
triggerBySelf: true,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "tab":
|
case "tab":
|
||||||
case "split":
|
case "split":
|
||||||
|
|
@ -1043,7 +1046,10 @@ export default class FloatSearchPlugin extends Plugin {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await initSearchViewWithLeaf(this.app, type);
|
await initSearchViewWithLeaf(this.app, type, {
|
||||||
|
...this.state,
|
||||||
|
triggerBySelf: true,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1416,6 +1422,7 @@ class FloatSearchModal extends Modal {
|
||||||
this.searchLeaf.setPinned(true);
|
this.searchLeaf.setPinned(true);
|
||||||
await this.searchLeaf.setViewState({
|
await this.searchLeaf.setViewState({
|
||||||
type: "search",
|
type: "search",
|
||||||
|
state: this.state,
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue