-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathXmpButton.vue
40 lines (38 loc) · 910 Bytes
/
XmpButton.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
<a
ref="xmp"
class="button donate small copy-button is-xmp"
type="text/xml"
:href="xmpHref"
:download="xmpFilename"
>
{{ xmpLabel }}
</a>
</template>
<script>
import { createXMP } from '@/utils/xmp';
import { mapGetters } from 'vuex';
export default {
name: 'XmpButton',
computed: {
...mapGetters(['shortName']),
xmpLabel() {
return this.$t('license-use.xmp-label');
},
xmpFilename() {
return `${this.shortName}.xmp`;
},
xmpHref() {
const shortName = this.$store.getters.shortName;
const {
workUrl,
workTitle,
creatorName,
} = this.$store.state.attributionDetails;
const xmp = createXMP({ shortName, workUrl, workTitle, creatorName });
const xmpBlob = new Blob([xmp], { type: 'text/xml;charset=utf-8' });
return URL.createObjectURL(xmpBlob);
},
},
};
</script>