-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New tab prop #51
New tab prop #51
Conversation
This does increase ease of use for enabling Currently, you can get the same result by doing: <Linkify properties={{target: '_blank'}}>
...
</Linkify> In const componentDecorator = (href, text, key) => (
<a href={href} key={key} target="_blank">
{text}
</a>
);
<Linkify componentDecorator={componentDecorator}>
...
</Linkify> This may look like more code, but the idea is to make Does this seem reasonable? |
Using Example: https://mathiasbynens.github.io/rel-noopener I think good way is to use with const componentDecorator = (href, text, key) => (
<a href={href} key={key} target="_blank" rel="noopener noreferrer">
{text}
</a>
);
<Linkify componentDecorator={componentDecorator}>
...
</Linkify> Anyway, thank you! |
@tasti I recently downloaded the latest version of react-linkify and looks like new tab property does not work for me. I even haven`t found it in props, which in turn means that package was downloaded without this update. Can u help me with this issue? |
@nevermore11184 have you tried using the |
@tasti please update in documentation here http://tasti.github.io/react-linkify . For target new tab, no more property?. |
Per the discussion on Issue #48, I have added a
newTab
boolean prop that, if provided, will settarget: _blank
on matched URLs.I added unit tests for the positive and negative cases, but I would LOVE feedback - this style of React is a bit different from what I'm used to writing 😃