From 0644d317c987f43a45871c8563ec26d236f607cf Mon Sep 17 00:00:00 2001 From: Quorafind Date: Thu, 30 Mar 2023 09:13:09 +0800 Subject: [PATCH] feat: support open search view in leaf --- src/floatSearchIndex.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/floatSearchIndex.ts b/src/floatSearchIndex.ts index 510312b..7ab178a 100644 --- a/src/floatSearchIndex.ts +++ b/src/floatSearchIndex.ts @@ -273,6 +273,18 @@ export default class FloatSearchPlugin extends Plugin { } } }); + + this.addCommand({ + id: 'open-search-view', + name: 'Open Search View', + callback: async () => { + const leaf = app.workspace.getLeaf(); + leaf.setPinned(true); + await leaf.setViewState({ + type: "search", + }); + } + }); } registerEditorMenuHandler() {