The next-generation file converter. Open source, fully local* and free forever.
fix: dropdown scrolling, circular import
JovannMCec9b9a30d7bc
diff --git a/src/lib/components/functional/Dropdown.svelte b/src/lib/components/functional/Dropdown.svelteindex 8cb9c43..84c6e6d 100644--- a/src/lib/components/functional/Dropdown.svelte+++ b/src/lib/components/functional/Dropdown.svelte@@ -42,7 +42,7 @@const selectedValue = getValue(option);selected = selectedValue;onselect?.(selectedValue);- toggle();+ open = false;};const toggle = () => {@@ -64,7 +64,18 @@"[data-selected='true']",) as HTMLButtonElement | null;if (!selectedButton) return;- selectedButton.scrollIntoView({ block: "start" });++ const menuRect = menuElement.getBoundingClientRect();+ const buttonRect = selectedButton.getBoundingClientRect();+ if (+ buttonRect.top >= menuRect.top &&+ buttonRect.bottom <= menuRect.bottom+ )+ return;++ if (buttonRect.top < menuRect.top)+ menuElement.scrollTop -= menuRect.top - buttonRect.top;+ else menuElement.scrollTop += buttonRect.bottom - menuRect.bottom;};// outside clicksdiff --git a/src/lib/components/functional/FormatDropdown.svelte b/src/lib/components/functional/FormatDropdown.svelteindex 120592e..539f1c0 100644--- a/src/lib/components/functional/FormatDropdown.svelte+++ b/src/lib/components/functional/FormatDropdown.svelte@@ -395,13 +395,15 @@const listRect = formatList.getBoundingClientRect();const optionRect = selectedOption.getBoundingClientRect();- // only scroll if button isnt fully visibleif (optionRect.top >= listRect.top &&optionRect.bottom <= listRect.bottom)return;- formatList.scrollTop += optionRect.top - listRect.top;++ if (optionRect.top < listRect.top)+ formatList.scrollTop -= listRect.top - optionRect.top;+ else formatList.scrollTop += optionRect.bottom - listRect.bottom;};const clickDropdown = async () => {diff --git a/src/lib/types/file.svelte.ts b/src/lib/types/file.svelte.tsindex 515fbfb..eeff6d5 100644--- a/src/lib/types/file.svelte.ts+++ b/src/lib/types/file.svelte.ts@@ -5,7 +5,6 @@ import { byNative, categories, converters } from "#lib/converters";import type { Converter } from "#lib/converters/converter.svelte";import { formatDuration } from "#lib/converters/converter.svelte";import { m } from "#lib/paraglide/messages";-import { Settings } from "#lib/sections/settings/index.svelte";import { addDialog } from "#lib/store/DialogProvider";import { MAX_ARRAY_BUFFER_SIZE } from "#lib/store/index.svelte";import { conversionConcurrency } from "#lib/util/consts";@@ -331,7 +330,10 @@ export class VertFile {}private async detectFileType() {- if (!Settings.instance.settings.fileTypeDetection) return;+ const detectionEnabled =+ readSettings<{ fileTypeDetection?: boolean }>().fileTypeDetection ??+ true;+ if (!detectionEnabled) return;try {this.fileType = await fileTypeFromBuffer(