UNPKG

@lexical/react

Version:

This package provides Lexical components and hooks for React applications.

10 lines (8 loc) 638 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{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{createEmptyHistoryState as o,registerHistory as r}from"@lexical/history";export{createEmptyHistoryState}from"@lexical/history";import{useMemo as e,useEffect as i}from"react";function a({delay:a,externalHistoryState:c}){const[l]=t();return function(t,a,c=1e3){const l=e((()=>a||o()),[a]);i((()=>r(t,l,c)),[c,t,l])}(l,c,a),null}export{a as HistoryPlugin};