diff --git a/src/lib/components/workspace/Skills/SkillFiles.svelte b/src/lib/components/workspace/Skills/SkillFiles.svelte index 5e1568ab2b..ca26c10705 100644 --- a/src/lib/components/workspace/Skills/SkillFiles.svelte +++ b/src/lib/components/workspace/Skills/SkillFiles.svelte @@ -2,6 +2,7 @@ import { v4 as uuidv4 } from 'uuid'; import { onDestroy, getContext, tick, type Snippet } from 'svelte'; import { toast } from 'svelte-sonner'; + import { copyToClipboard } from '$lib/utils'; import { createFocusTrap } from 'focus-trap'; import { mobile } from '$lib/stores'; import Drawer from '$lib/components/common/Drawer.svelte'; @@ -153,6 +154,12 @@ dirty = true; } }; + const copyContent = async () => { + if (loading || loadError || !loadedPath || objectUrl) return; + if (await copyToClipboard(codeEditor?.getValue() ?? value)) + toast.success($i18n.t('Copied to clipboard')); + else toast.error($i18n.t('Could not copy to clipboard. Please try again.')); + }; const compareRevision = () => { if (readOnly || loading || loadError || !loadedPath || objectUrl) return; flush(); @@ -611,6 +618,14 @@ if (preview) await renderPreview(); }}>{preview ? 'Edit' : 'Preview'}{/if} + {#if loadedPath && !objectUrl && !loading && !loadError} + + {/if}