Fix clipboard functionality

Everything should work as advertised now
This commit is contained in:
Stefan Feješ
2017-12-28 16:45:29 +01:00
parent 677bbbeba2
commit f91c846874
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@
button.addEventListener ("click", function() {
//The following regex removes all the comments from the snippet
const text = element.textContent.replace(/\/\*(.|[\r\n])*?\*\//g, '').replace(/\/\/.*/gm, '');
const text = element.textContent;
// Apparently you can't copy a variable to clipboard so you need to create text input element,
// give it a value, copy it and then remove it from DOM.
const textArea = document.createElement("textarea");

View File

@ -46,7 +46,7 @@
button.addEventListener ("click", function() {
//The following regex removes all the comments from the snippet
const text = element.textContent.replace(/\/\*(.|[\r\n])*?\*\//g, '').replace(/\/\/.*/gm, '');
const text = element.textContent;
// Apparently you can't copy a variable to clipboard so you need to create text input element,
// give it a value, copy it and then remove it from DOM.
const textArea = document.createElement("textarea");