linkifyjs icon indicating copy to clipboard operation
linkifyjs copied to clipboard

Why does `NUM` capture text?

Open plandem opened this issue 3 years ago • 2 comments

Here is an attempt to create a timeline plugin, but looks like something is broken with the NUM token since it captures texts.

Any idea why it captures 'abc:2:3`, as NUM, COLON, NUM, COLON, NUM sequence of tokens?

https://codesandbox.io/s/gifted-darwin-h1owf9?file=/src/App.js

plandem avatar Apr 20 '22 03:04 plandem

Hi @plandem, this happens because in v3 NUM and word tokens transition to the same state. Try out the latest v4.0.0-beta.5, this should be fixed there. Only change you have to make to your code is replace utils.createTokenClass with linkify.createTokenClass (exported from the linkifyjs module)

Edit: Install with npm install linkifyjs@beta

nfrasser avatar Apr 23 '22 21:04 nfrasser

@nfrasser sadly beta for major release is not the best choice for production :(

plandem avatar Apr 24 '22 04:04 plandem