修改复制链接等功能
This commit is contained in:
@@ -5,36 +5,37 @@ const route = useRoute()
|
|||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const { copy, copied } = useClipboard()
|
const { copy, copied } = useClipboard()
|
||||||
|
|
||||||
const markdownLink = computed(() => `${window?.location?.origin}/raw${route.path}.md`)
|
const mdcLink = computed(() => `${window?.location?.origin}${decodeURIComponent(route.path)}`)
|
||||||
|
const markdownLink = computed(() => `${window?.location?.origin}/raw${decodeURIComponent(route.path)}.md`)
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
label: 'Copy Markdown link',
|
label: '复制链接',
|
||||||
icon: 'lucide-link',
|
icon: 'lucide-link',
|
||||||
onSelect() {
|
onSelect() {
|
||||||
copy(markdownLink.value)
|
copy(mdcLink.value)
|
||||||
|
|
||||||
toast.add({
|
toast.add({
|
||||||
title: 'Markdown link copied to clipboard',
|
title: '文档链接已复制到剪贴板',
|
||||||
icon: 'lucide-check-circle',
|
icon: 'lucide-check-circle',
|
||||||
color: 'success'
|
color: 'success'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'View as Markdown',
|
label: '查看 Markdown',
|
||||||
icon: 'simple-icons:markdown',
|
icon: 'simple-icons:markdown',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
to: markdownLink.value
|
to: markdownLink.value
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Open in ChatGPT',
|
label: '在 ChatGPT 中打开',
|
||||||
icon: 'simple-icons:openai',
|
icon: 'simple-icons:openai',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
to: `https://chatgpt.com/?hints=search&q=${encodeURIComponent(`Read ${markdownLink.value} so I can ask questions about it.`)}`
|
to: `https://chatgpt.com/?hints=search&q=${encodeURIComponent(`Read ${markdownLink.value} so I can ask questions about it.`)}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Open in Claude',
|
label: '在 Claude 中打开',
|
||||||
icon: 'simple-icons:anthropic',
|
icon: 'simple-icons:anthropic',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
to: `https://claude.ai/new?q=${encodeURIComponent(`Read ${markdownLink.value} so I can ask questions about it.`)}`
|
to: `https://claude.ai/new?q=${encodeURIComponent(`Read ${markdownLink.value} so I can ask questions about it.`)}`
|
||||||
@@ -45,14 +46,14 @@ const items = [
|
|||||||
<template>
|
<template>
|
||||||
<UButtonGroup size="sm">
|
<UButtonGroup size="sm">
|
||||||
<UButton
|
<UButton
|
||||||
label="Copy page"
|
label="复制链接"
|
||||||
:icon="copied ? 'lucide-copy-check' : 'lucide-copy'"
|
:icon="copied ? 'lucide-copy-check' : 'lucide-copy'"
|
||||||
color="neutral"
|
color="neutral"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
:ui="{
|
:ui="{
|
||||||
leadingIcon: [copied ? 'text-primary' : 'text-neutral', 'size-3.5']
|
leadingIcon: [copied ? 'text-primary' : 'text-neutral', 'size-3.5']
|
||||||
}"
|
}"
|
||||||
@click="copy(markdownLink)"
|
@click="copy(mdcLink)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<UDropdownMenu
|
<UDropdownMenu
|
||||||
|
Reference in New Issue
Block a user