Skip to content

Commit

Permalink
feat: add copy to clipboard on click
Browse files Browse the repository at this point in the history
also move bibtex to its own section
  • Loading branch information
alee committed Oct 7, 2023
1 parent b4ceb16 commit b5f6584
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
24 changes: 22 additions & 2 deletions app/components/Citation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
</p>

<h2>Example Citation</h2>
<blockquote class="blockquote">{{ citationText }}</blockquote>
<blockquote class="blockquote">{{ citationBibTex }}</blockquote>
<blockquote class="blockquote" @click="copyToClipboard">
{{ citationText }}
</blockquote>
<h2>BibTeX</h2>
<blockquote class="blockquote" @click="copyToClipboard">
{{ citationBibTex }}
</blockquote>

<h2>Contact us</h2>
<p class="text-body-1 px-2">
Expand All @@ -36,6 +41,12 @@
skope-team@googlegroups.com
</a>
</p>
<v-snackbar v-model="clipboardMessage" timeout="6000">
<p class="text-center">
Citation text copied to clipboard. Use <kbd>Ctrl + V</kbd> to
paste.
</p>
</v-snackbar>
</v-card-text>
</v-card>
</v-dialog>
Expand All @@ -49,6 +60,7 @@ import { CITATION_TXT, CITATION_BIB } from "@/store/modules/_constants";
@Component()
class Citation extends Vue {
showCitation = false;
clipboardMessage = false;
get citationText() {
return CITATION_TXT;
Expand All @@ -57,6 +69,14 @@ class Citation extends Vue {
get citationBibTex() {
return CITATION_BIB;
}
copyToClipboard(evt, data) {
const srcElement = evt.srcElement;
const citationText = srcElement.innerText;
navigator.clipboard.writeText(citationText).then(() => {
this.clipboardMessage = true;
});
}
}
export default Citation;
Expand Down
1 change: 1 addition & 0 deletions app/components/TermsOfUse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

<h2>Example Citation</h2>
<blockquote class="blockquote">{{ citationText }}</blockquote>
<h2>BibTeX</h2>
<blockquote class="blockquote">{{ citationBibTex }}</blockquote>

<h2>Contact us</h2>
Expand Down

0 comments on commit b5f6584

Please sign in to comment.