@facundo-tolosa-appspace/draft-js-plugins-inline-toolbar
Version:
Toolbar Plugin for DraftJS
39 lines (38 loc) • 1.48 kB
TypeScript
import React, { ComponentType, CSSProperties, Component } from 'react';
import { EditorState } from 'draft-js';
import { DraftJsButtonTheme } from '@draft-js-plugins/buttons';
import { InlineToolbarPluginStore } from '../..';
import { InlineToolbarPluginTheme } from '../../theme';
export interface ToolbarChildrenProps {
theme: DraftJsButtonTheme;
getEditorState: () => EditorState;
setEditorState: (editorState: EditorState) => void;
onOverrideContent: (content: ComponentType<ToolbarChildrenProps> | undefined) => void;
}
interface ToolbarProps {
store: InlineToolbarPluginStore;
children?: ((externalProps: ToolbarChildrenProps) => React.ReactElement) | React.FC<ToolbarChildrenProps>;
theme: InlineToolbarPluginTheme;
}
interface ToolbarState {
isVisible: boolean;
position?: {
top: number;
left: number;
};
overrideContent?: ComponentType<ToolbarChildrenProps>;
}
export declare class Toolbar extends Component<ToolbarProps, ToolbarState> {
toolbar: HTMLDivElement | null;
state: ToolbarState;
static defaultProps: {
children: (externalProps: ToolbarChildrenProps) => React.ReactElement;
};
UNSAFE_componentWillMount(): void;
componentWillUnmount(): void;
onOverrideContent: (overrideContent: ComponentType<ToolbarChildrenProps> | undefined) => void;
onSelectionChanged: () => void;
getStyle(): CSSProperties;
render(): React.ReactNode;
}
export default Toolbar;