diff --git a/public/index.html b/public/index.html index c2c8b8e..9a97cf3 100644 --- a/public/index.html +++ b/public/index.html @@ -33,7 +33,7 @@ Control - Copy + Copy - + diff --git a/public/main.js b/public/main.js index c16a37c..d212345 100644 --- a/public/main.js +++ b/public/main.js @@ -155,6 +155,13 @@ var app = new Vue({ }; navigator.mediaDevices.getUserMedia(constraints).then(this.gotStream).then(this.gotDevices).catch(this.handleError); }, + copyToClipboard: function(selector) { + let element = document.querySelector(selector); + element.select(); + element.setSelectionRange(0, 99999); /*For mobile devices*/ + document.execCommand("copy"); + alert("Copied the text: " + element.value); + } }, mounted() { console.log('VUE is alive!');