UNPKG

@lexical/react

Version:

This package provides Lexical components and hooks for React applications.

27 lines (26 loc) • 1.01 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 { type FocusManagerOptions } from '@lexical/a11y'; import { type RefCallback } from 'react'; export type { FocusManagerOptions } from '@lexical/a11y'; /** * Returns a `RefCallback` that registers the attached DOM element as a * focus-managed toolbar with {@link FocusManagerExtension}, and releases * it when the element detaches. Attach it to a toolbar element via `ref=`: * * ```tsx * const toolbarRef = useLexicalFocusManagerRef(); * return <div ref={toolbarRef} role="toolbar">…</div>; * ``` * * Multiple elements can use this hook simultaneously — each gets its * own independent Alt+F10 / Escape handler. * * Requires `FocusManagerExtension` in the editor's extension tree. */ export declare function useLexicalFocusManagerRef(options?: FocusManagerOptions): RefCallback<HTMLElement>;