Skip to content
Snippets Groups Projects
Commit f5735a14 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

add copy notification

parent 30c5ab92
No related branches found
No related tags found
No related merge requests found
<template> <template>
<div class="article_footer"> <div class="article_footer">
<v-snackbar center left light
<v-btn v-if="!webShareApiSupported || $vuetify.breakpoint.mdAndUp" x-small depressed class="toolbar-button" rounded tabindex="0" @click="copy_link"> v-model='copy_popup'
<v-icon small>link</v-icon> <span class = "button-text">Kopier lenke</span> 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-btn v-if="webShareApiSupported" depressed x-small class="toolbar-button" rounded tabindex="0" @click="shareViaWebShare"> <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-icon x-small>share</v-icon><span class = "button-text">Del ordet</span>
</v-btn> </v-btn>
...@@ -52,6 +70,7 @@ export default { ...@@ -52,6 +70,7 @@ export default {
}, },
data: function() { data: function() {
return { return {
copy_popup: false,
citation_dialog: false citation_dialog: false
} }
...@@ -85,12 +104,15 @@ export default { ...@@ -85,12 +104,15 @@ export default {
}, },
copy_link() { copy_link() {
navigator.clipboard.writeText(this.create_link()); navigator.clipboard.writeText(this.create_link());
this.copy_popup = true
}, },
copy_citation() { copy_citation() {
let citation = document.getElementById("citation").textContent; let citation = document.getElementById("citation").textContent;
navigator.clipboard.writeText(citation) navigator.clipboard.writeText(citation)
this.citation_dialog = false this.citation_dialog = false
this.copy_popup = true
}, },
close_citation_dialog() { close_citation_dialog() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment