File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
app/pages/package-code/[[org]]/[packageName]/v/[version] Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,11 @@ function copyPermalinkUrl() {
249249 copyPermalink (url .toString ())
250250}
251251
252+ const { copied : fileContentCopied, copy : copyFileContent } = useClipboard ({
253+ source : () => fileContent .value ?.content || ' ' ,
254+ copiedDuring: 2000 ,
255+ })
256+
252257// Scroll to top of file content
253258const contentContainer = useTemplateRef (' contentContainer' )
254259function scrollToTop() {
@@ -474,6 +479,18 @@ defineOgImageComponent('Default', {
474479 >
475480 {{ permalinkCopied ? $t('common.copied') : $t('code.copy_link') }}
476481 </button >
482+ <button
483+ v-if =" !!fileContent?.content"
484+ type =" button"
485+ class =" px-2 py-1 font-mono text-xs text-fg-muted bg-bg-subtle border border-border rounded hover:text-fg hover:border-border-hover transition-colors inline-flex items-center gap-1 capitalize"
486+ @click =" copyFileContent()"
487+ >
488+ <span
489+ class =" w-3 h-3"
490+ :class =" fileContentCopied ? 'i-lucide:check' : 'i-lucide:file'"
491+ />
492+ {{ fileContentCopied ? $t('common.copied') : $t('common.copy') }}
493+ </button >
477494 <a
478495 :href =" `https://cdn.jsdelivr.net/npm/${packageName}@${version}/${filePath}`"
479496 target =" _blank"
You can’t perform that action at this time.
0 commit comments