UNPKG

@lexical/react

Version:

This package provides Lexical components and hooks for React applications.

41 lines (37 loc) 1.25 kB
/** * 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 { getExtensionDependencyFromEditor } from '@lexical/extension'; import { ReactExtension } from '@lexical/react/ReactExtension'; import { jsx } from 'react/jsx-runtime'; /** * 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. * */ /** * The equivalent of LexicalComposer for an editor that was already built for * extensions, typically used with nested editors. * * Make sure that your initialEditor argument is stable (e.g. using module scope or useMemo) so * that you are not re-creating the editor on every render! The editor should be built with * ReactProviderExtension and ReactExtension dependencies. */ function LexicalExtensionEditorComposer({ initialEditor: editor, children }) { const { Component } = getExtensionDependencyFromEditor(editor, ReactExtension).output; return /*#__PURE__*/jsx(Component, { children: children }); } export { LexicalExtensionEditorComposer };