mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	add copy functionality
This commit is contained in:
		
							parent
							
								
									960e0ce15e
								
							
						
					
					
						commit
						ed9379dad7
					
				
					 2 changed files with 15 additions and 5 deletions
				
			
		| 
						 | 
					@ -14,7 +14,7 @@
 | 
				
			||||||
                <h3 class="mt-4" v-text="generatedLink" />
 | 
					                <h3 class="mt-4" v-text="generatedLink" />
 | 
				
			||||||
                <div class="flex justify-end mt-4">
 | 
					                <div class="flex justify-end mt-4">
 | 
				
			||||||
                    <button class="btn" v-t="'actions.follow_link'" @click="followLink()" />
 | 
					                    <button class="btn" v-t="'actions.follow_link'" @click="followLink()" />
 | 
				
			||||||
                    <button class="btn ml-5" v-t="'actions.copy_link'" @click="copyLink()" />
 | 
					                    <button class="btn ml-3" v-t="'actions.copy_link'" @click="copyLink()" />
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
| 
						 | 
					@ -68,10 +68,18 @@ export default {
 | 
				
			||||||
            event.preventDefault();
 | 
					            event.preventDefault();
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        followLink() {
 | 
					        followLink() {
 | 
				
			||||||
            window.location.href = this.generatedLink;
 | 
					            window.open(this.generatedLink, "_blank").focus();
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        copyLink() {
 | 
					        async copyLink() {
 | 
				
			||||||
            this.$emit("close");
 | 
					            await this.copyURL(this.generatedLink);
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        async copyURL(mytext) {
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                await navigator.clipboard.writeText(mytext);
 | 
				
			||||||
 | 
					                alert(this.$t("info.copied"));
 | 
				
			||||||
 | 
					            } catch ($e) {
 | 
				
			||||||
 | 
					                alert(this.$t("info.cannot_copy"));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    computed: {
 | 
					    computed: {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,6 +149,8 @@
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "info": {
 | 
					    "info": {
 | 
				
			||||||
        "preferences_note": "Note: preferences are saved in the local storage of your browser. Deleting your browser data will reset them.",
 | 
					        "preferences_note": "Note: preferences are saved in the local storage of your browser. Deleting your browser data will reset them.",
 | 
				
			||||||
        "page_not_found": "Page not found"
 | 
					        "page_not_found": "Page not found",
 | 
				
			||||||
 | 
					        "copied": "Copied!",
 | 
				
			||||||
 | 
					        "cannot_copy": "Can't copy!"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue