Quick hack for global app
This commit is contained in:
11
src/main.ts
11
src/main.ts
@@ -1,4 +1,4 @@
|
|||||||
import { App, Notice, Platform, Plugin } from 'obsidian'
|
import { App, Notice, Platform, Plugin, type PluginManifest } from 'obsidian'
|
||||||
import {
|
import {
|
||||||
OmnisearchInFileModal,
|
OmnisearchInFileModal,
|
||||||
OmnisearchVaultModal,
|
OmnisearchVaultModal,
|
||||||
@@ -14,14 +14,13 @@ import {
|
|||||||
import {
|
import {
|
||||||
eventBus,
|
eventBus,
|
||||||
EventNames,
|
EventNames,
|
||||||
getTextExtractor,
|
|
||||||
indexingStep,
|
indexingStep,
|
||||||
IndexingStepType,
|
IndexingStepType,
|
||||||
isCacheEnabled,
|
isCacheEnabled,
|
||||||
} from './globals'
|
} from './globals'
|
||||||
import api, { notifyOnIndexed } from './tools/api'
|
import api, { notifyOnIndexed } from './tools/api'
|
||||||
import { isFileIndexable, logDebug } from './tools/utils'
|
import { isFileIndexable, logDebug } from './tools/utils'
|
||||||
import { database, OmnisearchCache } from './database'
|
import { OmnisearchCache, database } from './database'
|
||||||
import * as NotesIndex from './notes-index'
|
import * as NotesIndex from './notes-index'
|
||||||
import { searchEngine } from './search/omnisearch'
|
import { searchEngine } from './search/omnisearch'
|
||||||
import { cacheManager } from './cache-manager'
|
import { cacheManager } from './cache-manager'
|
||||||
@@ -32,8 +31,12 @@ export default class OmnisearchPlugin extends Plugin {
|
|||||||
public apiHttpServer: null | any = null
|
public apiHttpServer: null | any = null
|
||||||
private ribbonButton?: HTMLElement
|
private ribbonButton?: HTMLElement
|
||||||
|
|
||||||
async onload(): Promise<void> {
|
constructor(app: App, manifest: PluginManifest) {
|
||||||
|
super(app, manifest)
|
||||||
setObsidianApp(this.app)
|
setObsidianApp(this.app)
|
||||||
|
}
|
||||||
|
|
||||||
|
async onload(): Promise<void> {
|
||||||
await loadSettings(this)
|
await loadSettings(this)
|
||||||
this.addSettingTab(new SettingsTab(this))
|
this.addSettingTab(new SettingsTab(this))
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ export function setObsidianApp(app: App) {
|
|||||||
*/
|
*/
|
||||||
export function getObsidianApp() {
|
export function getObsidianApp() {
|
||||||
if (!obsidianApp) {
|
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
|
return obsidianApp as App
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user