linkifyjs icon indicating copy to clipboard operation
linkifyjs copied to clipboard

turn off/on plugin per usage

Open plandem opened this issue 3 years ago • 1 comments

We may have a few different uses on the same page at the same time. And while in one case a plugin can be valid, it can be totally opposite in another case. Is there any way to turn off/on plugins except the validate option? It can be really annoying to use fake validators each time:

<Linkify options={{ validate: { foo: () => false }}>...</Linkify>
<Linkify options={{ validate: { bar: () => false }}>...</Linkify>
<Linkify options={{ validate: { baz: () => false }}>...</Linkify>

plandem avatar Apr 28 '22 21:04 plandem

Unfortunately this is the only way to do it. Note that you don't have to declare a function for each key, you can just set it to false

e.g.,

<Linkify options={{ validate: { foo: false }}>...</Linkify>

Can you suggest a better API to do this?

nfrasser avatar Sep 18 '22 22:09 nfrasser