13
13
>
14
14
<span class =" inline-flex justify-center" v-show =" copied" >
15
15
<svg
16
- class =" w-6 h-6 mr-2"
16
+ class =" inline-block w-6 h-6 mr-2 ml-[-4px] "
17
17
fill =" none"
18
18
stroke =" currentColor"
19
19
viewBox =" 0 0 24 24"
@@ -125,10 +125,10 @@ export default {
125
125
}
126
126
},
127
127
methods: {
128
- copyUrlToClipboard ( ) {
129
- navigator .clipboard .writeText (window . location . href )
128
+ putToClipboard ( textToPut , toastContent ) {
129
+ navigator .clipboard .writeText (textToPut )
130
130
this .$store .commit (' toast/setData' , {
131
- content: ' Link copied to your clipboard ' ,
131
+ content: toastContent ,
132
132
iconHTML: `
133
133
<svg
134
134
class="w-6 h-6"
@@ -148,46 +148,27 @@ export default {
148
148
theme: ' success' ,
149
149
})
150
150
this .$store .commit (' toast/toggle' )
151
- this .copied = true
152
151
setTimeout (() => {
153
152
this .$store .commit (' toast/toggle' )
154
- this .copied = false
155
153
}, 5000 )
156
154
setTimeout (() => {
157
155
this .$store .commit (' toast/clean' )
158
156
}, 5500 )
159
157
},
160
- copyTextToClipboard (e ) {
161
- navigator .clipboard .writeText (
162
- e .currentTarget .parentNode .parentNode .innerText .split (' \n\n ' ).join (' \n ' )
163
- )
164
- this .$store .commit (' toast/setData' , {
165
- content: ' Text copied to your clipboard' ,
166
- iconHTML: `
167
- <svg
168
- class="w-6 h-6"
169
- fill="none"
170
- stroke="currentColor"
171
- viewBox="0 0 24 24"
172
- xmlns="http://www.w3.org/2000/svg"
173
- >
174
- <path
175
- stroke-linecap="round"
176
- stroke-linejoin="round"
177
- stroke-width="2"
178
- d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
179
- ></path>
180
- </svg>
181
- ` ,
182
- theme: ' success' ,
183
- })
184
- this .$store .commit (' toast/toggle' )
158
+ copyUrlToClipboard () {
159
+ this .putToClipboard (window .location .href , ' Link copied to your clipboard' )
160
+ this .copied = true
185
161
setTimeout (() => {
186
- this .$store . commit ( ' toast/toggle ' )
162
+ this .copied = false
187
163
}, 5000 )
188
- setTimeout (() => {
189
- this .$store .commit (' toast/clean' )
190
- }, 5500 )
164
+ },
165
+ copyTextToClipboard (e ) {
166
+ this .putToClipboard (
167
+ e .currentTarget .parentNode .parentNode .innerText
168
+ .split (' \n\n ' )
169
+ .join (' \n ' ),
170
+ ' Text copied to your clipboard'
171
+ )
191
172
},
192
173
},
193
174
}
0 commit comments