fix(web): delete action closes asset viewer in asset view (#15469)

fixes #14647
This commit is contained in:
Alessandro Baroni 2025-03-03 19:24:37 +01:00 committed by GitHub
parent e2c34f17ba
commit f89e74181b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 9 deletions

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { focusTrap } from '$lib/actions/focus-trap';
import type { Action, OnAction } from '$lib/components/asset-viewer/actions/action';
import type { Action, OnAction, PreAction } from '$lib/components/asset-viewer/actions/action';
import MotionPhotoAction from '$lib/components/asset-viewer/actions/motion-photo-action.svelte';
import NextAssetAction from '$lib/components/asset-viewer/actions/next-asset-action.svelte';
import PreviousAssetAction from '$lib/components/asset-viewer/actions/previous-asset-action.svelte';
@ -58,6 +58,7 @@
isShared?: boolean;
album?: AlbumResponseDto | null;
person?: PersonResponseDto | null;
preAction?: PreAction | undefined;
onAction?: OnAction | undefined;
reactions?: ActivityResponseDto[];
onClose: (dto: { asset: AssetResponseDto }) => void;
@ -75,6 +76,7 @@
isShared = false,
album = null,
person = null,
preAction = undefined,
onAction = undefined,
reactions = $bindable([]),
onClose,
@ -366,7 +368,9 @@
const handleStackedAssetMouseEvent = (isMouseOver: boolean, asset: AssetResponseDto) => {
previewStackedAsset = isMouseOver ? asset : undefined;
};
const handlePreAction = (action: Action) => {
preAction?.(action);
};
const handleAction = async (action: Action) => {
switch (action.type) {
case AssetAction.ADD_TO_ALBUM: {
@ -431,6 +435,7 @@
showSlideshow={true}
onZoomImage={zoomToggle}
onCopyImage={copyImage}
preAction={handlePreAction}
onAction={handleAction}
onRunJob={handleRunJob}
onPlaySlideshow={() => ($slideshowState = SlideshowState.PlaySlideshow)}