UNPKG

@lexical/react

Version:

This package provides Lexical components and hooks for React applications.

10 lines (8 loc) 862 B
/** * 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. * */ "use strict";var e=require("@lexical/markdown"),r=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/react/LexicalHorizontalRuleNode"),o=require("react");const l=[{dependencies:[t.HorizontalRuleNode],export:e=>t.$isHorizontalRuleNode(e)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,r,o,l)=>{const n=t.$createHorizontalRuleNode();l||null!=e.getNextSibling()?e.replace(n):e.insertBefore(n),n.selectNext()},type:"element"},...e.TRANSFORMERS];exports.DEFAULT_TRANSFORMERS=l,exports.MarkdownShortcutPlugin=function({transformers:t=l}){const[n]=r.useLexicalComposerContext();return o.useEffect((()=>e.registerMarkdownShortcuts(n,t)),[n,t]),null};