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