Fix clipboard functionality
Everything should work as advertised now
This commit is contained in:
@ -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");
|
||||
|
||||
@ -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");
|
||||
|
||||
Reference in New Issue
Block a user