From f5735a140b59a832f874a22cd27d8d1bfcd9e78d Mon Sep 17 00:00:00 2001 From: Henrik Askjer <henrik.askjer@uib.no> Date: Thu, 18 Nov 2021 15:05:26 +0100 Subject: [PATCH] add copy notification --- src/components/ArticleFooter.vue | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/components/ArticleFooter.vue b/src/components/ArticleFooter.vue index f8357297..c6989373 100644 --- a/src/components/ArticleFooter.vue +++ b/src/components/ArticleFooter.vue @@ -1,10 +1,28 @@ <template> <div class="article_footer"> - - <v-btn v-if="!webShareApiSupported || $vuetify.breakpoint.mdAndUp" x-small depressed class="toolbar-button" rounded tabindex="0" @click="copy_link"> - <v-icon small>link</v-icon> <span class = "button-text">Kopier lenke</span> + <v-snackbar center left light + v-model='copy_popup' + timeout="2000"> + + <span class="text-center">Kopiert til utklippstavla</span> + <template v-slot:action="{ attrs }"> + <v-btn + color="primary" + text + v-bind="attrs" + @click="copy_popup = false" + > + <v-icon>close</v-icon> + </v-btn> + </template> + </v-snackbar> + + <v-btn v-if="!webShareApiSupported || $vuetify.breakpoint.mdAndUp" + x-small depressed class="toolbar-button" rounded tabindex="0" @click="copy_link"> + <v-icon small>link</v-icon><span class = "button-text">Kopier lenke</span> </v-btn> + <v-btn v-if="webShareApiSupported" depressed x-small class="toolbar-button" rounded tabindex="0" @click="shareViaWebShare"> <v-icon x-small>share</v-icon><span class = "button-text">Del ordet</span> </v-btn> @@ -52,6 +70,7 @@ export default { }, data: function() { return { + copy_popup: false, citation_dialog: false } @@ -85,12 +104,15 @@ export default { }, copy_link() { navigator.clipboard.writeText(this.create_link()); + this.copy_popup = true }, copy_citation() { + let citation = document.getElementById("citation").textContent; navigator.clipboard.writeText(citation) this.citation_dialog = false + this.copy_popup = true }, close_citation_dialog() { -- GitLab