-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clipboard copy from code block
- Loading branch information
Showing
5 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<code | ||
class="text-sm sm:text-base inline-flex text-left items-center space-x-4 bg-gray-900 text-white rounded-lg p-4 pl-6 relative w-full" | ||
> | ||
<slot /> | ||
<img | ||
src="@/assets/images/copy.svg" | ||
class="absolute w-7 top-2 right-2 bg-gray-600 hover:bg-gray-500 rounded-xl p-1 box-content transition-colors cursor-pointer" | ||
@click="onClick" | ||
/> | ||
</code> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useClipboard } from '@vueuse/core' | ||
const props = defineProps({ | ||
code: { | ||
type: String, | ||
default: '' | ||
} | ||
}) | ||
const { copy } = useClipboard() | ||
const onClick = () => { | ||
copy(props.code) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
<template> | ||
<main> | ||
<ContentDoc /> | ||
<ContentRenderer v-if="data" :value="data" /> | ||
</main> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const route = useRoute() | ||
const { data } = await useAsyncData('get-document', () => | ||
queryContent(route.path).findOne() | ||
) | ||
const { page } = useContent() | ||
useContentHead(page) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1510,6 +1510,11 @@ | |
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.9.tgz#72e164381659a49557b0a078b28308f2c6a3e1ce" | ||
integrity sha512-zC0iXxAv1C1ERURduJueYzkzZ2zaGyc+P2c95hgkikHPr3z8EdUZOlgEQ5X0DRmwDZn+hekycQnoeiiRVrmilQ== | ||
|
||
"@types/web-bluetooth@^0.0.18": | ||
version "0.0.18" | ||
resolved "https://registry.yarnpkg.com/@types/web-bluetooth/-/web-bluetooth-0.0.18.tgz#74bd1c8fd3a2058cb6fc76b188fcded50a83d866" | ||
integrity sha512-v/ZHEj9xh82usl8LMR3GarzFY1IrbXJw5L4QfQhokjRV91q+SelFqxQWSep1ucXEZ22+dSTwLFkXeur25sPIbw== | ||
|
||
"@typescript-eslint/eslint-plugin@^6.5.0", "@typescript-eslint/eslint-plugin@^6.8.0": | ||
version "6.8.0" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.8.0.tgz#06abe4265e7c82f20ade2dcc0e3403c32d4f148b" | ||
|
@@ -1815,6 +1820,16 @@ | |
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.3.6.tgz#bd97c22972c6519250069297d01cbed077054b7e" | ||
integrity sha512-Xno5pEqg8SVhomD0kTSmfh30ZEmV/+jZtyh39q6QflrjdJCXah5lrnOLi9KB6a5k5aAHXMXjoMnxlzUkCNfWLQ== | ||
|
||
"@vueuse/[email protected]": | ||
version "10.5.0" | ||
resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-10.5.0.tgz#04d1e6d26592bb997bb755a4830ea7583c3e8612" | ||
integrity sha512-z/tI2eSvxwLRjOhDm0h/SXAjNm8N5ld6/SC/JQs6o6kpJ6Ya50LnEL8g5hoYu005i28L0zqB5L5yAl8Jl26K3A== | ||
dependencies: | ||
"@types/web-bluetooth" "^0.0.18" | ||
"@vueuse/metadata" "10.5.0" | ||
"@vueuse/shared" "10.5.0" | ||
vue-demi ">=0.14.6" | ||
|
||
"@vueuse/head@^2.0.0": | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/@vueuse/head/-/head-2.0.0.tgz#a4570c0933368a436796c2f737d56e169a8f0864" | ||
|
@@ -1825,6 +1840,30 @@ | |
"@unhead/ssr" "^1.7.0" | ||
"@unhead/vue" "^1.7.0" | ||
|
||
"@vueuse/[email protected]": | ||
version "10.5.0" | ||
resolved "https://registry.yarnpkg.com/@vueuse/metadata/-/metadata-10.5.0.tgz#7501a88cf5cbf7a515a03f0b8bbe3cecf30cad11" | ||
integrity sha512-fEbElR+MaIYyCkeM0SzWkdoMtOpIwO72x8WsZHRE7IggiOlILttqttM69AS13nrDxosnDBYdyy3C5mR1LCxHsw== | ||
|
||
"@vueuse/nuxt@^10.5.0": | ||
version "10.5.0" | ||
resolved "https://registry.yarnpkg.com/@vueuse/nuxt/-/nuxt-10.5.0.tgz#91a37130718230602a7749113915a9e3e9c8a208" | ||
integrity sha512-x1mpjwcPB5DGA3cTM29Hf3bralslrma3Jr0fXm3Js3dbUHdadC/iVMf831W+sKPjZBhiZxR0S94B8gmGlvZ/1Q== | ||
dependencies: | ||
"@nuxt/kit" "^3.7.4" | ||
"@vueuse/core" "10.5.0" | ||
"@vueuse/metadata" "10.5.0" | ||
local-pkg "^0.5.0" | ||
nuxt "^3.7.4" | ||
vue-demi ">=0.14.6" | ||
|
||
"@vueuse/[email protected]": | ||
version "10.5.0" | ||
resolved "https://registry.yarnpkg.com/@vueuse/shared/-/shared-10.5.0.tgz#b3ac8c190a5dae41db5e1b60fe304a9b4247393c" | ||
integrity sha512-18iyxbbHYLst9MqU1X1QNdMHIjks6wC7XTVf0KNOv5es/Ms6gjVFCAAWTVP2JStuGqydg3DT+ExpFORUEi9yhg== | ||
dependencies: | ||
vue-demi ">=0.14.6" | ||
|
||
abbrev@1, abbrev@^1.0.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" | ||
|
@@ -9139,6 +9178,11 @@ vue-bundle-renderer@^2.0.0: | |
dependencies: | ||
ufo "^1.2.0" | ||
|
||
vue-demi@>=0.14.6: | ||
version "0.14.6" | ||
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.6.tgz#dc706582851dc1cdc17a0054f4fec2eb6df74c92" | ||
integrity sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w== | ||
|
||
vue-devtools-stub@^0.1.0: | ||
version "0.1.0" | ||
resolved "https://registry.yarnpkg.com/vue-devtools-stub/-/vue-devtools-stub-0.1.0.tgz#a65b9485edecd4273cedcb8102c739b83add2c81" | ||
|