mirror of
https://github.com/immich-app/immich.git
synced 2026-02-04 08:49:01 +03:00
fix: escape handling in search asset viewer (#25621)
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { afterNavigate, goto } from '$app/navigation';
|
import { afterNavigate, goto } from '$app/navigation';
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import { shortcut } from '$lib/actions/shortcut';
|
|
||||||
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
||||||
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
|
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
|
||||||
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
|
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
|
||||||
@@ -24,7 +23,6 @@
|
|||||||
import type { Viewport } from '$lib/managers/timeline-manager/types';
|
import type { Viewport } from '$lib/managers/timeline-manager/types';
|
||||||
import { Route } from '$lib/route';
|
import { Route } from '$lib/route';
|
||||||
import { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
import { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||||
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
|
|
||||||
import { lang, locale } from '$lib/stores/preferences.store';
|
import { lang, locale } from '$lib/stores/preferences.store';
|
||||||
import { preferences, user } from '$lib/stores/user.store';
|
import { preferences, user } from '$lib/stores/user.store';
|
||||||
import { handlePromiseError } from '$lib/utils';
|
import { handlePromiseError } from '$lib/utils';
|
||||||
@@ -48,7 +46,6 @@
|
|||||||
import { tick, untrack } from 'svelte';
|
import { tick, untrack } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
let { isViewing: showAssetViewer } = assetViewingStore;
|
|
||||||
const viewport: Viewport = $state({ width: 0, height: 0 });
|
const viewport: Viewport = $state({ width: 0, height: 0 });
|
||||||
let searchResultsElement: HTMLElement | undefined = $state();
|
let searchResultsElement: HTMLElement | undefined = $state();
|
||||||
|
|
||||||
@@ -82,18 +79,6 @@
|
|||||||
untrack(() => handlePromiseError(onSearchQueryUpdate()));
|
untrack(() => handlePromiseError(onSearchQueryUpdate()));
|
||||||
});
|
});
|
||||||
|
|
||||||
const onEscape = () => {
|
|
||||||
if ($showAssetViewer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assetInteraction.selectionActive) {
|
|
||||||
assetInteraction.selectedAssets = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handlePromiseError(goto(previousRoute));
|
|
||||||
};
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (scrollY) {
|
if (scrollY) {
|
||||||
scrollYHistory = scrollY;
|
scrollYHistory = scrollY;
|
||||||
@@ -260,7 +245,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window bind:scrollY />
|
<svelte:window bind:scrollY />
|
||||||
<svelte:document use:shortcut={{ shortcut: { key: 'Escape' }, onShortcut: onEscape }} />
|
|
||||||
|
|
||||||
{#if terms}
|
{#if terms}
|
||||||
<section
|
<section
|
||||||
|
|||||||
Reference in New Issue
Block a user