1
1
<template >
2
- <div >
3
- <div >
4
- <v-btn icon :dark =" dark" @click =" onClick" >
5
- <v-icon medium >{{icon}}</v-icon >
6
- {{text}}
7
- </v-btn >
8
- <textarea id =" permalinkurl" ref =" permalinkurl" style =" display : none ; position : relative " ></textarea >
2
+ <div class =" text-xs-center" >
3
+ <v-menu >
4
+ <template #activator =" { on: menu } " >
5
+ <v-tooltip bottom >
6
+ <template #activator =" { on: tooltip } " >
7
+ <v-btn icon :dark =" dark" v-on =" { ...tooltip, ...menu }" >
8
+ <v-icon medium >{{icon}}</v-icon >
9
+ {{text}}
10
+ </v-btn >
11
+ <textarea id =" textstore" ref =" textstore" style =" display : none ; position : relative " ></textarea >
12
+ </template >
13
+ <span >{{hoverText}}</span >
14
+ </v-tooltip >
15
+ </template >
16
+ <v-list >
17
+ <v-list-tile
18
+ v-for =" (item, index) in items"
19
+ :key =" index"
20
+ @click =" onClick(item.action)"
21
+ >
22
+ <v-list-tile-title >{{ item.title }}</v-list-tile-title >
23
+ </v-list-tile >
24
+ </v-list >
25
+ </v-menu >
26
+ <v-alert
27
+ class =" wgu-alert"
28
+ :value =" alert"
29
+ :dark =" dark"
30
+ type =" info"
31
+ transition =" fade-transition"
32
+ >
33
+ {{alertText}}
34
+ </v-alert >
9
35
</div >
10
- <v-alert
11
- class =" wgu-alert"
12
- :value =" alert"
13
- :dark =" dark"
14
- type =" info"
15
- transition =" fade-transition"
16
- >
17
- {{alertText}}
18
- </v-alert >
19
- </div >
36
+ <!-- <div>-->
37
+ <!-- <div>-->
38
+ <!-- <v-btn icon :dark="dark" @click="onClick">-->
39
+ <!-- <v-icon medium>{{icon}}</v-icon>-->
40
+ <!-- {{text}}-->
41
+ <!-- </v-btn>-->
42
+ <!-- <textarea id="textstore" ref="textstore" style="display: none; position: relative"></textarea>-->
43
+ <!-- </div>-->
44
+ <!-- <v-alert-->
45
+ <!-- class="wgu-alert"-->
46
+ <!-- :value="alert"-->
47
+ <!-- :dark="dark"-->
48
+ <!-- type="info"-->
49
+ <!-- transition="fade-transition"-->
50
+ <!-- >-->
51
+ <!-- {{alertText}}-->
52
+ <!-- </v-alert>-->
53
+ <!-- </div>-->
20
54
</template >
21
55
22
56
<script >
@@ -29,17 +63,23 @@ export default {
29
63
props: {
30
64
icon: {type: String , required: false , default: ' share' },
31
65
text: {type: String , required: false , default: ' ' },
32
- alertText: {type: String , required: false , default: ' Link copied!' },
33
- alertTimeMillis: {type: Number , required: false , default: 750 },
66
+ hoverText: {type: String , required: false , default: ' Share permalink' },
67
+ alertText: {type: String , required: false , default: ' Copied' },
68
+ alertTimeMillis: {type: Number , required: false , default: 1000 },
34
69
dark: {type: Boolean , required: false , default: false }
35
70
},
36
71
data () {
37
72
return {
38
- alert: false
73
+ alert: false ,
74
+ items: [
75
+ { title: ' Copy URL' , action: ' copy' },
76
+ { title: ' Copy HTML Embed Code' , action: ' embed' }
77
+ // { title: 'Email URL', action: 'email' }
78
+ ]
39
79
}
40
80
},
41
81
methods: {
42
- onClick () {
82
+ onClick (action ) {
43
83
// Get permalink URL and copy to clipboard
44
84
const permalinkController = this .map .get (' permalinkcontroller' );
45
85
if (! permalinkController) {
@@ -49,11 +89,20 @@ export default {
49
89
try {
50
90
// Copy to clipboard: selected text needs to be visible so
51
91
// toggle textarea short time
52
- const url = permalinkController .getShareUrl ();
53
- const textArea = this .$refs .permalinkurl ;
92
+ let text;
93
+
94
+ if (action === ' copy' ) {
95
+ text = permalinkController .getShareUrl ();
96
+ } else if (action === ' embed' ) {
97
+ text = permalinkController .getEmbedHTML ();
98
+ } else {
99
+ console .error (' no permalink controller available!' );
100
+ return true ;
101
+ }
102
+ const textArea = this .$refs .textstore ;
54
103
// Show and select textarea
55
104
textArea .style .display = ' block' ;
56
- textArea .value = url ;
105
+ textArea .value = text ;
57
106
textArea .select ();
58
107
59
108
// Copy to clipboard
0 commit comments