From 809154ad2ac240caa10fdbb15ff322b9eb1edc17 Mon Sep 17 00:00:00 2001 From: ildyria Date: Wed, 20 Dec 2023 21:18:16 +0100 Subject: [PATCH] another fix --- resources/js/data/views/albumView.ts | 2 ++ resources/js/data/views/types.d.ts | 1 + resources/js/lycheeOrg/actions/keybindings.ts | 5 +++++ resources/views/livewire/pages/gallery/search.blade.php | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/js/data/views/albumView.ts b/resources/js/data/views/albumView.ts index 3bbd61f55cd..f5b502a100e 100644 --- a/resources/js/data/views/albumView.ts +++ b/resources/js/data/views/albumView.ts @@ -31,7 +31,9 @@ export const albumView = (Alpine: Alpine) => photo_layout_square_column_width: 200, photo_layout_gap: 12, }, + isSearch: boolean = false, ): AlbumView => ({ + isSearch: isSearch, select: new Selection(albumIDs, photos, rights.can_edit), actions: new AlbumActions(), keybinds: new Keybindings(), diff --git a/resources/js/data/views/types.d.ts b/resources/js/data/views/types.d.ts index d88f06828b4..0fdf0c38492 100644 --- a/resources/js/data/views/types.d.ts +++ b/resources/js/data/views/types.d.ts @@ -13,6 +13,7 @@ export interface PhotoArray { } export type AlbumView = AlpineComponent<{ + isSearch: boolean; select: Selection; actions: AlbumActions; keybinds: Keybindings; diff --git a/resources/js/lycheeOrg/actions/keybindings.ts b/resources/js/lycheeOrg/actions/keybindings.ts index fce45496abb..e20c876e961 100644 --- a/resources/js/lycheeOrg/actions/keybindings.ts +++ b/resources/js/lycheeOrg/actions/keybindings.ts @@ -49,6 +49,11 @@ export default class Keybindings { const url = document.getElementById("backButton")?.getAttribute("href"); // @ts-expect-error Alpine.navigate(url); + } else if (view.isSearch) { + event.preventDefault(); + const url = document.getElementById("backButton")?.getAttribute("href"); + // @ts-expect-error + Alpine.navigate(url); } return true; } diff --git a/resources/views/livewire/pages/gallery/search.blade.php b/resources/views/livewire/pages/gallery/search.blade.php index 993d7568558..bc783cae674 100644 --- a/resources/views/livewire/pages/gallery/search.blade.php +++ b/resources/views/livewire/pages/gallery/search.blade.php @@ -8,7 +8,8 @@ @js($this->photosResource), @js(null), @js($this->overlayType), - @js($this->layouts) + @js($this->layouts), + @js(true) )" @keydown.window="handleKeydown(event)" @popstate.window="handlePopState(event)">