@lexical/react
Version:
This package provides Lexical components and hooks for React applications.
10 lines (8 loc) • 668 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{$isRootTextContentEmptyCurry as t}from"@lexical/text";import{useLayoutEffect as e,useEffect as o,useState as i}from"react";const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?e:o;function r(e,o){const[r,d]=i(e.getEditorState().read(t(e.isComposing(),o)));return n((()=>e.registerUpdateListener((({editorState:i})=>{const n=e.isComposing(),r=i.read(t(n,o));d(r)}))),[e,o]),r}export{r as useLexicalIsTextContentEmpty};