UNPKG

@terrible-lexical/react

Version:

This package provides Lexical components and hooks for React applications.

30 lines (21 loc) 746 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 type {HistoryState} from '@terrible-lexical/history/src'; import {useLexicalComposerContext} from '@terrible-lexical/react/src/LexicalComposerContext'; import {useHistory} from './@terrible-lexical/shared/useHistory'; export {createEmptyHistoryState} from '@terrible-lexical/history/src'; export type {HistoryState}; export function HistoryPlugin({ externalHistoryState, }: { externalHistoryState?: HistoryState; }): null { const [editor] = useLexicalComposerContext(); useHistory(editor, externalHistoryState); return null; }