@lexical/react
Version:
This package provides Lexical components and hooks for React applications.
10 lines (8 loc) • 838 B
JavaScript
/**
* 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.
*
*/
;var e=require("@lexical/extension"),r=require("@lexical/markdown"),t=require("@lexical/react/LexicalComposerContext"),o=require("react");const l=[{dependencies:[e.HorizontalRuleNode],export:r=>e.$isHorizontalRuleNode(r)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(r,t,o,l)=>{const n=e.$createHorizontalRuleNode();l||null!=r.getNextSibling()?r.replace(n):r.insertBefore(n),n.selectNext()},type:"element"},...r.TRANSFORMERS];exports.DEFAULT_TRANSFORMERS=l,exports.MarkdownShortcutPlugin=function({transformers:e=l}){const[n]=t.useLexicalComposerContext();return o.useEffect(()=>r.registerMarkdownShortcuts(n,e),[n,e]),null};