-
Notifications
You must be signed in to change notification settings - Fork 239
can't seem to get replaceFn
to fire
#199
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
Comments
Hey @adamgins, what's the input string you're passing to Autolinker? |
@gregjacobs here's the console.log of a series 'INPUT TEXT' prior to calling the
console.log:
the replaceFn never gets called, the www.smh.com.au gets converted to a link |
... and a year later replaceFn still never gets called possibly because hashtag results in error if assigned true (as per the documentation). So hashtag can take false not boolean. |
ok, got it... for hashtags add either twitter, facebook or instagram as well as the replaceFn function and ... all ok. |
Hey guys, Does anyone have any example input text that the Sorry for the delay btw - finally going through the backlog of all the issues now that I have a break from work! |
@adamgins Only two years later, I finally figured out what you are doing wrong: the var Autolinker = require( 'autolinker' );
var autolinker = new Autolinker( {
urls : {
schemeMatches : true,
wwwMatches : true,
tldMatches : true
},
email : true,
phone : true,
mention : 'twitter',
hashtag : 'twitter',
stripPrefix : true,
newWindow : true,
truncate : {
length : 0,
location : 'end'
},
className : '',
replaceFn: function() { ... } // <-- replaceFn goes here
} ); Hoping that you figured this out long before I did :) |
Just creating a new issue, that's a revive of an old closed one #96:
@gregjacobs great package. I have been using in default state in production for ages. Thanks.
I wanted to customize some of the mentions, I am having a similar issues to this issue of getting the replaceFn to fire.
I have initialized the autolinker with
then I call it like so
But the console.logs below never fire. Any ideas pls?
``
console.log( "href = ", match.getAnchorHref() );
console.log( "text = ", match.getAnchorText() );
console.log("INPUTTEXT:", inputText, "MATCH TYPE:", match.getType(), match )
The text was updated successfully, but these errors were encountered: