@atlaskit/editor-plugin-block-menu
Version:
BlockMenu plugin for @atlaskit/editor-core
25 lines (24 loc) • 1.13 kB
TypeScript
import React from 'react';
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
import type { BlockMenuPlugin } from '../blockMenuPluginType';
export type Direction = 'moveUp' | 'moveDown';
type BlockMenuProviderProps = {
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
children: React.ReactNode;
editorView: EditorView | undefined;
};
export type BlockMenuContextType = {
getFirstSelectedDomNode: () => Element | undefined;
moveDownRef: React.MutableRefObject<HTMLButtonElement | null>;
moveUpRef: React.MutableRefObject<HTMLButtonElement | null>;
/**
* Callback for when the dropdown is open/closed. Receives an object with `isOpen` state.
*
* If the dropdown was closed programmatically, the `event` parameter will be `null`.
*/
onDropdownOpenChanged: (isOpen: boolean) => void;
};
export declare const useBlockMenu: () => BlockMenuContextType;
export declare const BlockMenuProvider: ({ children, api, editorView, }: BlockMenuProviderProps) => React.JSX.Element;
export {};