@lexical/react
Version:
This package provides Lexical components and hooks for React applications.
10 lines (8 loc) • 696 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{registerList as t,ListNode as r,ListItemNode as o,registerListStrictIndentTransform as e}from"@lexical/list";import{useLexicalComposerContext as i}from"@lexical/react/LexicalComposerContext";import{useEffect as n}from"react";function s({hasStrictIndent:s=!1}){const[c]=i();return n(()=>{if(!c.hasNodes([r,o]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[c]),n(()=>{if(s)return e(c)},[c,s]),function(r){n(()=>t(r),[r])}(c),null}export{s as ListPlugin};