Taking advantage of app as a global var

This commit is contained in:
Simon Cambier
2022-04-21 21:39:33 +02:00
parent 4238bc510e
commit 244211bd69
9 changed files with 132 additions and 125 deletions

View File

@@ -1,14 +1,11 @@
import { MarkdownView } from 'obsidian'
import { get } from 'svelte/store'
import type { ResultNote } from './globals'
import { plugin } from './stores'
import { stringsToRegex } from './utils'
export async function openNote(
item: ResultNote,
newPane = false,
): Promise<void> {
const app = get(plugin).app
const reg = stringsToRegex(item.foundWords)
reg.exec(item.content)
const offset = reg.lastIndex