Skip to content

Commit

Permalink
fix(transcript): fix find command patch fail on load
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenlx committed Apr 5, 2024
1 parent 1764fed commit 4ed78ea
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions apps/app/src/transcript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ declare module "obsidian" {

export function registerTranscriptView(plugin: MxPlugin) {
LocalTranscriptView.register(plugin);
plugin.register(
around(plugin.app.commands.commands["editor:open-search"] as Command, {
checkCallback: (next) =>
function (checking) {
if (next?.(checking)) return true;
const view =
plugin.app.workspace.getActiveViewOfType(LocalTranscriptView);
if (!view) return false;
if (checking) return true;
view.store.getState().toggleSearchBox();
},
}),
plugin.app.workspace.onLayoutReady(() =>
plugin.register(
around(plugin.app.commands.commands["editor:open-search"] as Command, {
checkCallback: (next) =>
function (checking) {
if (next?.(checking)) return true;
const view =
plugin.app.workspace.getActiveViewOfType(LocalTranscriptView);
if (!view) return false;
if (checking) return true;
view.store.getState().toggleSearchBox();
},
}),
),
);
}

0 comments on commit 4ed78ea

Please sign in to comment.