Removed a circular dependency
This commit is contained in:
parent
833d89dea8
commit
fc847b02b5
7
.madgerc
Normal file
7
.madgerc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"detectiveOptions": {
|
||||
"ts": {
|
||||
"skipTypeImports": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
<script lang="ts">
|
||||
import { showExcerpt } from '../settings/index'
|
||||
import { setIcon, TFile } from 'obsidian'
|
||||
import { onMount } from 'svelte'
|
||||
import type { ResultNote } from '../globals'
|
||||
import type LocatorPlugin from '../main'
|
||||
import {
|
||||
getExtension,
|
||||
isFileCanvas,
|
||||
|
@ -10,17 +12,14 @@
|
|||
pathWithoutFilename,
|
||||
} from '../tools/utils'
|
||||
import ResultItemContainer from './ResultItemContainer.svelte'
|
||||
import type LocatorPlugin from '../main'
|
||||
import { setIcon, TFile } from 'obsidian'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
// Import icon utility functions
|
||||
import { showExcerpt } from 'src/settings/utils'
|
||||
import {
|
||||
loadIconData,
|
||||
initializeIconPacks,
|
||||
getIconNameForPath,
|
||||
loadIconSVG,
|
||||
getDefaultIconSVG,
|
||||
getIconNameForPath,
|
||||
initializeIconPacks,
|
||||
loadIconData,
|
||||
loadIconSVG,
|
||||
} from '../tools/icon-utils'
|
||||
|
||||
export let selected = false
|
||||
|
@ -148,25 +147,24 @@
|
|||
</script>
|
||||
|
||||
<ResultItemContainer
|
||||
glyph="{glyph}"
|
||||
id="{note.path}"
|
||||
{glyph}
|
||||
id={note.path}
|
||||
cssClass=" {note.isEmbed ? 'omnisearch-result__embed' : ''}"
|
||||
on:auxclick
|
||||
on:click
|
||||
on:mousemove
|
||||
selected="{selected}">
|
||||
{selected}>
|
||||
<div>
|
||||
<div class="omnisearch-result__title-container">
|
||||
<span class="omnisearch-result__title">
|
||||
{#if note.isEmbed}
|
||||
<span
|
||||
bind:this="{elEmbedIcon}"
|
||||
title="The document above is embedded in this note"></span>
|
||||
bind:this={elEmbedIcon}
|
||||
title="The document above is embedded in this note" />
|
||||
{:else}
|
||||
<!-- File Icon -->
|
||||
{#if fileIconSVG}
|
||||
<span class="omnisearch-result__icon" use:renderSVG="{fileIconSVG}"
|
||||
></span>
|
||||
<span class="omnisearch-result__icon" use:renderSVG={fileIconSVG} />
|
||||
{/if}
|
||||
{/if}
|
||||
<span>
|
||||
|
@ -194,8 +192,7 @@
|
|||
<div class="omnisearch-result__folder-path">
|
||||
<!-- Folder Icon -->
|
||||
{#if folderIconSVG}
|
||||
<span class="omnisearch-result__icon" use:renderSVG="{folderIconSVG}"
|
||||
></span>
|
||||
<span class="omnisearch-result__icon" use:renderSVG={folderIconSVG} />
|
||||
{/if}
|
||||
<span>
|
||||
{@html plugin.textProcessor.highlightText(notePath, matchesNotePath)}
|
||||
|
@ -218,7 +215,7 @@
|
|||
<!-- Image -->
|
||||
{#if imagePath}
|
||||
<div class="omnisearch-result__image-container">
|
||||
<img style="width: 100px" src="{imagePath}" alt="" />
|
||||
<img style="width: 100px" src={imagePath} alt="" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
32
src/main.ts
32
src/main.ts
|
@ -6,36 +6,26 @@ import {
|
|||
type PluginManifest,
|
||||
TFile,
|
||||
} from 'obsidian'
|
||||
import {
|
||||
LocatorInFileModal,
|
||||
LocatorVaultModal,
|
||||
} from './components/modals'
|
||||
import {
|
||||
getDefaultSettings,
|
||||
loadSettings,
|
||||
SettingsTab,
|
||||
showExcerpt,
|
||||
} from './settings'
|
||||
import type { LocatorSettings } from './settings/utils'
|
||||
import { isCacheEnabled } from './settings/utils'
|
||||
import { saveSettings } from './settings/utils'
|
||||
import { LocatorInFileModal, LocatorVaultModal } from './components/modals'
|
||||
import { Database } from './database'
|
||||
import {
|
||||
eventBus,
|
||||
EventNames,
|
||||
indexingStep,
|
||||
IndexingStepType,
|
||||
type TextExtractorApi,
|
||||
type AIImageAnalyzerAPI,
|
||||
type TextExtractorApi
|
||||
} from './globals'
|
||||
import { notifyOnIndexed, registerAPI } from './tools/api'
|
||||
import { Database } from './database'
|
||||
import { SearchEngine } from './search/search-engine'
|
||||
import { DocumentsRepository } from './repositories/documents-repository'
|
||||
import { logVerbose } from './tools/utils'
|
||||
import { NotesIndexer } from './notes-indexer'
|
||||
import { TextProcessor } from './tools/text-processing'
|
||||
import { DocumentsRepository } from './repositories/documents-repository'
|
||||
import { EmbedsRepository } from './repositories/embeds-repository'
|
||||
import { SearchEngine } from './search/search-engine'
|
||||
import { SearchHistory } from './search/search-history'
|
||||
import { getDefaultSettings, loadSettings, SettingsTab } from './settings'
|
||||
import type { LocatorSettings } from './settings/utils'
|
||||
import { isCacheEnabled, saveSettings, showExcerpt } from './settings/utils'
|
||||
import { notifyOnIndexed, registerAPI } from './tools/api'
|
||||
import { TextProcessor } from './tools/text-processing'
|
||||
import { logVerbose } from './tools/utils'
|
||||
|
||||
export default class LocatorPlugin extends Plugin {
|
||||
// FIXME: fix the type
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
// noinspection CssUnresolvedCustomProperty
|
||||
import { App, Plugin, PluginSettingTab, Setting } from 'obsidian'
|
||||
import { writable } from 'svelte/store'
|
||||
import { RecencyCutoff } from '../globals'
|
||||
import type LocatorPlugin from '../main'
|
||||
import { enableVerboseLogging } from '../tools/utils'
|
||||
import { injectSettingsIndexing } from './settings-indexing'
|
||||
import { type LocatorSettings, saveSettings } from './utils'
|
||||
import { injectSettingsBehavior } from './settings-behavior'
|
||||
import { injectSettingsDanger } from './settings-danger'
|
||||
import { injectSettingsHttp } from './settings-http'
|
||||
import { injectSettingsIndexing } from './settings-indexing'
|
||||
import { injectSettingsUserInterface } from './settings-ui'
|
||||
import { injectSettingsWeighting } from './settings-weighting'
|
||||
import { injectSettingsHttp } from './settings-http'
|
||||
import { injectSettingsDanger } from './settings-danger'
|
||||
|
||||
/**
|
||||
* A store to reactively toggle the `showExcerpt` setting on the fly
|
||||
*/
|
||||
export const showExcerpt = writable(false)
|
||||
import { type LocatorSettings, saveSettings, showExcerpt } from './utils'
|
||||
|
||||
export class SettingsTab extends PluginSettingTab {
|
||||
plugin: LocatorPlugin
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import { Setting } from 'obsidian'
|
||||
import type LocatorPlugin from 'src/main'
|
||||
import { showExcerpt } from '.'
|
||||
import type { LocatorSettings } from './utils'
|
||||
import { saveSettings } from './utils'
|
||||
import { htmlDescription } from './utils'
|
||||
import { htmlDescription, saveSettings, showExcerpt } from './utils'
|
||||
|
||||
export function injectSettingsUserInterface(
|
||||
plugin: LocatorPlugin,
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
import { App, Platform, Plugin } from 'obsidian'
|
||||
import { Platform, Plugin } from 'obsidian'
|
||||
import { RecencyCutoff } from 'src/globals'
|
||||
import { writable } from 'svelte/store'
|
||||
import { settings } from '.'
|
||||
|
||||
/**
|
||||
* A store to reactively toggle the `showExcerpt` setting on the fly
|
||||
*/
|
||||
export const showExcerpt = writable(false)
|
||||
|
||||
export function htmlDescription(innerHTML: string): DocumentFragment {
|
||||
const desc = new DocumentFragment()
|
||||
desc.createSpan({}, span => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user