mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(web): handle delete shortcut on shared link page as remove (#26552)
This commit is contained in:
@@ -140,7 +140,7 @@
|
|||||||
</ControlAppBar>
|
</ControlAppBar>
|
||||||
{/if}
|
{/if}
|
||||||
<section class="my-40 mx-4" bind:clientHeight={viewport.height} bind:clientWidth={viewport.width}>
|
<section class="my-40 mx-4" bind:clientHeight={viewport.height} bind:clientWidth={viewport.width}>
|
||||||
<GalleryViewer {assets} {assetInteraction} {viewport} />
|
<GalleryViewer {assets} {assetInteraction} {viewport} allowDeletion={false} />
|
||||||
</section>
|
</section>
|
||||||
{:else if assets.length === 1}
|
{:else if assets.length === 1}
|
||||||
{#await getAssetInfo({ ...authManager.params, id: assets[0].id }) then asset}
|
{#await getAssetInfo({ ...authManager.params, id: assets[0].id }) then asset}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
pageHeaderOffset?: number;
|
pageHeaderOffset?: number;
|
||||||
slidingWindowOffset?: number;
|
slidingWindowOffset?: number;
|
||||||
arrowNavigation?: boolean;
|
arrowNavigation?: boolean;
|
||||||
|
allowDeletion?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
slidingWindowOffset = 0,
|
slidingWindowOffset = 0,
|
||||||
pageHeaderOffset = 0,
|
pageHeaderOffset = 0,
|
||||||
arrowNavigation = true,
|
arrowNavigation = true,
|
||||||
|
allowDeletion = true,
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
let { isViewing: isViewerOpen, asset: viewingAsset } = assetViewingStore;
|
let { isViewing: isViewerOpen, asset: viewingAsset } = assetViewingStore;
|
||||||
@@ -273,11 +275,15 @@
|
|||||||
if (assetInteraction.selectionActive) {
|
if (assetInteraction.selectionActive) {
|
||||||
shortcuts.push(
|
shortcuts.push(
|
||||||
{ shortcut: { key: 'Escape' }, onShortcut: deselectAllAssets },
|
{ shortcut: { key: 'Escape' }, onShortcut: deselectAllAssets },
|
||||||
{ shortcut: { key: 'Delete' }, onShortcut: onDelete },
|
{ shortcut: { key: 'D', ctrl: true }, onShortcut: deselectAllAssets },
|
||||||
{ shortcut: { key: 'Delete', shift: true }, onShortcut: () => trashOrDelete(true) },
|
|
||||||
{ shortcut: { key: 'D', ctrl: true }, onShortcut: () => deselectAllAssets() },
|
|
||||||
{ shortcut: { key: 'a', shift: true }, onShortcut: toggleArchive },
|
|
||||||
);
|
);
|
||||||
|
if (allowDeletion) {
|
||||||
|
shortcuts.push(
|
||||||
|
{ shortcut: { key: 'Delete' }, onShortcut: onDelete },
|
||||||
|
{ shortcut: { key: 'Delete', shift: true }, onShortcut: () => trashOrDelete(true) },
|
||||||
|
{ shortcut: { key: 'a', shift: true }, onShortcut: toggleArchive },
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return shortcuts;
|
return shortcuts;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { shortcut } from '$lib/actions/shortcut';
|
||||||
import { handleRemoveSharedLinkAssets } from '$lib/services/shared-link.service';
|
import { handleRemoveSharedLinkAssets } from '$lib/services/shared-link.service';
|
||||||
import { getAssetControlContext } from '$lib/utils/context';
|
import { getAssetControlContext } from '$lib/utils/context';
|
||||||
import { type SharedLinkResponseDto } from '@immich/sdk';
|
import { type SharedLinkResponseDto } from '@immich/sdk';
|
||||||
@@ -23,6 +24,8 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:document use:shortcut={{ shortcut: { key: 'Delete' }, onShortcut: handleSelect }} />
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
shape="round"
|
shape="round"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
|
|||||||
Reference in New Issue
Block a user