Skip to content

Commit 76105d4

Browse files
authored
Merge pull request #823 from citation-file-format/158-notify-copy-to-clipboard
2 parents 1215d8b + 6e7d774 commit 76105d4

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

quasar.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ module.exports = configure(function () {
117117

118118
// Quasar plugins
119119
plugins: [
120-
'Dialog'
120+
'Dialog',
121+
'Notify'
121122
]
122123
},
123124

src/components/Preview.vue

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,6 @@
2222
<q-tooltip class="bg-primary text-subtitle2">
2323
Copy to clipboard
2424
</q-tooltip>
25-
<q-tooltip
26-
anchor="center left"
27-
self="center right"
28-
v-bind:offset="[10, 10]"
29-
no-parent-event
30-
v-bind:model-value="showTooltip"
31-
class="text-subtitle2"
32-
>
33-
Copied
34-
<q-icon
35-
size="md"
36-
name="check"
37-
class="text-positive"
38-
/>
39-
</q-tooltip>
4025
</q-btn>
4126
</template>
4227
</q-input>
@@ -66,8 +51,9 @@
6651
</template>
6752

6853
<script lang="ts">
69-
import { computed, defineComponent, ref } from 'vue'
54+
import { computed, defineComponent } from 'vue'
7055
import { useCffstr } from 'src/store/cffstr'
56+
import { useQuasar } from 'quasar'
7157
import { useValidation } from 'src/store/validation'
7258
7359
export default defineComponent({
@@ -82,13 +68,19 @@ export default defineComponent({
8268
setup () {
8369
const { cffstr } = useCffstr()
8470
const { errors } = useValidation()
85-
const showTooltip = ref(false)
71+
const $q = useQuasar()
8672
8773
const copyToClipboard = async () => {
8874
await navigator.clipboard.writeText(cffstr.value)
89-
showTooltip.value = true
90-
await new Promise(resolve => setTimeout(resolve, 3000))
91-
showTooltip.value = false
75+
$q.notify({
76+
message: 'CITATION.cff copied!',
77+
color: 'primary',
78+
progress: true,
79+
timeout: 800,
80+
actions: [
81+
{ label: 'Dismiss', color: 'white' }
82+
]
83+
})
9284
}
9385
9486
return {
@@ -97,8 +89,7 @@ export default defineComponent({
9789
doesNotHaveRequiredFields: computed(() => errors.value
9890
.map((v) => v.instancePath)
9991
.some((i) => i.includes('title') || i.includes('authors') || i.includes('message'))),
100-
isValidCFF: computed(() => errors.value.length === 0),
101-
showTooltip
92+
isValidCFF: computed(() => errors.value.length === 0)
10293
}
10394
}
10495
})

0 commit comments

Comments
 (0)