diff --git a/web/src/app.d.ts b/web/src/app.d.ts index 62ce34f496..947bb146a6 100644 --- a/web/src/app.d.ts +++ b/web/src/app.d.ts @@ -9,3 +9,11 @@ declare namespace App { // interface Platform {} } + +// Source: https://stackoverflow.com/questions/63814432/typescript-typing-of-non-standard-window-event-in-svelte +// To fix the { + oncopyImage?: () => void; + } +} diff --git a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte index f3c51ccbb8..c4c49e965c 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte @@ -11,10 +11,13 @@ import MenuOption from '../shared-components/context-menu/menu-option.svelte'; import Star from 'svelte-material-icons/Star.svelte'; import StarOutline from 'svelte-material-icons/StarOutline.svelte'; + import ContentCopy from 'svelte-material-icons/ContentCopy.svelte'; + import { page } from '$app/stores'; import { AssetResponseDto } from '../../../api'; export let asset: AssetResponseDto; + export let showCopyButton: boolean; const isOwner = asset.ownerId === $page.data.user.id; @@ -45,6 +48,15 @@ dispatch('goBack')} />
+ {#if showCopyButton} + { + const copyEvent = new CustomEvent('copyImage'); + window.dispatchEvent(copyEvent); + }} + /> + {/if} dispatch('download')} /> dispatch('showDetail')} /> {#if isOwner} diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 9b02299ac7..df251283e5 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -1,7 +1,7 @@ - + + + await doCopy()} />