UNPKG

phx-react

Version:

PHX REACT

12 lines 685 B
import { AutoLinkPlugin, createLinkMatcherWithRegExp } from '@lexical/react/LexicalAutoLinkPlugin'; import * as React from 'react'; import { EMAIL_REGEX } from '../../../../utils/constants'; const URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/; const MATCHERS = [ createLinkMatcherWithRegExp(URL_REGEX, (text) => (text.startsWith('http') ? text : `https://${text}`)), createLinkMatcherWithRegExp(EMAIL_REGEX, (text) => `mailto:${text}`), ]; export default function LexicalAutoLinkPlugin() { return React.createElement(AutoLinkPlugin, { matchers: MATCHERS }); } //# sourceMappingURL=index.js.map