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