File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/renderer/components/snippets Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1111 </div >
1212 <div class =" action" >
1313 <AppActionButton >
14- <UniconsArrow />
14+ <UniconsArrow @click = " onCopySnippet " />
1515 </AppActionButton >
1616 <AppActionButton >
1717 <UniconsPlus @click =" onAddNewFragment" />
2626
2727<script setup lang="ts">
2828import { emitter } from ' @/composable'
29+ import { ipc } from ' @/electron'
2930import { useSnippetStore } from ' @/store/snippets'
30- import { useDebounceFn } from ' @vueuse/core'
31+ import { useClipboard , useDebounceFn } from ' @vueuse/core'
3132import { computed , ref } from ' vue'
33+ import type { NotificationPayload } from ' @@/types'
3234
3335const snippetStore = useSnippetStore ()
3436const inputRef = ref <HTMLInputElement >()
@@ -47,6 +49,14 @@ const onAddNewFragment = () => {
4749 snippetStore .fragment = snippetStore .fragmentCount !
4850}
4951
52+ const onCopySnippet = () => {
53+ const { copy } = useClipboard ({ source: snippetStore .currentContent })
54+ copy ()
55+ ipc .invoke <any , NotificationPayload >(' notification' , {
56+ body: ' Snippet copied'
57+ })
58+ }
59+
5060emitter .on (' focus:snippet-name' , () => {
5161 inputRef .value ?.select ()
5262})
You can’t perform that action at this time.
0 commit comments