freeCodeCamp / wiki-generator

freeCodeCamp's deprecated generator for our live wiki
https://www.freecodecamp.com/wiki/en/
14 stars 9 forks source link

External links no longer work #58

Open QuincyLarson opened 8 years ago

QuincyLarson commented 8 years ago

If you go to https://www.freecodecamp.com/wiki/en/localgroups-list/ and try to click on the links, you'll note that they don't open unless you open them in a new tab (command-click).

Rafase282 commented 8 years ago

They work just fine for me. Could you provide a screenshot of the source code from your end @QuincyLarson @atjonathan

Imgur

justincorrigible commented 8 years ago

Out of curiosity, I've tried it too and they seem to work fine on my devices.

ghost commented 8 years ago

@Rafase282

image

I'm getting these errors in the console when I click on a link:

image

BerkeleyTrue commented 8 years ago

@Rafase282 I'm getting this behavior inconsistently. Seems like sometimes the links have target=blank and sometimes they don't.

How are the links transformed? Are you running a script at start to add target blank?

Rafase282 commented 8 years ago

@BerkeleyTrue it is done on the react side. Starting on line 30.

BerkeleyTrue commented 8 years ago

Looks like we'll need to actually change the links or find some way to change the links during compilation.

BerkeleyTrue commented 8 years ago

@Rafase282 It could also be that the because that your changing the links outside of react. Then React throws away the changes and recreates the DOM.

Rafase282 commented 8 years ago

But is was on component mount, the other way is via regex on the markdown side, the problem with that was getting a regex that would only select the link, before it was selecting more than needed and some links would get messed up or even whole paragraphs which is why I switched to the current solution.

BerkeleyTrue commented 8 years ago

There is an alternative, you could create a webpack plugin that would add target blank to absolute links. It might be challenge but a lot of fun and you'd learn a new skill.

Another option would be to use http://regex.inginf.units.it/ to create the regex. You'll need to feed it a lot of data but the regex it create would be pretty good.

Rafase282 commented 8 years ago

Well the problem with the first alternative si that I change relative links to absolute ones, to get around it, I could apply the link to tab function before I convert the others to absolute links. Actually, that should be able to work just fine unless we have issues with images with links.

ghost commented 8 years ago

OK, i don't think I can fix this problem, as they open fine for me anyway now :disappointed:

Rafase282 commented 8 years ago

As I was telling @atjonathan I think it might be an async issue, I will try to revert from converting the different parts of code into functions to have it all in nested array functions.

Unless someone with more async experience wants to chime in?