UNPKG

@lexical/react

Version:

This package provides Lexical components and hooks for React applications.

10 lines (8 loc) • 1.06 kB
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import{AutoLinkNode as e,registerAutoLink as r}from"@lexical/link";export{createLinkMatcherWithRegExp}from"@lexical/link";import{useLexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{useEffect as o}from"react";function t({matchers:t,onChange:i,excludeParents:a}){const[c]=n();return function(n,t,i,a){o(()=>{n.hasNodes([e])||function(e,...r){throw function(e,...r){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of r)o.append("v",e);return n.search=o.toString(),new Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...r)}(77)}),o(()=>r(n,{changeHandlers:i?[i]:[],excludeParents:a??[],matchers:t}),[n,t,i,a])}(c,t,i,a),null}export{t as AutoLinkPlugin};