diff --git a/src/ui/code-blocks/ReadingLogCodeBlock.ts b/src/ui/code-blocks/ReadingLogCodeBlock.ts index cb099ae..54e013b 100644 --- a/src/ui/code-blocks/ReadingLogCodeBlock.ts +++ b/src/ui/code-blocks/ReadingLogCodeBlock.ts @@ -17,12 +17,7 @@ export class ReadingLogCodeBlockRenderer extends SvelteCodeBlockRenderer< typeof ReadingLogCodeBlockView > { constructor(contentEl: HTMLElement, plugin: BookTrackerPlugin) { - super(contentEl, ReadingLogCodeBlockView, { - props: { - app: plugin.app, - readingLog: plugin.readingLog, - }, - }); + super(contentEl, ReadingLogCodeBlockView, { props: { plugin } }); } onunload() {} diff --git a/src/ui/code-blocks/ReadingLogCodeBlockView.svelte b/src/ui/code-blocks/ReadingLogCodeBlockView.svelte index 228f2dc..09a6765 100644 --- a/src/ui/code-blocks/ReadingLogCodeBlockView.svelte +++ b/src/ui/code-blocks/ReadingLogCodeBlockView.svelte @@ -1,21 +1,19 @@ diff --git a/src/ui/components/suggesters/BookSuggest.svelte b/src/ui/components/suggesters/BookSuggest.svelte index 7b4f6ea..61fa01d 100644 --- a/src/ui/components/suggesters/BookSuggest.svelte +++ b/src/ui/components/suggesters/BookSuggest.svelte @@ -7,6 +7,7 @@ id: string; asString?: boolean; value?: TFile | string; + bookFolder?: string; onSelected?: (fileOrPath: TFile | string) => void; }; @@ -15,6 +16,7 @@ id, asString, value = $bindable(), + bookFolder, onSelected, }: Props = $props(); @@ -23,8 +25,11 @@ function handleChange(query: string) { items = app.vault .getMarkdownFiles() - .filter((f) => - f.basename.toLowerCase().includes(query.toLowerCase()), + .filter( + (f) => + (bookFolder === undefined || + f.path.startsWith(bookFolder)) && + f.basename.toLowerCase().includes(query.toLowerCase()), ) .map((f) => ({ text: f.basename, diff --git a/src/ui/modals/ReadingLogEntryEditModal.ts b/src/ui/modals/ReadingLogEntryEditModal.ts index 295dba1..88b40e8 100644 --- a/src/ui/modals/ReadingLogEntryEditModal.ts +++ b/src/ui/modals/ReadingLogEntryEditModal.ts @@ -1,18 +1,18 @@ import ReadingLogEntryEditModalView from "./ReadingLogEntryEditModalView.svelte"; import type { ReadingLogEntry } from "@src/types"; -import { App } from "obsidian"; import { SvelteModal } from "./SvelteModal"; +import type BookTrackerPlugin from "@src/main"; export class ReadingLogEntryEditModal extends SvelteModal< typeof ReadingLogEntryEditModalView > { constructor( - app: App, + plugin: BookTrackerPlugin, onSubmit?: (entry: ReadingLogEntry) => void, entry?: ReadingLogEntry ) { - super(app, ReadingLogEntryEditModalView, { - props: { app, entry, onSubmit }, + super(plugin.app, ReadingLogEntryEditModalView, { + props: { plugin, entry, onSubmit }, }); } } diff --git a/src/ui/modals/ReadingLogEntryEditModalView.svelte b/src/ui/modals/ReadingLogEntryEditModalView.svelte index bfc5e83..0a20718 100644 --- a/src/ui/modals/ReadingLogEntryEditModalView.svelte +++ b/src/ui/modals/ReadingLogEntryEditModalView.svelte @@ -1,14 +1,14 @@