|
@@ -10,6 +10,7 @@ import {
|
|
import { Tab } from '@headlessui/react'
|
|
import { Tab } from '@headlessui/react'
|
|
import { Tag } from './tag'
|
|
import { Tag } from './tag'
|
|
import classNames from '@/utils/classnames'
|
|
import classNames from '@/utils/classnames'
|
|
|
|
+import { writeTextToClipboard } from '@/utils/clipboard'
|
|
|
|
|
|
const languageNames = {
|
|
const languageNames = {
|
|
js: 'JavaScript',
|
|
js: 'JavaScript',
|
|
@@ -71,7 +72,7 @@ function CopyButton({ code }: { code: string }) {
|
|
: 'bg-white/5 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5',
|
|
: 'bg-white/5 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5',
|
|
)}
|
|
)}
|
|
onClick={() => {
|
|
onClick={() => {
|
|
- window.navigator.clipboard.writeText(code).then(() => {
|
|
|
|
|
|
+ writeTextToClipboard(code).then(() => {
|
|
setCopyCount(count => count + 1)
|
|
setCopyCount(count => count + 1)
|
|
})
|
|
})
|
|
}}
|
|
}}
|