Cleaned some warnings from the deprecated global app object

This commit is contained in:
Simon Cambier
2023-11-01 14:51:07 +01:00
parent 8832ce7b78
commit 1e6478d83e
7 changed files with 26 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import InputSearch from './InputSearch.svelte'
import {
Action,
Action,
eventBus,
excerptAfter,
type ResultNote,
@@ -9,7 +9,7 @@
} from 'src/globals'
import { getCtrlKeyLabel, loopIndex } from 'src/tools/utils'
import { onDestroy, onMount, tick } from 'svelte'
import { MarkdownView } from 'obsidian'
import { MarkdownView, App } from 'obsidian'
import ModalContainer from './ModalContainer.svelte'
import {
OmnisearchInFileModal,
@@ -24,6 +24,7 @@
export let parent: OmnisearchVaultModal | null = null
export let singleFilePath = ''
export let previousQuery: string | undefined
export let app: App
let searchQuery: string
let groupedOffsets: number[] = []

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import { MarkdownView, Notice, TFile } from 'obsidian'
import { App, MarkdownView, Notice, TFile } from 'obsidian'
import { onDestroy, onMount, tick } from 'svelte'
import InputSearch from './InputSearch.svelte'
import ModalContainer from './ModalContainer.svelte'
@@ -33,6 +33,8 @@
export let modal: OmnisearchVaultModal
export let previousQuery: string | undefined
export let app: App
let selectedIndex = 0
let historySearchIndex = 0
let searchQuery: string | undefined
@@ -296,6 +298,7 @@
<ModalContainer>
{#each resultNotes as result, i}
<ResultItemVault
app="{app}"
selected="{i === selectedIndex}"
note="{result}"
on:mousemove="{_ => (selectedIndex = i)}"

View File

@@ -10,12 +10,13 @@
removeDiacritics,
} from '../tools/utils'
import ResultItemContainer from './ResultItemContainer.svelte'
import { TFile, setIcon } from 'obsidian'
import { TFile, setIcon, App } from 'obsidian'
import { cloneDeep } from 'lodash-es'
import { stringsToRegex, getMatches, makeExcerpt, highlightText } from 'src/tools/text-processing'
export let selected = false
export let note: ResultNote
export let app: App
let imagePath: string | null = null
let title = ''

View File

@@ -164,6 +164,7 @@ export class OmnisearchVaultModal extends OmnisearchModal {
const cmp = new ModalVault({
target: this.modalEl,
props: {
app,
modal: this,
previousQuery: query || selectedText || previous || '',
},
@@ -189,6 +190,7 @@ export class OmnisearchInFileModal extends OmnisearchModal {
const cmp = new ModalInFile({
target: this.modalEl,
props: {
app,
modal: this,
singleFilePath: file.path,
parent: parent,