potty / react-anchorme Goto Github PK
View Code? Open in Web Editor NEW⚓️ React component using Anchorme.js to detect urls and emails in a text and converts them into clickable HTML links.
License: MIT License
⚓️ React component using Anchorme.js to detect urls and emails in a text and converts them into clickable HTML links.
License: MIT License
Hi
Is there a way to add options, passed to anchorme.js ?
Say I'd like to do
<Anchorme options={{truncate: 6}}>text</Anchorme>
Great library!
One issue I'm seeing is that if you have both normal text and bracketed inner parameters passed as children the component throws various errors.
Example 1:
testa.com {"testb.com"}
Example 2, note the spaces around the brackets:
{"testa.com"}
Hello, you might want to know that there is an issue going on with anchrome v3 : alexcorvi/anchorme.js#142
It throws this error : Invalid regular expression: invalid group specifier name
React 18 released (https://github.com/facebook/react/releases/tag/v18.0.0)
It would be nice to add support to avoid warnings/fails on package install.
We have a strange issue using this lib, which is only reproducible in our production builds:
TypeError: Cannot read properties of undefined (reading 'list')
at react-anchorme.esm.js:1:1275
at react-anchorme.esm.js:1:1550
at Object.useMemo (react-dom.production.min.js:184:189)
at Er.useMemo (react.production.min.js:25:208)
at react-anchorme.esm.js:1:1530
at eK (react-dom.production.min.js:167:137)
at s$ (react-dom.production.min.js:197:258)
at Vge (react-dom.production.min.js:195:204)
at dre (react-dom.production.min.js:194:176)
at lbe (react-dom.production.min.js:297:71)
o$ @ react-dom.production.min.js:189
which I can pinpoint to line 16 in AnchorMe.tsx
:
import React, { useCallback, useMemo } from 'react'
import anchorme from 'anchorme'
import { AnchorProps, LinkComponent } from './types'
import { Link } from './Link'
type Props = {
children: string
linkComponent?: LinkComponent
} & AnchorProps
const Anchorme = ({ children, ...rest }: Props) => {
const text = children
const parse = useCallback(() => {
const matches = anchorme.list(text) // <- This right here
if (matches.length === 0) return text
...
What gives? It's as if the anchorme
package isn't bundled for production?
Environment:
Hi @potty, thanks so much for creating this excellent wrapper! Curious if there is a way to pass through the props to anchorme to take full advantage of the Anchorme library?
Hey, nice component! We would like to use it in one of our projects, but it looks like you haven't explicitly defined a license for this project so it would go against our open source dependency guidelines. Could you add one? :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.