Quick hack for global app

This commit is contained in:
Simon Cambier
2024-05-18 22:54:12 +02:00
parent e5e62ded85
commit a370041e2f
2 changed files with 10 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import { App, Notice, Platform, Plugin } from 'obsidian'
import { App, Notice, Platform, Plugin, type PluginManifest } from 'obsidian'
import {
OmnisearchInFileModal,
OmnisearchVaultModal,
@@ -14,14 +14,13 @@ import {
import {
eventBus,
EventNames,
getTextExtractor,
indexingStep,
IndexingStepType,
isCacheEnabled,
} from './globals'
import api, { notifyOnIndexed } from './tools/api'
import { isFileIndexable, logDebug } from './tools/utils'
import { database, OmnisearchCache } from './database'
import { OmnisearchCache, database } from './database'
import * as NotesIndex from './notes-index'
import { searchEngine } from './search/omnisearch'
import { cacheManager } from './cache-manager'
@@ -32,8 +31,12 @@ export default class OmnisearchPlugin extends Plugin {
public apiHttpServer: null | any = null
private ribbonButton?: HTMLElement
async onload(): Promise<void> {
constructor(app: App, manifest: PluginManifest) {
super(app, manifest)
setObsidianApp(this.app)
}
async onload(): Promise<void> {
await loadSettings(this)
this.addSettingTab(new SettingsTab(this))

View File

@@ -11,7 +11,9 @@ export function setObsidianApp(app: App) {
*/
export function getObsidianApp() {
if (!obsidianApp) {
throw new Error('Obsidian app not set')
// throw new Error('Obsidian app not set')
// console.trace('Obsidian app not set')
return app // FIXME: please.
}
return obsidianApp as App
}