UNPKG

@lexical/react

Version:

This package provides Lexical components and hooks for React applications.

10 lines (8 loc) • 563 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. * */ import{registerClearEditor as o}from"@lexical/extension/ClearEditorExtension";import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as t}from"lexical";import{useLayoutEffect as e,useEffect as i}from"react";const n=t?e:i;function l({onClear:t}){const[e]=r();return n(()=>o(e,t),[e,t]),null}export{l as ClearEditorPlugin};