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