@atlaskit/editor-plugin-floating-toolbar
Version:
Floating toolbar plugin for @atlaskit/editor-core
58 lines (57 loc) • 2.07 kB
TypeScript
/**
* @jsxRuntime classic
* @jsx jsx
* @jsxFrag
*/
import type { ReactElement } from 'react';
import React, { Component } from 'react';
import { jsx } from '@emotion/react';
import type { CommandDispatch, DropdownOptions, ExtensionDropdownOptions, FloatingToolbarOverflowDropdownOptions } from '@atlaskit/editor-common/types';
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
export interface Props {
alignDropdownWithToolbar?: boolean;
alignX?: 'left' | 'right' | 'center';
areAnyNewToolbarFlagsEnabled: boolean;
boundariesElement?: HTMLElement;
buttonTestId?: string;
disabled?: boolean;
dispatchCommand: (command: Function) => void;
dropdownListId?: string;
dropdownWidth?: number;
editorView?: EditorView;
footer?: React.ReactNode;
hideExpandIcon?: boolean;
icon?: ReactElement<any>;
iconBefore?: ReactElement<any>;
mountPoint?: HTMLElement;
onClick?: () => void;
onMount?: () => void;
onToggle?: (state: EditorState, dispatch: CommandDispatch | undefined) => boolean;
options: DropdownOptions<Function> | FloatingToolbarOverflowDropdownOptions<Function> | ExtensionDropdownOptions;
/** If true, the component will have pulse onboarding effect around it. */
pulse?: boolean;
scrollableElement?: HTMLElement;
setDisableParentScroll?: (disable: boolean) => void;
shouldFitContainer?: boolean;
showSelected?: boolean;
title: string;
tooltip?: string;
}
export interface State {
isOpen: boolean;
isOpenedByKeyboard: boolean;
}
export default class Dropdown extends Component<Props, State> {
state: State;
triggerRef: React.RefObject<HTMLDivElement>;
render(): jsx.JSX.Element;
private makeArrayOptionsFromCallback;
private renderArrayOptions;
private toggleOpen;
private toggleOpenByKeyboard;
private hide;
private hideOnEsc;
private onOpenChanged;
componentDidUpdate(prevProps: Props, prevState: State): void;
}