The copy to clipboard button is not copying the entire code snippet. Someone please check it out.
Does this happen on all snippets or just some of them? Can you give me an example of the copied snippet so that we can work from there?
For httpsRedirect snippet, the real code is
const httpsRedirect = () => {
if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]);
};
But I am getting
const httpsRedirect = () => {
if (location.protocol !== 'https:') location.replace('https:
};
But it's not happening to all the snippets. Maybe it's a problem is with copying // as a part of the code.
The most likely scenario is that it has something to do with //. I'll see if anyone can deal with it today, but we will definitely fix this soon!
Maybe this can be solved by identifying the scope of the function somehow and ignoring stuff only outside this scope.
That's not a good idea, as some functions (i.e. the Node ones) have things declared outside the function, such as dependencies on certain modules.
This is what is causing an issue:
const text = element.textContent.replace(/\/\*(.|[\r\n])*?\*\//g, '').replace(/\/\/.*/gm, '');
The regex is meant to remove all of the comments from the snippet.
@fejes713 Now that we have restructured, I think we don't really have to remove comments anymore, so maybe we don't have to process the comments, right?
You're right! I've discussed this with David on gitter and I taught someone changed it already. This can definitely be removed now
Alright, send in a PR and we will merge it soon! 馃槈
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for any follow-up tasks.