PR fixes for obsidian-releases

https://github.com/obsidianmd/obsidian-releases/pull/920#issuecomment-1110183606
This commit is contained in:
Simon Cambier
2022-04-26 22:10:05 +02:00
parent 664d2ef30b
commit e7b552dc92
2 changed files with 24 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
import { MarkdownView, Plugin, TFile } from 'obsidian'
import { Plugin, TFile } from 'obsidian'
import {
addToIndex,
initGlobalSearchIndex,
@@ -21,16 +21,8 @@ export default class OmnisearchPlugin extends Plugin {
this.addCommand({
id: 'show-modal-infile',
name: 'In-file search',
checkCallback: (checking: boolean) => {
// Can only be shown when a note is active
const view = app.workspace.getActiveViewOfType(MarkdownView)
if (view) {
if (!checking) {
new OmnisearchInFileModal(app, view.file).open()
}
return true
}
return false
editorCallback: (_editor, view) => {
new OmnisearchInFileModal(app, view.file).open()
},
})