-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add copy to clipboard on click
also move bibtex to its own section
- Loading branch information
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"> | ||
|
@@ -36,6 +41,12 @@ | |
[email protected] | ||
</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> | ||
|
@@ -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; | ||
|
@@ -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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters